Begin Blocker
The BeginBlocker abci call is invoked on the beginning of each block. The newly created block's BlockTime field is used to update the Reward Programs and Reward Claims.
State Machine Update
The following conditional logic is evaluated to help a Reward Program transition between states:
- Starts a
Reward Programif theBlockTime>=program_start_time. - Evaluates if
BlockTime>=claim_period_end_time, and if it evaluates to true theReward Programwill attempt to progress to the next claim period. - The Reward Program will successfully progress to the next claim period, if all of the following criteria are true:
remaining_pool_balance>=minimum_rollover_amountBlockTime<program_end_time_max
- If either of the previously mentioned criteria is not met, then the
Reward Programwill end. - A completed
Reward Programwill then expire afterreward_claim_expiration_offsetseconds from its completion time. - All expired
Reward Programwill return any unused funds to the reward creator and expire any unclaimed rewards.
End Blocker
The EndBlocker abci call is ran at the end of each block. The EventManager is monitored and Qualifying Actions are deduced from newly created events and prior internal state.
Qualifying Action Detection
The following is logic is used to detect Qualifying Actions and grant shares:
- The
EventManageris utilized to traverse the events from the newly created block. - Using the
QualifyingActiontypes defined in each activeRewardProgram, the module attempts to build actions using the event and any prior events. - Each detected action will then be evaluated and only deemed a
QualifyingActionif it matches theEvaluation Criteria. - One or more shares will be granted to the participant performing the
QualifyingAction. - Participants can then claim these shares once the claim period that they were earned in completes.
- Detects qualifying events based on events in EventManager for reward programs currently running.
- Gives out shares for a running rewards program for that claim period for a given address performing qualifying events.