cosmos-sdk/x/distribution/spec/05_hooks.md

27 lines
1001 B
Markdown
Raw Normal View History

2018-08-28 15:23:57 -07:00
# Hooks
## Create or modify delegation distribution
2019-01-17 09:53:22 -08:00
- triggered-by: `staking.MsgDelegate`, `staking.MsgBeginRedelegate`, `staking.MsgUndelegate`
The pool of a new delegator bond will be 0 for the height at which the bond was
2018-08-08 12:03:43 -07:00
added, or the withdrawal has taken place. This is achieved by setting
2018-10-05 17:32:06 -07:00
`DelegationDistInfo.WithdrawalHeight` to the height of the triggering transaction.
## Commission rate change
2019-01-17 09:53:22 -08:00
- triggered-by: `staking.MsgEditValidator`
If a validator changes its commission rate, all commission on fees must be
2018-08-08 20:43:40 -07:00
simultaneously withdrawn using the transaction `TxWithdrawValidator`.
Additionally the change and associated height must be recorded in a
`ValidatorUpdate` state record.
2018-08-08 12:03:43 -07:00
## Change in Validator State
2019-01-11 12:08:01 -08:00
- triggered-by: `staking.Slash`, `staking.UpdateValidator`
2018-08-08 12:03:43 -07:00
2018-08-08 20:43:40 -07:00
Whenever a validator is slashed or enters/leaves the validator group all of the
2018-08-20 08:50:13 -07:00
validator entitled reward tokens must be simultaneously withdrawn from
`Global.Pool` and added to `ValidatorDistInfo.Pool`.