Badger-Finance / badger-strategies

5 stars 1 forks source link

[bveCVX] BribesProcessor Integration | Bribes Processor Code Review #51

Closed GalloDaSballo closed 2 years ago

GalloDaSballo commented 2 years ago

Strategy Review

BribesProcessor Code Review

Description

Bribes Processor, allows Multi to sell bribes but limits their rugging ability

Code Link

Code https://github.com/GalloDaSballo/fair-selling/tree/rc.4 Integration https://github.com/GalloDaSballo/vested-cvx/tree/cvx.1.7

Deployments

Newer V0.1 Deployments onChainPricerLenient: https://etherscan.io/address/0xbab7f98d62479309219b2cc5026d4ad1c6c05674

New VotiumBribesProcesso: https://etherscan.io/address/0xb2Bf1d48F2C2132913278672e6924efda3385de2

bveCVX v1.7.1 Logic: https://etherscan.io/address/0x86ca553D5Ae7cD0005552D6E275786D5043800Bd

OLD Deployment: onChainPricer OLD: https://etherscan.io/address/0xea7cf04df34812ec26492b6b6aa90825645b641c

VotiumBribesProcessor: https://etherscan.io/address/0xbed8f323456578981952e33bbfbe80d23289246b#code

bveCVX v1.7: https://etherscan.io/address/0x57961a757ba249e616c1940548401b7cdf83a849

GalloDaSballo commented 2 years ago

@sajanrajdev @shuklaayush @axejintao @petrovska-petro @jorijnsmit thoughts before integrating?

GalloDaSballo commented 2 years ago

From @axejintao

processor

sajanrajdev commented 2 years ago

Bribes Processor review:

VotiumBribesProcessor.sol

CowSwapSeller.sol

LGTM

OnChainPricingMainnet.sol

LGTM

Testing:

A few unit tests are missing as pointed out on the test_reverts.py suite, although core functionalities and integrations are covered.

Test results: image The following tests are failing: image

The first two seem to fail with an issue with the API, the third reverts at: require(checkCowswapOrder(orderData, orderUid));. Will investigate further...

GalloDaSballo commented 2 years ago
  • It should also be noted that the Ops fee should be 5% of the total bribes amount in the form of bveCVX. In this case, the fee is taken from the total CVX amount obtained which is not the total Bribes amount. Therefore, charging the hardcoded 5% on CVX won't equate to the expected 5% of the total. Maybe I am missing something? From the BIP:

Please refer to the math that @jorijnsmit came up with: https://github.com/Badger-Finance/badger-multisig/blob/eb27eb035878264d41ab368e1d63306da32a61da/scripts/badger/swap_bribes_for_bvecvx.py#L104

Ultimately if the split was 75/25 then that math helps figure out the 5% fee for total bribes, taken exclusively in CVX

GalloDaSballo commented 2 years ago

@sajanrajdev @axejintao @shuklaayush @jorijnsmit See updated Release that addresses the issues you've raised (optimization, docs and issue with approvals) https://github.com/GalloDaSballo/fair-selling/tree/rc.1

GalloDaSballo commented 2 years ago

Updated to rc.2 with fix to access control, received informal signoff from team

GalloDaSballo commented 2 years ago

Deployment: onChainPricer: https://etherscan.io/address/0xea7cf04df34812ec26492b6b6aa90825645b641c

VotiumBribesProcessor: https://etherscan.io/address/0xbed8f323456578981952e33bbfbe80d23289246b#code

TODO: [X] Write integration in bveCVX [] Pass ownership of Processor to TechOps [] Upgrade bveCVX

shuklaayush commented 2 years ago

LGTM

Tests passing

image
GalloDaSballo commented 2 years ago

Waiting for Peer Review of Integration here: https://github.com/GalloDaSballo/vested-cvx/pull/5

@shuklaayush @dapp-whisperer @jorijnsmit @petrovska-petro

If this LG, last step is for me to renounce processor to MultiSig and then we can queue upgrade

GalloDaSballo commented 2 years ago

Release: https://github.com/GalloDaSballo/vested-cvx/tree/cvx.1.7

GalloDaSballo commented 2 years ago

NOTE: Future versions should emit by using this contract (until we emit to BadgerRewards) https://etherscan.io/address/0xa84b663837d94ec41b0f99903f37e1d69af9ed3e#code

GalloDaSballo commented 2 years ago

Updated: New processor with proper approvals as well as the harvest_forwarder https://etherscan.io/address/0xb2Bf1d48F2C2132913278672e6924efda3385de2#code

Latest Code: https://github.com/GalloDaSballo/fair-selling/tree/v0.1

GalloDaSballo commented 2 years ago

Updated bveCVX: https://github.com/GalloDaSballo/vested-cvx/pull/6

Waiting for review by @sajanrajdev @axejintao @shuklaayush and we can queue upgrade for Thursday

shuklaayush commented 2 years ago

Changes to bribes processor

Changes to strategy

LGTM

sajanrajdev commented 2 years ago

Bribes processor Changes

CowSwapSeller:

VotiumBribesProcessor:

LGTM

Vested CVX Strat Changes

LGTM

NOTES

GalloDaSballo commented 2 years ago

Updated bveCVX Logic to use newer Bribes Processor: https://etherscan.io/address/0x86ca553D5Ae7cD0005552D6E275786D5043800Bd

GalloDaSballo commented 2 years ago

Diff: https://www.diffchecker.com/wDz9XyzR

GalloDaSballo commented 2 years ago

Delegation to Tech_ops: https://etherscan.io/tx/0x64364386745cca6f927f6fe73887a87bfa7ac73a127f783cab7ef1e5514bf926

GalloDaSballo commented 2 years ago

Closing as it's live and seems to be working well