CowSwap
Swap
- Label: Swap_CowSwap
- Description: Swap a token to get another in exchange in CowSwap.
- Actions in execution process:
- Swap SELL_TOKENto getBUY_TOKENin exchange.
 
- Swap 
Note: When using the Pilot Extension and the Agile Execution App, all swaps will be routed through a delegate call to the OrderSigner (opens in a new tab) in order to facilitate parameter scoping and minimize risks.
Note: If SELL_TOKEN or BUY_TOKEN is a native token, it gets wrapped before executing the following functions.
SELL_TOKEN · approve
Approve GPv2VaultRelayer to spend SELL_TOKEN tokens on behalf of the avatar.
- 
Contract: SELL_TOKEN
- 
Function: approve(address,uint256)Parameter Constraint spenderequal to GPv2VaultRelayeramountequal to the SELL_TOKENamount to swap
OrderSigner · signOrder
Sign order to swap order.sellAmount of SELL_TOKEN tokens for as much as possible of BUY_TOKEN tokens.
- 
Contract: OrderSigner
- 
Function: signOrder((address,address,address,uint256,uint256,uint32,bytes32,uint256,bytes32,bool,bytes32,bytes32),uint32,uint256)→ delegatecallParameter Constraint order.sellTokenequal to SELL_TOKENorder.buyTokenequal to BUY_TOKENorder.receiverequal to AVATARorder.sellAmountequal to the SELL_TOKENamount to swaporder.buyAmountequal to minimum amount of BUY_TOKENto receiveorder.validToequal to time_now+validDurationorder.appData- order.feeAmountequal to 0 order.kindequal to sellorder.partiallyFillableFalseorder.sellTokenBalance- order.buyTokenBalance- validDurationequal to 10 mins feeAmountBplower or equal to FEE_AMOUNT_BP: Fee amount basis points (0-10000), where 0 is 0% and 10000 is 100%