Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename some fields of Budget #84

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

# Budget Module

A budget module is a Cosmos SDK module that implements budget functionality. It is an independent module from other SDK modules and core functionality is to enable anyone to create a budget plan through governance param change proposal. Once it is agreed within the community, voted, and passed, it uses the budget source address to distribute amount of coins by the rate defined in the plan to the collection address. Collecting all budgets and distribution take place every epoch blocks that can be modified by a governance proposal.
The budget module is a Cosmos SDK module that implements budget functionality. It is an independent module from other SDK modules and core functionality is to enable anyone to create a budget plan through governance param change proposal. Once it is agreed within the community, voted, and passed, it uses the source address to distribute amount of coins by the rate defined in the plan to the destination address. Collecting all budgets and distribution take place every epoch blocks that can be modified by a governance proposal.

A primary use case is for Gravity DEX farming plan. The budget module can be used to create a budget plan that defines Cosmos Hub's FeeCollector module account where transaction gas fees and part of ATOM inflation are collected as budget source address and uses a custom module account (created by budget creator) as collection address. Read [spec docs](./x/budget/spec/01_concepts.md) to get to know more about the module.
A primary use case is for Gravity DEX farming plan. The budget module can be used to create a budget plan that defines Cosmos Hub's FeeCollector module account where transaction gas fees and part of ATOM inflation are collected as source address and uses a custom module account (created by budget creator) as destination address. Read [spec docs](./x/budget/spec/01_concepts.md) to get to know more about the module.

⚠ **Budget module v1 is in active development** ⚠
- see the [main](https://github.com/tendermint/budget/tree/main) branch for the latest
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ paths:
title: >-
rate specifies the distributing amount by ratio of
total budget source
budget_source_address:
source_address:
type: string
title: >-
budget_source_address defines the bech32-encoded
address that source of the budget
collection_address:
source_address defines the bech32-encoded address
that source of the budget
destination_address:
type: string
title: >-
collection_address defines the bech32-encoded
destination_address defines the bech32-encoded
address of the budget pool to distribute
start_time:
type: string
Expand Down Expand Up @@ -264,11 +264,11 @@ paths:
in: query
required: false
type: string
- name: budget_source_address
- name: source_address
in: query
required: false
type: string
- name: collection_address
- name: destination_address
in: query
required: false
type: string
Expand Down Expand Up @@ -308,15 +308,15 @@ paths:
title: >-
rate specifies the distributing amount by ratio of
total budget source
budget_source_address:
source_address:
type: string
title: >-
budget_source_address defines the bech32-encoded
address that source of the budget
collection_address:
source_address defines the bech32-encoded address
that source of the budget
destination_address:
type: string
title: >-
collection_address defines the bech32-encoded
destination_address defines the bech32-encoded
address of the budget pool to distribute
start_time:
type: string
Expand Down Expand Up @@ -549,15 +549,15 @@ definitions:
rate:
type: string
title: rate specifies the distributing amount by ratio of total budget source
budget_source_address:
source_address:
type: string
title: >-
budget_source_address defines the bech32-encoded address that source
of the budget
collection_address:
source_address defines the bech32-encoded address that source of the
budget
destination_address:
type: string
title: >-
collection_address defines the bech32-encoded address of the budget
destination_address defines the bech32-encoded address of the budget
pool to distribute
start_time:
type: string
Expand All @@ -582,15 +582,15 @@ definitions:
title: >-
rate specifies the distributing amount by ratio of total budget
source
budget_source_address:
source_address:
type: string
title: >-
budget_source_address defines the bech32-encoded address that
source of the budget
collection_address:
source_address defines the bech32-encoded address that source of
the budget
destination_address:
type: string
title: >-
collection_address defines the bech32-encoded address of the
destination_address defines the bech32-encoded address of the
budget pool to distribute
start_time:
type: string
Expand Down Expand Up @@ -637,15 +637,15 @@ definitions:
title: >-
rate specifies the distributing amount by ratio of total budget
source
budget_source_address:
source_address:
type: string
title: >-
budget_source_address defines the bech32-encoded address that
source of the budget
collection_address:
source_address defines the bech32-encoded address that source of
the budget
destination_address:
type: string
title: >-
collection_address defines the bech32-encoded address of the
destination_address defines the bech32-encoded address of the
budget pool to distribute
start_time:
type: string
Expand Down Expand Up @@ -679,16 +679,16 @@ definitions:
title: >-
rate specifies the distributing amount by ratio of total
budget source
budget_source_address:
source_address:
type: string
title: >-
budget_source_address defines the bech32-encoded address
that source of the budget
collection_address:
source_address defines the bech32-encoded address that
source of the budget
destination_address:
type: string
title: >-
collection_address defines the bech32-encoded address of the
budget pool to distribute
destination_address defines the bech32-encoded address of
the budget pool to distribute
start_time:
type: string
format: date-time
Expand Down Expand Up @@ -745,16 +745,16 @@ definitions:
title: >-
rate specifies the distributing amount by ratio of total
budget source
budget_source_address:
source_address:
type: string
title: >-
budget_source_address defines the bech32-encoded address
that source of the budget
collection_address:
source_address defines the bech32-encoded address that
source of the budget
destination_address:
type: string
title: >-
collection_address defines the bech32-encoded address of the
budget pool to distribute
destination_address defines the bech32-encoded address of
the budget pool to distribute
start_time:
type: string
format: date-time
Expand Down
8 changes: 4 additions & 4 deletions docs/How-To/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ http://localhost:1317/cosmos/budget/v1beta1/params <!-- markdown-link-check-disa
{
"name": "gravity-dex-farming-20213Q-20221Q",
"rate": "0.300000000000000000",
"budget_source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"collection_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"destination_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"start_time": "2021-10-01T00:00:00Z",
"end_time": "2022-04-01T00:00:00Z"
}
Expand All @@ -42,8 +42,8 @@ http://localhost:1317/cosmos/budget/v1beta1/budgets <!-- markdown-link-check-dis
"budget": {
"name": "gravity-dex-farming-20213Q-20221Q",
"rate": "0.300000000000000000",
"budget_source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"collection_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"destination_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"start_time": "2021-10-01T00:00:00Z",
"end_time": "2022-04-01T00:00:00Z"
},
Expand Down
22 changes: 11 additions & 11 deletions docs/How-To/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ sdk.AccAddress(address.Module("farming", []byte("GravityDEXFarmingBudget")))
- `name`: is the name of the budget plan used for display
- `description`: is the description of the budget plan used for display
- `rate`: is the distributing amount by ratio of the total budget source
- `budget_source_address`: is the address where the source of budget comes from
- `collection_address`: is the address that collects budget from the budget source address
- `start_time`: is start time of the budget plan
- `source_address`: is the address where the source of budget comes from
- `destination_address`: is the address that collects budget from the source address
- `start_time`: is start time of the budget plan
- `end_time`: is end time of the budget plan

```json
Expand All @@ -49,8 +49,8 @@ sdk.AccAddress(address.Module("farming", []byte("GravityDEXFarmingBudget")))
{
"name": "gravity-dex-farming-20213Q-20221Q",
"rate": "0.300000000000000000",
"budget_source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"collection_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"destination_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"start_time": "2021-10-01T00:00:00Z",
"end_time": "2022-04-01T00:00:00Z"
}
Expand Down Expand Up @@ -88,8 +88,8 @@ budgetd tx gov vote 1 yes \
# Query the proposal again to check the status PROPOSAL_STATUS_PASSED
budgetd q gov proposals --output json | jq

# Query the balances of collection_address for a couple times
# the balances should increrase over time as gas fees and part of ATOM inflation flow in
# Query the balances of destination_address for a couple times
# the balances should increase over time as gas fees and part of ATOM inflation flow in
budgetd q bank balances cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl --output json | jq
```

Expand All @@ -113,8 +113,8 @@ budgetd q budget params --output json | jq
{
"name": "gravity-dex-farming-20213Q-20221Q",
"rate": "0.300000000000000000",
"budget_source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"collection_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"destination_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"start_time": "2021-10-01T00:00:00Z",
"end_time": "2022-04-01T00:00:00Z"
}
Expand All @@ -136,8 +136,8 @@ budgetd q budget budgets --output json | jq
"budget": {
"name": "gravity-dex-farming-20213Q-20221Q",
"rate": "0.300000000000000000",
"budget_source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"collection_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"destination_address": "cosmos10pg34xts7pztyu9n63vsydujjayge7gergyzavl4dhpq36hgmkts880rwl",
"start_time": "2021-10-01T00:00:00Z",
"end_time": "2022-04-01T00:00:00Z"
},
Expand Down
10 changes: 5 additions & 5 deletions proto/tendermint/budget/v1beta1/budget.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ message Budget {
(gogoproto.nullable) = false
];

// budget_source_address defines the bech32-encoded address that source of the budget
string budget_source_address = 3 [(gogoproto.moretags) = "yaml:\"budget_source_address\""];
// source_address defines the bech32-encoded address that source of the budget
string source_address = 3 [(gogoproto.moretags) = "yaml:\"source_address\""];

// collection_address defines the bech32-encoded address of the budget pool to distribute
string collection_address = 4 [(gogoproto.moretags) = "yaml:\"collection_address\""];
// destination_address defines the bech32-encoded address of the budget pool to distribute
string destination_address = 4 [(gogoproto.moretags) = "yaml:\"destination_address\""];

// start_time specifies the start time of the budget
google.protobuf.Timestamp start_time = 5
Expand All @@ -56,7 +56,7 @@ message Budget {
message TotalCollectedCoins {
option (gogoproto.goproto_getters) = false;

// total_collected_coins specifis the total collected coins in a budget ever since the budget is created
// total_collected_coins specifies the total collected coins in a budget ever since the budget is created
repeated cosmos.base.v1beta1.Coin total_collected_coins = 1 [
(gogoproto.moretags) = "yaml:\"total_collected_coins\"",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
Expand Down
2 changes: 1 addition & 1 deletion proto/tendermint/budget/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ message BudgetRecord {
// name defines the name of the budget
string name = 1 [(gogoproto.moretags) = "yaml:\"name\""];

// total_collected_coins specifis the total collected coins in a budget ever since the budget is created
// total_collected_coins specifies the total collected coins in a budget ever since the budget is created
repeated cosmos.base.v1beta1.Coin total_collected_coins = 2 [
(gogoproto.moretags) = "yaml:\"total_collected_coins\"",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
Expand Down
6 changes: 3 additions & 3 deletions proto/tendermint/budget/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ message QueryParamsResponse {

// QueryBudgetsRequest is the request type for the Query/Budgets RPC method.
message QueryBudgetsRequest {
string name = 1;
string budget_source_address = 2;
string collection_address = 3;
string name = 1;
string source_address = 2;
string destination_address = 3;
}

// QueryBudgetsResponse is the response type for the Query/Budgets RPC method.
Expand Down
10 changes: 5 additions & 5 deletions x/budget/client/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import (
)

const (
FlagName = "name"
FlagBudgetSourceAddress = "budget-source-address"
FlagCollectionAddress = "collection-address"
FlagName = "name"
FlagSourceAddress = "source-address"
FlagDestinationAddress = "destination-address"
)

// flagSetBudgets returns the FlagSet used for budgets.
func flagSetBudgets() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)

fs.String(FlagName, "", "The budget name")
fs.String(FlagBudgetSourceAddress, "", "The bech32 address of the budget source account")
fs.String(FlagCollectionAddress, "", "The bech32 address of the collection account")
fs.String(FlagSourceAddress, "", "The bech32 address of the source account")
fs.String(FlagDestinationAddress, "", "The bech32 address of the destination account")

return fs
}
14 changes: 7 additions & 7 deletions x/budget/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func GetCmdQueryBudgets() *cobra.Command {
Example:
$ %s query %s budgets
$ %s query %s budgets --name ...
$ %s query %s budgets --budget-source-address %s1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v
$ %s query %s budgets --collection-address %s1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v
$ %s query %s budgets --source-address %s1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v
$ %s query %s budgets --destination-address %s1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v
`,
version.AppName, types.ModuleName,
version.AppName, types.ModuleName,
Expand All @@ -99,16 +99,16 @@ $ %s query %s budgets --collection-address %s1zaavvzxez0elundtn32qnk9lkm8kmcszzs
}

name, _ := cmd.Flags().GetString(FlagName)
budgetSourceAddr, _ := cmd.Flags().GetString(FlagBudgetSourceAddress)
collectionAddr, _ := cmd.Flags().GetString(FlagCollectionAddress)
sourceAddr, _ := cmd.Flags().GetString(FlagSourceAddress)
destinationAddr, _ := cmd.Flags().GetString(FlagDestinationAddress)

queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Budgets(
context.Background(),
&types.QueryBudgetsRequest{
Name: name,
BudgetSourceAddress: budgetSourceAddr,
CollectionAddress: collectionAddr,
Name: name,
SourceAddress: sourceAddr,
DestinationAddress: destinationAddr,
},
)
if err != nil {
Expand Down
Loading