Skip to content

Commit

Permalink
Implement codebase to use AutocompoundIntervalNumBlocks property on a…
Browse files Browse the repository at this point in the history
…utocompounding reward distribution codebase
  • Loading branch information
kiragpg committed Oct 11, 2023
1 parent ccdb3cf commit 83fa456
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x/multistaking/keeper/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ func (k Keeper) IncreasePoolRewards(ctx sdk.Context, pool types.StakingPool, rew
// autocompound rewards
rewards := k.GetDelegatorRewards(ctx, delegator)
compoundInfo := k.GetCompoundInfoByAddress(ctx, delegator.String())
properties := k.govKeeper.GetNetworkProperties(ctx)
if compoundInfo.LastExecBlock+properties.AutocompoundIntervalNumBlocks > uint64(ctx.BlockHeight()) {
continue
}
autoCompoundRewards := sdk.Coins{}
if compoundInfo.AllDenom {
autoCompoundRewards = rewards
Expand Down Expand Up @@ -234,6 +238,8 @@ func (k Keeper) IncreasePoolRewards(ctx sdk.Context, pool types.StakingPool, rew
if err != nil {
panic(err)
}
compoundInfo.LastExecBlock = uint64(ctx.BlockHeight())
k.SetCompoundInfo(ctx, compoundInfo)
}
}
}
Expand Down

0 comments on commit 83fa456

Please sign in to comment.