This guide explains how to manually assemble a message for a swap transaction on dedust.io through act.
The swap message consists of:
The SwapParams
structure consists of the following fields:
beginCell() .storeUint(now() + 5 * 60, 32) // Deadline .storeAddress(myAddress()) // Recipient address .storeUint(0, 2) // Referral (if any) .storeBit(0) // Fulfill payload (optional) .storeBit(0) // Reject payload (optional) .endCell();
Refer to Dedust Docs for additional swap message structures.
SwapParams [docs]
swap_params#_ deadline:Timestamp recipient_addr:MsgAddressInt referral_addr:MsgAddress fulfill_payload:(Maybe ^Cell) reject_payload:(Maybe ^Cell) = SwapParams;
beginCell() .storeUint(0xea06185d, 32) // Swap op-code .storeUint(0, 64) // Query ID .storeCoins(amount - toNano(0.2)) // Amount minus fee .storeAddress("EQDQ...XJWC") // dedust_pool address .storeUint(0, 1) // Swap kind .storeCoins(0) // Minimum output of the swap .storeBit(0) // Reference to the next step .storeRef(swap_params) // Reference to SwapParams .endCell();
Refer to Dedust Docs for additional swap message structures.
Message "swap" [docs]
swap#ea06185d query_id:uint64 amount:Coins _:SwapStep¹ swap_params:^SwapParams² = InMsgBody;
SwapStep [docs]
step#_ pool_addr:MsgAddressInt params:SwapStepParams = SwapStep;
step_params#_ kind:SwapKind limit:Coins next:(Maybe ^SwapStep) = SwapStepParams;
Once the message is constructed, send it to the contract using your preferred wallet / script / act interface.