Skip to content

Commit

Permalink
autodeploy the repo's markdown files onto docs.stride.zone using GH a…
Browse files Browse the repository at this point in the history
…ctions (#428)
  • Loading branch information
riley-stride authored Dec 7, 2022
1 parent c913955 commit 87f7e6d
Show file tree
Hide file tree
Showing 30 changed files with 544 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/rdme-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This GitHub Actions workflow was auto-generated by the `rdme` cli on 2022-11-30T20:42:35.570Z
# You can view our full documentation here: https://docs.readme.com/docs/rdme
name: ReadMe GitHub Action 🦉

on:
push:
branches:
# This workflow will run every time you push code to the following branch
# Check out GitHub's docs for more info on configuring this:
# https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
- main

jobs:
rdme-docs:
runs-on: ubuntu-latest
steps:
- name: Check out repo 📚
uses: actions/checkout@v3
- name: Copy repo's markdown docs to single flat folder
run: bash readme-docs/gather-docs.sh
- name: Run `docs` command 🚀
uses: readmeio/rdme@v8
with:
rdme: docs ./readme-docs/md --key=${{ secrets.README_API_KEY }} --version=1.0
8 changes: 8 additions & 0 deletions readme-docs/gather-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
for f in $(find "./x" -type f -name "*.md" \ # -not -path "deps/*"
-not -path "scripts/*" \
-not -path "readme-docs/*"
)
do
echo $f
cp $f readme-docs/md
done
21 changes: 21 additions & 0 deletions readme-docs/md/01_concepts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: "Claim Module: Overview"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---


<!--
order: 1
-->

# Concepts

In Stride, users are required to claim their airdrop by participating in core network activities. An Airdrop recipient is given 20% of the airdrop amount which is not in vesting, and then they have to perform the following activities to get the rest:

* 20% vesting over 3 months by staking
* 60% vesting over 3 months by liquid staking

At initial, module stores all airdrop users with amounts from genesis inside KVStore.

Airdrop users are eligible to claim their vesting or free amount only once in the initial period of 3 months and after the initial period, users can claim tokens monthly not in vesting format.
51 changes: 51 additions & 0 deletions readme-docs/md/02_state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: "Claim Module: State"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---

<!--
order: 2
-->

# State

### Claim Records

```protobuf
// A Claim Records is the metadata of claim data per address
message ClaimRecord {
// address of claim user
string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ];
// weight that represent the portion from total allocations
double weight = 2;
// true if action is completed
// index of bool in array refers to action enum #
repeated bool action_completed = 3 [
(gogoproto.moretags) = "yaml:\"action_completed\""
];
}
```
When a user get airdrop for his/her action, claim record is created to prevent duplicated actions on future actions.

### State

```protobuf
message GenesisState {
// params defines all the parameters of the module.
Params params = 2 [
(gogoproto.moretags) = "yaml:\"params\"",
(gogoproto.nullable) = false
];
// list of claim records, one for every airdrop recipient
repeated ClaimRecord claim_records = 3 [
(gogoproto.moretags) = "yaml:\"claim_records\"",
(gogoproto.nullable) = false
];
}
```

Claim module's state consists of `params`, and `claim_records`.
38 changes: 38 additions & 0 deletions readme-docs/md/03_end_epoch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: "Mint Module: End Epoch"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---

<!--
order: 3
-->

# Begin-Epoch

Minting parameters are recalculated and inflation
paid at the beginning of each epoch. An epoch is signalled by x/epochs

## NextEpochProvisions

The target epoch provision is recalculated on each reduction period (default 3 years).
At the time of reduction, the current provision is multiplied by reduction factor (default `2/3`),
to calculate the provisions for the next epoch. Consequently, the rewards of the next period
will be lowered by `1 - reduction factor`.

```go
func (m Minter) NextEpochProvisions(params Params) sdk.Dec {
return m.EpochProvisions.Mul(params.ReductionFactor)
}
```

## EpochProvision

Calculate the provisions generated for each epoch based on current epoch provisions. The provisions are then minted by the `mint` module's `ModuleMinterAccount`. These rewards are transferred to a `FeeCollector`, which handles distributing the rewards per the chains needs. (See TODO.md for details) This fee collector is specified as the `auth` module's `FeeCollector` `ModuleAccount`.

```go
func (m Minter) EpochProvision(params Params) sdk.Coin {
provisionAmt := m.EpochProvisions.QuoInt(sdk.NewInt(int64(params.EpochsPerYear)))
return sdk.NewCoin(params.MintDenom, provisionAmt.TruncateInt())
}
```
20 changes: 20 additions & 0 deletions readme-docs/md/03_events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "Claim Module: Events"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---
<!--
order: 3
-->

# Events

## External module hooks

`claim` module emits the following events at the time of hooks:

| Type | Attribute Key | Attribute Value |
| ----- | ------------- | --------------- |
| claim | sender | {receiver} |
| claim | amount | {claim_amount} |

30 changes: 30 additions & 0 deletions readme-docs/md/04_keeper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: "Claim Module: Keeper"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---

<!--
order: 4
-->

# Keepers

## Keeper functions

Claim keeper module provides utility functions to manage epochs.

```go
GetModuleAccountAddress(ctx sdk.Context) sdk.AccAddress
GetDistributorAccountBalance(ctx sdk.Context) sdk.Coin
EndAirdrop(ctx sdk.Context) error
GetClaimRecord(ctx sdk.Context, addr sdk.AccAddress) (types.ClaimRecord, error)
GetClaimRecords(ctx sdk.Context) []types.ClaimRecord
SetClaimRecord(ctx sdk.Context, claimRecord types.ClaimRecord) error
SetClaimRecords(ctx sdk.Context, claimRecords []types.ClaimRecord) error
GetClaimableAmountForAction(ctx sdk.Context, addr sdk.AccAddress, action types.Action, includeClaimed bool) (sdk.Coins, error)
GetUserTotalClaimable(ctx sdk.Context, addr sdk.AccAddress) (sdk.Coins, error)
ClaimCoinsForAction(ctx sdk.Context, addr sdk.AccAddress, action types.Action) (sdk.Coins, error)
clearInitialClaimables(ctx sdk.Context)
fundRemainingsToCommunity(ctx sdk.Context) error
```
37 changes: 37 additions & 0 deletions readme-docs/md/04_params.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: "Mint Module: Params"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---

<!--
order: 4
-->

# Parameters

The minting module contains the following parameters:

| Key | Type | Example |
| ------------------------------------------ | ------------ | -------------------------------------- |
| mint_denom | string | "uosmo" |
| genesis_epoch_provisions | string (dec) | "500000000" |
| epoch_identifier | string | "weekly" |
| reduction_period_in_epochs | int64 | 156 |
| reduction_factor | string (dec) | "0.6666666666666" |
| distribution_proportions.staking | string (dec) | "0.4" |
| distribution_proportions.pool_incentives | string (dec) | "0.3" |
| distribution_proportions.developer_rewards | string (dec) | "0.2" |
| distribution_proportions.community_pool | string (dec) | "0.1" |
| weighted_developer_rewards_receivers | array | [{"address": "osmoxx", "weight": "1"}] |
| minting_rewards_distribution_start_epoch | int64 | 10 |

**Notes**
1. `mint_denom` defines denom for minting token - uosmo
2. `genesis_epoch_provisions` provides minting tokens per epoch at genesis.
3. `epoch_identifier` defines the epoch identifier to be used for mint module e.g. "weekly"
4. `reduction_period_in_epochs` defines the number of epochs to pass to reduce mint amount
5. `reduction_factor` defines the reduction factor of tokens at every `reduction_period_in_epochs`
6. `distribution_proportions` defines distribution rules for minted tokens, when developer rewards address is empty, it distribute tokens to community pool.
7. `weighted_developer_rewards_receivers` provides the addresses that receives developer rewards by weight
8. `minting_rewards_distribution_start_epoch` defines the start epoch of minting to make sure minting start after initial pools are set
22 changes: 22 additions & 0 deletions readme-docs/md/05_events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "Mint Module: Events"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---


<!--
order: 5
-->

# Events

The minting module emits the following events:

## End of Epoch

| Type | Attribute Key | Attribute Value |
| ---- | ---------------- | ----------------- |
| mint | epoch_number | {epochNumber} |
| mint | epoch_provisions | {epochProvisions} |
| mint | amount | {amount} |
18 changes: 18 additions & 0 deletions readme-docs/md/05_react_hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: "Claim Module: React Hooks"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---

<!--
order: 5
-->

# React Hooks

Claim module react on following hooks of external modules.

20% of airdrop is sent to a vesting account when `staking.AfterDelegationModified` hook is triggered.
20% of airdrop is sent to a vesting account when `stakeibc.AfterLiquidStake` hook is triggered.

When airdrop is claimed for specific hook type, it can't be claimed double.
48 changes: 48 additions & 0 deletions readme-docs/md/06_queries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: "Claim Module: Queries"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---

<!--
order: 6
-->

# Queries

## GRPC queries

Claim module provides below GRPC queries to query claim status

```protobuf
service Query {
rpc DistributorAccountBalance(QueryDistributorAccountBalanceRequest) returns (QueryDistributorAccountBalanceResponse) {}
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {}
rpc ClaimRecord(QueryClaimRecordRequest) returns (QueryClaimRecordResponse) {}
rpc ClaimableForAction(QueryClaimableForActionRequest) returns (QueryClaimableForActionResponse) {}
rpc TotalClaimable(QueryTotalClaimableRequest) returns (QueryTotalClaimableResponse) {}
}
```

## CLI commands

For the following commands, you can change `$(strided keys show -a {your key name})` with the address directly.

Query the claim record for a given address

```sh
strided query claim claim-record $(strided keys show -a {your key name})
```

Query the claimable amount that would be earned if a specific action is completed right now.

```sh

strided query claim claimable-for-action $(strided keys show -a {your key name}) ActionAddLiquidity
```

Query the total claimable amount that would be earned if all remaining actions were completed right now.

```sh
strided query claim total-claimable $(strided keys show -a {your key name}) ActionAddLiquidity
```
39 changes: 39 additions & 0 deletions readme-docs/md/07_params.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: "Claim Module: Params"
excerpt: ""
category: 62c5c5ff03a5bf069004def2
---

<!--
order: 7
-->

# Params

Claim module provides below params

```protobuf
// Params defines the claim module's parameters.
message Params {
google.protobuf.Timestamp airdrop_start_time = 1 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"airdrop_start_time\""
];
google.protobuf.Timestamp airdrop_duration = 2 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.jsontag) = "airdrop_duration,omitempty",
(gogoproto.moretags) = "yaml:\"airdrop_duration\""
];
// denom of claimable asset
string claim_denom = 3;
// airdrop distribution account
string distributor_address = 4;
}
```

1. `airdrop_start_time` refers to the time when user can start to claim airdrop.
2. `airdrop_duration` refers to the duration from start time to end time.
3. `claim_denom` refers to the denomination of claiming tokens. As a default, it's `ustrd`.
4. `distributor_address` refers to the address of distribution account.
Loading

0 comments on commit 87f7e6d

Please sign in to comment.