-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add UniswapV3 strategy #26
base: dev
Are you sure you want to change the base?
Conversation
Fix bug Co-authored-by: arcantheon <140178288+arcantheon@users.noreply.github.com>
- As safeApprove reverts if allowance is not 0
1. Move nfpm, uniV3Factory and lpTokenId to UniswapPoolData 2. Remove setPTokenAddress and removePToken 3. Calling _setPTokenAddress inside initialize 4. Had to make `poolData` inside `allocate` as storage because updating `lpTokenId`
This comment was marked as outdated.
This comment was marked as outdated.
Stack-too-deep error persists. As at two places we are using-
And running this line itself throws a stack-too-deep. |
/// @notice Allocates deposited assets into the Uniswap V3 pool to provide liquidity. | ||
/// @param _amounts An array containing the amounts of tokens to be allocated. | ||
/// @param _minMintAmt An array specifying the minimum minting amounts for each token. | ||
function allocate(uint256[2] calldata _amounts, uint256[2] calldata _minMintAmt) external onlyOwner nonReentrant { |
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.
Calculate minMintAmt inside the function rather than accepting it.
Make use of depositSlippage
minAmount = amount - amount * depositSlippage / Helpers.MAX_PERCENTAGE;
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.
Yeah makes sense. We can do this.
/// @notice Redeems a specified amount of liquidity from the Uniswap V3 pool. | ||
/// @param _liquidity The amount of liquidity to redeem. | ||
/// @param _minBurnAmt An array specifying the minimum burn amounts for each token. | ||
function redeem(uint256 _liquidity, uint256[2] calldata _minBurnAmt) external onlyOwner nonReentrant { |
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.
variable name _minBurnAmt is not relevant with it's actual meaning. Consider renaming it with _minAmountOut
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.
Fixed in e353a38
} | ||
|
||
/// @inheritdoc InitializableAbstractStrategy | ||
/// @dev Calls checkBalance internally as the Uniswap V3 pools does not lock the deposited assets. |
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.
Does not call checkBalance internally, kindly update the doc
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.
Fixed in 48ad03c
getAmountsForLiquidity function.
|
||
/// @notice Redeems a specified amount of liquidity from the Uniswap V3 pool. | ||
/// @param _liquidity The amount of liquidity to redeem. | ||
/// @param _minAmountOut An array specifying the minimum burn amounts for each token. |
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.
Update code doc, it still refers to burn amounts
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.
Fixed in 48ad03c
This file has some TODO text, please do not merge yet. I will remove the TODOs after the review. |
I have added TODO in places that require higher focus for review. I will remove them ASAP.