-
Notifications
You must be signed in to change notification settings - Fork 75
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
Update Buyback contract for OGV & CVX swaps #1876
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1876 +/- ##
==========================================
+ Coverage 67.60% 67.71% +0.11%
==========================================
Files 50 52 +2
Lines 2710 2726 +16
Branches 700 706 +6
==========================================
+ Hits 1832 1846 +14
- Misses 875 877 +2
Partials 3 3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Is there a reason we use one contract with lots of if statements, rather than just deploying one simple contract twice? Seems like it would keep the code simpler, and with that be easier to change in the future? The different swap routes for each coin could just be an immutable bytestring passed in during the constructor. |
Thanks for cleaning up the now unused swap() method. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Buybacks ReviewRequirementsThis PR is shifting to include buying and locking CVX as a part of buyback contract, rather than as a separate strategist action. We're also now using a mostly shared codebase for both OETH and OUSD buybacks. Deployment ConsiderationsOnce we create the governance proposals, we'll need to not do buybacks on the migrated old buyback contracts, since the amounts transferred will be hardcoded into the governance action. Internal StateOnly config AttackThe consequences of this contract going bad should be small. A week or two of a percentage of yield. An attacker could try to get the contract to transfer tokens to themselves, however, all transfer destinations are controlled by governance. The primary threat is MEV action during the swaps. This is defended against via minimum output parameters passed in by the strategist. These minimum output amounts are passed to the Uniswap router for checking. LogicLooks correct TestsNot checked FlavorLooking good Overflow
Proxy
Black magic
Dependencies
Deploy
Authentication
Cryptographic code
Gas problems
External calls
Ethereum
|
Fork tests: from world import *
OETH_WHALE = '0xEADB3840596cabF312F2bC88A4Bb0b93A4E1FF5F'
NEW_OETH_BUYBACK = '0x85094b52754591A3dE0002AD97F433584389aea0'
buyback_oeth = Contract.from_abi('buyback_oeth', NEW_OETH_BUYBACK, buyback.abi, owner=STRATEGIST)
buyback_ousd = buyback
buyback.swap(100*1e18, 1e18, 1e18, {'from': STRATEGIST})
show_transfers(history[-1])
buyback.swap(100*1e18, 1e18, 20* 1e18, {'from': STRATEGIST})
buyback.swap(100*1e18, 99*1e18, 1* 1e18, {'from': STRATEGIST})
buyback.swap(100*1e18, 999*1e18, 1* 1e18, {'from': STRATEGIST})
buyback.swap(100*1e18, 9999*1e18, 1* 1e18, {'from': STRATEGIST})
buyback.swap(100*1e18, 99999*1e18, 1* 1e18, {'from': STRATEGIST})
oeth.transfer(buyback_oeth, 10*1e18, {'from': OETH_WHALE})
buyback_oeth.swap(1e18, 1e18, 1e18, {'from': STRATEGIST})
buyback_oeth.swap(int(1e18)+1, 1e18, 1e18, {'from': STRATEGIST})
show_transfers(history[-1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three or four minor tweaks needed, but otherwise looks good. 👍
Should be good for deploy. |
If you made a contract change, make sure to complete the checklist below before merging it in master.
Refer to our documentation for more details about contract security best practices.
Contract change checklist: