Jongseung Lim (@weeb_mcgee)
SwapEthWrapper
A wrapper contract for Swap contracts that have WETH as one of the pooled tokens.
Methods
LP_TOKEN
Copy function LP_TOKEN () external view returns (contract LPToken )
Returns
OWNER
Copy function OWNER () external view returns ( address )
Returns
SWAP
Copy function SWAP () external view returns (contract Swap )
Returns
WETH_ADDRESS
Copy function WETH_ADDRESS () external view returns ( address payable)
Returns
WETH_INDEX
Copy function WETH_INDEX () external view returns ( uint8 )
Returns
addLiquidity
Copy function addLiquidity ( uint256 [] amounts , uint256 minToMint , uint256 deadline) external payable returns ( uint256 )
Add liquidity to the pool with the given amounts of tokens.
The msg.value of this call should match the value in amounts array in position of WETH9.
Parameters
Returns
calculateRemoveLiquidity
Copy function calculateRemoveLiquidity ( uint256 amount) external view returns ( uint256 [])
A simple method to calculate amount of each underlying tokens that is returned upon burning given amount of LP tokens
Parameters
Returns
calculateRemoveLiquidityOneToken
Copy function calculateRemoveLiquidityOneToken(uint256 tokenAmount, uint8 tokenIndex) external view returns (uint256 availableTokenAmount)
Calculate the amount of underlying token available to withdraw when withdrawing via only single token
Parameters
Returns
calculateTokenAmount
Copy function calculateTokenAmount ( uint256 [] amounts , bool deposit) external view returns ( uint256 )
A simple method to calculate prices from deposits or withdrawals, excluding fees but including slippage. This is helpful as an input into the various "min" parameters on calls to fight front-running
This shouldn't be used outside frontends for user estimates.
Parameters
Returns
pooledTokens
Copy function pooledTokens ( uint256 ) external view returns (contract IERC20 )
Parameters
Returns
removeLiquidity
Copy function removeLiquidity(uint256 amount, uint256[] minAmounts, uint256 deadline) external nonpayable returns (uint256[])
Burn LP tokens to remove liquidity from the pool.
Liquidity can always be removed, even when the pool is paused. Caller will receive ETH instead of WETH9.
Parameters
Returns
removeLiquidityImbalance
Copy function removeLiquidityImbalance(uint256[] amounts, uint256 maxBurnAmount, uint256 deadline) external nonpayable returns (uint256)
Remove liquidity from the pool, weighted differently than the pool's current balances.
Caller will receive ETH instead of WETH9.
Parameters
Returns
removeLiquidityOneToken
Copy function removeLiquidityOneToken(uint256 tokenAmount, uint8 tokenIndex, uint256 minAmount, uint256 deadline) external nonpayable returns (uint256)
Remove liquidity from the pool all in one token.
Caller will receive ETH instead of WETH9.
Parameters
Returns
rescue
Copy function rescue () external nonpayable
Rescues any of the ETH, the pooled tokens, or the LPToken that may be stuck in this contract. Only the OWNER can call this function.
swap
Copy function swap(uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 dx, uint256 minDy, uint256 deadline) external payable returns (uint256)
Swap two tokens using the underlying pool. If tokenIndexFrom represents WETH9 in the pool, the caller must set msg.value equal to dx. If the user is swapping to WETH9 in the pool, the user will receive ETH instead.
Parameters
Returns