- Docs
- Developers
- Rewards reference
Rewards Reference
This guide is a list of the availabe queries and commands related to the rewards system. The rewards module is a strong value proposition for the Archway network, as it ensures that developers can build sustainable and resilient projects.
Rewards Queries
You can use the developer tools to query rewards information, for example by launching the following commands:
archwayd query rewards block-rewards-tracking [flags]
- Query rewards tracking data for the current block height
archwayd query rewards contract-metadata [contract-address] [flags]
- Query contract metadata (contract rewards parameters)
archwayd query rewards estimate-fees [gas-limit] [flags]
- Query transaction fees estimation for a given gas limit
archwayd query rewards outstanding-rewards [rewards-address] [flags]
- Query current credited rewards for a given address (the address set in contract(s) metadata rewards_address field)
archwayd query rewards params [flags]
- Query module parameters
archwayd query rewards pool [flags]
- Query the undistributed rewards pool (ready for withdrawal) and the treasury pool funds
archwayd query rewards rewards-records [rewards-address] [flags]
- Query rewards records stored for a given address (the address set in contract(s) metadata rewards_address field) with pagination
Transaction Commands
Rewards are only distributed to the rewards receiver address, which can be a contract or a user address. The contract owner can choose to update the receiver address by updating the contract's metadata, for example with:
archwayd tx rewards set-contract-metadata [contract-address] [flags]
- Create / modify contract metadata (contract rewards parameters)
archwayd tx rewards withdraw-rewards [flags]
- Withdraw current credited rewards for the transaction sender.
The last command requires a few mandatory flags, as you would need to know the list of rewards to pull from. For this reason, you need to:
- Either set the record-ids or records-limit flag.
- Set the from flag must be set to the signer of the transaction, which must also act as a rewards address on one or more contracts.
Here's an example of a working command:
mainnet
testnet
archwayd tx rewards withdraw-rewards --chain-id archway-1 --node https://rpc.mainnet.archway.io:443 --records-limit 100 --from mywallet --gas auto --gas-prices $(archwayd q rewards estimate-fees 1 --node 'https://rpc.mainnet.archway.io:443' --output json | jq -r '.gas_unit_price | (.amount + .denom)') --gas-adjustment 1.4 --broadcast-mode sync --output json -y
Flags
Make sure to send queries and transactions to a node connected to the right network. You can use the
- node and chain-id flags, and look at their respective network values on the (listed networks page).