cosmos-sdk/x/staking/spec/06_hooks.md

28 lines
1.1 KiB
Markdown

<!--
order: 6
-->
# Hooks
Other modules may register operations to execute when a certain event has
occurred within staking. These events can be registered to execute either
right `Before` or `After` the staking event (as per the hook name). The
following hooks can registered with staking:
* `AfterValidatorCreated(Context, ValAddress) error`
* called when a validator is created
* `BeforeValidatorModified(Context, ValAddress) error`
* called when a validator's state is changed
* `AfterValidatorRemoved(Context, ConsAddress, ValAddress) error`
* called when a validator is deleted
* `AfterValidatorBonded(Context, ConsAddress, ValAddress) error`
* called when a validator is bonded
* `AfterValidatorBeginUnbonding(Context, ConsAddress, ValAddress) error`
* called when a validator begins unbonding
* `BeforeDelegationCreated(Context, AccAddress, ValAddress) error`
* called when a delegation is created
* `BeforeDelegationSharesModified(Context, AccAddress, ValAddress) error`
* called when a delegation's shares are modified
* `BeforeDelegationRemoved(Context, AccAddress, ValAddress) error`
* called when a delegation is removed