Skip to content

Commit

Permalink
docs: clean up and update minor stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaybxyz committed Sep 17, 2021
1 parent 56d74df commit 12c89c8
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 151 deletions.
2 changes: 1 addition & 1 deletion docs/How-To/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ This section contains how-to guides for different aspects of the farming module.

How-To Documentation will come in various forms:

* [REST APIs](./api) - all the available REST APIs in the farming module.
* [gRPC-gateway REST Routes](./api) - all the available REST APIs in the farming module.
* [Command-line Interfaces](./cli) - all the available command-line interfaces in the farming module.
115 changes: 45 additions & 70 deletions docs/How-To/api/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
Title: REST APIs
Description: A high-level overview of how the REST API interfaces work for the farming module.
Description: A high-level overview of gRPC-gateway REST Routes in farming module.
---

## Swagger Documentation

- [Swagger Docs v0.2.0](https://app.swaggerhub.com/apis-docs/gravity-devs/farming/0.2.0)

## REST APIs
## gRPC-gateway REST Routes

In order to test out the following REST APIs, you need to set up a local node to query from. You can refer to this [localnet tutorial](./Tutorials/localnet) on how to build `farmingd` binary and bootstrap a local network in your local machine.
In order to test out the following REST routes, you need to set up a local node to query from. You can refer to this [localnet tutorial](./Tutorials/localnet) on how to build `farmingd` binary and bootstrap a local network in your local machine.

- [Params](#Params)
- [Plans](#Plans)
Expand All @@ -18,6 +18,7 @@ In order to test out the following REST APIs, you need to set up a local node to
- [TotalStakings](#TotalStakings)
- [Rewards](#Rewards)
- [CurrentEpochDays](#CurrentEpochDays)

### Params

Query the values set as farming parameters
Expand All @@ -32,7 +33,7 @@ http://localhost:1317/cosmos/farming/v1beta1/params
"amount": "100000000"
}
],
"epoch_days": 1,
"next_epoch_days": 1,
"farming_fee_collector": "cosmos1h292smhhttwy0rl3qr4p6xsvpvxc4v05s6rxtczwq3cs6qc462mqejwy8x"
}
}
Expand All @@ -48,66 +49,40 @@ http://localhost:1317/cosmos/farming/v1beta1/plans
{
"plans": [
{
"@type": "/cosmos.farming.v1beta1.FixedAmountPlan",
"@type": "/cosmos.farming.v1beta1.RatioPlan",
"base_plan": {
"id": "1",
"name": "This plan intends to provide incentives for liquidity pool investors and ATOM holders",
"type": "PLAN_TYPE_PRIVATE",
"farming_pool_address": "cosmos10tmtlj9au53ws34ycu95p0k67mxxus6h4q4z0a5pw77vc4n93nmqfp58g0",
"termination_address": "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v",
"name": "Second Public Ratio Plan",
"type": "PLAN_TYPE_PUBLIC",
"farming_pool_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"termination_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"staking_coin_weights": [
{
"denom": "poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4",
"amount": "0.800000000000000000"
"denom": "pool3036F43CB8131A1A63D2B3D3B11E9CF6FA2A2B6FEC17D5AD283C25C939614A8C",
"amount": "0.500000000000000000"
},
{
"denom": "uatom",
"amount": "0.200000000000000000"
"denom": "poolE4D2617BFE03E1146F6BBA1D9893F2B3D77BA29E7ED532BB721A39FF1ECC1B07",
"amount": "0.500000000000000000"
}
],
"start_time": "2021-08-06T09:00:00Z",
"end_time": "2021-08-13T09:00:00Z",
"terminated": true,
"last_distribution_time": null,
"distributed_coins": []
},
"epoch_amount": [
{
"denom": "uatom",
"amount": "100000000"
}
]
},
{
"@type": "/cosmos.farming.v1beta1.RatioPlan",
"base_plan": {
"id": "2",
"name": "This plan intends to provide incentives for Cosmonauts!",
"type": "PLAN_TYPE_PRIVATE",
"farming_pool_address": "cosmos1tye4hfxt57r65sshv4e4hmq22un9rrmg26v23dyl5grqdn0fsews9uqtfl",
"termination_address": "cosmos13w4ueuk80d3kmwk7ntlhp84fk0arlm3mqf0w08",
"staking_coin_weights": [
"start_time": "2021-09-10T00:00:00Z",
"end_time": "2021-10-01T00:00:00Z",
"terminated": false,
"last_distribution_time": "2021-09-17T01:00:43.410373Z",
"distributed_coins": [
{
"denom": "poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4",
"amount": "0.800000000000000000"
},
{
"denom": "uatom",
"amount": "0.200000000000000000"
"denom": "stake",
"amount": "2399261190929"
}
],
"start_time": "2021-08-06T09:00:00Z",
"end_time": "2021-08-13T09:00:00Z",
"terminated": true,
"last_distribution_time": null,
"distributed_coins": []
]
},
"epoch_ratio": "0.100000000000000000"
"epoch_ratio": "0.500000000000000000"
}
],
"pagination": {
"next_key": null,
"total": "2"
"total": "1"
}
}
```
Expand All @@ -121,35 +96,35 @@ http://localhost:1317/cosmos/farming/v1beta1/plans/1
```json
{
"plan": {
"@type": "/cosmos.farming.v1beta1.FixedAmountPlan",
"@type": "/cosmos.farming.v1beta1.RatioPlan",
"base_plan": {
"id": "1",
"name": "This plan intends to provide incentives for liquidity pool investors and ATOM holders",
"type": "PLAN_TYPE_PRIVATE",
"farming_pool_address": "cosmos10tmtlj9au53ws34ycu95p0k67mxxus6h4q4z0a5pw77vc4n93nmqfp58g0",
"termination_address": "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v",
"name": "Second Public Ratio Plan",
"type": "PLAN_TYPE_PUBLIC",
"farming_pool_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"termination_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"staking_coin_weights": [
{
"denom": "poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4",
"amount": "0.800000000000000000"
"denom": "pool3036F43CB8131A1A63D2B3D3B11E9CF6FA2A2B6FEC17D5AD283C25C939614A8C",
"amount": "0.500000000000000000"
},
{
"denom": "uatom",
"amount": "0.200000000000000000"
"denom": "poolE4D2617BFE03E1146F6BBA1D9893F2B3D77BA29E7ED532BB721A39FF1ECC1B07",
"amount": "0.500000000000000000"
}
],
"start_time": "2021-08-06T09:00:00Z",
"end_time": "2021-08-13T09:00:00Z",
"terminated": true,
"last_distribution_time": null,
"distributed_coins": []
"start_time": "2021-09-10T00:00:00Z",
"end_time": "2021-10-01T00:00:00Z",
"terminated": false,
"last_distribution_time": "2021-09-17T01:00:43.410373Z",
"distributed_coins": [
{
"denom": "stake",
"amount": "2399261190929"
}
]
},
"epoch_amount": [
{
"denom": "uatom",
"amount": "100000000"
}
]
"epoch_ratio": "0.500000000000000000"
}
}
```
Expand Down Expand Up @@ -244,4 +219,4 @@ http://localhost:1317/cosmos/farming/v1beta1/current_epoch_days
{
"current_epoch_days": 1
}
```
```
139 changes: 59 additions & 80 deletions docs/How-To/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,7 @@ farmingd q farming params --output json | jq
"amount": "100000000"
}
],
"staking_creation_fee": [
{
"denom": "stake",
"amount": "100000"
}
],
"epoch_days": 1,
"next_epoch_days": 1,
"farming_fee_collector": "cosmos1h292smhhttwy0rl3qr4p6xsvpvxc4v05s6rxtczwq3cs6qc462mqejwy8x"
}
```
Expand All @@ -456,14 +450,14 @@ farmingd q farming params --output json | jq
farmingd q farming plans --output json | jq

# Query for all farmings plans with the given plan type
# plan type must be either public or private
# plan type must be either PLAN_TYPE_PUBLIC or PLAN_TYPE_PRIVATE
farmingd q farming plans \
--plan-type private \
--plan-type PLAN_TYPE_PUBLIC \
--output json | jq

# Query for all farmings plans with the given farming pool address
farmingd q farming plans \
--farming-pool-addr cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v \
--farming-pool-addr cosmos13w4ueuk80d3kmwk7ntlhp84fk0arlm3mqf0w08 \
--output json | jq

# Query for all farmings plans with the given reward pool address
Expand All @@ -473,7 +467,7 @@ farmingd q farming plans \

# Query for all farmings plans with the given termination address
farmingd q farming plans \
--termination-addr cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v \
--termination-addr cosmos185fflsvwrz0cx46w6qada7mdy92m6kx4gqx0ny \
--output json | jq

# Query for all farmings plans with the given staking coin denom
Expand All @@ -486,57 +480,35 @@ farmingd q farming plans \
{
"plans": [
{
"@type": "/cosmos.farming.v1beta1.FixedAmountPlan",
"@type": "/cosmos.farming.v1beta1.RatioPlan",
"base_plan": {
"id": "1",
"name": "This plan intends to provide incentives for Cosmonauts!",
"type": "PLAN_TYPE_PRIVATE",
"farming_pool_address": "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v",
"reward_pool_address": "cosmos1gshap5099dwjdlxk2ym9z8u40jtkm7hvux45pze8em08fwarww6qc0tvl0",
"termination_address": "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v",
"name": "Second Public Ratio Plan",
"type": "PLAN_TYPE_PUBLIC",
"farming_pool_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"termination_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"staking_coin_weights": [
{
"denom": "poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4",
"amount": "0.800000000000000000"
"denom": "pool3036F43CB8131A1A63D2B3D3B11E9CF6FA2A2B6FEC17D5AD283C25C939614A8C",
"amount": "0.500000000000000000"
},
{
"denom": "uatom",
"amount": "0.200000000000000000"
"denom": "poolE4D2617BFE03E1146F6BBA1D9893F2B3D77BA29E7ED532BB721A39FF1ECC1B07",
"amount": "0.500000000000000000"
}
],
"start_time": "2021-08-06T09:00:00Z",
"end_time": "2021-08-13T09:00:00Z"
},
"epoch_amount": [
{
"denom": "uatom",
"amount": "100000000"
}
]
},
{
"@type": "/cosmos.farming.v1beta1.RatioPlan",
"base_plan": {
"id": "2",
"name": "This plan intends to provide incentives for Cosmonauts!",
"type": "PLAN_TYPE_PRIVATE",
"farming_pool_address": "cosmos13w4ueuk80d3kmwk7ntlhp84fk0arlm3mqf0w08",
"reward_pool_address": "cosmos1qr3xrf66kl594rjtj5mukz2khym4srent0cjafenat6xwym6q8gsq50x7g",
"termination_address": "cosmos13w4ueuk80d3kmwk7ntlhp84fk0arlm3mqf0w08",
"staking_coin_weights": [
"start_time": "2021-09-10T00:00:00Z",
"end_time": "2021-10-01T00:00:00Z",
"terminated": false,
"last_distribution_time": "2021-09-17T01:00:43.410373Z",
"distributed_coins": [
{
"denom": "poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4",
"amount": "0.800000000000000000"
},
{
"denom": "uatom",
"amount": "0.200000000000000000"
"denom": "stake",
"amount": "2399261190929"
}
],
"start_time": "2021-08-06T09:00:00Z",
"end_time": "2021-08-13T09:00:00Z"
]
},
"epoch_ratio": "0.100000000000000000"
"epoch_ratio": "0.500000000000000000"
}
],
"pagination": {
Expand All @@ -554,35 +526,42 @@ farmingd q farming plan 1 --output json | jq

```json
{
"plan": {
"@type": "/cosmos.farming.v1beta1.FixedAmountPlan",
"base_plan": {
"id": "1",
"name": "This plan intends to provide incentives for liquidity pool investors and ATOM holders",
"type": "PLAN_TYPE_PRIVATE",
"farming_pool_address": "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v",
"reward_pool_address": "cosmos1gshap5099dwjdlxk2ym9z8u40jtkm7hvux45pze8em08fwarww6qc0tvl0",
"termination_address": "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v",
"staking_coin_weights": [
{
"denom": "poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4",
"amount": "0.800000000000000000"
},
{
"denom": "uatom",
"amount": "0.200000000000000000"
}
],
"start_time": "2021-08-06T09:00:00Z",
"end_time": "2021-08-13T09:00:00Z",
"terminated": false
},
"epoch_amount": [
{
"denom": "uatom",
"amount": "100000000"
}
]
"plans": [
{
"@type": "/cosmos.farming.v1beta1.RatioPlan",
"base_plan": {
"id": "1",
"name": "Second Public Ratio Plan",
"type": "PLAN_TYPE_PUBLIC",
"farming_pool_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"termination_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"staking_coin_weights": [
{
"denom": "pool3036F43CB8131A1A63D2B3D3B11E9CF6FA2A2B6FEC17D5AD283C25C939614A8C",
"amount": "0.500000000000000000"
},
{
"denom": "poolE4D2617BFE03E1146F6BBA1D9893F2B3D77BA29E7ED532BB721A39FF1ECC1B07",
"amount": "0.500000000000000000"
}
],
"start_time": "2021-09-10T00:00:00Z",
"end_time": "2021-10-01T00:00:00Z",
"terminated": false,
"last_distribution_time": "2021-09-17T01:00:43.410373Z",
"distributed_coins": [
{
"denom": "stake",
"amount": "2399261190929"
}
]
},
"epoch_ratio": "0.500000000000000000"
}
],
"pagination": {
"next_key": null,
"total": "0"
}
}
```
Expand Down

0 comments on commit 12c89c8

Please sign in to comment.