AaveSwapWrapper
A wrapper contract for interacting with aTokens
Methods
LENDING_POOL
Copy function LENDING_POOL () external view returns (contract ILendingPool )
Returns
LP_TOKEN
Copy function LP_TOKEN () external view returns (contract LPToken )
Returns
OWNER
Copy function OWNER () external view returns ( address )
Returns
POOLED_TOKENS
Copy function POOLED_TOKENS ( uint256 ) external view returns (contract IERC20 )
Parameters
Returns
SWAP
Copy function SWAP () external view returns (contract Swap )
Returns
UNDERLYING_TOKENS
Copy function UNDERLYING_TOKENS ( uint256 ) external view returns (contract IERC20 )
Parameters
Returns
addLiquidity
Copy function addLiquidity ( uint256 [] amounts , uint256 minToMint , uint256 deadline) external nonpayable returns ( uint256 )
Add liquidity to the pool with the given amounts of tokens.
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
calculateSwap
Copy function calculateSwap ( uint8 tokenIndexFrom , uint8 tokenIndexTo , uint256 dx) external view returns ( uint256 )
Calculate amount of tokens you receive on swap
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
getToken
Copy function getToken ( uint8 index) external view returns (contract IERC20 )
Return address of the pooled token at given index. Reverts if tokenIndex is out of range.
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
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 nonpayable 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