Payloads

Swap Payload

Following is the struct for swapping tokens from EVM-based chains being used by Swap Bridge as the payload of VAA.

struct Swap {
        // PayloadID uint8 = 1
        uint8 payloadID;
        // Amount being transferred (big-endian uint256)
        uint256 amountIn;
        // Address of the ouput token. Left-zero-padded if shorter than 32 bytes
        bytes32 tokenAddress;
        // Chain ID of the ouput token
        uint16 tokenChain;
        // Address of the recipient. Left-zero-padded if shorter than 32 bytes
        bytes32 to;
        // Chain ID of the recipient
        uint16 toChain;
        // Address of sender (for revert scenario)
        bytes32 from;
        // ChainId of sender (for revert scenario)
        uint16 fromChain;
        // sequence of token bridge VAA
        uint64 sequence;
        // minimum output amount
        uint256 amountOutMin;
        // deadline of swap
        uint64 deadline;
        // Swap relayer fee
        uint64 swapFee;
        // Redeem relayer fee
        uint64 redeemFee;
        // Refund relayer fee
        uint64 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.

struct Redeem {
	// final recepient of tokens
	bytes32 recepient;
	// relayer fee
	uint64 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.

Last updated