Skip to content

Commit

Permalink
fix: get extract reward_token from reward pool 0x00F54653e66Baf7ddCD0…
Browse files Browse the repository at this point in the history
…9f6e59206F8906Bfa6eA
  • Loading branch information
crebsy committed Jul 3, 2023
1 parent a3fb3a1 commit ff66f5a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions yearn/apy/balancer/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,12 @@ def get_bonus_rewards_apr(rewards, rewards_tvl, block=None):
result = 0
for index in range(rewards.extraRewardsLength(block_identifier=block)):
extra_rewards = contract(rewards.extraRewards(index))
extra_rewards_per_year = (extra_rewards.rewardRate(block_identifier=block) / 10**extra_rewards.decimals()) * SECONDS_PER_YEAR
extra_rewards_per_year_usd = extra_rewards_per_year * magic.get_price(extra_rewards, block=block)
reward_token = extra_rewards
if hasattr(extra_rewards, 'rewardToken'):
reward_token = contract(extra_rewards.rewardToken())

extra_rewards_per_year = (extra_rewards.rewardRate(block_identifier=block) / 10**reward_token.decimals()) * SECONDS_PER_YEAR
extra_rewards_per_year_usd = extra_rewards_per_year * magic.get_price(reward_token, block=block)
result += extra_rewards_per_year_usd / rewards_tvl
return result

Expand Down

0 comments on commit ff66f5a

Please sign in to comment.