0g-chain/x/harvest/abci.go
2020-09-25 11:07:20 -04:00

16 lines
479 B
Go

package harvest
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// BeginBlocker applies rewards to liquidity providers and delegators according to params
func BeginBlocker(ctx sdk.Context, k Keeper) {
k.ApplyDepositRewards(ctx)
if k.ShouldDistributeValidatorRewards(ctx, k.BondDenom(ctx)) {
k.ApplyDelegationRewards(ctx, k.BondDenom(ctx))
k.SetPreviousDelegationDistribution(ctx, ctx.BlockTime(), k.BondDenom(ctx))
}
k.SetPreviousBlockTime(ctx, ctx.BlockTime())
}