Badger-Finance / badger-strategies

5 stars 1 forks source link

[AURA] bauraBal staking vault #58

Closed shuklaayush closed 2 years ago

shuklaayush commented 2 years ago

Strategy Review

Description

Stake auraBal to get rewards

Code Link

https://github.com/shuklaayush/auraBal-staker/tree/v0.0.4

Due Diligence Document (Link, but could also just be a .md file in repo)

Aura Aura Report yet to be released, from my own knowledge meaningful bugs where mitigated: https://code4rena.com/reports

Balancer: https://docs.balancer.fi/security/audits

Deployed Contract (If present)

Review By

Review by Security Board

Test Checks (screen shot of all test passing)

image

Launch Checklist

GalloDaSballo commented 2 years ago

Review: Tests are passing

Function for Minting is scraped from AuraToken, would like to see a couple tests against it just to be sure

Gas: AURA.INIT_MINT_AMOUNT(); AURA.reductionPerCliff() totalCliffs EMISSIONS_MAX_SUPPLY

Are all constants / immutable could just be hardcoded for cheaper gas, although they are for view function so prob doesn't matter

GalloDaSballo commented 2 years ago

Question: Harvests have 0 minOut, anything we can do to make it better?

GalloDaSballo commented 2 years ago

Question: Do we have option to lock vs buy from pool for some of these swaps?

aj-maz commented 2 years ago

General Review:

Functions Review:

shuklaayush commented 2 years ago

Function for Minting is scraped from AuraToken, would like to see a couple tests against it just to be sure

Added test for minting calculation https://github.com/shuklaayush/auraBal-staker/blob/241840f1641616a912c160854a703a987f1e7330/tests/test_custom.py#L27-L50

Are all constants / immutable could just be hardcoded for cheaper gas, although they are for view function so prob doesn't matter

Yep, these would only be called from off-chain

Harvests have 0 minOut, anything we can do to make it better?

We can but should be fine if we harvest using flashbots like in other strategies

Do we have option to lock vs buy from pool for some of these swaps?

Yes we do, but calculating the optimal way requires simulating the swap which might be expensive in balancer

https://github.com/balancer-labs/balancer-v2-monorepo/blob/d2794ef7d8f6d321cde36b7c536e8d51971688bd/pkg/vault/contracts/Swaps.sol#L447-L539

sajanrajdev commented 2 years ago

Review

Description

Strategy that takes auraBAL as want and stakes it on the rewards pool for more rewards. Upon harvest, it autocompounds the BAL received and emits all of the AURA in the form of graviAURA.

Features

Notes

@shuklaayush

  1. Provide liq and lock (Gas: 174,773 + 314,272):

  2. Direct BAL -> auraBAL deposit through Aura (Gas: 588,184): https://etherscan.io/tx/0x0f17866a94f6b68c501a1a3ba396987776c432bd5cd3960a6dd36d4db0c1b02d

So if we won't dynamically choose the best path, it seems like the current approach leads to the least gas consuming for the time being

Testing

Test cover the different scenarios expected for this strat (resolver checks tree and autocompounding), the rewards estimation logic and that the claim on withdraw flag works as expected with its proper permissions. All tests are passing and LGTM: image

GalloDaSballo commented 2 years ago

@shuklaayush I've noticed that fees where changed, @Tritium-VLK pls confirm fees before deployment

shuklaayush commented 2 years ago

We should consider setting a default value for the balEthBptToAuraBalMinOutBps upon initialize to save us the trouble of calling afterwards.

Good catch. Fixed

What if, after _reportToVault is called and fees are processed, we re-stake (_deposit) the outstanding amount to increase the position atomically?

Sure sir

sajanrajdev commented 2 years ago

Tests are still passing: image

LGTM!

shuklaayush commented 2 years ago

Deployment

Vault proxy: 0x37d9D2C6035b744849C15F1BFEE8F268a20fCBd8

Strategy proxy: 0xfB490b5beA343ABAe0E71B61bBdfd4301F5e4df9

Strategy logic: 0x500C5Aa6661B7d40fBcB05c6bd9bdC9e63f3C5AA

Guestlist: 0x6f54b4f2179b4125C4992a33FFB89e5322E26523

Caps

Total cap set at 85k auraBal and no user cap.

Current prices:

80bal-20eth pool:

Price of bpt can be calculated as

$$ \begin{align} p_{bpt} &= \frac{Invariant}{TotalSupply}\cdot \left(\frac{p_1}{w_1}\right)^{w_1} \cdot \left(\frac{p_2}{w_2}\right)^{w_2}\ &= \frac{3501000.4}{6902277.5}\cdot \left(\frac{4.75}{0.8}\right)^{0.8} \cdot \left(\frac{1116}{0.2}\right)^{0.2}\ &\approx $11.84 \end{align} $$

Assuming 1 auraBal = 1 veBal = 1 80bal-20eth bpt

sajanrajdev commented 2 years ago

Deployments review

Vault

Parameters:

Actors LG and fees confirmed with @Tritium-VLK LGTM

Strategy

Paramters:

LGTM

Guestlist

Caps Math checks out

LGTM

General

Deployments, logics and parameters LGTM

shuklaayush commented 2 years ago

Harvest: https://etherscan.io/tx/0x09376a5c2a024db8eb2fdc47c46fb19f9de1a0e66638bb293f0a5e194d814fa8 Governance delegation: https://etherscan.io/tx/0x0ed843ee7b87165acc3948cda7034077c33f60817eb65dbe64e9126b9e973152

shuklaayush commented 2 years ago

Update to emit bb-a-usd https://github.com/shuklaayush/auraBal-staker/tree/v0.1.3

Diff: https://github.com/shuklaayush/auraBal-staker/compare/v0.0.4...v0.1.3

sajanrajdev commented 2 years ago

Changes Review

Changes LGTM

Testing

All tests are passing, including upgrade test: image

Test harvest shows proper handling of bb-a-usd and no dust: image

Test changes LGTM

Overall

LGTM

shuklaayush commented 2 years ago

New strategy deployments

Proxy: 0xED6d51A82065725e283fC035f488213e869FD976

Logic: 0x959927641c65A9FA13C6102091BC0cCdDB827D77

sajanrajdev commented 2 years ago

New strategy deployments

Proxy: 0xED6d51A82065725e283fC035f488213e869FD976

Logic: 0x959927641c65A9FA13C6102091BC0cCdDB827D77

New deployed strategy actors and parameters LGTM. Address already applied to migration script which further confirms proper logic and functioning through simulation: https://github.com/Badger-Finance/badger-multisig/pull/635

LGTM

sajanrajdev commented 2 years ago

Migration to new strategy executed; https://etherscan.io/tx/0xf8b99c319f881b9486b018ca20b1d6789c2d520fc1fcc00262187a827e015f10

GalloDaSballo commented 2 years ago

Harvested over the weekend and then guarded launch over next week

sajanrajdev commented 2 years ago

Governance delegation: https://etherscan.io/tx/0x0ed843ee7b87165acc3948cda7034077c33f60817eb65dbe64e9126b9e973152

Tritium-VLK commented 2 years ago

@shuklaayush Per feedback from the beta-squad, can we change the bauraBAL vault to autocompound USD for more auraBAL instead of emitting it s bobba?

https://discord.com/channels/743271185751474307/996717380023631892/1001560433406246952

sajanrajdev commented 2 years ago

Latest deployment of version that autocompounds BB-A-USD by @shuklaayush : https://etherscan.io/address/0x32BdF2B35Bbf8dAca3561C3ADE59c941488E9c69#readProxyContract

Review

Deployment LGTM

Migration script

Ready for review: https://github.com/Badger-Finance/badger-multisig/pull/721

sajanrajdev commented 2 years ago

Strategy difference for reference: https://www.diffchecker.com/CbqkLoPp

Current logic: https://etherscan.io/address/0x959927641c65a9fa13c6102091bc0ccddb827d77#code New logic: https://etherscan.io/address/0x79b9cb36b6cb7ecb073de493aa2b9c5995854a21#code

GalloDaSballo commented 2 years ago

Closing as succesful