singleLiquidityWrapper.sol

Primary Uses - Unique to uTrade, the Single Liquidity Wrapper allows BTT or any BRC-20 token on BTT to converted into a LP pool. For example, USDT can be added using the wrapper to supply liquidity for a USDT.t / WBTT 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

function convertSingleAssetToLiquidity(address tokenA, address requireToken, uint amount, address to, uint minOut) external ;

The convertSingleAssetToLiquidityfunction 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

function convertSingleAssetToLiquidityEth(address requireToken, address to, uint minOut) payable external ;

The convertSingleAssetToLiquidityETHfunction converts BTT into a LP token. It does so by first converting the provided BTT 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 BTT value is sent as a msg.value parameter. One of the two assets can be WBTT.

Parameter Breakdown

convertSingleAssetToOtherLiquidity

function convertSingleAssetToOtherLiquidity(address depositToken, address requireTokenA,address requireTokenB , uint amount , address to, address[] calldata path1, address[] calldata path2,uint minOut) external ;

The convertSingleAssetToOtherLiquidityfunction converts any BRC-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

function convertSingleAssetToOtherLiquidityETH( address requireTokenA,address requireTokenB  , address to, address[] calldata path1, address[] calldata path2,uint minOut) payable external ;

The convertSingleAssetToOtherLiquidityETHfunction converts BTT to an uTrade V2 LP token made up of two different tokens. In other words, BTT 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

function withdrawSupplyAsSingleAsset( address receiveToken , address liquidityToken ,address tokenA,address tokenB, address payable to, uint amount, bool toReceiveWNative,uint minOut) external ;

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

function withdrawSupplyAsOtherSingleAsset(address receiveToken, address liquidityToken, address tokenA, address tokenB, address payable to, uint amount, address[] calldata path1, address[] calldata path2, bool toReceiveWNative, uint minOut) external ;

The withdrawSupplyAsOtherSingleAssetfunction 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 BTT or any BRC-20 token available.

Parameter Breakdown

Interface Code

interface IUnifiSingleLiquidity {
    function convertSingleAssetToLiquidity(address tokenA, address requireToken, uint amount, address to, uint minOut) external ;
    function convertSingleAssetToLiquidityEth(address requireToken, address to, uint minOut) payable external ;
    function convertSingleAssetToOtherLiquidity(address depositToken, address requireTokenA, address requireTokenB, uint amount, address to, address[] calldata path1, address[] calldata path2, uint minOut) external ;
    function convertSingleAssetToOtherLiquidityETH(address requireTokenA, address requireTokenB, address to, address[] calldata path1, address[] calldata path2, uint minOut) payable external ;
    function withdrawSupplyAsSingleAsset(address receiveToken, address liquidityToken, address tokenA, address tokenB, address payable to, uint amount, bool toReceiveWNative, uint minOut) external ;
    function withdrawSupplyAsOtherSingleAsset(address receiveToken, address liquidityToken, address tokenA, address tokenB, address payable to, uint amount, address[] calldata path1, address[] calldata path2, bool toReceiveWNative, uint minOut) external ;
}

Last updated