Skip to content

Commit

Permalink
chore: rewards per token getter
Browse files Browse the repository at this point in the history
  • Loading branch information
romanagureev committed Aug 30, 2024
1 parent c9a08fa commit 3d0ee3c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions contracts/implementations/ChildGauge.vy
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,18 @@ def rate_per_lp_token(_reward_id: uint256, _with_precision: bool=False) -> uint2
return rate / precision


@external
@view
def get_rewards_of(_token: ERC20) -> DynArray[RewardData, MAX_REWARDS]:
rewards: DynArray[RewardData, MAX_REWARDS] = []
for i in range(MAX_REWARDS):
if i >= len(self.reward_data):
break
if self.reward_data[i].token == _token:
rewards.append(self.reward_data[i])
return rewards


@view
@external
def decimals() -> uint256:
Expand Down

0 comments on commit 3d0ee3c

Please sign in to comment.