CowSwap on Arbitrum
Deployments
Name | Address |
---|---|
GPv2VaultRelayer | 0xC92E8bdf79f0507f65a392b0ab4667716BFE0110 (opens in a new tab) |
OrderSigner | 0x23dA9AdE38E4477b23770DeD512fD37b12381FAB (opens in a new tab) |
Action: swap
Parameters
Name | Type | Description |
---|---|---|
sell | string[] (required) | ETH | Token address |
buy | string[] (optional) | ETH | Token address |
feeAmountBp | int[] (optional) | Fee amount basis points (0-10000), where 0 is 0% and 10000 is 100% |
When using the Pilot Extension, 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.
To allow ETH as sell
or buy
token, either the "ETH" literal or the
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
address can be used.
If buy
is left undefined
, there would be no restriction on the buy side of
the swap.
SELL_TOKEN
below refers to the ERC-20 token address of each element given in
sell
.
BUY_TOKEN
below refers to the ERC-20 token address of each element given in
buy
.
FEE_AMOUNT_BP
specifies the fee amount in basis points given in
feeAmountBp
. It accepts a value between 0 and 10000, where 0 represents 0%
and 10000 represents 100%.
SELL_TOKEN · approve
Approve GPv2VaultRelayer
to spend SELL_TOKEN
tokens on behalf of the avatar.
-
Contract:
SELL_TOKEN
-
Function:
approve(address,uint256)
Parameter Constraint spender
equal to GPv2VaultRelayer
amount
-
OrderSigner · signOrder
Sign order to swap SELL_TOKEN
for BUY_TOKEN
.
-
Contract:
OrderSigner
-
Function:
signOrder((address,address,address,uint256,uint256,uint32,bytes32,uint256,bytes32,bool,bytes32,bytes32),uint32,uint256)
→ delegatecallParameter Constraint order.sellToken
equal to SELL_TOKEN
order.buyToken
equal to BUY_TOKEN
order.receiver
equal to AVATAR
order.sellAmount
- order.buyAmount
- order.validTo
- order.appData
- order.feeAmount
- order.kind
- order.partiallyFillable
- order.sellTokenBalance
- order.buyTokenBalance
- validDuration
- feeAmountBp
lower or equal to FEE_AMOUNT_BP
The signOrder
function does not allow sending ETH. Therefore, ETH must be
wrapped in order to be sent as a sell token.
OrderSigner · unsignOrder
Unsign and cancel order.
-
Contract:
OrderSigner
-
Function:
unsignOrder((address,address,address,uint256,uint256,uint32,bytes32,uint256,bytes32,bool,bytes32,bytes32))
→ delegatecallParameter Constraint order.sellToken
equal to SELL_TOKEN
order.buyToken
equal to BUY_TOKEN
order.receiver
equal to AVATAR
order.sellAmount
- order.buyAmount
- order.validTo
- order.appData
- order.feeAmount
- order.kind
- order.partiallyFillable
- order.sellTokenBalance
- order.buyTokenBalance
-
If ETH is SELL_TOKEN
:
WETH · approve
Approve GPv2VaultRelayer
to spend WETH
tokens on behalf of the avatar.
-
Contract:
WETH
-
Function:
approve(address,uint256)
Parameter Constraint spender
equal to GPv2VaultRelayer
amount
-
WETH · deposit
Deposit ETH and receive WETH
tokens.
-
Contract:
WETH
-
Function:
deposit()
Ξ allow sending ETHParameter Constraint N/A N/A