Open calvinaco opened 2 years ago
Issuing shares
= delegator stake amount
x (validator total shares
/ validator total tokens
)
rewards
eventproposer_reward
event will be emitted together. But the reward pool will be incremented once only (no double count issue).amount
value of those events are included the commission, need to be deduct by a commission rateDelegator rewards
= delegator bonded tokens
x ( ( validator rewards
/ validator tokens
) [now] - ( validator rewards
/ validator tokens
) [at the beginning of the staking or at the last withdraw action] )
Events exmaple:
{
"type": "proposer_reward",
"attributes": [
{
"key": "amount",
"value": "241502067.800000000000000000basetcro",
"index": true
},
{
"key": "validator",
"value": "tcrocncl14fzksz5h72et4ssjtqpwsmhz6ysk6r4na5tr63=",
"index": true
}
]
},
{
"type": "rewards",
"attributes": [
{
"key": "amount",
"value": "241502067.800000000000000000basetcro",
"index": true
},
{
"key": "validator",
"value": "tcrocncl14fzksz5h72et4ssjtqpwsmhz6ysk6r4na5tr63=",
"index": true
}
]
}
commission
eventcommission
= reward
x commission rate
Events example:
{
"type": "commission",
"attributes": [
{
"key": "amount",
"value": "24150206.780000000000000000basetcro",
"index": true
},
{
"key": "validator",
"value": "tcrocncl14fzksz5h72et4ssjtqpwsmhz6ysk6r4na5tr63=",
"index": true
}
]
}
To conclude, by using the below Msg and events, the reward of validators and delegators, the commission of validators could indexed:
MsgDelegate
MsgUndelegate
MsgRedelegate
MsgWithdrawDelegatorReward
complete_unbonding
(from v0.32)complete_redelegation
(from v0.32)rewards
(from v0.32)commission
(from v0.32)withdraw_rewards
(from v0.32)withdraw_commission
(from v0.32)
Task Details
Definition of Done