github.com/Finschia/finschia-sdk@v0.48.1/x/distribution/spec/05_hooks.md (about)

     1  <!--
     2  order: 5
     3  -->
     4  
     5  # Hooks
     6  
     7  Available hooks that can be called by and from this module.
     8  
     9  ## Create or modify delegation distribution
    10  
    11  - triggered-by: `staking.MsgDelegate`, `staking.MsgBeginRedelegate`, `staking.MsgUndelegate`
    12  
    13  ### Before
    14  
    15  - The delegation rewards are withdrawn to the withdraw address of the delegator.
    16    The rewards include the current period and exclude the starting period.
    17  - The validator period is incremented.
    18    The validator period is incremented because the validator's power and share distribution might have changed.
    19  - The reference count for the delegator's starting period is decremented.
    20  
    21  ### After
    22  
    23  The starting height of the delegation is set to the previous period.
    24  Because of the `Before`-hook, this period is the last period for which the delegator was rewarded.
    25  
    26  ## Validator created
    27  
    28  - triggered-by: `staking.MsgCreateValidator`
    29  
    30  When a validator is created, the following validator variables are initialized:
    31  
    32  - Historical rewards
    33  - Current accumulated rewards
    34  - Accumulated commission
    35  - Total outstanding rewards
    36  - Period
    37  
    38  By default, all values are set to a `0`, except period, which is set to `1`.
    39  
    40  ## Validator removed
    41  
    42  - triggered-by: `staking.RemoveValidator`
    43  
    44  Outstanding commission is sent to the validator's self-delegation withdrawal address.
    45  Remaining delegator rewards get sent to the community fee pool.
    46  
    47  Note: The validator gets removed only when it has no remaining delegations.
    48  At that time, all outstanding delegator rewards will have been withdrawn.
    49  Any remaining rewards are dust amounts.
    50  
    51  ## Validator is slashed
    52  
    53  - triggered-by: `staking.Slash`
    54    
    55  - The current validator period reference count is incremented.
    56    The reference count is incremented because the slash event has created a reference to it.
    57  - The validator period is incremented.
    58  - The slash event is stored for later use.
    59    The slash event will be referenced when calculating delegator rewards.