Skip to content

Commit

Permalink
reward ratio logic works
Browse files Browse the repository at this point in the history
  • Loading branch information
mconcat committed Jan 15, 2025
1 parent b2f1f5b commit a074322
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion staker/reward_calculation_pool.gno
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ type Pool struct {
func NewPool(poolPath string, currentHeight uint64) *Pool {
unclaimableAcc := uint64(0)
tierRewardTotal := uint64(0)
// For some reason we cannot use &currentHeight directly
currentHeightVar := currentHeight

return &Pool{
poolPath: poolPath,
Expand All @@ -100,7 +102,7 @@ func NewPool(poolPath string, currentHeight uint64) *Pool {
incentives: NewIncentives(currentHeight),
ticks: NewTicks(),
globalRewardRatioAccumulation: u256.Zero(),
lastGlobalRewardRatioAccumulationHeight: &currentHeight,
lastGlobalRewardRatioAccumulationHeight: &currentHeightVar,
}
}

Expand Down Expand Up @@ -196,6 +198,9 @@ func (self *Pool) cacheInternalReward(currentHeight uint64, emissionUpdate en.Em

*self.lastRewardCacheHeight = currentHeight
println("\t\tlastRewardCacheHeight : ", *self.lastRewardCacheHeight)

self.updateGlobalRewardRatioAccumulation(currentHeight, self.CurrentStakedLiquidity(currentHeight))

println("\t[", currentHeight, "] cacheInternalReward End ")
}

Expand Down

0 comments on commit a074322

Please sign in to comment.