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

Using wrappedToken in CompositeLiquidityRouter in ERC4626Pool operations #1201

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1ca2458
fist iteration
elshan-eth Dec 24, 2024
757545a
fix code and tests
elshan-eth Jan 7, 2025
9dbf7fc
change var name
elshan-eth Jan 8, 2025
4b39b72
refactoring prepareTokens
elshan-eth Jan 9, 2025
f6bcd4e
fixes
elshan-eth Jan 10, 2025
413315d
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
c441933
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
164cdae
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
6d7f538
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
c4a2662
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
6b1c8db
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
b0eeb6e
Update pkg/vault/contracts/CompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
6008eca
Update pkg/vault/contracts/CompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
06ab630
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
9fe3242
Update pkg/vault/contracts/CompositeLiquidityRouter.sol
elshan-eth Jan 13, 2025
acac9ec
small fixes
elshan-eth Jan 13, 2025
8a876c8
Merge branch 'using-wrapped-amount-in-erc4626-operations-in-clr' of h…
elshan-eth Jan 13, 2025
cf43702
fixes
elshan-eth Jan 13, 2025
af63d70
update snapshots
elshan-eth Jan 13, 2025
8ca5aa6
small fixes
elshan-eth Jan 14, 2025
537f45f
small fixes
elshan-eth Jan 14, 2025
7119580
Update pkg/vault/contracts/CompositeLiquidityRouter.sol
elshan-eth Jan 17, 2025
7828184
Update pkg/vault/contracts/CompositeLiquidityRouter.sol
elshan-eth Jan 17, 2025
853d161
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 17, 2025
af362c2
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 17, 2025
fafa55e
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 17, 2025
e54e485
Update pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
elshan-eth Jan 17, 2025
21c8a88
fix comments
elshan-eth Jan 17, 2025
9f07b85
Merge branch 'using-wrapped-amount-in-erc4626-operations-in-clr' of h…
elshan-eth Jan 17, 2025
2a58957
fix tests
elshan-eth Jan 17, 2025
0748090
add rest tests
elshan-eth Jan 17, 2025
c5fc0e3
Merge branch 'main' into using-wrapped-amount-in-erc4626-operations-i…
elshan-eth Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 29 additions & 32 deletions pkg/interfaces/contracts/vault/ICompositeLiquidityRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,73 +24,71 @@ interface ICompositeLiquidityRouter {
***************************************************************************/

/**
* @notice Add arbitrary amounts of underlying tokens to an ERC4626 pool through the buffer.
* @notice Add arbitrary amounts of tokens to an ERC4626 pool through the buffer.
* @dev An "ERC4626 pool" contains IERC4626 yield-bearing tokens (e.g., waDAI). Ensure that any buffers associated
* with the wrapped tokens in the ERC4626 pool have been initialized before initializing or adding liquidity to
* the "parent" pool, and also make sure limits are set properly.
*
* @param pool Address of the liquidity pool
* @param useAsStandardToken An array indicating whether to use the token as standard or wrap it,
* sorted in token registration order of wrapped tokens in the pool
* @param wrapUnderlying Flags indicating whether the corresponding token should be wrapped or
* use as a standard ERC20
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* use as a standard ERC20
* used as a standard ERC20

* @param exactAmountsIn Exact amounts of underlying/wrapped tokens in, sorted in token registration order
* wrapped tokens in the pool
* @param minBptAmountOut Minimum amount of pool tokens to be received
* @param wethIsEth If true, incoming ETH will be wrapped to WETH and outgoing WETH will be unwrapped to ETH
* @param userData Additional (optional) data required for adding liquidity
* @return bptAmountOut Actual amount of pool tokens received
*/
function addLiquidityUnbalancedToERC4626Pool(
address pool,
bool[] memory useAsStandardToken,
bool[] memory wrapUnderlying,
uint256[] memory exactAmountsIn,
uint256 minBptAmountOut,
bool wethIsEth,
bytes memory userData
) external payable returns (uint256 bptAmountOut);

/**
* @notice Add proportional amounts of underlying tokens to an ERC4626 pool through the buffer.
* @notice Add proportional amounts of tokens to an ERC4626 pool through the buffer.
* @dev An "ERC4626 pool" contains IERC4626 yield-bearing tokens (e.g., waDAI). Ensure that any buffers associated
* with the wrapped tokens in the ERC4626 pool have been initialized before initializing or adding liquidity to
* the "parent" pool, and also make sure limits are set properly.
*
* @param pool Address of the liquidity pool
* @param useAsStandardToken An array indicating whether to use the token as standard or wrap it,
* sorted in token registration order of wrapped tokens in the pool
* @param wrapUnderlying Flags indicating whether the corresponding token should be wrapped or
* use as a standard ERC20
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* use as a standard ERC20
* used as a standard ERC20

* @param maxAmountsIn Maximum amounts of underlying/wrapped tokens in, sorted in token registration order
* wrapped tokens in the pool
* @param exactBptAmountOut Exact amount of pool tokens to be received
* @param wethIsEth If true, incoming ETH will be wrapped to WETH and outgoing WETH will be unwrapped to ETH
* @param userData Additional (optional) data required for adding liquidity
* @return tokensIn Actual tokens added in the pool
* @return amountsIn Actual amounts of tokens added in the pool
* @return tokensIn Actual tokens added to the pool
* @return amountsIn Actual amounts of tokens added to the pool
*/
function addLiquidityProportionalToERC4626Pool(
address pool,
bool[] memory useAsStandardToken,
bool[] memory wrapUnderlying,
uint256[] memory maxAmountsIn,
uint256 exactBptAmountOut,
bool wethIsEth,
bytes memory userData
) external payable returns (address[] memory tokensIn, uint256[] memory amountsIn);

/**
* @notice Remove proportional amounts of underlying from an ERC4626 pool, burning an exact pool token amount.
* @notice Remove proportional amounts of tokens from an ERC4626 pool, burning an exact pool token amount.
* @dev An "ERC4626 pool" contains IERC4626 yield-bearing tokens (e.g., waDAI).
* @param pool Address of the liquidity pool
* @param useAsStandardToken An array indicating whether to use the token as standard or unwrap it,
* sorted in token registration order of wrapped tokens in the pool
* @param unwrapWrapper Flags indicating whether the corresponding token should be unwrapped or
* use as a standard ERC20
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* use as a standard ERC20
* used as a standard ERC20

* @param exactBptAmountIn Exact amount of pool tokens provided
* @param minAmountsOut Minimum amounts of each token, sorted according to tokensIn array
* wrapped tokens in the pool
* @param minAmountsOut Minimum amounts of each token, corresponding to `tokensOut`
* @param wethIsEth If true, incoming ETH will be wrapped to WETH and outgoing WETH will be unwrapped to ETH
* @param userData Additional (optional) data required for removing liquidity
* @return tokensOut Actual tokens received
* @return amountsOut Actual amounts of tokens received
*/
function removeLiquidityProportionalFromERC4626Pool(
address pool,
bool[] memory useAsStandardToken,
bool[] memory unwrapWrapper,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
bool[] memory unwrapWrapper,
bool[] memory unwrapWrapped,

If we're saying "wrapped" and "underlying," this should be unwrapWrapped

uint256 exactBptAmountIn,
uint256[] memory minAmountsOut,
bool wethIsEth,
Expand All @@ -101,17 +99,16 @@ interface ICompositeLiquidityRouter {
* @notice Queries an `addLiquidityUnbalancedToERC4626Pool` operation without actually executing it.
* @dev An "ERC4626 pool" contains IERC4626 yield-bearing tokens (e.g., waDAI).
* @param pool Address of the liquidity pool
* @param useAsStandardToken An array indicating whether to use the token as standard or wrap it,
* sorted in token registration order of wrapped tokens in the pool
* @param wrapUnderlying Flags indicating whether the corresponding token should be wrapped or
* use as a standard ERC20
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* use as a standard ERC20
* used as a standard ERC20

* @param exactAmountsIn Exact amounts of underlying/wrapped tokens in, sorted in token registration order
* wrapped tokens in the pool
* @param sender The sender passed to the operation. It can influence results (e.g., with user-dependent hooks)
* @param userData Additional (optional) data required for the query
* @return bptAmountOut Expected amount of pool tokens to receive
*/
function queryAddLiquidityUnbalancedToERC4626Pool(
address pool,
bool[] memory useAsStandardToken,
bool[] memory wrapUnderlying,
uint256[] memory exactAmountsIn,
address sender,
bytes memory userData
Expand All @@ -121,17 +118,17 @@ interface ICompositeLiquidityRouter {
* @notice Queries an `addLiquidityProportionalToERC4626Pool` operation without actually executing it.
* @dev An "ERC4626 pool" contains IERC4626 yield-bearing tokens (e.g., waDAI).
* @param pool Address of the liquidity pool
* @param useAsStandardToken An array indicating whether to use the token as standard or wrap/unwrap it,
* sorted in token registration order of wrapped tokens in the pool
* @param wrapUnderlying Flags indicating whether the corresponding token should be wrapped or
* use as a standard ERC20
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* use as a standard ERC20
* used as a standard ERC20

* @param exactBptAmountOut Exact amount of pool tokens to be received
* @param sender The sender passed to the operation. It can influence results (e.g., with user-dependent hooks)
* @param userData Additional (optional) data required for the query
* @return tokensIn Expected tokens added in the pool
* @return amountsIn Expected amounts of tokens added in the pool
* @return tokensIn Expected tokens added to the pool
* @return amountsIn Expected amounts of tokens added to the pool
*/
function queryAddLiquidityProportionalToERC4626Pool(
address pool,
bool[] memory useAsStandardToken,
bool[] memory wrapUnderlying,
uint256 exactBptAmountOut,
address sender,
bytes memory userData
Expand All @@ -141,8 +138,8 @@ interface ICompositeLiquidityRouter {
* @notice Queries a `removeLiquidityProportionalFromERC4626Pool` operation without actually executing it.
* @dev An "ERC4626 pool" contains IERC4626 yield-bearing tokens (e.g., waDAI).
* @param pool Address of the liquidity pool
* @param useAsStandardToken An array indicating whether to use the token as standard or unwrap it,
* sorted in token registration order of wrapped tokens in the pool
* @param unwrapWrapper Flags indicating whether the corresponding token should be unwrapped or
* use as a standard ERC20
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* use as a standard ERC20
* used as a standard ERC20

* @param exactBptAmountIn Exact amount of pool tokens provided for the query
* @param sender The sender passed to the operation. It can influence results (e.g., with user-dependent hooks)
* @param userData Additional (optional) data required for the query
Expand All @@ -151,7 +148,7 @@ interface ICompositeLiquidityRouter {
*/
function queryRemoveLiquidityProportionalFromERC4626Pool(
address pool,
bool[] memory useAsStandardToken,
bool[] memory unwrapWrapper,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
bool[] memory unwrapWrapper,
bool[] memory unwrapWrapped,

uint256 exactBptAmountIn,
address sender,
bytes memory userData
Expand All @@ -170,7 +167,7 @@ interface ICompositeLiquidityRouter {
* @param parentPool Address of the highest level pool (which contains BPTs of other pools)
* @param tokensIn Input token addresses, sorted by user preference. `tokensIn` array must have all tokens from
* child pools and all tokens that are not BPTs from the nested pool (parent pool).
* @param exactAmountsIn Amount of each token in, sorted according to tokensIn array
* @param exactAmountsIn Amount of each token in, corresponding to `tokensIn`
* @param minBptAmountOut Expected minimum amount of parent pool tokens to receive
* @param wethIsEth If true, incoming ETH will be wrapped to WETH and outgoing WETH will be unwrapped to ETH
* @param userData Additional (optional) data required for the operation
Expand All @@ -190,7 +187,7 @@ interface ICompositeLiquidityRouter {
* @param parentPool Address of the highest level pool (which contains BPTs of other pools)
* @param tokensIn Input token addresses, sorted by user preference. `tokensIn` array must have all tokens from
* child pools and all tokens that are not BPTs from the nested pool (parent pool).
* @param exactAmountsIn Amount of each token in, sorted according to tokensIn array
* @param exactAmountsIn Amount of each token in, corresponding to `tokensIn`
* @param sender The sender passed to the operation. It can influence results (e.g., with user-dependent hooks)
* @param userData Additional (optional) data required for the operation
* @return bptAmountOut Expected amount of parent pool tokens to receive
Expand All @@ -214,7 +211,7 @@ interface ICompositeLiquidityRouter {
* @param tokensOut Output token addresses, sorted by user preference. `tokensOut` array must have all tokens from
* child pools and all tokens that are not BPTs from the nested pool (parent pool). If not all tokens are informed,
* balances are not settled and the operation reverts. Tokens that repeat must be informed only once.
* @param minAmountsOut Minimum amounts of each token, sorted according to tokensIn array
* @param minAmountsOut Minimum amounts of each outgoing token, corresponding to `tokensOut`
* @param wethIsEth If true, incoming ETH will be wrapped to WETH and outgoing WETH will be unwrapped to ETH
* @param userData Additional (optional) data required for the operation
* @return amountsOut Actual amounts of tokens received, parallel to `tokensOut`
elshan-eth marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading
Loading