Following is the struct for swapping tokens from EVM-based chains being used by Swap Bridge as the payload of VAA.
structSwap {// PayloadID uint8 = 1uint8 payloadID;// Amount being transferred (big-endian uint256)uint256 amountIn;// Address of the ouput token. Left-zero-padded if shorter than 32 bytesbytes32 tokenAddress;// Chain ID of the ouput tokenuint16 tokenChain;// Address of the recipient. Left-zero-padded if shorter than 32 bytesbytes32 to;// Chain ID of the recipientuint16 toChain;// Address of sender (for revert scenario)bytes32 from;// ChainId of sender (for revert scenario)uint16 fromChain;// sequence of token bridge VAAuint64 sequence;// minimum output amountuint256 amountOutMin;// deadline of swapuint64 deadline;// Swap relayer feeuint64 swapFee;// Redeem relayer feeuint64 redeemFee;// Refund relayer feeuint64 refundFee;}
In all of the payloads, every parameter is encoded in a big-endian manner and every address has been zero left padded to meet the 32 byte size.
Redeem Payload
To redeem tokens on EVM networks the following payload is being used by the Mayan program.
structRedeem {// final recepient of tokensbytes32 recepient;// relayer feeuint64 relayerFee;// whether to unwrap tokens or not (only applys for native currency)bool unwrap;}
Note that Redeem this is a payload 3 message and the above struct will be sent along the with the token bridge struct.