Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: calculate simple apy for balancer-aura vaults #486

Closed
wants to merge 16 commits into from

Conversation

murderteeth
Copy link

@murderteeth murderteeth commented Feb 20, 2023

Related issue: #407

What I did:

I added an apy calculation for balancer-aura vaults. Because this calculation is based on the existing curve-convex calculation I also refactored the existing curve calculation, moving a lot of shared code to yearn/apy/common, yearn/apy/gauge, and yearn/apy/booster.

How I did it:

  • Reviewed contracts and documentation on curve, balancer, convex, aura, and a few yearn vaults\strategies.
  • Mostly I just followed the curve-convex apy code, adapting for balancer-aura.
  • Had some issues with the dev-cycle time in my local environment when using docker. So I modified the debug_apy script to make it easier to use directly with brownie. I also added support for a DISABLE_CURVE envar for disabling the curve exporter during testing. This brought my cycle time down to 15 seconds when computing the bal-aura apy. I mostly ran this while testing: brownie run scripts/debug_apy.py with_exception_handling --network=mainnet

How to verify it:

I used Balancer Boosted Aave USD Pool yVault to test, 0xc5F3D11580c41cD07104e9AF154Fc6428bb93c73. Following is output from the new calculation.

Apy(
  type='aura', 
  gross_apr=0.03632927090500676, 
  net_apy=0.024819477484117503, 
  fees=ApyFees(performance=0.1, withdrawal=None, management=0.0, keep_crv=0.0, cvx_keep_crv=0.0), 
  points=None, 
  blocks=ApyBlocks(now=16711392, week_ago=16661618, month_ago=16489965, inception=15804834), 
  composite={
    'boost': 1.5253965330323664, 
    'bal_rewards_apr': 0.013408715009768951, 
    'aura_rewards_apr': 0.02292055589523781, 
    'extra_rewards_apr': 0, 
    'aura_gross_apr': 0.03632927090500676, 
    'aura_net_apr': 0.02724695317875507, 
    'booster_net_apr': 0.024522257860879564
  }, error_reason=None
)

Check results against the bb-a-usd pool on https://app.aura.finance/, for example:
image

Checklist:

  • I have tested it locally and it works
  • I have included any relevant documentation for the repo maintainers
  • (If fixing a bug) I have added a test to the test suite to test for this particular bug

Adding a Network

If the purpose of your PR is to add support for a new network, please copy the checklist from here into this PR conversation, and use it to track your changes.

* DISABLE_CURVE disables the curve exporter. Useful in dev if you don't need
the curve exporter running as it currently takes a long time to load.

* Defer circular references to the price magic module to avoid partially
initialized module errors.
* Eg, this enables `brownie run scripts/debug_apy.py with_exception_handling`

* Measure `vault.apy()` run time
@murderteeth murderteeth changed the title Calculate simple apy for balancer-aura vaults feat: calculate simple apy for balancer-aura vaults Feb 20, 2023
@DarkGhost7 DarkGhost7 linked an issue Mar 1, 2023 that may be closed by this pull request
@murderteeth murderteeth deleted the issue-407-bal-aura-apys branch July 20, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add Balancer and Aura Finance fwd looking APYs
2 participants