How to Withdraw

Chain abstracted withdrawing has slightly different behaviors compared to a typical withdraw. In the case that there is an issue, whether due to the bridge, there are excess tokens, or invalid parameters were supplied, when bridging the asset from Pool Chain (Arbitrum) to another chain there are a few things to note:

  • The default behavior is that unbridged assets are supplied to the pool on behalf of onBehalfOf. Allows for the user to withdraw the asset on any chain in another transaction.

  • transferExtraAssets is an option to allow for transferring the unbridged assets to onBehalfOf on Arbitrum instead of doing the default behavior above.

Withdrawing Security

To minimize smart contract risk when Replete withdraws assets on behalf of users, Replete utilizes permit signatures. This means all withdrawing functions will have an extra parameter called permitSignature allowing Replete to withdraw a particular asset on behalf of the user via the permit function, up to the allowance provided. This is because the caller for withdraw() will be BridgeReceiver on Arbitrum. Essentially, you are delegating token approval to the BridgeReceiver contract.

The following function is called on the particular rToken:

function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s)

It is also fine to not provide a valid permitSignature (set it as empty bytes), as long as BridgeReceiver has enough allowance with the rToken. This can be achieved through calling approve() on the rToken on Arbitrum.

Native Asset

The native asset on Pool Chain is ETH. To withdraw ETH from any chain set asset as BridgeReceiver.ETH_ADDRESS(). You can still withdraw even if ETH is not the native token of the chain, for example you can still withdraw ETH from Avalanche even though the native token is AVAX, as long as there is a bridge route for ETH from Pool Chain to Avalanche.

Any Chain to Pool Chain

You can withdraw any supported asset, assuming you have sufficient collateral, across any chain through Replete.

Interface

Example

Any Chain to Any Chain

Currently, Replete is configured to work with either Stargate or LayerZero to allow bridging support for multiple assets. Withdraw the Replete way.

Interface

Stargate v1

Stargate v2

LayerZero

Example

Stargate v1

Stargate v2

LayerZero

Last updated

Was this helpful?