Pool

A pool is a regular Stargate liquidity pool where e.g. USDC will be deposited. Liquidity from these pools is later used to enable cross chain swaps of the same asset.

Deposit

function deposit(
    address _receiver,
    uint256 _amountLD
) external payable nonReentrantAndNotPaused returns (uint256 amountLD)

Withdraw

There are two ways you can withdraw your tokens from the liquidity pool. The first is a standard function which returns the pool's underlying token in exchange for the liquidity token on the same chain the method is called:

function redeem(
    uint256 _amountLD,
    address _receiver
) external nonReentrantAndNotPaused returns (uint256 amountLD)

The second function also allows for redeeming the underlying token, but it also sends it to the destination chain that user wants. This function can only be used in taxi mode. Here's a signature of the function:

function redeemSend(
    SendParam calldata _sendParam,
    MessagingFee calldata _fee,
    address _refundAddress
) external payable nonReentrantAndNotPaused
    returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt)

Credits

Redeeming liquidity tokens for underlying pool tokens, e.g., LP to USDC, may in some cases be limited by the credits available on the particular chain you want to redeem on. For the redeem() function to successfully process, an adequate number of credits must be available on the local blockchain where the redeem transaction is initiated. If you call redeemSend() enough credits need to be available on the destination chain. You can read more about Credits.

Composability

Because redeemSend() is using the LayerZero protocol to send the message to the destination chain - it is also composable. You can read more about Composability.

Code

The code for the ERC20 token pool lives in StargatePool.sol and is using StargatePoolNative.solfor the native token.

When you call stargateType() method from the IStargate interface on the Pool asset it will return:

StargateType.Pool

Last updated