Skip to main content

Understanding Voyager

Architecture

The Voyager consists of smart contracts which are deployed on all the blockchains that it supports and a middleware contract sitting on the Router Chain which forms the abstraction layer for many complexities of the cross-chain communication.

The smart contracts include the Voyager Deposit Handler, the Voyager Execute Handler, the Voyager Utils contract etc. The Voyager Deposit Handler is responsible for handling the deposits from users on the source chain while the Voyager Execute Handler is responsible for execution of the transaction on the destination chain.

Flow of cross-chain token transfers:

When a user calls a function to transfer funds to another chain, the Voyager Deposit Handler contract will process the transaction, deduct the funds from user’s wallet and create a cross-chain communication request to the Router Chain endpoint. After receiving data from the source chain, our bridge contract on the Router Chain will process the request, make some necessary checks and deduct the fees required for the transaction to be processed. Once this is complete, it will fire a transaction to the destination chain to complete the cross-chain transfer request.

Edge Cases

  1. What if liquidity is not available for a token on the destination chain?

    The user will get the Wrapped tokens for those tokens on the destination chain which can be redeemed as soon as the liquidity is available on the chain.

  2. What if I end up getting lesser amount of tokens on the destination chain than the minimum amount promised to me?

    This would never happen. The amount of destination tokens received depends on the DEX output while swapping the tokens. Maybe the output changed between the time that elapsed between when the amount was shown to you and the actual execution. In this case, the swap may result in lesser output for the user, but at Voyager, we have a policy of no loss to the user. So we provide you stable tokens equivalent to the minimum amount displayed to you instead of the token which was the output of the DEX so that you do not suffer any loss.

Flow of cross-chain token transfers along with arbitrary instructions:

The flow is almost the same as that of token transfers. The main difference here is that the user also passes an arbitrary instructions from the source chain which is executed just after the token transfer is executed on the destination chain. The Voyager Execute Handler is responsible for calling the target contract on the destination chain. The target contract on the destination chain must implement the voyagerReceive function which is the entry point for the execution of the arbitrary instruction. An example to create send arbitrary instruction from a source chain and handling it on the destination chain is mentioned here.

Edge Cases

  1. What if the token transfer is successful but the arbitrary instruction execution fails?

    This would never happen as the transaction, by design, is atomic which means that either both will execute or none will execute.

  2. What if my transaction fails on the destination chain due to some issues? What happens to my funds?

    No need to worry. We provide a replay function on our bridge contract on the Router Chain which can be called by any user to replay a failed request. You can fix the issues and call this replay function to replay your transaction on the destination chain. Your funds are safe!

Fee Mechanism for Token Transfers/Swaps

The fee is calculated on the bridge contract on the Router Chain based on the source chain, destination chain, the transaction volume and some other parameters. The fee consists of a flat fee and an additional bips based fee based on the transaction volume.

The fee is deducted directly from the tokens transferred to the Voyager Deposit Handler on the source chain and the remaining amount of tokens are transferred to the recipient on the destination chain.

If the fee required for transaction is greater than the amount being transferred and the cost of reverting it is lesser than the amount transferred, the transaction will be reverted back on the source chain by a request from the bridge contract on the Router Chain.

Fee Mechanism for Arbitrary Instructions along with Token Transfers/Swaps

The fee mechanism for arbitrary instructions transfer along with the funds differs from that of normal fund transfers across chains because with arbitrary instructions, the user wants the same amount of tokens to be credited on the destination chain as were deducted on the source chain.

The fees here entails the fees for token transfer plus the amount of gas limit passed for arbitrary instruction transfer to the destination chain. The fees will be deducted in the form of WRoute tokens on the Voyager middleware contract on the Router Chain from an account which will be known as fee payer.

For this, the application has to register with Voyager by contacting the Voyager team to set an account as a fee payer admin for the application. This fee payer admin can then set any account on Router chain as the fee payer for requests originating from that application. Also the fee payer has to confirm on the Voyager middleware that it indeed wants to pay the fees for this application. This is a one time process and once done, fees for every request that originates from that application will be paid by the fee payer account. The fee payer admin can also change the fee payer address in the future by following the similar process.