Title | Description |
---|---|
Budgetd |
A high-level overview of how the command-line (CLI) interfaces work for the budget module. |
This document provides a high-level overview of how the command-line (CLI) interfaces work for the budget module.
In order to test out the following command-line interfaces, you need to set up a local node to either send transaction or query from. You can refer to this localnet tutorial on how to build budgetd
binary and bootstrap a local network in your local machine.
There is no command-line interface for the Budget module. However, in order to query budget parameters and plans we are going to submit a governance proposal to create a budget plan in this documentation.
Let's create proposal.json
file. Depending on what budget plan you plan to create, change the following values of the fields for your need. In this case, we plan to create a budget plan that distributes partial amount of coins from the Cosmos Hub's gas fees and ATOM inflation accrued in FeeCollector module account for Gravity DEX farming plan to GravityDEXFarmingBudget account (see the code below)
// cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky
sdk.AccAddress(address.Module("farming", []byte("GravityDEXFarmingBudget")))
name
: is the name of the budget plan used for displaydescription
: is the description of the budget plan used for displayrate
: is the distributing amount by ratio of the total budget sourcesource_address
: is the address where the source of budget comes fromdestination_address
: is the address that collects budget from the source addressstart_time
: is start time of the budget planend_time
: is end time of the budget plan
{
"title": "Create a Budget Plan",
"description": "Here is an example of how to add a budget plan by using ParameterChangeProposal",
"changes": [
{
"subspace": "budget",
"key": "Budgets",
"value": [
{
"name": "gravity-dex-farming-20213Q-20221Q",
"rate": "0.300000000000000000",
"source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"destination_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"start_time": "2021-10-01T00:00:00Z",
"end_time": "2022-04-01T00:00:00Z"
}
]
}
],
"deposit": "10000000stake"
}
# Submit a parameter changes proposal to create a budget plan
budgetd tx gov submit-proposal param-change proposal.json \
--chain-id localnet \
--from user1 \
--keyring-backend test \
--broadcast-mode block \
--yes
# Query the proposal to check the status PROPOSAL_STATUS_VOTING_PERIOD
budgetd q gov proposals --output json | jq
# Vote
budgetd tx gov vote 1 yes \
--chain-id localnet \
--from val1 \
--keyring-backend test \
--broadcast-mode block \
--yes
#
# Wait a while (30s) for the proposal to pass
#
# Query the proposal again to check the status PROPOSAL_STATUS_PASSED
budgetd q gov proposals --output json | jq
# 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 cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky --output json | jq
https://github.com/tendermint/budget/blob/main/proto/tendermint/budget/v1beta1/query.proto
# Query an address that derived can be used as source and destination
# Derived according to the given name, module name, and type
# Default flag:
# $ [--type 0] - ADDRESS_TYPE_32_BYTES of ADR 028
# $ [--module-name budget] - When B, the default module name is budget
budgetd query budget address testSourceAddr
# address: cosmos1hg0v9u92ztzecpmml26206wwtghggx0flpwn5d4qc3r6dvuanxeqs4mnk5
budgetd query budget address fee_collector --type 1
# address: cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta
budgetd query budget address GravityDEXFarmingBudget --module-name farming
# address: cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky
# Query the values set as budget parameters
# Note that default params are empty. You need to submit governance proposal to create budget plan
# Reference the Transaction section in thid documentation
budgetd q budget params --output json | jq
{
"epoch_blocks": 1,
"budgets": [
{
"name": "gravity-dex-farming-20213Q-20221Q",
"rate": "0.300000000000000000",
"source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"destination_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"start_time": "2021-10-01T00:00:00Z",
"end_time": "2022-04-01T00:00:00Z"
}
]
}
# Query all the budget plans exist in the network
budgetd q budget budgets --output json | jq
{
"budgets": [
{
"budget": {
"name": "gravity-dex-farming-20213Q-20221Q",
"rate": "0.300000000000000000",
"source_address": "cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta",
"destination_address": "cosmos1228ryjucdpdv3t87rxle0ew76a56ulvnfst0hq0sscd3nafgjpqqkcxcky",
"start_time": "2021-10-01T00:00:00Z",
"end_time": "2022-04-01T00:00:00Z"
},
"total_collected_coins": [
{
"denom": "stake",
"amount": "2220"
}
]
}
]
}