Open sherlock-admin opened 11 months ago
It should be noted that none of the pools are available on Convex either: https://www.convexfinance.com/stake
Furthermore, the Convex vault is only explicitly written for 2 token vaults, which the ones auditor listed are not. So therefore they could not be listed as structured Arbitrum in any case. I would range this as a medium severity, if anything.
xiaoming90
high
Leverage Vault on sidechains that support Curve V2 pools is broken
Summary
No users will be able to deposit to the Leverage Vault on Arbitrum and Optimism that supports Curve V2 pools, leading to the core contract functionality of a vault being broken and a loss of revenue for the protocol.
Vulnerability Detail
Following are examples of some Curve V2 pools in Arbitum:
The code from Line 64 to Line 71 is only executed if the contract resides on Ethereum. As a result, for Arbitrum and Optimism sidechains, the
IS_CURVE_V2
variable is always false.https://github.com/sherlock-audit/2023-10-notional/blob/main/leveraged-vaults/contracts/vaults/curve/Curve2TokenPoolMixin.sol#L73
As a result, code within the
_joinPoolAndStake
function will always call the Curve V1'sadd_liquidity
function that does not define theuse_eth
parameter.https://github.com/sherlock-audit/2023-10-notional/blob/main/leveraged-vaults/contracts/vaults/Curve2TokenConvexVault.sol#L51
If the
use_eth
parameter is not defined, it will default toFalse
. As a result, the Curve pool expects the caller to transfer over the WETH to the pool and the pool will callWETH.withdraw
to unwrap the WETH to Native ETH as shown in the code below.However, Notional's leverage vault only works with Native ETH, and if one of the pool tokens is WETH, it will explicitly convert the address to either the
Deployments.ALT_ETH_ADDRESS
(0xEeeee) orDeployments.ETH_ADDRESS
(address(0)) during deployment and initialization.The implementation of the above
_joinPoolAndStake
function will forward Native ETH to the Curve Pool, while the pool expects the vault to transfer in WETH. As a result, a revert will occur since the pool did not receive the WETH it required during the unwrap process.https://arbiscan.io/address/0xf7fed8ae0c5b78c19aadd68b700696933b0cefd9#code#L509 (Taken from Curve V2 fETH/ETH/xETH pool)
Impact
No users will be able to deposit to the Leverage Vault on Arbitrum and Optimism that supports Curve V2 pools. The deposit function is a core function of any vault. Thus, this issue breaks the core contract functionality of a vault.
In addition, if the affected vaults cannot be used, it leads to a loss of revenue for the protocol.
Code Snippet
https://github.com/sherlock-audit/2023-10-notional/blob/main/leveraged-vaults/contracts/vaults/curve/Curve2TokenPoolMixin.sol#L73
https://github.com/sherlock-audit/2023-10-notional/blob/main/leveraged-vaults/contracts/vaults/Curve2TokenConvexVault.sol#L51
Tool used
Manual Review
Recommendation
Ensure the
IS_CURVE_V2
variable is initialized on the Arbitrum and Optimism side chains according to the Curve Pool's version.If there is a limitation on the existing approach to determining a pool is V1 or V2 on Arbitrum and Optimsim, an alternative approach might be to use the presence of a
gamma()
function as an indicator of pool type