> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cow.bleu.builders/llms.txt
> Use this file to discover all available pages before exploring further.

# Market orders (swap)

> Swapping is the bread and butter of CoW Protocol! Let's swap some tokens!

## Connect wallet

Go to [CoW Swap](https://swap.cow.fi/#/swap?utm_source=docs.cow.fi\&utm_content=swap-tutorial) and connect your web3 wallet.

<Note>
  If you don't have a web3 wallet yet, you can easily get one! Here are some suggestions:

  * Use a browser extension wallet such as [Rabby](https://rabby.io/) or [Metamask](https://metamask.io/download/)
  * A hardware wallet such as [Trezor](https://trezor.io/)
  * A Smart Contract Wallet such as [Safe](https://app.safe.global)

  Please do your own research on the advantages and disadvantages of each wallet to select the one that works best for you.
</Note>

<img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_connect1.f3cdfc5.1954.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=e215bd7091f3c85caaf8c21c914e6491" alt="" width="1954" height="1094" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_connect1.f3cdfc5.1954.png" />

Click on `Connect wallet`.

<img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_connect2.0233be0.973.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=a4bd00c2e6063d13b2ade0a8c675a036" alt="" width="973" height="563" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_connect2.0233be0.973.png" />

Select one of the available wallets.

## Select tokens

Consider an example swapping 0.05 `WETH` for `COW`.

<img src="https://mintcdn.com/cowswap/BmBLPrBvQ401BeyM/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_need_approval.e315025.3840.png?fit=max&auto=format&n=BmBLPrBvQ401BeyM&q=85&s=b5bce4e97602c48dc2ef8fd119eb9761" alt="" width="3840" height="2160" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_need_approval.e315025.3840.png" />

When you do a swap on CoW Swap for the first time, you must give approval for the [*vault relayer*](/cow-protocol/reference/contracts/core/vault-relayer) contract to spend your token (in this case, `WETH`). This is because this is the contract that will pull the `WETH` from your wallet and send it to the [*settlement*](/cow-protocol/reference/contracts/core/settlement) contract that will co-ordinate the swap on your behalf.

Both contracts are audited, battle-tested and non-upgradeable.

Moreover, the settlement contract is the only address that can request the vault relayer to pull your funds and **only after verifying** both that:

1. Your order was signed by you
2. and that you will receive at least your limit execution price or better

## Approve sell token

<Check>
  Some tokens, such as `USDC`, `DAI`, `COW` and many others support gasless approvals. This means that you can approve the [vault relayer](/cow-protocol/reference/contracts/core/vault-relayer) contract to spend your tokens without having any initial gas for an on-chain transaction. This is a great way to save on gas costs!

  You don't have to worry about this, as CoW Swap will automatically detect if the token supports gasless approvals and will guide you through the process.

  Just look for the `gasless approval` flag when picking the tokens to get started:

  <img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_gasless_approval.55db35d.1155.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=414c57393393bb30df9e5e074f118174" alt="" width="1155" height="569" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_gasless_approval.55db35d.1155.png" />
</Check>

<Note>
  Trade of gasless compatible tokens is supported on Swap and [Limit](/cow-swap/tutorials/limit) orders, and are NOT available for Smart Contract wallets.
</Note>

<img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_approval_default.ff42ec8.3840.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=9ea7ef6e96610c6f070d3e4ba40742e1" alt="" width="3840" height="2160" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_approval_default.ff42ec8.3840.png" />

By default, CoW Swap prompts you to give [vault relayer](/cow-protocol/reference/contracts/core/vault-relayer) an "unlimited" allowance for the sell token.

This has the benefits of:

* Not having to approve every time you trade
* Saving on gas costs

<Warning>
  A user should be careful when signing approval transactions. Verify carefully that the spender address is correct (in this case GPv2VaultRelayer's address).

  If in doubt about any of the above, do *not* sign the transaction. To review your approvals, you can use [https://revoke.cash/](https://revoke.cash/).
</Warning>

Once the `approve` transaction is confirmed, you can proceed to swap!

<img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_approved.7a034f4.3840.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=6419a52cced5c74b08345d8728681402" alt="" width="3840" height="2160" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_approved.7a034f4.3840.png" />

<Check>
  CoW Swap has a special integration with [Safe](https://app.safe.global) when opened as a [Safe app](https://app.safe.global/share/safe-app?appUrl=https%3A%2F%2Fswap.cow.fi\&chain=eth), where the approval and order placement transactions can be combined into a single Safe transaction.

  <img src="https://mintcdn.com/cowswap/BmBLPrBvQ401BeyM/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_safe_approval_bundle_1.494598c.1136.png?fit=max&auto=format&n=BmBLPrBvQ401BeyM&q=85&s=ca5a3f6af3278bcbdc2b5a5b3c63f158" alt="" width="1136" height="732" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_safe_approval_bundle_1.494598c.1136.png" />

  <img src="https://mintcdn.com/cowswap/BmBLPrBvQ401BeyM/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_safe_approval_bundle_2.dd00428.1118.png?fit=max&auto=format&n=BmBLPrBvQ401BeyM&q=85&s=c5a3e099d1830cfc2e8f9323cf5b79ef" alt="" width="1118" height="777" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_safe_approval_bundle_2.dd00428.1118.png" />
</Check>

## Confirm swap

When you're ready to swap, click the "Swap" button.

You will be prompted to confirm the swap. This is when you can review the details of the swap (i.e. the quote, the slippage tolerance, etc.).

If you're happy with the details, click "Confirm Swap". You will be prompted to sign the order.

<Warning>
  Ensure that the `receiver` address is correct. Fake CoW Swap websites have been observed and often substitute this parameter with their own address. This **should be set to 0x0...0 or your signer's address** to indicate that the tokens will be sent to the order signer's address. If you have set a custom receiver, you should verify that the address is correct.

  The user interface should display a warning if the `receiver` address is not the address from which you are signing the order.
</Warning>

Be careful when signing an order. All of the associated parameters are final and cannot be changed once the order is signed and submitted to the API. If you make a mistake, you will need to cancel the order and create a new one.

<img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_confirm.a359db9.3840.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=3ad382cdc6f62878dc8c506790813ac2" alt="" width="3840" height="2160" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_confirm.a359db9.3840.png" />

At this stage, your wallet will prompt you to sign the order. The user interface for this will vary depending on your wallet.

<img src="https://mintcdn.com/cowswap/BmBLPrBvQ401BeyM/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_signing.4f8e1cd.3840.png?fit=max&auto=format&n=BmBLPrBvQ401BeyM&q=85&s=50af77d7e0f41f7b4257ffae360b713b" alt="" width="3840" height="2160" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_signing.4f8e1cd.3840.png" />

Once the order has been signed, it will be submitted to CoW Protocol where it is now ready to be executed! 🎉

<img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_confirmed.bda6b48.3840.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=e21460a8e7448ff809bc2127b8faf31b" alt="" width="3840" height="2160" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_confirmed.bda6b48.3840.png" />

## Track your order

Your order will be in the order book and ready to be executed.

* CoW Swap will automatically notify in a pop-up message once your order is executed.
* You can keep track of the order status by checking the recent history (click on your connected wallet address in the top right corner).
* You can also view your order on [CoW Explorer](/cow-protocol/howto/cow-explorer).

<img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_account.a0f044f.2506.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=5a617d63656e8ffeca26d507f769f643" alt="" width="2506" height="1922" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_account.a0f044f.2506.png" />

## Cancel your order

Changed your mind? Not a problem! CoW Swap makes it easy and gasless[1](#user-content-fn-1) to cancel your order.

First, open the activity panel by clicking on your address in the top right corner.

<img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_activity-modal.a7d0c9f.1110.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=69431f6021b49cbfc0bb13812226d041" alt="" width="1110" height="550" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_activity-modal.a7d0c9f.1110.png" />

Find your pending order in the list and click on `Cancel order`.

<img src="https://mintcdn.com/cowswap/QlHNrQeNXiohzdCD/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_cancel-pending-order.8afc1ab.812.png?fit=max&auto=format&n=QlHNrQeNXiohzdCD&q=85&s=225158b4ea663090d8c50059f5c4fffc" alt="" width="812" height="545" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_cancel-pending-order.8afc1ab.812.png" />

Confirm the cancellation, picking which mode of cancellation you'd like: `off-chain` (default) or `on-chain`.

Cancelling orders `off-chain` is free and does *not* require a transaction. However, there is a risk that the order is matched between the time you cancel it and the time the cancellation is processed `off-chain`.

<Note>
  Cancellations are not immediate, and your order may settle before the cancellation goes through.
</Note>

To proceed with an `off-chain` cancellation, click "Request cancellation" as shown below.

<img src="https://mintcdn.com/cowswap/BmBLPrBvQ401BeyM/images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_off-chain-cancellation.def17cd.532.png?fit=max&auto=format&n=BmBLPrBvQ401BeyM&q=85&s=7b7b8906d63232687937966db3dcc855" alt="" width="532" height="432" data-path="images/cow-protocol/tutorials/cow-swap/assets/ideal-img/swap_off-chain-cancellation.def17cd.532.png" />

If you do not want to place trust in the API to cancel your order, you may wish to cancel your order via an `on-chain` cancellation transaction. This will cost gas. To do so, toggle the type of cancellation to `on-chain` by clicking on `off-chain`.

<Note>
  Even with `on-chain` cancellations, there is still a risk that the order is matched before the `on-chain` cancellation transaction is confirmed. Make sure to set a high priority fee and sign swiftly.
</Note>

Confirm the transaction in your wallet and you are done!

## Footnotes

1. Only `off-chain` cancellations are gasless. `on-chain` cancellations - as the name states - require a regular network transaction. [↩](#user-content-fnref-1)
