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

Enable pool fees when rebalancing Aerodrome AMO #2276

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

sparrowDom
Copy link
Member

@sparrowDom sparrowDom commented Oct 15, 2024

  • Leave fees on Aerodrome pool when performing rebalances
  • fix Quoter contract to report correct swap values when estimating amount to swap when reaching price. Before it was overshooting
  • fix Quoter contract to start the binary search at a more appropriate levels according to the strategy contract's current TVL

Code Change Checklist

To be completed before internal review begins:

  • The contract code is complete
  • Executable deployment file
  • Fork tests that test after the deployment file runs
  • Unit tests *if needed
  • The owner has done a full checklist review of the code + tests

Internal review:

  • Two approvals by internal reviewers

Deploy checklist

Two reviewers complete the following checklist:

- [ ] All deployed contracts are listed in the deploy PR's description
- [ ] Deployed contract's verified code (and all dependencies) match the code in master
- [ ] Contract constructors have correct arguments
- [ ] The transactions that interacted with the newly deployed contract match the deploy script.
- [ ] Governance proposal matches the deploy script
- [ ] Smoke tests pass after fork test execution of the governance proposal

Copy link

github-actions bot commented Oct 15, 2024

Warnings
⚠️ 👀 This PR needs at least 2 reviewers

Generated by 🚫 dangerJS against cf8084c

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 0% with 28 lines in your changes missing coverage. Please review.

Project coverage is 53.16%. Comparing base (704bc66) to head (cf8084c).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
...acts/strategies/aerodrome/AerodromeAMOStrategy.sol 0.00% 20 Missing ⚠️
contracts/contracts/utils/AerodromeAMOQuoter.sol 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2276      +/-   ##
==========================================
- Coverage   53.26%   53.16%   -0.11%     
==========================================
  Files          79       79              
  Lines        4089     4097       +8     
  Branches     1074     1074              
==========================================
  Hits         2178     2178              
- Misses       1908     1916       +8     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sparrowDom sparrowDom force-pushed the sparrowDom/aerodromeAMOswapFees branch from be5a5a5 to 946061a Compare October 18, 2024 01:01
@sparrowDom
Copy link
Member Author

@DanielVF & @shahthepro would you mind doing another pass? Aside from burning the OETHb left on the contract the main changes were a couple of fixes on the quoter contract (as described in PR description)

Copy link
Collaborator

@shahthepro shahthepro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_checkForExpectedPoolPrice should be view not internal I believe (though it's not part of this PR)

*/
if (tokenId != 0) {
_removeLiquidity(1e18);
_removeLiquidityToEnsureSwap(_amountToSwap, _swapWeth);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can probably replace lines 431 to 439 with something like this. But not a big deal though since _removeLiquidityToEnsureSwap has a amountToSwap > 0 check

        if (_amountToSwap > 0) {
            if (tokenId != 0) {
                _removeLiquidityToEnsureSwap(_amountToSwap, _swapWeth);
            }

            _swapToDesiredPosition(_amountToSwap, _swapWeth, _minTokenReceived);
        }
        ```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I think this would be cleaner.

@DanielVF DanielVF changed the title enable pool fees when rebalancing Aerodrome AMO Enable pool fees when rebalancing Aerodrome AMO Oct 18, 2024
* enhance the way we withdraw liquidity

* better location

* fix comment

* update tests and simplify liquidity calculation

* small fix
@@ -351,7 +351,7 @@ contract AerodromeAMOStrategy is InitializableAbstractStrategy {
*/
function depositAll() external override onlyVault nonReentrant {
uint256 _wethBalance = IERC20(WETH).balanceOf(address(this));
if (_wethBalance > 0) {
if (_wethBalance > 1e12) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to do this > 1e12 thing inside _burnOethbOnTheContract() as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed it makes sense as a defensive measure: cf8084c

DanielVF
DanielVF previously approved these changes Oct 25, 2024
Copy link
Collaborator

@DanielVF DanielVF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, though we might want to return early in the burn function if we just have dust. This way we'll only do non-dust burns.

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.

3 participants