singleLiquidityWrapper.sol
Primary Uses - Unique to uTrade, the Single Liquidity Wrapper allows ETH or any ERC-20 token to converted into a LP pool. For example, USDT can be added using the wrapper to supply liquidity for a BUSD / WETH pair. The wrapper allows LP tokens to exit in a similar fashion. The functionality from this wrapper simplifies applications such as compounding or fee-on-transfer additions to liquidity pools.
uTrade V2 Single Liquidity Wrapper Code / Interfaces
uTrade V2 Single Liquidity Wrapper Contract Addresses
convertSingleAssetToLiquidity
The convertSingleAssetToLiquidity
function converts one of the assets that a liquidity pool contains into a LP token. It does so by first converting the exact amount of one token required for an equal amount of the other asset that makes up the pool. Next, the two equal values of tokens are added to the liquidity pool. And lastly, the LP tokens are sent to the address provided.
convertSingleAssetToLiquidityEth
The convertSingleAssetToLiquidityETH
function converts ETH into a LP token. It does so by first converting the provided ETH into equal amounts of the two tokens that make up the liquidity pool. Next, the two equal values of tokens are added to the liquidity pool. And lastly, the LP tokens are sent to the address provided. The ETH value is sent as a msg.value parameter. One of the two assets can be WETH.
Parameter Breakdown
convertSingleAssetToOtherLiquidity
The convertSingleAssetToOtherLiquidity
function converts any ERC-20 token available on uTrade V2 to a uTrade V2 LP token made up of two different tokens. In other words, a token that is not included in a liquidity pair will be converted to the two tokens that do make up the liquidity pair, and added to the liquidity pool.
convertSingleAssetToOtherLiquidityETH
The convertSingleAssetToOtherLiquidityETH
function converts ETH to an uTrade V2 LP token made up of two different tokens. In other words, ETH will be converted to the two tokens that make up a liquidity pair, and then the two tokens are added to the liquidity pool.
withdrawSupplyAsSingleAsset
The withdrawSupplyAsSingleAsset
function withdraws a user's liquidity from a pool, and converts it to one of the two tokens that makes up the liquidity pool. In other words, it redeems an LP token for one of the two assets that make up an LP token.
Parameter Breakdown
withdrawSupplyAsOtherSingleAsset
The withdrawSupplyAsOtherSingleAsset
function withdraws a user's liquidity from a pool, and converts it to any other asset that is available on uTrade V2. In other words, it redeems an LP token for ETH or any ERC-20 token available.
Parameter Breakdown
Interface Code
Last updated