How to Borrow

Chain abstracted borrowing has slightly different behaviors compared to a typical borrow. 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.

Borrowing Security

To minimize smart contract risk when Replete borrows assets on behalf of users, Replete utilizes credit delegation signatures. This means all borrowing functions will have an extra parameter called delegationData which contain an EIP712 signature allowing Replete to borrow a particular debt token on behalf of the user via the delegation function, up to the allowance provided. This is because the caller for borrow() will be BridgeReceiver on Arbitrum. Essentially, you are delegating credit to the BridgeReceiver contract.

The following function is called on the particular debt token:

function delegationWithSig(address delegator, address delegatee, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)

It is also fine to not provide a valid delegationData (set it as empty bytes), as long as BridgeReceiver has enough allowance with the debt token. This can be achieved either through calling approveDelegation(), or calling delegationWithSig() on the debt token on Arbitrum.

Read more about credit delegation here.

Native Asset

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

Any Chain to Pool Chain

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

Interface

Example

Any to Any Chain

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

Interface

Stargate v1

Stargate v2

LayerZero

Example

Stargate v1

Stargate v2

LayerZero

Last updated

Was this helpful?