Skip to content

Commit

Permalink
Check current epoch period before reporting emissions.
Browse files Browse the repository at this point in the history
  • Loading branch information
stas committed Mar 20, 2024
1 parent e8cf644 commit d9770d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions contracts/LpSugar.vy
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ interface IGauge:
def rewardRate() -> uint256: view
def rewardRateByEpoch(_ts: uint256) -> uint256: view
def rewardToken() -> address: view
def lastTimeRewardApplicable() -> uint256: view

interface ICLGauge:
def earned(_account: address, _position_id: uint256) -> uint256: view
Expand All @@ -219,6 +220,7 @@ interface ICLGauge:
def feesVotingReward() -> address: view
def stakedContains(_account: address, _position_id: uint256) -> bool: view
def stakedValues(_account: address) -> DynArray[uint256, MAX_POSITIONS]: view
def lastTimeRewardApplicable() -> uint256: view

interface INFPositionManager:
def positions(_position_id: uint256) -> PositionData: view
Expand Down Expand Up @@ -546,7 +548,7 @@ def _v2_lp(_data: address[4], _token0: address, _token1: address) -> Lp:
gauge_liquidity = gauge.totalSupply()
emissions_token = gauge.rewardToken()

if gauge_alive:
if gauge_alive and gauge.lastTimeRewardApplicable() > block.timestamp:
emissions = gauge.rewardRate()
if gauge_liquidity > 0:
token0_fees = (pool.claimable0(_data[2]) * pool_liquidity) / gauge_liquidity
Expand Down Expand Up @@ -881,7 +883,7 @@ def _cl_lp(_data: address[4], _token0: address, _token1: address) -> Lp:
token0_fees = staked_fees.amount0
token1_fees = staked_fees.amount1

if gauge_alive:
if gauge_alive and gauge.lastTimeRewardApplicable() > block.timestamp:
emissions = gauge.rewardRate()

return Lp({
Expand Down

0 comments on commit d9770d1

Please sign in to comment.