2018-09-25 23:11:57 -07:00
|
|
|
## Receiver Hooks
|
|
|
|
|
|
|
|
The staking module allow for the following hooks to be registered with staking events:
|
|
|
|
|
|
|
|
``` golang
|
|
|
|
// event hooks for staking validator object
|
|
|
|
type StakingHooks interface {
|
2018-10-22 11:59:00 -07:00
|
|
|
OnValidatorCreated(ctx Context, address ValAddress) // Must be called when a validator is created
|
|
|
|
OnValidatorModified(ctx Context, address ValAddress) // Must be called when a validator's state changes
|
2018-11-08 16:28:28 -08:00
|
|
|
OnValidatorRemoved(ctx Context, address ConsAddress, operator ValAddress) // Must be called when a validator is deleted
|
2018-09-25 23:11:57 -07:00
|
|
|
|
|
|
|
OnValidatorBonded(ctx Context, address ConsAddress) // called when a validator is bonded
|
2018-10-19 15:13:44 -07:00
|
|
|
OnValidatorBeginUnbonding(ctx Context, address ConsAddress, operator ValAddress) // called when a validator begins unbonding
|
2018-09-25 23:11:57 -07:00
|
|
|
|
|
|
|
OnDelegationCreated(ctx Context, delAddr AccAddress, valAddr ValAddress) // called when a delegation is created
|
|
|
|
OnDelegationSharesModified(ctx Context, delAddr AccAddress, valAddr ValAddress) // called when a delegation's shares are modified
|
|
|
|
OnDelegationRemoved(ctx Context, delAddr AccAddress, valAddr ValAddress) // called when a delegation is removed
|
|
|
|
}
|
|
|
|
```
|