Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mayan-mayanintern-image-upload.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Mayan Forwarder serves as the entry point for interacting with our set of smart contracts, providing a unified interface to all three cross-chain swap methods: WH Swap, MCTP, and Swift. The Forwarder maintains a whitelist of protocol addresses that user can interact with to ensure safetey of user in case of receiving a comporomised quote from API. The Forwarder smart contract is deployed on the following EVM networks with address: 0x337685fdaB40D39bd02028545a4FfA7D287cC3E2
  • Ethereum
  • Arbitrum
  • Base
  • Optimism
  • Avalanche
  • Polygon
  • BSC
  • Unichain
  • Linea

Swap From EVM

To initiate a swap with an ERC20 token as input token you should first approve the required allowance to the forwarder contract or alternatively pass permit object to the contract.
tokenContract.approve(forwarderContract, amountIn);
Once you approved the spending amount, you can get the complete transaction payload by using getSwapFromEvmTxPayload from SDK and then pass it to the 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: Your input token is ERC20
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: Similar to forwardERC20 but you also need a swap in source chain before the actual 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 (e.g 1inch)
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: Your input token is the native token of chain
ParameterTypeDescription
mayanProtocoladdressAddress of Mayan final contract
mayanDatabytesBytes data for Mayan final contract
  • swapAndForwardEth: Similar to forwardEth but you need a swap before the actual bridging.
ParameterTypeDescription
amountInunit256Input amount of native token
swapProtocoladdressContract address of swap protocol (e.g 1inch)
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