Reward Distribution Contract

rwddist.xsat

Actions

  • Mint XSAT and distribute it to validators

Quickstart

# distribute @utxomng.xsat
$ cleos push action rwddist.xsat distribute '{"height": 840000}' -p utxomng.xsat

# endtreward @utxomng.xsat
$ cleos push action rwddist.xsat endtreward '{"height": 840000, "from_index": 0, "to_index": 10}' -p utxomng.xsat

# endtreward2 @utxomng.xsat - XSAT
$ cleos push action rwddist.xsat endtreward2 '{"height": 840000, "from_index": 0, "to_index": 10}' -p utxomng.xsat

# setrwdconfig @auth get_self()
$ cleos push action rwddist.xsat setrwdconfig '{"v1": {"miner_reward_rate": 1000, "synchronizer_reward_rate": 1000, "btc_consensus_reward_rate": 1000, "xsat_consensus_reward_rate": 1000, "xsat_staking_reward_rate": 1000}, "v2": {"miner_reward_rate": 2000, "synchronizer_reward_rate": 500, "btc_consensus_reward_rate": 0, "xsat_consensus_reward_rate": 500}}' -p rwddist.xsat

Table Information

STRUCT validator_info

  • {name} account - validator account

  • {uint64_t} staking - the validator's staking amount

  • {time_point_sec} created_at - created at time

example

TABLE rewardlogs

scope height

params

  • {uint64_t} height - block height

  • {checksum256} hash - block hash

  • {asset} synchronizer_rewards - the synchronizer assigns the number of rewards

  • {asset} consensus_rewards - the consensus validator allocates the number of rewards

  • {asset} staking_rewards - the validator assigns the number of rewards

  • {uint32_t} num_validators - the number of validators who pledge more than 100 BTC

  • {std::vector<validator_info> } provider_validators - list of endorsed validators

  • {uint64_t} endorsed_staking - total endorsed staking amount

  • {uint64_t} reached_consensus_staking - the total staking amount to reach consensus is (number of validators * 2/3+ 1 staking amount)

  • {uint32_t} num_validators_assigned - the number of validators that have been allocated rewards

  • {name} synchronizer -synchronizer account

  • {name} miner - miner account

  • {name} parser - parse the account of the block

  • {checksum256} tx_id - tx_id of the reward after distribution

  • {time_point_sec} latest_exec_time - latest reward distribution time

example

TABLE rewardbal

scope

rwddist.xsat

params

  • {uint64_t} height - block height

  • {asset} synchronizer_rewards_unclaimed - unclaimed synchronizer rewards

  • {asset} consensus_rewards_unclaimed - unclaimed consensus rewards

  • {asset} staking_rewards_unclaimed - unclaimed staking rewards

example

STRUCT reward_rate_t

params

  • {uint64_t} miner_reward_rate - reward rate for miners

  • {uint64_t} synchronizer_reward_rate - reward rate for synchronizers

  • {uint64_t} btc_consensus_reward_rate - reward rate for BTC consensus

  • {uint64_t} xsat_consensus_reward_rate - reward rate for XSAT consensus

  • {uint64_t} xsat_staking_reward_rate - reward rate for XSAT staking

  • {uint64_t} reserve1 - reserved for future use

  • {uint64_t} reserve2 - reserved for future use

  • {std::optional<int>} reserved3 - reserved for future use

example

TABLE rewardconfig

scope

rwddist.xsat

params

  • {uint16_t} cached_version - cached version (0 - unset)

  • {reward_rate_t} v1 - reward rate configuration version 1

  • {reward_rate_t} v2 - reward rate configuration version 2

example

ACTION distribute

  • authority: utxomng.xsat

Allocate rewards and record allocation information.

params

  • {uint64_t} height - Block height for allocating rewards

example

ACTION endtreward

  • authority: utxomng.xsat

Allocate rewards and record allocation information.

params

  • {uint64_t} height - block height

  • {uint32_t} from_index - the starting reward index of provider_validators

  • {uint32_t} to_index - end reward index of provider_validators

example

ACTION endtreward2

  • authority: utxomng.xsat

Allocate XSAT rewards and record allocation information.

params

  • {uint64_t} height - block height

  • {uint32_t} from_index - the starting reward index of provider_validators

  • {uint32_t} to_index - end reward index of provider_validators

example

ACTION setrwdconfig

  • authority: rwddist.xsat

Set reward configuration.

params

  • {reward_config_row} config - reward configuration

example

Last updated