Skip to content

Commit

Permalink
one day rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
ssubik committed Dec 14, 2022
1 parent f573b27 commit 04b742b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions subgraph/src/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ function getOneDayReward(streamId: BigInt, now: BigInt):BigInt{
}
const streamTime = stream.time
let currentIndex = 0
while(now.le(streamTime[currentIndex])){
while(now.gt(streamTime[currentIndex])){
currentIndex++
}
const indexDuration = stream.time[currentIndex + 1].minus(stream.time[currentIndex])
const indexRewards = stream.reward[currentIndex].minus(stream.reward[currentIndex + 1])
const indexDuration = stream.time[currentIndex].minus(stream.time[currentIndex-1])
const indexRewards = stream.reward[currentIndex-1].minus(stream.reward[currentIndex])
const oneDayReward = indexRewards.times(oneDay).div(indexDuration)
return oneDayReward
}
Expand Down

0 comments on commit 04b742b

Please sign in to comment.