Learn
Gnosis

CowSwap on Gnosis Chain

Deployments

NameAddress
GPv2VaultRelayer0xC92E8bdf79f0507f65a392b0ab4667716BFE0110 (opens in a new tab)
OrderSigner0x23dA9AdE38E4477b23770DeD512fD37b12381FAB (opens in a new tab)

Action: swap

Parameters

NameTypeDescription
sellstring[] (required)XDAI | Token address
buystring[] (optional)XDAI | Token address
feeAmountBpint[] (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 XDAI as sell or buy token, either the "XDAI" 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)

    ParameterConstraint
    spenderequal 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) → delegatecall

    ParameterConstraint
    order.sellTokenequal to SELL_TOKEN
    order.buyTokenequal to BUY_TOKEN
    order.receiverequal to AVATAR
    order.sellAmount-
    order.buyAmount-
    order.validTo-
    order.appData-
    order.feeAmount-
    order.kind-
    order.partiallyFillable-
    order.sellTokenBalance-
    order.buyTokenBalance-
    validDuration-
    feeAmountBplower or equal to FEE_AMOUNT_BP

The signOrder function does not allow sending XDAI. Therefore, XDAI 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)) → delegatecall

    ParameterConstraint
    order.sellTokenequal to SELL_TOKEN
    order.buyTokenequal to BUY_TOKEN
    order.receiverequal to AVATAR
    order.sellAmount-
    order.buyAmount-
    order.validTo-
    order.appData-
    order.feeAmount-
    order.kind-
    order.partiallyFillable-
    order.sellTokenBalance-
    order.buyTokenBalance-

If XDAI is SELL_TOKEN:

WXDAI · approve

Approve GPv2VaultRelayer to spend WXDAI tokens on behalf of the avatar.

  • Contract: WXDAI

  • Function: approve(address,uint256)

    ParameterConstraint
    spenderequal to GPv2VaultRelayer
    amount-

WXDAI · deposit

Deposit XDAI and receive WXDAI tokens.

  • Contract: WXDAI

  • Function: deposit() Ξ allow sending XDAI

    ParameterConstraint
    N/AN/A