2020-09-25 15:07:20 +00:00
|
|
|
package harvest
|
2020-09-21 21:08:43 +00:00
|
|
|
|
|
|
|
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))
|
|
|
|
}
|
2020-11-13 15:51:52 +00:00
|
|
|
k.ApplyInterestRateUpdates(ctx)
|
2020-12-18 01:12:48 +00:00
|
|
|
k.AttemptIndexLiquidations(ctx)
|
2020-09-21 21:08:43 +00:00
|
|
|
k.SetPreviousBlockTime(ctx, ctx.BlockTime())
|
|
|
|
}
|