> For the complete documentation index, see [llms.txt](https://docs.replete.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.replete.fi/developers/how-to-supply.md).

# How to Supply

{% hint style="danger" %}
When supplying take care to input the correct data. Make sure you are supplying to a wallet you can control on Pool Chain (Arbitrum).
{% endhint %}

You can supply any supported asset and earn interest across any chain through Replete by interacting with [RepletePool](/contracts/repletepool.md) . After supplying collateral, you are able to create borrow positions with supported assets or withdraw to a different chain.

{% hint style="warning" %}
The provided `onBehalfOf` will receive [rTokens](https://docs.aave.com/developers/tokens/atoken) on Pool Chain and requires no user interaction.
{% endhint %}

### From Any Chain

{% hint style="warning" %}
When supplying, ensure the [RepletePool](/contracts/repletepool.md) contract has enough allowance to spend funds on behalf of `msg.sender` for the amount being supplied.
{% endhint %}

To supply native token (if supported) through [RepletePool](/contracts/repletepool.md), set the `asset` parameter as `RepletePool.ETH_ADDRESS()` and set `amount` as the intended supply amount. Ensure that `msg.value` covers the bridge transfer fee too. `msg.value` should equal `amount` + `bridgeFee`.

If supplying native is not supported, the function will revert with error `Replete_UnsupportedAsset(address asset)`

#### Interface

#### Stargate v1

{% code fullWidth="true" %}

```solidity
 /**
  * @notice Supplies an `amount` of `asset` into the reserve, receiving in return overlying rTokens.
  * - E.g. User supplies 100 USDC and gets in return 100 rUSDC
  * @dev Ensure that this contract has enough allowance to spend `asset` locally
  * @param asset The local underlying asset to supply
  * @param amount The amount to be supplied in local asset decimals
  * @param onBehalfOf The address that will receive the rTokens on Pool Chain.
  *  Even if you will not transact on Pool Chain, it is recommended to set this
  *  to an address you can control.
  * @param referralCode Referral code for integrators -- can safely set to 0
  * @param stgParams Stargate v1 related bridge parameters
  */
function supply(
   address asset,
   uint256 amount,
   address onBehalfOf,
   uint16 referralCode,
   StargateSupplyParams calldata stgParams
) external payable;
```

{% endcode %}

#### Stargate v2

{% code fullWidth="true" %}

```solidity
 /**
  * @notice Supplies an `amount` of `asset` into the reserve, receiving in return overlying rTokens.
  * - E.g. User supplies 100 USDC and gets in return 100 rUSDC
  * @dev Ensure that this contract has enough allowance to spend `asset` locally
  * @param asset The local underlying asset to supply
  * @param amount The amount to be supplied in local asset decimals
  * @param onBehalfOf The address that will receive the rTokens on Pool Chain.
  *  Even if you will not transact on Pool Chain, it is recommended to set this
  *  to an address you can control.
  * @param referralCode Referral code for integrators -- can safely set to 0
  * @param stgParams Stargate v2 related bridge parameters
  */
 function supply(
     address asset,
     uint256 amount,
     address onBehalfOf,
     uint16 referralCode,
     StargateV2SupplyParams calldata stgParams
 ) external payable returns (Ticket memory);
```

{% endcode %}

#### Example

#### Stargate v1

{% code fullWidth="true" %}

```solidity
RepletePool.supply{value: bridgeFee}({
    asset: address(DAI),                           // local chain DAI address
    amount: 1337 * 1e18,                           // supply 1337 DAI
    onBehalfOf: msg.sender,                        // who is this supply for
    referralCode: 0,                               // referral code; you can safely set to 0
    stgParams: StargateSupplyParams({              // ~~ Stargate v1 related parameters ~~
        dstGasForCall: 500_000,                    // 500k gas for the destination tx
        dstNativeAmount: 0,                        // native gas airdrop in the destination tx
        dstNativeAddr: RepletePool.destAddress(),  // {BridgeReceiver} address on Pool Chain
        srcPoolId: srcPoolId,                      // source Stargate v1 pool ID
        dstPoolId: dstPoolId,                      // destination Stargate v1 pool ID
        refundAddress: payable(msg.sender),        // refund address
        minAmountLD: 1337 * 1e18                   // set max slippage amount
    })
});
```

{% endcode %}

#### Stargate v2

{% code fullWidth="true" %}

```solidity
RepletePool.supply{value: bridgeFee}({
    asset: address(DAI),                     // local chain DAI address
    amount: 1337 * 1e18,                     // supply 1337 DAI
    onBehalfOf: msg.sender,                  // who is this supply for
    referralCode: 0,                         // referral code; you can safely set to 0
    stgParams: StargateV2SupplyParams({      // ~~ Stargate v2 related parameters ~~
        router: stargateDAIPool,             // Stargate v2 DAI pool address
        extraOptions: extraOptions,          // LZv2 composed message execution options
        oftCmd: "",                          // unused for Stargate taxi transactions 
        refundAddress: payable(msg.sender),  // refund address
        minAmountLD: 1337 * 1e18             // set max slippage amount  
    })
});
```

{% endcode %}
