Across+ Integration

Product Description

Across+ is a bridge abstraction framework. A developer can use Across+ in their dApp to bundle bridging and protocol actions in the same transaction, abstracting it away from the user. This can be used to promote user onboarding and defragment user liquidity across chains.

Instead of users independently bridging assets to chains to use applications, Across+ enables your application to meet the user where they already are.

At a high level, Across+ works through the following process:

  • End-user (or intermediate contract) includes a message field in the deposit transaction.

  • To be repaid for the fill, the relayer is required to include the same message field in their fill.

  • When this message field is non-empty and the recipient is a contract, the SpokePool calls a special handler function on the recipient contract with the message (and a few other fields).

  • This function can do anything, meaning application-specific actions can be executed atomically.

Integrating Across+ into Your Application

This guide contains instructions and examples for calling the smart contract functions and constructing the message that will be passed to a destination handler contract. We include documentation to use our already-deployed and audited generic "multicall" handler contract, which is the recommended way to integrate Across+. We also include instructions for creating your own custom handler contract.

Using the Generic Multicaller Handler ContractUsing a Custom Handler Contract

The tradeoff of using the generic multicall handler contract is that the complexity is encountered when crafting the message, which must be a correctly-encoded Instructions object. Once the message is formed correctly, you don't need to write any more code.

On the other hand, when using a custom handler contract, you'll need to implement a custom handleV3AcrossMessage function and deploy a new contract, but creating the deposit message is trivial.

If you have further questions or suggestions for this guide, please send a message to the #developer-questions channel in the Across Discord.

Last updated