Skip to content

Commit

Permalink
chore: prod docs (#33)
Browse files Browse the repository at this point in the history
# Description

With documentation going to production, links need to be updated.

# Changes

- [x] All docs link have `beta` tag removed.
  • Loading branch information
mfw78 authored Jan 9, 2024
1 parent 67213e2 commit 43fd760
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
title: Approving sell token
---

For an order to be tradeable on CoW Protocol, the owner needs to approve the [GPv2VaultRelayer](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core/vault-relayer) to spend the token they want to trade.
For an order to be tradeable on CoW Protocol, the owner needs to approve the [GPv2VaultRelayer](https://docs.cow.fi/cow-protocol/reference/contracts/core/vault-relayer) to spend the token they want to trade.

> A list of the core deployed contracts can be found [here](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core).
> A list of the core deployed contracts can be found [here](https://docs.cow.fi/cow-protocol/reference/contracts/core).
## Contract (token) interaction

Expand All @@ -21,7 +21,7 @@ Additionally, if we want to **make a transaction**, we must have a _signer_ (e.g

The contract to be interacted with is the token we want to trade. In this tutorial, we use the [wxDAI](https://gnosisscan.io/token/0xe91d153e0b41518a2ce8dd3d7944fa863463a97d) token, and assign it's address `0xe91d153e0b41518a2ce8dd3d7944fa863463a97d` to a `const`.

At the same time, we assign the address of the [GPv2VaultRelayer](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core/vault-relayer) to a `const`:
At the same time, we assign the address of the [GPv2VaultRelayer](https://docs.cow.fi/cow-protocol/reference/contracts/core/vault-relayer) to a `const`:

```typescript
/// file: run.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Quoting
---

OK, so you're wanting to trade some tokens on CoW Protocol. Great! But before we do that, let's get a quote first so we know what we're getting into. We get quotes using the [Order book API](https://beta.docs.cow.fi/cow-protocol/tutorials/arbitrate/orderbook).
OK, so you're wanting to trade some tokens on CoW Protocol. Great! But before we do that, let's get a quote first so we know what we're getting into. We get quotes using the [Order book API](https://docs.cow.fi/cow-protocol/tutorials/arbitrate/orderbook).

## API

The CoW Protocol API is [documented in swagger](https://beta.docs.cow.fi/cow-protocol/reference/apis/orderbook). Using API endpoints can be a bit tricky, so we've exposed all the settings that you need (including things like rate limiters so you don't get blocked) in a simple to use library: `@cowprotocol/cow-sdk`.
The CoW Protocol API is [documented in swagger](https://docs.cow.fi/cow-protocol/reference/apis/orderbook). Using API endpoints can be a bit tricky, so we've exposed all the settings that you need (including things like rate limiters so you don't get blocked) in a simple to use library: `@cowprotocol/cow-sdk`.

To install it, run: `npm install @cowprotocol/cow-sdk`

Expand Down Expand Up @@ -157,4 +157,4 @@ In the above case, we can see that:
- the `feeAmount` is `1881812051493698` atomic units of `wxDAI` (which is `0.001881812051493698` `wxDAI`)
- the `kind` is `sell`

The above `OrderQuoteResponse` object actually maps to the [`GPv2Order.Data`](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core/settlement#gpv2orderdata-struct) struct for the smart contract, so this is what we will sign in the [next tutorial](/tutorial/sign-order) for our swap.
The above `OrderQuoteResponse` object actually maps to the [`GPv2Order.Data`](https://docs.cow.fi/cow-protocol/reference/contracts/core/settlement#gpv2orderdata-struct) struct for the smart contract, so this is what we will sign in the [next tutorial](/tutorial/sign-order) for our swap.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Here we will build on the previous tutorial and sign the quote we got from the [

## Intents and signatures

CoW Protocol uses [intents](https://beta.docs.cow.fi/cow-protocol/reference/core/intents) to represent orders. An intent is a [signed message](https://beta.docs.cow.fi/cow-protocol/reference/core/signing-schemes). Most intents are signed using the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) signing scheme, and this is what we will use in this tutorial.
CoW Protocol uses [intents](https://docs.cow.fi/cow-protocol/reference/core/intents) to represent orders. An intent is a [signed message](https://docs.cow.fi/cow-protocol/reference/core/signing-schemes). Most intents are signed using the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) signing scheme, and this is what we will use in this tutorial.

## Signing an order

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ An example `orderId` should look like:
}
```

> The [`orderId`](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core/settlement#orderuid) is the unique identifier for the order we have just submitted. We can use this `orderId` (also known as `orderUid`) to check the status of the order on [CoW Explorer](https://beta.docs.cow.fi/cow-protocol/tutorials/cow-explorer/order). Keep this handy, as we will practice some more with this `orderId` in the next tutorial!
> The [`orderId`](https://docs.cow.fi/cow-protocol/reference/contracts/core/settlement#orderuid) is the unique identifier for the order we have just submitted. We can use this `orderId` (also known as `orderUid`) to check the status of the order on [CoW Explorer](https://docs.cow.fi/cow-protocol/tutorials/cow-explorer/order). Keep this handy, as we will practice some more with this `orderId` in the next tutorial!
### Errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ title: Cancelling on-chain

The preferred way to cancel an order is off-chain, notably because it is free. However, this places trust in the API to cancel the order. If you want to enforce the cancellation of an order, you can do so on-chain. This will cost gas, but will ensure that the order is cancelled.

To cancel, we will send an `invalidateOrder` transaction to the [`GPv2Settlement`](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core/settlement) contract.
To cancel, we will send an `invalidateOrder` transaction to the [`GPv2Settlement`](https://docs.cow.fi/cow-protocol/reference/contracts/core/settlement) contract.

> A list of the core deployed contracts can be found [here](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core).
> A list of the core deployed contracts can be found [here](https://docs.cow.fi/cow-protocol/reference/contracts/core).
## Contract (`GPv2Settlement`) interaction

Expand All @@ -21,7 +21,7 @@ Additionally, if we want to **make a transaction**, we must have a _signer_ (e.g

### Contract address and `orderUid`

The contract to be interacted with is the [`GPv2Settlement`](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core/settlement) contract. We assign it's address `0x9008D19f58AAbD9eD0D60971565AA8510560ab41` to a `const`.
The contract to be interacted with is the [`GPv2Settlement`](https://docs.cow.fi/cow-protocol/reference/contracts/core/settlement) contract. We assign it's address `0x9008D19f58AAbD9eD0D60971565AA8510560ab41` to a `const`.

At the same time, we assign the `orderUid` of the order we want to cancel to a `const`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ So, we have created a simple order in the previous section, but what if you're a

## `app-data` SDK

The `app-data` is documented in [JSON Schema](https://beta.docs.cow.fi/cow-protocol/reference/core/intents/app-data#schema). Writing to a schema is not very convenient, so we have a special SDK for that. It's called the `app-data` SDK.
The `app-data` is documented in [JSON Schema](https://docs.cow.fi/cow-protocol/reference/core/intents/app-data#schema). Writing to a schema is not very convenient, so we have a special SDK for that. It's called the `app-data` SDK.

To install it, run: `npm install @cowprotocol/app-data`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Creating order
---

[Eth-flow](https://beta.docs.cow.fi/cow-protocol/reference/contracts/periphery/eth-flow) allows users to create orders selling `ETH` without wrapping it to `WETH` first.
[Eth-flow](https://docs.cow.fi/cow-protocol/reference/contracts/periphery/eth-flow) allows users to create orders selling `ETH` without wrapping it to `WETH` first.

To create an `Eth-flow` order we will need to interact with the `Eth-Flow` contract.

Expand All @@ -19,7 +19,7 @@ Additionally, as we want to **make a transaction**, we must have a _signer_ (e.g

### Contract address

`EthFlow` is a periphery contract, and it's deployed on each supported network. As `EthFlow` orders are natively indexed by the [autopilot](https://beta.docs.cow.fi/cow-protocol/tutorials/arbitrate/autopilot), there also exists a `production` and `staging` version of the contract on each network.
`EthFlow` is a periphery contract, and it's deployed on each supported network. As `EthFlow` orders are natively indexed by the [autopilot](https://docs.cow.fi/cow-protocol/tutorials/arbitrate/autopilot), there also exists a `production` and `staging` version of the contract on each network.

For this tutorial, we will use the [`production` version of the contract](https://gnosisscan.io/address/0x40A50cf069e992AA4536211B23F286eF88752187) on Gnosis chain. Let's assign it's address to a constant:

Expand Down Expand Up @@ -136,7 +136,7 @@ In addition to the `OrderQuoteRequest` fields we've used in the previous tutoria

### `EthFlowOrder.Data` struct

Now that we have a quote, we can go about creating an `EthFlow` order. Unfortunately no `EthFlowOrder` type exists in the SDK, so we will need to create one ourselves. Simply we create a type that extends the `UnsignedOrder` type (removing the fields that are not required for [`EthFlow` orders](https://beta.docs.cow.fi/cow-protocol/reference/contracts/periphery/eth-flow#ethfloworderdata)) and add a `quoteId` field:
Now that we have a quote, we can go about creating an `EthFlow` order. Unfortunately no `EthFlowOrder` type exists in the SDK, so we will need to create one ourselves. Simply we create a type that extends the `UnsignedOrder` type (removing the fields that are not required for [`EthFlow` orders](https://docs.cow.fi/cow-protocol/reference/contracts/periphery/eth-flow#ethfloworderdata)) and add a `quoteId` field:

```typescript
/// file: run.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
title: Viewing status
---

One of the more difficult things to do with `Eth-flow` orders is to determine their status, as to do so we need to know the [`orderUid`](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core/settlement#orderuid) of the order.
One of the more difficult things to do with `Eth-flow` orders is to determine their status, as to do so we need to know the [`orderUid`](https://docs.cow.fi/cow-protocol/reference/contracts/core/settlement#orderuid) of the order.

In this tutorial, we will learn how to determine the `orderUid` of an `Eth-flow` order, and how to use it to determine the order's status.

## Determining the `orderUid`

Upon consulting the documentation's Technical reference on [`orderUid`](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core/settlement#orderuid), we can see that the `orderUid` is composed of the following fields:
Upon consulting the documentation's Technical reference on [`orderUid`](https://docs.cow.fi/cow-protocol/reference/contracts/core/settlement#orderuid), we can see that the `orderUid` is composed of the following fields:

- `digest`: The EIP-712 digest of the `GPv2Order.Data` struct
- `owner`: The address of the order's owner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ We will use the second method in this tutorial.

## Reconstructing the `EthFlowOrder.Data` struct

From the [`EthFlowOrder.Data` struct](https://beta.docs.cow.fi/cow-protocol/reference/contracts/periphery/eth-flow#ethfloworderdata) technical reference, we can see that the struct's fields are a subset of the [`GPv2Order.Data` struct](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core/settlement#gpv2orderdata-struct) and an additional `int64` field called `quoteId`.
From the [`EthFlowOrder.Data` struct](https://docs.cow.fi/cow-protocol/reference/contracts/periphery/eth-flow#ethfloworderdata) technical reference, we can see that the struct's fields are a subset of the [`GPv2Order.Data` struct](https://docs.cow.fi/cow-protocol/reference/contracts/core/settlement#gpv2orderdata-struct) and an additional `int64` field called `quoteId`.

Fortunately, in the `OrderPlacement` event log, we can see that the `order` field is the `GPv2Order.Data` struct, and the `data` field is a solidity-packed tuple containing the `quoteId` field and the `validTo` field. This means that we can reconstruct the `EthFlowOrder.Data` struct from the `OrderPlacement` event log!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ There are two types of wallets:
- EOA (externally owned account) wallets, which are controlled by a private key
- Smart contract wallets, which are controlled by a smart contract

Since smart contract wallets, such as [`Safe`](https://safe.global) are controlled by a smart contract, they can't sign transactions using [`EIP-712`](https://beta.docs.cow.fi/cow-protocol/reference/core/signing-schemes#eip-712). However, CoW Protocol supports smart contract wallets by allowing them to sign using:
- [`EIP-1271`](https://beta.docs.cow.fi/cow-protocol/reference/core/signing-schemes#eip-1271)
- [`PRESIGN`](https://beta.docs.cow.fi/cow-protocol/reference/core/signing-schemes#presign)
Since smart contract wallets, such as [`Safe`](https://safe.global) are controlled by a smart contract, they can't sign transactions using [`EIP-712`](https://docs.cow.fi/cow-protocol/reference/core/signing-schemes#eip-712). However, CoW Protocol supports smart contract wallets by allowing them to sign using:
- [`EIP-1271`](https://docs.cow.fi/cow-protocol/reference/core/signing-schemes#eip-1271)
- [`PRESIGN`](https://docs.cow.fi/cow-protocol/reference/core/signing-schemes#presign)

This tutorial will show you how to create an order using `PreSign` signing scheme, using a `Safe` wallet. It is assumed that you have a `Safe` wallet with at least one owner, and that the `owner` is the account you're using to run the tutorial.

Expand All @@ -35,7 +35,7 @@ To interact with a contract, we need to know:
### Contract address

`GPv2Settlement` is a core contract and it's deployed on each supported network. Core contracts deployment addresses can be found in the [CoW Protocol docs](https://beta.docs.cow.fi/cow-protocol/reference/contracts/core).
`GPv2Settlement` is a core contract and it's deployed on each supported network. Core contracts deployment addresses can be found in the [CoW Protocol docs](https://docs.cow.fi/cow-protocol/reference/contracts/core).

This is such a common use case that the SDK provides an export for the `GPv2Settlement` contract address:

Expand Down

0 comments on commit 43fd760

Please sign in to comment.