2020-04-24 15:20:34 +00:00
|
|
|
package incentive
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2020-04-30 14:13:31 +00:00
|
|
|
|
2020-04-24 15:20:34 +00:00
|
|
|
"github.com/kava-labs/kava/x/incentive/keeper"
|
|
|
|
)
|
|
|
|
|
|
|
|
// BeginBlocker runs at the start of every block
|
|
|
|
func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
|
2021-01-21 13:52:09 +00:00
|
|
|
params := k.GetParams(ctx)
|
2021-07-22 12:53:18 +00:00
|
|
|
|
2021-01-21 13:52:09 +00:00
|
|
|
for _, rp := range params.USDXMintingRewardPeriods {
|
2021-07-22 12:53:18 +00:00
|
|
|
k.AccumulateUSDXMintingRewards(ctx, rp)
|
2021-01-21 13:52:09 +00:00
|
|
|
}
|
|
|
|
for _, rp := range params.HardSupplyRewardPeriods {
|
2021-07-22 12:53:18 +00:00
|
|
|
k.AccumulateHardSupplyRewards(ctx, rp)
|
2021-01-21 13:52:09 +00:00
|
|
|
}
|
|
|
|
for _, rp := range params.HardBorrowRewardPeriods {
|
2021-07-22 12:53:18 +00:00
|
|
|
k.AccumulateHardBorrowRewards(ctx, rp)
|
2021-01-18 19:12:37 +00:00
|
|
|
}
|
2021-07-07 16:50:14 +00:00
|
|
|
for _, rp := range params.DelegatorRewardPeriods {
|
2021-07-22 12:53:18 +00:00
|
|
|
k.AccumulateDelegatorRewards(ctx, rp)
|
2021-01-29 20:32:07 +00:00
|
|
|
}
|
2021-07-07 13:23:06 +00:00
|
|
|
for _, rp := range params.SwapRewardPeriods {
|
|
|
|
k.AccumulateSwapRewards(ctx, rp)
|
|
|
|
}
|
2020-04-24 15:20:34 +00:00
|
|
|
}
|