When supplying take care to input the correct data. Make sure you are supplying to a wallet you can control on Pool Chain (Arbitrum).
You can supply any supported asset and earn interest across any chain through Replete by interacting with RepletePool . After supplying collateral, you are able to create borrow positions with supported assets or withdraw to a different chain.
The provided onBehalfOf will receive rTokens on Pool Chain and requires no user interaction.
From Any Chain
When supplying, ensure the RepletePool contract has enough allowance to spend funds on behalf of msg.sender for the amount being supplied.
To supply native token (if supported) through RepletePool, 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
/** * @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 */functionsupply(address asset,uint256 amount,address onBehalfOf,uint16 referralCode,StargateSupplyParamscalldata stgParams) externalpayable;
Stargate v2
/** * @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 */functionsupply(address asset,uint256 amount,address onBehalfOf,uint16 referralCode,StargateV2SupplyParamscalldata stgParams ) externalpayablereturns (Ticketmemory);
Example
Stargate v1
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 })});
Stargate v2
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 })});