Swaps

The frontend calls the β€œexecute function” of the ActionExecutor contract, this: passes in the parameters and addresses of the tokens (source and destination), the address of the recipient on the second network (optional), the amount in the source token, and the parameters of the exchange route. If the recipient's address is not specified, it is defaulted to the sender's address.

The parameters also contain a list of possible transactions on the destination chain. These transactions differ in the input sum. The choice of input data for the transaction on the destination chain occurs after the exchange of the token through the DEX aggregator on the initiation chain has been completed. Depending on the real slippage the swap is conducted on the destination chain.

The ActionExecutor contract refers to the ActionExecutorRegistry contract to get more detailed parameters: DEX aggregator router address, cross-chain gateway address, fee amount, etc.

On the initiation chain, the user token is exchanged for a stablecoin. If the user's original token matches the stablecoin token, the exchange step is skipped.

The result is checked for entry into the allowable range of exchange amounts. The received stablecoin is sent to the vault, minus the commission.

Last updated