Skip to main content

Overview

Mayan Forwarder serves as the unified entry point for interacting with Mayan’s cross-chain swap methods—Swift, MCTP, and Wormhole Swap. It streamlines integration by providing a single, secure interface and maintains a whitelist of trusted protocol addresses to mitigate risks from compromised quote data. The Forwarder contract is deployed across multiple EVM-compatible chains—including Ethereum, Arbitrum, Base, Optimism, Avalanche, Polygon, BSC, Unichain, and Linea. All share the same contract address:
0x337685fdaB40D39bd02028545a4FfA7D287cC3E2

Swap From EVM

To initiate a swap using an ERC20 token as input, you must first approve the required allowance for the Mayan Forwarder contract or alternatively provide a permit object to enable spending.
tokenContract.approve(forwarderContract, amountIn);
After approval, you can generate the complete transaction payload using the getSwapFromEvmTxPayload function from the Mayan SDK and then pass it to the Mayan Forwarder contract. If you need to build the payload manually and use Mayan Forwarder, you should choose the right method based on your input token:
  • forwardERC20: For input tokens that are ERC-20.
ParameterTypeDescrption
tokenInaddressInput token address
amountInuint256Input amount
permitParamsPermitParamsSigned permission (eip-2612) Pass zero for all values if you don’t want to use
mayanProtocoladdressAddress of Mayan final contract
protocolDatabytesBytes data for Mayan final contract
  • swapAndForwardERC20: Same as forwardERC20 but performs a swap on the source chain before bridging.
ParameterTypeDescription
tokenInaddressInput token address
amountInuint256Input amount
permitParamsPermitParamsSigned permission (eip-2612) Pass zero for all values if you don’t want to use
swapProtocoladdressContract address of swap protocol
swapDatabytesBytes data that is needed by swap protocol
middleTokenaddressThe output token of swap protocol
minMiddleAmountuint256Minimum output of swap step or the transaction will revert
mayanProtocoladdressAddress of Mayan final contract
mayanDatabytesBytes data for Mayan final contract
  • forwardEth: For input tokens that are native tokens of the chain.
ParameterTypeDescription
mayanProtocoladdressAddress of Mayan final contract
mayanDatabytesBytes data for Mayan final contract
  • swapAndForwardEth: Similar to forwardEth but performs a swap before bridging.
ParameterTypeDescription
amountInunit256Input amount of native token
swapProtocoladdressContract address of swap protocol
swapDatabytesData that is needed by swap protocol
middleTokenaddressThe output token of swap protocol
minMiddleAmountuint256Minimum output of swap step or the transaction will revert
mayanProtocoladdressAddress of Mayan final contract
mayanDataaddressBytes data for Mayan final contract