Skip to content

Commit 155c50a

Browse files
committed
fix: u256 nil
1 parent 0953c97 commit 155c50a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

staker/reward_calculation_pool.gno

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import (
77

88
"gno.land/p/demo/avl"
99

10-
ufmt "gno.land/p/demo/ufmt"
11-
1210
i256 "gno.land/p/gnoswap/int256"
1311
u256 "gno.land/p/gnoswap/uint256"
1412
)
@@ -211,7 +209,10 @@ func (self *ExternalRewardState) Calculate(startHeight, endHeight int64, current
211209

212210
func (self *ExternalRewardState) AccumulateReward(startHeight, endHeight uint64) {
213211
self.pool.incentives.rewardCache.RewardPerInterval(startHeight, endHeight, func(blockNumber uint64, poolRewardI interface{}) {
214-
poolRewardRatios := poolRewardI.(map[string]*u256.Uint)
212+
poolRewardRatios := map[string]*u256.Uint{}
213+
if poolRewardI != nil {
214+
poolRewardRatios = poolRewardI.(map[string]*u256.Uint)
215+
}
215216
for incentiveId, rewardRatio := range poolRewardRatios {
216217
positionReward := u256.Zero().Mul(self.deposit.liquidity, rewardRatio)
217218
positionReward = u256.Zero().Mul(positionReward, u256.NewUint(blockNumber))

0 commit comments

Comments
 (0)