# 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

{% code fullWidth="true" %}

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

{% endcode %}

## 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:

{% code fullWidth="true" %}

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

{% endcode %}

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:

{% code fullWidth="true" %}

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

{% endcode %}

### 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](https://stargateprotocol.gitbook.io/stargate/v2-developer-docs/integrate-with-stargate/credit-allocation-system).

### 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](https://stargateprotocol.gitbook.io/stargate/v2-developer-docs/integrate-with-stargate/composability).

## Code

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

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

{% code fullWidth="true" %}

```solidity
StargateType.Pool
```

{% endcode %}
