diff --git a/about-these-docs.mdx b/about-these-docs.mdx index 20f412b..c0bd2cb 100644 --- a/about-these-docs.mdx +++ b/about-these-docs.mdx @@ -201,7 +201,7 @@ If you'd like to contribute to any of these areas: ### File naming conventions -``` +```text section/ ├── explanation/ # Conceptual content ("why") │ ├── topic-name.mdx diff --git a/bff/api-reference/authentication.mdx b/bff/api-reference/authentication.mdx index ad5fa4f..d50c81c 100644 --- a/bff/api-reference/authentication.mdx +++ b/bff/api-reference/authentication.mdx @@ -122,7 +122,7 @@ curl -X POST https://api.cow.fi/affiliate/0x1234.../ \ The API supports Cross-Origin Resource Sharing (CORS) for browser-based applications: -``` +```http Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Cache-Control ``` diff --git a/bff/api-reference/endpoints/accounts.mdx b/bff/api-reference/endpoints/accounts.mdx index c10a415..bb773ec 100644 --- a/bff/api-reference/endpoints/accounts.mdx +++ b/bff/api-reference/endpoints/accounts.mdx @@ -112,20 +112,20 @@ Provides real-time streaming updates via Server-Sent Events for balance and allo ### Event Examples **Balance Update:** -``` +```text event: message data: [{"balance":"5000000000000000000","allowance":"115792089237316195423570985008687907853269984665640564039457584007913129639935","token":{"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","decimals":18,"symbol":"WETH","name":"Wrapped Ether"}}] ``` **Keep-Alive Ping:** -``` +```text event: ping data: {} ``` ### Response Headers -``` +```http Content-Type: text/event-stream Cache-Control: no-cache Connection: keep-alive diff --git a/bff/api-reference/endpoints/markets.mdx b/bff/api-reference/endpoints/markets.mdx index f74f105..8e9396e 100644 --- a/bff/api-reference/endpoints/markets.mdx +++ b/bff/api-reference/endpoints/markets.mdx @@ -131,7 +131,7 @@ The API calculates slippage tolerance based on: Slippage tolerance responses are cached for **120 seconds** (2 minutes): -``` +```http Cache-Control: public, max-age=120 ``` diff --git a/bff/api-reference/endpoints/notifications.mdx b/bff/api-reference/endpoints/notifications.mdx index d76fc91..32788f9 100644 --- a/bff/api-reference/endpoints/notifications.mdx +++ b/bff/api-reference/endpoints/notifications.mdx @@ -121,7 +121,7 @@ Users can subscribe to receive notifications via: Notification responses are cached for **5 minutes** (300 seconds): -``` +```http Cache-Control: public, max-age=300 ``` diff --git a/bff/api-reference/introduction.mdx b/bff/api-reference/introduction.mdx index a901a0a..c8df35d 100644 --- a/bff/api-reference/introduction.mdx +++ b/bff/api-reference/introduction.mdx @@ -11,13 +11,13 @@ The CoW Protocol BFF (Backend for Frontend) API provides a suite of services des The API is accessible at: -``` +```text https://api.cow.fi ``` For local development: -``` +```text http://localhost:3001 ``` diff --git a/bff/development/creating-services.mdx b/bff/development/creating-services.mdx index 6437fb6..8b975aa 100644 --- a/bff/development/creating-services.mdx +++ b/bff/development/creating-services.mdx @@ -1,5 +1,6 @@ --- title: "Creating Services and Libraries" +sidebarTitle: "Creating Services" description: "Guide to scaffolding new services, applications, and libraries in the CoW Protocol BFF monorepo using NX generators" --- diff --git a/bff/development/testing.mdx b/bff/development/testing.mdx index 4921100..9580287 100644 --- a/bff/development/testing.mdx +++ b/bff/development/testing.mdx @@ -46,7 +46,7 @@ nx run repositories:test --skip-nx-cache Test files should be colocated with the code they test: -``` +```text libs/repositories/src/ ├── usd/ │ ├── UsdRepository.ts diff --git a/bff/services/api.mdx b/bff/services/api.mdx index 600760f..2b0b2dc 100644 --- a/bff/services/api.mdx +++ b/bff/services/api.mdx @@ -1,6 +1,6 @@ --- title: "API Service" -description: "Documentation for the BFF API service, a Fastify-based HTTP server that aggregates data from multiple sources to provide unified endpoints for trading, tokens, and balances" +description: "Documentation for the CoW Protocol BFF API service — a Fastify server providing unified trading, token, and balance endpoints." --- # API Service @@ -185,7 +185,7 @@ Plugins are auto-loaded from `apps/api/src/app/plugins/`. Routes are organized hierarchically and auto-loaded: -``` +```text routes/ ├── about.ts # Health/version endpoint ├── hooks.ts # Dune Analytics hooks diff --git a/bff/services/notification-producer.mdx b/bff/services/notification-producer.mdx index cfe370b..de4cada 100644 --- a/bff/services/notification-producer.mdx +++ b/bff/services/notification-producer.mdx @@ -312,7 +312,7 @@ nx docker-build notification-producer The producer outputs structured logs with prefixes: -``` +```log [notification-producer:main] Start notification producer for networks: 1, 100 [TradeNotificationProducer:1] Indexing from block 18500000 to 18500100: 101 blocks [TradeNotificationProducer:1] Sending 5 notifications diff --git a/changelog.mdx b/changelog.mdx index cd9ecf5..56914aa 100644 --- a/changelog.mdx +++ b/changelog.mdx @@ -1,6 +1,6 @@ --- title: "Changelog" -description: "Latest updates to CoW DAO documentation." +description: "Latest updates and changes to CoW Protocol and CoW DAO documentation — new features, guides, and improvements." --- diff --git a/composable-cow/api/composable-cow.mdx b/composable-cow/api/composable-cow.mdx index ba90aea..f76009c 100644 --- a/composable-cow/api/composable-cow.mdx +++ b/composable-cow/api/composable-cow.mdx @@ -11,7 +11,7 @@ The `ComposableCoW` contract enables creation and management of programmatic ord Deployed identically across six networks (Ethereum Mainnet, Gnosis Chain, Arbitrum One, Base, Optimism, and Polygon) at address: -``` +```text 0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74 ``` diff --git a/composable-cow/api/extensible-fallback-handler.mdx b/composable-cow/api/extensible-fallback-handler.mdx index 20101fc..e54d6e6 100644 --- a/composable-cow/api/extensible-fallback-handler.mdx +++ b/composable-cow/api/extensible-fallback-handler.mdx @@ -11,7 +11,7 @@ The `ExtensibleFallbackHandler` is a Safe fallback handler enabling signature ve Deployed at the same address across multiple networks (Ethereum Mainnet, Gnosis Chain, Arbitrum One, Base, Optimism, and Polygon): -``` +```text 0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5 ``` diff --git a/composable-cow/api/orders/good-after-time.mdx b/composable-cow/api/orders/good-after-time.mdx index 7ae3a9f..5f72ec0 100644 --- a/composable-cow/api/orders/good-after-time.mdx +++ b/composable-cow/api/orders/good-after-time.mdx @@ -24,7 +24,7 @@ Good After Time orders are time-delayed programmatic orders that execute only af When enabled, the price checker validates that: -``` +```text buyAmount >= (expectedOut * (MAX_BPS - allowedSlippage)) / MAX_BPS ``` diff --git a/composable-cow/api/orders/perpetual-stable-swap.mdx b/composable-cow/api/orders/perpetual-stable-swap.mdx index 44c1a50..9b82117 100644 --- a/composable-cow/api/orders/perpetual-stable-swap.mdx +++ b/composable-cow/api/orders/perpetual-stable-swap.mdx @@ -24,7 +24,7 @@ The `getTradeableOrder` function executes the following workflow: 2. Identifies which token has greater value 3. Creates a sell order for the entire balance of the higher-value token 4. Applies the spread formula: - ``` + ```text buyAmount = convertedAmount * (10000 + halfSpreadBps) / 10000 ``` 5. Returns tokens to the owner automatically (`receiver = address(0)`) diff --git a/composable-cow/guides/debugging.mdx b/composable-cow/guides/debugging.mdx index 962bee8..76c98ff 100644 --- a/composable-cow/guides/debugging.mdx +++ b/composable-cow/guides/debugging.mdx @@ -9,7 +9,7 @@ Use this decision tree when your programmatic order isn't executing as expected. ## Why didn't my order execute? -``` +```text Order not executing ├── Is the tx confirmed on-chain? │ └── No → Wait for confirmation or check if tx reverted diff --git a/composable-cow/guides/signature-construction.mdx b/composable-cow/guides/signature-construction.mdx index dbbbb54..a741a1f 100644 --- a/composable-cow/guides/signature-construction.mdx +++ b/composable-cow/guides/signature-construction.mdx @@ -16,7 +16,7 @@ This guide assumes you have already [set up your Safe](/composable-cow/guides/se When the CoW Protocol settlement contract executes a trade for a ComposableCoW order, the following verification chain runs: -``` +```text GPv2Settlement │ ├─ calls isValidSignature(orderDigest, signature) on the Safe diff --git a/composable-cow/introduction.mdx b/composable-cow/introduction.mdx index 6cf9bc0..f76e4ee 100644 --- a/composable-cow/introduction.mdx +++ b/composable-cow/introduction.mdx @@ -1,6 +1,6 @@ --- title: "Introduction" -description: "ComposableCoW is the contract that implements programmatic orders on CoW Protocol — orders that execute automatically when predefined on-chain conditions are satisfied." +description: "ComposableCoW implements programmatic orders on CoW Protocol — orders that execute automatically when on-chain conditions are met." --- # Introduction to ComposableCoW diff --git a/composable-cow/order-types/good-after-time.mdx b/composable-cow/order-types/good-after-time.mdx index 489713e..d78dfd7 100644 --- a/composable-cow/order-types/good-after-time.mdx +++ b/composable-cow/order-types/good-after-time.mdx @@ -25,7 +25,7 @@ The off-chain input accepts varying `buyAmount` values, meaning different `buyAm Optional Milkman price checkers validate that provided buy amounts meet minimum requirements. The acceptable minimum calculates as: -``` +```text expectedOut * (10000 - allowedSlippage) / 10000 ``` diff --git a/composable-cow/order-types/perpetual-stable-swap.mdx b/composable-cow/order-types/perpetual-stable-swap.mdx index 51b3185..e6316ee 100644 --- a/composable-cow/order-types/perpetual-stable-swap.mdx +++ b/composable-cow/order-types/perpetual-stable-swap.mdx @@ -22,13 +22,13 @@ The contract examines your holdings of both tokens and creates sell orders for w ### Validity Bucket Calculation -``` +```text validTo = ((currentTime / validityBucketSeconds) * validityBucketSeconds) + validityBucketSeconds ``` ### Buy Amount Formula -``` +```text buyAmount = convertAmount(sellAmount) * (10000 + halfSpreadBps) / 10000 ``` @@ -42,7 +42,7 @@ The contract retrieves both token balances, normalizes them to a common decimal Different token decimals receive automatic conversion. For example, converting 1000 USDC (6 decimals) to DAI (18 decimals): -``` +```text 1000 * 10^6 * 10^(18-6) = 1000 * 10^18 ``` diff --git a/composable-cow/order-types/stop-loss.mdx b/composable-cow/order-types/stop-loss.mdx index 682a61b..82713e4 100644 --- a/composable-cow/order-types/stop-loss.mdx +++ b/composable-cow/order-types/stop-loss.mdx @@ -11,7 +11,7 @@ Stop Loss orders are oracle-based programmatic orders that automatically trigger The system monitors price ratios between two tokens. When the calculated exchange rate reaches or falls below the strike price, the order becomes executable: -``` +```text (sellTokenPrice / buyTokenPrice) <= strike ``` diff --git a/composable-cow/tutorials/custom-order-type.mdx b/composable-cow/tutorials/custom-order-type.mdx index 8255d1b..99f7b1e 100644 --- a/composable-cow/tutorials/custom-order-type.mdx +++ b/composable-cow/tutorials/custom-order-type.mdx @@ -12,7 +12,7 @@ A `TradeAboveThreshold` programmatic order that: - When the balance exceeds a threshold, generates a sell order for the excess - Automatically repeats until cancelled -``` +```text Safe balance: 15,000 USDC (threshold: 10,000) → Generates order: sell 5,000 USDC for WETH → Watch Tower submits it to CoW Protocol @@ -36,7 +36,7 @@ forge install cowprotocol/composable-cow Create `remappings.txt`: -``` +```text @cowprotocol/=lib/composable-cow/ @openzeppelin/=lib/composable-cow/lib/openzeppelin-contracts/ safe/=lib/composable-cow/lib/safe-contracts/contracts/ @@ -348,7 +348,7 @@ revert IConditionalOrder.PollNever("Order permanently invalid"); ## Architecture -``` +```text Safe Wallet └── ComposableCoW (fallback handler) └── Your Handler (TradeAboveThreshold) diff --git a/cow-amm.mdx b/cow-amm.mdx index a2e0eb0..b1b154c 100644 --- a/cow-amm.mdx +++ b/cow-amm.mdx @@ -1,6 +1,7 @@ --- title: "CoW AMM: The First MEV-capturing AMM" -description: "CoW AMM protects LPs from LVR so they can provide liquidity with less risk and more return. CoW AMM achieves close to 5% more in TVL compared to reference pools, protects millions from LVR, and has captured over $100,000 in surplus for LPs to date." +sidebarTitle: "CoW AMM" +description: "CoW AMM protects liquidity providers from LVR with less risk and more return — the first MEV-capturing AMM built on CoW Protocol." hidden: true --- diff --git a/cow-amm/explanation/how-cow-amms-work.mdx b/cow-amm/explanation/how-cow-amms-work.mdx index ed3ad70..3d3e2ab 100644 --- a/cow-amm/explanation/how-cow-amms-work.mdx +++ b/cow-amm/explanation/how-cow-amms-work.mdx @@ -1,5 +1,6 @@ --- title: "How CoW AMMs Work" +description: "Learn how CoW AMM uses the Function-Maximizing AMM mechanism to eliminate LVR and protect liquidity providers from MEV." --- ## FM-AMMs diff --git a/cow-amm/explanation/the-problem-of-lvr.mdx b/cow-amm/explanation/the-problem-of-lvr.mdx index 1645716..6d1e615 100644 --- a/cow-amm/explanation/the-problem-of-lvr.mdx +++ b/cow-amm/explanation/the-problem-of-lvr.mdx @@ -1,6 +1,7 @@ --- title: "The Problem of LVR (Loss-versus-rebalancing)" -description: "First coined by a team of researchers from LVR is a form of arbitrage that occurs whenever an AMM has an outdated (stale) price in comparison to some other trading venue." +sidebarTitle: "The Problem of LVR" +description: "Loss-versus-rebalancing (LVR) is arbitrage exploiting stale AMM prices — learn how it impacts LPs and how CoW AMM eliminates it." --- Arbitrageurs exploit this difference by trading from the AMM to the more liquid exchange (usually a centralized exchange like Binance), correcting the arbitrage and extracting value from LPs in the process. diff --git a/cow-amm/tutorials/cow-amm-for-solvers.mdx b/cow-amm/tutorials/cow-amm-for-solvers.mdx index 4d8deb1..90fb689 100644 --- a/cow-amm/tutorials/cow-amm-for-solvers.mdx +++ b/cow-amm/tutorials/cow-amm-for-solvers.mdx @@ -1,5 +1,6 @@ --- title: "CoW AMM Liquidity for Solvers" +description: "How CoW Protocol solvers can access and route through CoW AMM liquidity pools, including integration details and surplus optimization." --- ## I'm a solver. How do I use CoW AMM liquidity? @@ -87,7 +88,7 @@ When creating a CoW AMM order it is therefore encouraged to use the smallest pos If we call `X` (resp. `Y`) the reserves of sell (resp. buy) token, and `x` (resp. `y`) the executed sell (resp. buy) amount, then the minimal buy amount is `x Y / (X - x)` and the order surplus with that choice for the limit amount is: -``` +```text x Ysurplus = y - ----- . X - x ``` diff --git a/cow-contracts/api/contracts/settlement.mdx b/cow-contracts/api/contracts/settlement.mdx index 624ac5e..651f26f 100644 --- a/cow-contracts/api/contracts/settlement.mdx +++ b/cow-contracts/api/contracts/settlement.mdx @@ -101,7 +101,7 @@ function freePreSignatureStorage(bytes[] calldata orderUids) external; The contract enforces that clearing prices respect order limits: -``` +```text order.sellAmount * sellPrice >= order.buyAmount * buyPrice ``` diff --git a/cow-contracts/api/ts/deploy.mdx b/cow-contracts/api/ts/deploy.mdx index fecf414..0be1404 100644 --- a/cow-contracts/api/ts/deploy.mdx +++ b/cow-contracts/api/ts/deploy.mdx @@ -79,7 +79,7 @@ function deterministicDeploymentAddress( The computation follows: -``` +```text address = keccak256(0xff ++ deployerAddress ++ salt ++ keccak256(initCode))[12:] ``` diff --git a/cow-contracts/concepts/settlement.mdx b/cow-contracts/concepts/settlement.mdx index 4858cdf..6993bfd 100644 --- a/cow-contracts/concepts/settlement.mdx +++ b/cow-contracts/concepts/settlement.mdx @@ -38,7 +38,7 @@ Settlement involves three interaction phases: Orders validate through the equation: -``` +```text sellAmount * sellPrice >= buyAmount * buyPrice ``` diff --git a/cow-protocol/explanation/architecture/autopilot.mdx b/cow-protocol/explanation/architecture/autopilot.mdx index 79f406a..55fc130 100644 --- a/cow-protocol/explanation/architecture/autopilot.mdx +++ b/cow-protocol/explanation/architecture/autopilot.mdx @@ -1,5 +1,6 @@ --- title: "Autopilot" +description: "How the Autopilot orchestrates CoW Protocol batch auctions — collecting orders, coordinating solvers, and submitting settlements." --- ## Overview diff --git a/cow-protocol/explanation/architecture/driver.mdx b/cow-protocol/explanation/architecture/driver.mdx index aa8a1f2..3009c22 100644 --- a/cow-protocol/explanation/architecture/driver.mdx +++ b/cow-protocol/explanation/architecture/driver.mdx @@ -1,6 +1,6 @@ --- title: "Driver" -description: "People interested in running a solver to participate in CoW Protocol mainly want to focus on implementing the most efficient solver engine. However, there are also many mundane tasks that may not seem like a competitive advantage but have to be done regardless." +description: "The Driver handles operational tasks for CoW Protocol solvers, letting solver engines focus on finding the most efficient execution." --- ## Overview diff --git a/cow-protocol/explanation/architecture/solver-engine.mdx b/cow-protocol/explanation/architecture/solver-engine.mdx index 83678eb..0124814 100644 --- a/cow-protocol/explanation/architecture/solver-engine.mdx +++ b/cow-protocol/explanation/architecture/solver-engine.mdx @@ -1,6 +1,6 @@ --- title: "Solver Engine" -description: "The Solver Engine implements the of the CoW Protocol batch auction. As part of the auction lifecycle, it receives a request from the containing a potentially pre-processed auction instance and returns information about which order to execute together with instructions on how to achieve the desired execution using on-chain liquidity \"interactions\"." +description: "The Solver Engine implements core solving logic for CoW Protocol batch auctions — optimizing order execution and on-chain interactions." --- diff --git a/cow-protocol/explanation/benefits/trade-any-intent.mdx b/cow-protocol/explanation/benefits/trade-any-intent.mdx index f9670f1..160b209 100644 --- a/cow-protocol/explanation/benefits/trade-any-intent.mdx +++ b/cow-protocol/explanation/benefits/trade-any-intent.mdx @@ -1,6 +1,6 @@ --- title: "Trade any intent" -description: "CoW Protocol allows users to express any type of trade intent on Ethereum and EVM-compatible chains, leveraging to execute the transactions through the most optimal route." +description: "CoW Protocol lets users express any trade intent on Ethereum and EVM chains, with solvers finding the most optimal execution route." --- The protocol supports any order logic which includes standard market and limit orders, but also advanced order types such as [TWAP](/cow-protocol/explanation/order-types/twap-orders). Thanks to `ERC-1271`, smart contracts can also submit intents, paving the way for the [Programmatic Order Framework](/cow-protocol/explanation/order-types/programmatic-orders) and contracts like [Milkman](/cow-protocol/explanation/order-types/milkman-orders). diff --git a/cow-protocol/explanation/fee-model.mdx b/cow-protocol/explanation/fee-model.mdx index a5fdba4..31770c3 100644 --- a/cow-protocol/explanation/fee-model.mdx +++ b/cow-protocol/explanation/fee-model.mdx @@ -1,6 +1,6 @@ --- title: "Fee Model" -description: "How fees work in CoW Protocol — from the quote response to on-chain settlement. Everything you need to understand protocol fees, network costs, partner fees, and how to retrieve fee data for accounting." +description: "How fees work in CoW Protocol — protocol fees, network costs, partner fees, and retrieving fee data from quotes to settlement." --- @@ -29,7 +29,7 @@ There is no separate fee transfer, no gas token deduction, and no invoice. If yo Fees are applied in a specific order, transforming the raw spot price into the final signed amounts: -``` +```text Spot Price (beforeAllFees) → after Protocol Fee → after Network Costs diff --git a/cow-protocol/explanation/flash-loans/integrators.mdx b/cow-protocol/explanation/flash-loans/integrators.mdx index 535ddf9..841cb88 100644 --- a/cow-protocol/explanation/flash-loans/integrators.mdx +++ b/cow-protocol/explanation/flash-loans/integrators.mdx @@ -1,11 +1,12 @@ --- title: "How to specify an order with flash loan" -description: "The flash loan is encoded into the 's metadata as an optional object. This information serves as a hint for the solver, but the solver ultimately can decide for a different approach in order to make the operation more optimal." +sidebarTitle: "Flash Loan Orders" +description: "How to encode flash loan parameters in CoW Protocol order metadata so solvers can leverage borrowed liquidity for execution." --- It is important to ensure that the flash loan gas overhead is added to the slippage tolerance when creating the order. -``` +```json { "flashloan": { "lender": "0x1111111111111111111111111111111111111111", "borrower": "0x2222222222222222222222222222222222222222", "token": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "amount": "1000000" }} ``` diff --git a/cow-protocol/explanation/how-it-works/coincidence-of-wants.mdx b/cow-protocol/explanation/how-it-works/coincidence-of-wants.mdx index 5b39669..ba90724 100644 --- a/cow-protocol/explanation/how-it-works/coincidence-of-wants.mdx +++ b/cow-protocol/explanation/how-it-works/coincidence-of-wants.mdx @@ -1,6 +1,6 @@ --- title: "Coincidence of Wants" -description: "CoW (Coincidence of Wants): An economic phenomenon where two parties - each holding the asset that the other needs - exchange assets directly in an equivalent barter." +description: "Coincidence of Wants (CoW) — how CoW Protocol matches traders who hold each other's desired assets for direct peer-to-peer exchange." --- Thanks to CoW Protocol's batching mechanism, users can make peer-to-peer swaps in cases where they're trading the same assets. diff --git a/cow-protocol/explanation/how-it-works/flow-of-an-order.mdx b/cow-protocol/explanation/how-it-works/flow-of-an-order.mdx index ebaae20..8a65278 100644 --- a/cow-protocol/explanation/how-it-works/flow-of-an-order.mdx +++ b/cow-protocol/explanation/how-it-works/flow-of-an-order.mdx @@ -1,6 +1,6 @@ --- title: "Flow of an order" -description: "Rather than creating executable on-chain transactions, CoW Protocol users submit their orders as signed  messages. This allows to find the optimal execution path for the batch of orders before committing them on-chain." +description: "How a CoW Protocol order flows from signed intent through solver competition to optimal on-chain batch settlement." --- Let's bring all of our main concepts together by taking a look at the flow of an order through CoW Protocol. diff --git a/cow-protocol/explanation/how-it-works/how-intents-are-formed.mdx b/cow-protocol/explanation/how-it-works/how-intents-are-formed.mdx index 792ff69..df980f5 100644 --- a/cow-protocol/explanation/how-it-works/how-intents-are-formed.mdx +++ b/cow-protocol/explanation/how-it-works/how-intents-are-formed.mdx @@ -1,6 +1,6 @@ --- title: "How Intents Are Formed" -description: "An intent in CoW Protocol is a signed message that represents a user's wish to trade. It doesn't execute a trade directly — instead, it delegates execution to solvers who find the optimal path." +description: "How trade intents work in CoW Protocol — signed messages that delegate execution to competing solvers for optimal pricing." --- An [_intent_](/cow-protocol/explanation/introduction/intents) in CoW Protocol is a signed message that represents a user's wish to trade. It doesn't execute a trade directly — instead, it delegates execution to [solvers](/cow-protocol/explanation/introduction/solvers) who find the optimal path. @@ -13,7 +13,7 @@ For a step-by-step integration walkthrough, see the **[API Integration Guide](/c Forming an intent follows three stages: -``` +```text Intention → Quote → Intent ``` @@ -21,7 +21,7 @@ Intention → Quote → Intent An intention is the user's raw desire to trade. To obtain a quote, you send this intention to the `/quote` API endpoint: -``` +```text POST https://api.cow.fi/mainnet/api/v1/quote ``` @@ -220,7 +220,7 @@ The spot price is the exchange rate before any fees are applied. It serves as th ### Sell order -``` +```text beforeAllFees.sellAmount = quote.sellAmount + quote.feeAmount Network Costs (buy token) = (quote.buyAmount × quote.feeAmount) / quote.sellAmount @@ -230,7 +230,7 @@ beforeAllFees.buyAmount = quote.buyAmount + protocolFeeAmount + Network Costs (b ### Buy order -``` +```text beforeAllFees.sellAmount = quote.sellAmount - protocolFeeAmount beforeAllFees.buyAmount = quote.buyAmount @@ -244,7 +244,7 @@ The protocol fee is expressed as basis points (`protocolFeeBps`) in the quote re For sell orders, `quote.buyAmount` is already **after** the protocol fee has been deducted: -``` +```text protocolFeeAmount = quote.buyAmount × (protocolFeeBps / 10000) / (1 − protocolFeeBps / 10000) ``` @@ -252,7 +252,7 @@ protocolFeeAmount = quote.buyAmount × (protocolFeeBps / 10000) / (1 − protoco For buy orders, the protocol fee is applied to the sum of sell amount and network costs: -``` +```text protocolFeeAmount = (quote.sellAmount + quote.feeAmount) × (protocolFeeBps / 10000) / (1 + protocolFeeBps / 10000) ``` @@ -262,7 +262,7 @@ The partner (integrator) fee is calculated as a percentage of the **spot price** ### Sell orders (buy token units) -``` +```text partnerFeeAmount = beforeAllFees.buyAmount × partnerFeePercent / 100 ``` @@ -274,7 +274,7 @@ The same formula applies, but the result is in sell token units. Slippage tolerance uses the same calculation as the partner fee, but it is applied to the **`afterPartnerFees`** amount rather than the spot price: -``` +```text slippageAmount = afterPartnerFees × slippagePercent / 100 ``` @@ -284,7 +284,7 @@ Below is every stage computation in one place. All values are in token atoms (in ### Sell order — full computation -```` +````text ── Protocol Fee Amount (buy token units) ────────────────────────────────────── protocolFeeAmount = quote.buyAmount × (protocolFeeBps / 10000) / (1 − protocolFeeBps / 10000) @@ -323,7 +323,7 @@ buyAmount = afterSlippage.buyAmount (minimum to receive) ### Buy order — full computation -```` +````text ── Protocol Fee Amount (sell token units) ───────────────────────────────────── protocolFeeAmount = (quote.sellAmount + quote.feeAmount) × (protocolFeeBps / 10000) / (1 + protocolFeeBps / 10000) diff --git a/cow-protocol/explanation/introduction/fair-combinatorial-auction.mdx b/cow-protocol/explanation/introduction/fair-combinatorial-auction.mdx index d59774c..6c5d876 100644 --- a/cow-protocol/explanation/introduction/fair-combinatorial-auction.mdx +++ b/cow-protocol/explanation/introduction/fair-combinatorial-auction.mdx @@ -1,6 +1,7 @@ --- title: "Fair Combinatorial Batch Auction" -description: "CoW Protocol collects and aggregates intents off-chain and auctions them off to solvers. The auction is a Fair Combinatorial Batch Auction (FCBA) because each solver can submit multiple bids. A solver can submit multiple bids on individual orders, in which case each \"bid\" represents the best price this solver can provide to an individual order. However, a solver can also submit \"batched\" bids, that is, bids on groups of orders." +sidebarTitle: "Batch Auction" +description: "How CoW Protocol's batch auction works — solvers bid on individual orders and batched groups for optimal pricing and MEV protection." --- The protocol filters out \`\`unfair'' batched bids, which are those delivering less to an order than some available "non-batched" bids. It then selects the combination of winning bids that maximizes the surplus received by the orders that are part of the auction (subject to some computational constraints due to the combinatorial nature of the problem). diff --git a/cow-protocol/explanation/introduction/intents.mdx b/cow-protocol/explanation/introduction/intents.mdx index 73db31f..a1d25a6 100644 --- a/cow-protocol/explanation/introduction/intents.mdx +++ b/cow-protocol/explanation/introduction/intents.mdx @@ -1,6 +1,6 @@ --- title: "Intents" -description: "Rather than placing orders by that executes directly on-chain (i.e. as happens on Uniswap or SushiSwap), CoW Protocol users place orders by that specifies parameters like the assets and amounts they would like to trade. The intent is a signed message which allows the solvers to execute a trade on behalf of the user using their specified assets and amounts." +description: "CoW Protocol users sign intent messages specifying trade parameters, letting solvers execute optimal trades on their behalf." --- There are a number of [financial](#financial-benefits-of-intents) and [technical](#technical-benefits-of-intents) advantages to intent-based trading. diff --git a/cow-protocol/explanation/order-types/cow-hooks.mdx b/cow-protocol/explanation/order-types/cow-hooks.mdx index 6cf4839..2bfb807 100644 --- a/cow-protocol/explanation/order-types/cow-hooks.mdx +++ b/cow-protocol/explanation/order-types/cow-hooks.mdx @@ -1,6 +1,6 @@ --- title: "CoW Hooks" -description: "CoW Hooks allow users to pair any Ethereum action (or set of actions) with an order on CoW Protocol, leveraging the to execute the actions together in the sequence." +description: "CoW Hooks let users pair custom Ethereum actions with CoW Protocol orders, executing pre- and post-trade logic in one settlement." --- Hooks execute the entire sequence as a single transaction. True to the CoW Protocol model, users pay gas fees in their sell token if, and only if, the sequence of transactions succeeds. Under the hood, CoW Hooks are arbitrary Ethereum "calls" that attach to an order and execute before and/or after the order. Developers and advanced traders can use code to express an intent that performs some action before a swap (pre-hooks) and after a swap (post-hooks). diff --git a/cow-protocol/explanation/order-types/liquidations.mdx b/cow-protocol/explanation/order-types/liquidations.mdx index 5575ada..9e12bb1 100644 --- a/cow-protocol/explanation/order-types/liquidations.mdx +++ b/cow-protocol/explanation/order-types/liquidations.mdx @@ -1,6 +1,6 @@ --- title: "Liquidations" -description: "How lending protocols can use CoW Protocol to execute liquidations with MEV protection and competitive pricing, using ERC-1271 smart orders and the settlement contract's on-chain guarantees." +description: "How lending protocols use CoW Protocol for MEV-protected liquidations with competitive pricing via ERC-1271 smart orders." --- ## The problem with traditional liquidations diff --git a/cow-protocol/explanation/order-types/milkman-orders.mdx b/cow-protocol/explanation/order-types/milkman-orders.mdx index 64f7358..3546d46 100644 --- a/cow-protocol/explanation/order-types/milkman-orders.mdx +++ b/cow-protocol/explanation/order-types/milkman-orders.mdx @@ -17,7 +17,7 @@ Finally, once a user places a trade via Milkman, the order gets sent to the CoW Milkman follows a UniswapV2-style interface. To interact with Milkman, smart contracts need only to call the following function: -``` +```solidity function requestSwapExactTokensForTokens( uint256 amountIn, IERC20 fromToken, IERC20 toToken, address to, address priceChecker, bytes calldata priceCheckerData) ``` diff --git a/cow-protocol/explanation/order-types/pay-debt-flash-loans.mdx b/cow-protocol/explanation/order-types/pay-debt-flash-loans.mdx index f688f7c..195e98a 100644 --- a/cow-protocol/explanation/order-types/pay-debt-flash-loans.mdx +++ b/cow-protocol/explanation/order-types/pay-debt-flash-loans.mdx @@ -1,6 +1,7 @@ --- title: "Repay debt with collateral using flash loans" -description: "A key use case of flash loans is the ability to repay debt with collateral, since flash loans allow users to close or reduce their debt positions without needing upfront liquidity." +sidebarTitle: "Repay Debt (Flash Loans)" +description: "Use CoW Protocol flash loans to repay debt with collateral — close or reduce positions without needing upfront liquidity." --- Instead of requiring users to have assets readily available to repay their loans, flash loans enable them to temporarily borrow the needed funds, use those funds to repay their debt, and immediately reclaim their locked collateral. Once the collateral is received, it can be swapped or liquidated to cover the borrowed amount, ensuring the loan is repaid within the same transaction. diff --git a/cow-protocol/explanation/order-types/programmatic-orders.mdx b/cow-protocol/explanation/order-types/programmatic-orders.mdx index 9e26639..d337580 100644 --- a/cow-protocol/explanation/order-types/programmatic-orders.mdx +++ b/cow-protocol/explanation/order-types/programmatic-orders.mdx @@ -1,6 +1,6 @@ --- title: "Programmatic orders" -description: "In addition to normal wallets, CoW Protocol also supports smart contract wallets that implement . This allows users to place orders through smart contracts with programmable parameters that execute based on certain conditions." +description: "CoW Protocol programmatic orders — smart contract wallets using ERC-1271 to place orders with conditions that trigger automatically." --- We call these types of orders "programmatic orders" and we've developed a framework for creating programmatic orders, aptly named the "Programmatic Order Framework." diff --git a/cow-protocol/explanation/order-types/twap-orders.mdx b/cow-protocol/explanation/order-types/twap-orders.mdx index 397ffb7..52d0264 100644 --- a/cow-protocol/explanation/order-types/twap-orders.mdx +++ b/cow-protocol/explanation/order-types/twap-orders.mdx @@ -1,6 +1,6 @@ --- title: "TWAP orders" -description: "Time-Weighted Average Price (TWAP) orders are an advanced order type available on CoW Protocol that breaks up a large order into several smaller pieces. TWAP orders are ideal for executing big trades with minimal price impact." +description: "TWAP orders on CoW Protocol split large trades into smaller parts over time to minimize price impact and improve execution." --- ## How TWAP Orders Work diff --git a/cow-protocol/explanation/order-types/wrappers.mdx b/cow-protocol/explanation/order-types/wrappers.mdx index 823d5f1..9038f7d 100644 --- a/cow-protocol/explanation/order-types/wrappers.mdx +++ b/cow-protocol/explanation/order-types/wrappers.mdx @@ -20,7 +20,7 @@ When a settlement uses wrappers, the solver does not call `settle()` on the sett When multiple wrappers are chained, execution nests like function calls: -``` +```text Solver → Wrapper1(pre) → Wrapper2(pre) → Settlement → Wrapper2(post) → Wrapper1(post) ``` diff --git a/cow-protocol/howto/cow-explorer.mdx b/cow-protocol/howto/cow-explorer.mdx index 66aa16e..ab55cb3 100644 --- a/cow-protocol/howto/cow-explorer.mdx +++ b/cow-protocol/howto/cow-explorer.mdx @@ -1,6 +1,6 @@ --- title: "Viewing orders" -description: "As CoW Protocol utilizes an off-chain orderbook, and settles on-chain, getting a holistic view of the current state of CoW Protocol requires a combination of on-chain and off-chain data. Individually, this information is available from the following:" +description: "View CoW Protocol orders using CoW Explorer — combining on-chain settlement data with off-chain orderbook information." --- * [Order book API](/cow-protocol/reference/apis/orderbook) (off-chain) diff --git a/cow-protocol/howto/integrate/api.mdx b/cow-protocol/howto/integrate/api.mdx index 84d1535..85f7ce9 100644 --- a/cow-protocol/howto/integrate/api.mdx +++ b/cow-protocol/howto/integrate/api.mdx @@ -1,6 +1,6 @@ --- title: "API Integration Guide" -description: "Step-by-step guide to integrating with the CoW Protocol orderbook API — from requesting a quote, to computing signing amounts, to creating and monitoring orders." +description: "Guide to integrating with the CoW Protocol orderbook API — quotes, order signing, submission, and monitoring." --- import { InlineResource } from '/snippets/resource-actions.jsx' @@ -43,7 +43,7 @@ Interactive endpoint docs: [Order Book API Reference](/cow-protocol/reference/ap Send your trading intention to the `/quote` endpoint: -``` +```text POST https://api.cow.fi/mainnet/api/v1/quote ``` @@ -178,13 +178,13 @@ The protocol fee is expressed as basis points (`protocolFeeBps`) in the quote re **Sell orders** (buy token units) — `quote.buyAmount` is already after the protocol fee has been deducted: -``` +```text protocolFeeAmount = quote.buyAmount × (protocolFeeBps / 10000) / (1 − protocolFeeBps / 10000) ``` **Buy orders** (sell token units) — the protocol fee is applied to the sum of sell amount and network costs: -``` +```text protocolFeeAmount = (quote.sellAmount + quote.feeAmount) × (protocolFeeBps / 10000) / (1 + protocolFeeBps / 10000) ``` @@ -194,7 +194,7 @@ The partner (integrator) fee is calculated as a percentage of the **spot price** **Sell orders** (buy token units): -``` +```text partnerFeeAmount = beforeAllFees.buyAmount × partnerFeeBps / 10000 ``` @@ -204,7 +204,7 @@ partnerFeeAmount = beforeAllFees.buyAmount × partnerFeeBps / 10000 Slippage tolerance is applied to the `afterPartnerFees` amount (not the spot price): -``` +```text slippageAmount = afterPartnerFees × slippageBps / 10000 ``` @@ -301,7 +301,7 @@ Below is every stage computation in one place. All values are in token atoms (in **Sell order — full computation:** -```` +````text ── Protocol Fee Amount (buy token units) ────────────────────────────────────── protocolFeeAmount = quote.buyAmount × (protocolFeeBps / 10000) / (1 − protocolFeeBps / 10000) @@ -340,7 +340,7 @@ buyAmount = afterSlippage.buyAmount (minimum to receive) **Buy order — full computation:** -```` +````text ── Protocol Fee Amount (sell token units) ───────────────────────────────────── protocolFeeAmount = (quote.sellAmount + quote.feeAmount) × (protocolFeeBps / 10000) / (1 + protocolFeeBps / 10000) @@ -680,7 +680,7 @@ Include `quoteId` (from the quote's `id` field) for slippage analysis. Include ` ## Quick Reference: Full Flow -``` +```text 1. Approve sell token to Vault Relayer (if not already done) 2. POST /api/v1/quote → Get pricing and fee estimates 3. Compute amount stages → beforeAllFees, afterNetworkCosts, diff --git a/cow-protocol/howto/integrate/sdk.mdx b/cow-protocol/howto/integrate/sdk.mdx index fe28e38..a61b0b5 100644 --- a/cow-protocol/howto/integrate/sdk.mdx +++ b/cow-protocol/howto/integrate/sdk.mdx @@ -1,6 +1,6 @@ --- title: "SDK Integration" -description: "The CoW SDK provides programmatic access to CoW Protocol's functionality, enabling you to build custom trading applications with full control over the user interface and trading logic." +description: "Integrate CoW Protocol with the CoW SDK — build custom trading applications with full control over UI and trading logic." hidden: true --- @@ -18,13 +18,13 @@ The CoW SDK is a TypeScript library that offers multiple levels of abstraction, ## Quick Start Example -``` +```typescript import { SupportedChainId, OrderKind, TradeParameters, TradingSdk } from '@cowprotocol/cow-sdk'import { ViemAdapter } from '@cowprotocol/sdk-viem-adapter'import { createPublicClient, http, privateKeyToAccount } from 'viem'import { mainnet } from 'viem/chains'// Setup adapterconst adapter = new ViemAdapter({ provider: createPublicClient({ chain: mainnet, transport: http('YOUR_RPC_URL') }), signer: privateKeyToAccount('YOUR_PRIVATE_KEY' as `0x${string}`)})// Initialize SDKconst sdk = new TradingSdk({ chainId: SupportedChainId.MAINNET, appCode: 'YOUR_APP_CODE',}, {}, adapter)// Define trade parametersconst parameters: TradeParameters = { kind: OrderKind.SELL, sellToken: '0xA0b86a33E6411Ec5d0b9dd2E7dC15A9CAA6C1F8e', // USDC sellTokenDecimals: 6, buyToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH buyTokenDecimals: 18, amount: '1000000', // 1 USDC}// Get quote and execute tradeconst { quoteResults, postSwapOrderFromQuote } = await sdk.getQuote(parameters)const orderId = await postSwapOrderFromQuote()console.log('Order created:', orderId) ``` ## Installation -``` +```bash # Install the SDKnpm install @cowprotocol/cow-sdk# Install an adapter (choose one)npm install @cowprotocol/sdk-viem-adapter viemnpm install @cowprotocol/sdk-ethers-v6-adapter ethersnpm install @cowprotocol/sdk-ethers-v5-adapter ethers@^5.7.0 ``` diff --git a/cow-protocol/howto/solvers/fee-computation.mdx b/cow-protocol/howto/solvers/fee-computation.mdx index 1061f81..c7ead8d 100644 --- a/cow-protocol/howto/solvers/fee-computation.mdx +++ b/cow-protocol/howto/solvers/fee-computation.mdx @@ -1,5 +1,6 @@ --- title: "Fee computation for limit orders" +sidebarTitle: "Fee Computation" description: "Guidelines for how solvers should compute fees when executing limit orders, where users sign orders with zero fees and solvers propose fees at execution time." --- diff --git a/cow-protocol/howto/solvers/flashloans_support.mdx b/cow-protocol/howto/solvers/flashloans_support.mdx index 4906561..8eae882 100644 --- a/cow-protocol/howto/solvers/flashloans_support.mdx +++ b/cow-protocol/howto/solvers/flashloans_support.mdx @@ -1,5 +1,6 @@ --- title: "How to execute flashloans orders" +sidebarTitle: "Flash Loan Execution" description: "This short tutorial explains how orders with flashloans hints can be executed by solvers." --- @@ -13,7 +14,7 @@ Information about an order's flashloan is added by the user inside the order’s For example, this [staging order](https://explorer.cow.fi/gc/orders/0x413a7246f58441ad92ea19c09cef90d1b23a1e211e0963f3d39b7db48140533d669685c660c260d80b614f8d1a5ffd24c4e3b82668cd8760) has the appdata hash `0xa8476d34ec1e22b818cf3d6289e30271a04a4e38a8a3a71f947b5881de06a852` which can be looked up [here](https://barn.api.cow.fi/xdai/api/v1/app_data/0xa8476d34ec1e22b818cf3d6289e30271a04a4e38a8a3a71f947b5881de06a852). Specifically, in the `metadata` field, the `flashloan` entry looks as follows: -``` +```json "flashloan": { "amount": "20000000000000000000", "liquidityProvider": "0xb50201558B00496A145fE76f7424749556E326D8", "protocolAdapter": "0x19167A179bcDDBecc2d655d059f20501E5323560", "receiver": "0x19167A179bcDDBecc2d655d059f20501E5323560", "token": "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d" } ``` diff --git a/cow-protocol/howto/solvers/onboard.mdx b/cow-protocol/howto/solvers/onboard.mdx index 600f6f8..8c3506e 100644 --- a/cow-protocol/howto/solvers/onboard.mdx +++ b/cow-protocol/howto/solvers/onboard.mdx @@ -1,5 +1,7 @@ --- title: "Joining The CoW Protocol Solver Competition" +sidebarTitle: "Solver Onboarding" +description: "Step-by-step guide to joining the CoW Protocol solver competition — requirements, registration, and bonding pool setup." --- > ***NOTE:*** In order to get connected to the shadow competition, feel free to reach out to an admin of the ["CoW Swap Solvers"](https://t.me/+2Z_-DW57meA1MDlh) group on Telegram. diff --git a/cow-protocol/howto/solvers/routes_integration.mdx b/cow-protocol/howto/solvers/routes_integration.mdx index 3a8b1e4..2e4f94c 100644 --- a/cow-protocol/howto/solvers/routes_integration.mdx +++ b/cow-protocol/howto/solvers/routes_integration.mdx @@ -1,5 +1,7 @@ --- -title: "Getting new routes integrated Into CoW Protocol" +title: "Getting new routes integrated into CoW Protocol" +sidebarTitle: "Route Integration" +description: "How to propose and integrate new DEX routes and liquidity sources into CoW Protocol's solver infrastructure." --- ## Overview @@ -66,7 +68,7 @@ Instead of waiting for solver teams to have the capacity and resources to delive ## Integration Proposal Template -``` +```markdown # Liquidity Source Integration Proposal## Title[Your DEX/Liquidity Source Name] Integration## Author[Name(s)][Contact Information]## Simple Summary[Brief description of your liquidity source and its unique features]## Motivation- What unique value does your liquidity source bring?- How will it improve settlement quality?- What trading pairs/assets are supported?- Current trading volumes and liquidity depth## Technical Specification### Price Discovery- How can solvers obtain price information?- API endpoints or on-chain methods- Response formats and data structures- Rate limits and performance characteristics### Settlement Interface- Smart contract addresses- Function signatures- Parameter specifications- Gas cost estimates- Example transactions## Integration Incentives- Are you offering integration grants?## Additional Information- Security audits- Known limitations- Future roadmap- Testing environment details## Contact Information- Development team contacts- Technical support channels- Response time expectations ``` diff --git a/cow-protocol/overview.mdx b/cow-protocol/overview.mdx index 2f5dbee..ac2f5b1 100644 --- a/cow-protocol/overview.mdx +++ b/cow-protocol/overview.mdx @@ -1,6 +1,6 @@ --- title: "What is CoW Protocol?" -description: "CoW Protocol is the most user-protective trading protocol in DeFi, using batch auctions and solver competition to deliver MEV protection, better prices, and gasless trading." +description: "CoW Protocol is DeFi's most user-protective trading protocol — batch auctions and solver competition for MEV protection and better prices." --- What is CoW Protocol diff --git a/cow-protocol/reference/contracts/core.mdx b/cow-protocol/reference/contracts/core.mdx index a2d4884..7502b9a 100644 --- a/cow-protocol/reference/contracts/core.mdx +++ b/cow-protocol/reference/contracts/core.mdx @@ -90,7 +90,7 @@ The CoW Protocol API allows you to specify some signed [metadata](/cow-protocol/ The signer property in the `metadata` is used by the CoW Protocol API to check that the signature is meant for the specified wallet. If this doesn't match the order origin, the order is rejected. A minimal example of app data is the following: -``` +```json { "metadata": { "signer": "0x291cf356e5639fb4c19ba5bfb4e2f8f82b371573" } } ``` diff --git a/cow-protocol/reference/contracts/core/allowlist.mdx b/cow-protocol/reference/contracts/core/allowlist.mdx index 2546430..21a3d0a 100644 --- a/cow-protocol/reference/contracts/core/allowlist.mdx +++ b/cow-protocol/reference/contracts/core/allowlist.mdx @@ -1,6 +1,6 @@ --- title: "GPv2AllowlistAuthentication" -description: "import HistoricalFact from './_gpv2.md'" +description: "Reference for the GPv2AllowListAuthentication contract that manages authorized solver addresses in CoW Protocol." --- ## Architecture @@ -26,7 +26,7 @@ The smart contract allows a manager to add or remove solvers with an on-chain tr The manager is the address that can add or remove solvers. -``` +```solidity address public manager; ``` @@ -34,7 +34,7 @@ address public manager; The `solvers` mapping stores whether an address is a solver. -``` +```solidity mapping(address => bool) private solvers; ``` @@ -50,7 +50,7 @@ mapping(address => bool) private solvers; Allows the `owner` or the `manager` to set a new manager. -``` +```solidity function setManager(address manager_) external onlyManagerOrOwner; ``` @@ -60,7 +60,7 @@ function setManager(address manager_) external onlyManagerOrOwner; Allows the `manager` to add a solver. -``` +```solidity function addSolver(address solver) external onlyManager; ``` @@ -68,7 +68,7 @@ function addSolver(address solver) external onlyManager; Allows the `manager` to remove a solver. -``` +```solidity function removeSolver(address solver) external onlyManager; ``` @@ -78,7 +78,7 @@ function removeSolver(address solver) external onlyManager; A view function that returns whether an address is a solver. This method is used by the settlement contract to ensure critical functions can only be invoked by accounts passing the allow-list authentication. -``` +```solidity function isSolver( address prospectiveSolver) external view override returns (bool); ``` diff --git a/cow-protocol/reference/contracts/core/settlement.mdx b/cow-protocol/reference/contracts/core/settlement.mdx index 53d9b7b..f224edd 100644 --- a/cow-protocol/reference/contracts/core/settlement.mdx +++ b/cow-protocol/reference/contracts/core/settlement.mdx @@ -1,6 +1,6 @@ --- title: "GPv2Settlement" -description: "import HistoricalFact from './_gpv2.md'" +description: "Reference for the GPv2Settlement contract — the core CoW Protocol smart contract that executes batch auction settlements." --- ## Architecture @@ -59,7 +59,7 @@ The `GPV2Order.Data` is the one of the most important data structures in the Pro In code, it is defined as: -``` +```solidity struct Data { IERC20 sellToken; IERC20 buyToken; address receiver; uint256 sellAmount; uint256 buyAmount; uint32 validTo; bytes32 appData; uint256 feeAmount; bytes32 kind; bool partiallyFillable; bytes32 sellTokenBalance; bytes32 buyTokenBalance;} ``` @@ -92,7 +92,7 @@ struct Data { IERC20 sellToken; IERC20 buyToken; address receiver; u The `orderUid` is a unique identifier for an order. It is 56 bytes and defined as: -``` +```text orderUid = orderDigest ‖ owner ‖ validTo ``` @@ -107,7 +107,7 @@ Where: The `filledAmounts` mapping stores the amount of an order that has been filled. It is defined as: -``` +```solidity mapping(bytes => uint256) public filledAmounts; ``` @@ -127,7 +127,7 @@ This section will cover the main functions that are used by users and solvers. This function allows a user to pre-sign an order, which can be used if for some reason the user is unable to sign with `eth_sign`, `EIP-712`, or `ERC-1271`. This is most useful for smart contracts that have neither a private key, nor implement `ERC-1271`, but still want to use CoW Protocol. -``` +```solidity function setPreSignature(bytes calldata orderUid, bool signed) external; ``` @@ -135,7 +135,7 @@ function setPreSignature(bytes calldata orderUid, bool signed) external; This function allows a user to invalidate (cancel) an order: -``` +```solidity function invalidateOrder(bytes calldata orderUid) external; ``` @@ -145,7 +145,7 @@ function invalidateOrder(bytes calldata orderUid) external; This function is permissioned and can only be called by solvers passing the allow-list authentication. It executes a settlement: -``` +```solidity function settle( IERC20[] calldata tokens, uint256[] calldata clearingPrices, GPv2Trade.Data[] calldata trades, GPv2Interaction.Data[][3] calldata interactions) external nonReentrant onlySolver; ``` diff --git a/cow-protocol/reference/contracts/core/vault-relayer.mdx b/cow-protocol/reference/contracts/core/vault-relayer.mdx index d0e1be7..9b2cb9e 100644 --- a/cow-protocol/reference/contracts/core/vault-relayer.mdx +++ b/cow-protocol/reference/contracts/core/vault-relayer.mdx @@ -1,6 +1,6 @@ --- title: "GPv2VaultRelayer" -description: "import HistoricalFact from './_gpv2.md'" +description: "Reference for the GPv2VaultRelayer contract that secures token allowances and protects user funds from malicious solvers." --- ## Architecture @@ -61,7 +61,7 @@ Nil This function is used for transferring `ERC-20` tokens from users to the `GPv2Settlement` contract in the course of settling a batch auction. -``` +```solidity function transferFromAccounts( GPv2Transfer.Data[] calldata transfers) external onlyCreator { vault.transferFromAccounts(transfers, msg.sender);} ``` @@ -69,7 +69,7 @@ function transferFromAccounts( GPv2Transfer.Data[] calldata transfers) externa This function is used in the course of settling a single trade on-chain. It is called by the `GPv2Settlement` contract and is used to perform a batch swap on the Balancer V2 vault. The function is defined as: -``` +```solidity function batchSwapWithFee( IVault.SwapKind kind, IVault.BatchSwapStep[] calldata swaps, IERC20[] memory tokens, IVault.FundManagement memory funds, int256[] memory limits, uint256 deadline, GPv2Transfer.Data calldata feeTransfer) external onlyCreator returns (int256[] memory tokenDeltas) ``` diff --git a/cow-protocol/reference/contracts/periphery/composable-cow.mdx b/cow-protocol/reference/contracts/periphery/composable-cow.mdx index d3894e3..972c071 100644 --- a/cow-protocol/reference/contracts/periphery/composable-cow.mdx +++ b/cow-protocol/reference/contracts/periphery/composable-cow.mdx @@ -1,6 +1,6 @@ --- title: "ComposableCoW" -description: "ComposableCoW is the contract that implements programmatic orders on CoW Protocol. Programmatic orders are a subset of smart contract orders. It allows one to create programmatic orders that:" +description: "ComposableCoW contract reference — enabling programmatic orders on CoW Protocol with custom conditions, TWAP, and stop-loss logic." --- 1. Can be used to generate multiple discrete order (self-expressing) @@ -28,7 +28,7 @@ For simplicity, single orders are also supported, however, this is **NOT** recom As there are many nested contracts, it's important for a callee to know some context from the caller. To achieve this, ComposableCoW passes a `bytes32` variable `ctx` to the callee, such that: -``` +```text ctx = merkle root of orders: bytes32(0) single order: H(ConditionalOrderParams) ``` @@ -46,7 +46,7 @@ CoW Protocol order settlement execution path (assuming `safe`): ComposableCoW implements `ISafeSignatureVerifier`, which allows for delegated `ERC-1271` signature validation with an enhanced context: -``` +```solidity function isValidSafeSignature( Safe safe, address sender, bytes32 _hash, bytes32 domainSeparator, bytes32, // typeHash bytes calldata encodeData, bytes calldata payload) external view override returns (bytes4 magic); ``` @@ -77,7 +77,7 @@ In order to delegate signature verification to `ComposableCoW`, the delegating c A programmatic order that verifies a proposed discrete order against a set of conditions shall implement the `IConditionalOrder` interface. -``` +```solidity function verify( address owner, address sender, bytes32 _hash, bytes32 domainSeparator, bytes32 ctx, bytes calldata staticInput, bytes calldata offchainInput GPv2Order.Data calldata order,) external view; ``` @@ -108,7 +108,7 @@ function verify( address owner, address sender, bytes32 _hash, bytes A programmatic order that generates discrete orders shall implement the `IConditionalOrderGenerator` interface. -``` +```solidity function getTradeableOrder( address owner, address sender, bytes32 ctx, bytes calldata staticInput, bytes calldata offchainInput) external view returns (GPv2Order.Data memory); ``` @@ -125,7 +125,7 @@ This allows for `owner`-wide restrictions on the programmatic order, such as: The `ISwapGuard` interface is as follows: -``` +```solidity function verify( GPv2Order.Data calldata order, bytes32 ctx, IConditionalOrder.ConditionalOrderParams calldata params, bytes calldata offchainInput) external view returns (bool); ``` @@ -152,7 +152,7 @@ function verify( GPv2Order.Data calldata order, bytes32 ctx, ICondition A programmatic order is defined by the following data: -``` +```solidity struct ConditionalOrderParams { IConditionalOrder handler; bytes32 salt; bytes staticData;} ``` @@ -180,7 +180,7 @@ struct ConditionalOrderParams { IConditionalOrder handler; bytes32 salt; This is the data passed to `ComposableCoW` via the `payload` parameter of `isValidSafeSignature`: -``` +```solidity struct PayloadStruct { bytes32[] proof; IConditionalOrder.ConditionalOrderParams params; bytes offchainInput;} ``` @@ -200,7 +200,7 @@ The proof data can be emitted on-chain, but it can also be retrieved from other The location field signals where this data can be retrieved. -``` +```solidity struct Proof { uint256 location; bytes data;} ``` @@ -230,7 +230,7 @@ struct Proof { uint256 location; bytes data;} It is expected that the proofs retrieved, excluding `PRIVATE` and `LOG` conform to a JSON schema: - ``` + ```json { "type": "object", "properties": { "proof": { "type": "array", "items": { "type": "string" } }, "params": { "type": "object", "properties": { "handler": { "type": "string" }, "salt": { "type": "string" }, "staticData": { "type": "string" } }, "required": [ "handler", "salt", "staticData" ] }, "offchainInput": { "type": "string" } "description": { "type": "string" } }, "required": [ "proof", "params", ]} ``` @@ -239,7 +239,7 @@ struct Proof { uint256 location; bytes data;} Using an `owner` as a key, the `roots` mapping stores the Merkle Tree root for the programmatic orders of that `owner`. -``` +```solidity mapping(address => bytes32) public roots; ``` @@ -247,7 +247,7 @@ mapping(address => bytes32) public roots; Using `owner, ctx` as a key, the `singleOrders` mapping stores the single orders for the programmatic orders of that `owner`. -``` +```solidity mapping(address => mapping(bytes32 => bool)) public singleOrders; ``` @@ -255,7 +255,7 @@ mapping(address => mapping(bytes32 => bool)) public singleOrders; Using `owner, ctx` as a key, the `cabinet` mapping stores the programmatic order-specific data for the programmatic orders of that `owner`. -``` +```solidity mapping(address => mapping(bytes32 => bytes32)) public cabinet; ``` @@ -263,7 +263,7 @@ mapping(address => mapping(bytes32 => bytes32)) public cabinet; Using `owner` as a key, the `swapGuards` mapping stores the swap guards for the programmatic orders of that `owner`. -``` +```solidity mapping(address => ISwapGuard) public swapGuards; ``` @@ -275,7 +275,7 @@ mapping(address => ISwapGuard) public swapGuards; A `safe` or `owner` calls the respective setter method to set the Merkle Tree root for their programmatic orders: -``` +```solidity function setRoot(bytes32 root, Proof calldata proof) public;function setRootWithContext( bytes32 root, Proof calldata proof, IValueFactory factory, bytes calldata data) external; ``` @@ -296,7 +296,7 @@ When a new merkle root is set, emits `MerkleRootSet(address indexed owner, bytes The `owner` calls the respective setter method to create a programmatic order: -``` +```solidity function create( IConditionalOrder.ConditionalOrderParams calldata params, bool dispatch) public;function createWithContext( IConditionalOrder.ConditionalOrderParams calldata params, IValueFactory factory, bytes calldata data, bool dispatch) external; ``` @@ -311,7 +311,7 @@ function create( IConditionalOrder.ConditionalOrderParams calldata params, The `owner` calls the `remove(bytes32 singleOrderHash)` method to remove a programmatic order: -``` +```solidity function remove(bytes32 singleOrderHash) external; ``` @@ -323,7 +323,7 @@ function remove(bytes32 singleOrderHash) external; The `owner` calls the `setSwapGuard(ISwapGuard guard)` method to set a swap guard for a programmatic order: -``` +```solidity function setSwapGuard(ISwapGuard swapGuard) external; ``` @@ -337,7 +337,7 @@ function setSwapGuard(ISwapGuard swapGuard) external; A watch-tower calls the `getTradeableOrderWithSignature` method to get a discrete order that is tradeable on CoW Protocol: -``` +```solidity function getTradeableOrderWithSignature( address owner, IConditionalOrder.ConditionalOrderParams calldata params, bytes calldata offchainInput, bytes32[] calldata proof) external view returns (GPv2Order.Data memory order, bytes memory signature); ``` diff --git a/cow-protocol/reference/contracts/periphery/cow-uid-generator.mdx b/cow-protocol/reference/contracts/periphery/cow-uid-generator.mdx index 0f61294..d0eae2d 100644 --- a/cow-protocol/reference/contracts/periphery/cow-uid-generator.mdx +++ b/cow-protocol/reference/contracts/periphery/cow-uid-generator.mdx @@ -18,7 +18,7 @@ This contract is a simple helper contract that: An interface for the [CoW Protocol settlement contract](/cow-protocol/reference/contracts/core/settlement). -``` +```solidity interface GPv2SettlementContract { function domainSeparator() external view returns (bytes32);} ``` @@ -32,7 +32,7 @@ Constructs an order, determines if it is a sell or buy order, then computes the Note: The digest being returned is only the order digest, not the actual order uid. In order to get the order uid this must be concatenated with the address of the order owner and the timestamp until which the order is valid ([reference](/cow-protocol/reference/contracts/core/settlement#orderuid)). -``` +```solidity getUid( address sellToken, address buyToken, address receiver, uint256 sellAmount, uint256 buyAmount, uint32 validTo, bytes32 appData, uint256 feeAmount, bool isSell, bool partiallyFillable)public view returns (bytes32 hash, bytes memory encoded) ``` diff --git a/cow-protocol/reference/contracts/periphery/eth-flow.mdx b/cow-protocol/reference/contracts/periphery/eth-flow.mdx index e9b40e2..d496bcf 100644 --- a/cow-protocol/reference/contracts/periphery/eth-flow.mdx +++ b/cow-protocol/reference/contracts/periphery/eth-flow.mdx @@ -68,7 +68,7 @@ If all verification steps succeed, Eth-flow affirmatively signs the digest with This struct contains the parts of a user intent that need to be stored on chain. -``` +```solidity struct OnchainData { address owner; uint32 validTo;} ``` @@ -85,7 +85,7 @@ For asserting the validity of the intent, the Eth-flow contract applies some ass This struct collects all parameters needed to describe a single user trade intent. -``` +```solidity struct Data { IERC20 buyToken; address receiver; uint256 sellAmount; uint256 buyAmount; bytes32 appData; uint256 feeAmount; uint32 validTo; bool partiallyFillable; int64 quoteId;} ``` @@ -102,7 +102,7 @@ struct Data { IERC20 buyToken; address receiver; uint256 sellAmount; The Eth-flow contract stores users' intents as a `mapping`: -``` +```solidity mapping(bytes32 => EthFlowOrder.OnchainData) public orders; ``` @@ -124,7 +124,7 @@ The key of the mapping is the intent digest. It is derived by computing the cont For when a user wants to sell `ETH`: -``` +```solidity function createOrder(EthFlowOrder.Data order) payable; ``` @@ -135,7 +135,7 @@ Eth-flow performs some checks when the user creates an intent. Failing any of th The intent parameters are used to compute the intent digest according to the [intent mapping](#user-intent--contract-intent). On successful execution of the transaction a new order is added to storage: -``` +```text intent digest -> (msg.sender, validTo) ``` @@ -143,7 +143,7 @@ intent digest -> (msg.sender, validTo) For when a user wants to invalidate an intent and return the `ETH` to the intent creator: -``` +```solidity function invalidateOrder(EthFlowOrder.Data order) ``` diff --git a/cow-protocol/reference/contracts/periphery/flashloans.mdx b/cow-protocol/reference/contracts/periphery/flashloans.mdx index 880c570..8bcabf8 100644 --- a/cow-protocol/reference/contracts/periphery/flashloans.mdx +++ b/cow-protocol/reference/contracts/periphery/flashloans.mdx @@ -9,7 +9,7 @@ This contract manages all flash-loan requests and is eventually responsible for ### Data Types and Storage -``` +```solidity interface IFlashLoanRouter { function flashLoanAndSettle(Loan.Data[] calldata loans, bytes calldata settlement) external; function borrowerCallBack(bytes calldata encodedLoansWithSettlement) external; function settlementContract() external returns (ICowSettlement); function settlementAuthentication() external returns (ICowAuthentication);} ``` @@ -19,7 +19,7 @@ interface IFlashLoanRouter { function flashLoanAndSettle(Loan.Data[] calldata Request all flash loan specified in the input and, after that, executes the specified settlement. -``` +```solidity flashLoanAndSettle(Loan.Data[] calldata loans, bytes calldata settlement) external; ``` @@ -32,7 +32,7 @@ flashLoanAndSettle(Loan.Data[] calldata loans, bytes calldata settlement) extern Once a borrower has received the proceeds of a flash loan, it calls back the router through this function. -``` +```solidity borrowerCallBack(bytes calldata encodedLoansWithSettlement) external; ``` @@ -44,7 +44,7 @@ borrowerCallBack(bytes calldata encodedLoansWithSettlement) external; The settlement contract supported by this router. This is the contract that will be called when the settlement is executed. -``` +```solidity settlementContract() external returns (ICowSettlement); ``` @@ -52,7 +52,7 @@ settlementContract() external returns (ICowSettlement); The settlement authenticator contract for CoW Protocol. This contract determines whether CoW protocol considers an address an eligible solver. -``` +```solidity settlementAuthentication() external returns (ICowAuthentication); ``` @@ -62,7 +62,7 @@ IBorrower is an abstraction around specific flash-loan providers. Each provider ### Data Types and Storage -``` +```solidity interface IBorrower { function flashLoanAndCallBack(address lender, IERC20 token, uint256 amount, bytes calldata callBackData) external; function approve(IERC20 token, address target, uint256 amount) external; function settlementContract() external view returns (ICowSettlement); function router() external view returns (IFlashLoanRouter);} ``` @@ -72,7 +72,7 @@ interface IBorrower { function flashLoanAndCallBack(address lender, IERC20 to Requests a flash loan with the specified parameters from the lender and, once the funds have been received, call back the router while passing through the specified custom data. The flash-loan repayment is expected to take place during the final settlement in the router. -``` +```solidity flashLoanAndCallBack(address lender, IERC20 token, uint256 amount, bytes calldata callBackData) external; ``` @@ -87,7 +87,7 @@ flashLoanAndCallBack(address lender, IERC20 token, uint256 amount, bytes calldat Approves the target address to spend the specified token on behalf of the Borrower up to the specified amount. -``` +```solidity approve(IERC20 token, address target, uint256 amount) external; ``` @@ -101,7 +101,7 @@ approve(IERC20 token, address target, uint256 amount) external; The settlement contract supported by this contract. -``` +```solidity settlementContract() external view returns (ICowSettlement); ``` @@ -109,7 +109,7 @@ settlementContract() external view returns (ICowSettlement); The router contract that manages this borrower contract. It will be called back once the flash-loan proceeds are received and is the only address that can trigger a flash loan request. -``` +```solidity router() external view returns (IFlashLoanRouter); ``` diff --git a/cow-protocol/reference/contracts/periphery/hooks-trampoline.mdx b/cow-protocol/reference/contracts/periphery/hooks-trampoline.mdx index d2da242..0926c45 100644 --- a/cow-protocol/reference/contracts/periphery/hooks-trampoline.mdx +++ b/cow-protocol/reference/contracts/periphery/hooks-trampoline.mdx @@ -53,7 +53,7 @@ Solvers may use the `HooksTrampoline` contract to execute hooks, as it offers a Hooks are passed to the trampoline contract as a `Hook` struct: -``` +```solidity struct Hook { address target; bytes callData; uint256 gasLimit;} ``` @@ -71,7 +71,7 @@ struct Hook { address target; bytes callData; uint256 gasLimit;} This function is called by the settlement contract during the course of settlement as an *interaction* to execute the user's hooks. -``` +```solidity function execute(Hook[] calldata hooks) external onlySettlement; ``` diff --git a/cow-protocol/reference/contracts/programmatic/twap.mdx b/cow-protocol/reference/contracts/programmatic/twap.mdx index 2463cb1..8b55532 100644 --- a/cow-protocol/reference/contracts/programmatic/twap.mdx +++ b/cow-protocol/reference/contracts/programmatic/twap.mdx @@ -1,11 +1,11 @@ --- title: "TWAP" -description: "A simple (TWAP) trade may be thought of as smaller trades happening every time interval, commencing at time . Additionally, it is possible to limit a part's validity of the order to a certain of time interval ." +description: "TWAP contract reference — time-weighted average price orders that split trades into parts at regular intervals on CoW Protocol." --- ## Data Structure -``` +```solidity struct Data { IERC20 sellToken; IERC20 buyToken; address receiver; // address(0) if the safe uint256 partSellAmount; // amount to sell in each part uint256 minPartLimit; // minimum buy amount in each part (limit) uint256 t0; uint256 n; uint256 t; uint256 span; bytes32 appData;} ``` diff --git a/cow-protocol/reference/core/auctions.mdx b/cow-protocol/reference/core/auctions.mdx index 17ee32f..9218edd 100644 --- a/cow-protocol/reference/core/auctions.mdx +++ b/cow-protocol/reference/core/auctions.mdx @@ -1,6 +1,6 @@ --- title: "Auction mechanism" -description: "CoW Protocol uses an implementation of the for executing trades. Within a given auction, the goal is to compute prices and traded amounts to maximize a well-defined function, subject to a fairness constraint." +description: "CoW Protocol's batch auction mechanism — how prices and traded amounts are computed to maximize welfare under fairness constraints." --- This can be formulated as a concrete optimization problem that needs to be solved, and this is where solvers come into play. Informally, a solver is an algorithm that takes as its input an auction instance and outputs a set of solutions (or bids), each corresponding to how it can best execute different combinations of orders in the batch. The solutions proposed by all solvers are then processed by the protocol, which selects (potentially multiple) winners according to a well-defined objective function. diff --git a/cow-protocol/reference/core/auctions/accounting.mdx b/cow-protocol/reference/core/auctions/accounting.mdx index 8a437b6..5ff968d 100644 --- a/cow-protocol/reference/core/auctions/accounting.mdx +++ b/cow-protocol/reference/core/auctions/accounting.mdx @@ -1,6 +1,7 @@ --- title: "Solver competition accounting process" -description: "There is an accounting process in place for the solver competition. It is performed separately on each chain. Currently, the execution of the accounting process takes place once a week for all chains the protocol operates on, and each accounting week starts on Tuesday at midnight UTC and concludes a week later at midnight UTC. This accounting process consists of the following:" +sidebarTitle: "Accounting Process" +description: "Weekly accounting process for the CoW Protocol solver competition — performance tracking, reward distribution, and penalties." --- * calculation of total rewards/penalties, as specified by the [mechanism](/cow-protocol/reference/core/auctions/rewards); @@ -58,7 +59,7 @@ In this section, we share a few details about how protocol/partner/network fees To use an example, suppose that we have a sell order that sells 1 WETH and the user receives 3000 USDC. When checking the api, we might see the following: -``` +```json "executedProtocolFees": [ { "policy": { "surplus": { "factor": 0.5, "maxVolumeFactor": 0.01 } }, "amount": "5000000", "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" } ] ``` diff --git a/cow-protocol/reference/core/auctions/competition-rules.mdx b/cow-protocol/reference/core/auctions/competition-rules.mdx index 9b59010..f90514d 100644 --- a/cow-protocol/reference/core/auctions/competition-rules.mdx +++ b/cow-protocol/reference/core/auctions/competition-rules.mdx @@ -1,6 +1,6 @@ --- title: "Solver competition rules" -description: "All solvers participating in the solver competition must abide by certain rules. In this section, we outline all these rules. They naturally split into three classes:" +description: "Rules that all CoW Protocol solvers must follow — covering fairness, execution quality, and protocol compliance requirements." --- 1. Those enforced explicitly by the [smart contract](#smart-contract) diff --git a/cow-protocol/reference/core/auctions/ebbo-rules.mdx b/cow-protocol/reference/core/auctions/ebbo-rules.mdx index afd9ba0..3e57869 100644 --- a/cow-protocol/reference/core/auctions/ebbo-rules.mdx +++ b/cow-protocol/reference/core/auctions/ebbo-rules.mdx @@ -1,6 +1,6 @@ --- title: "EBBO violations: details" -description: "In this section, we will elaborate on the details about what consistutes an EBBO violation, and what actions are taken by the DAO in case such a violation occurs. The content of this section is based on ." +description: "What constitutes an EBBO violation in the CoW Protocol solver competition and the enforcement actions taken by CoW DAO." --- ## Certificate of EBBO violation diff --git a/cow-protocol/reference/core/auctions/rewards.mdx b/cow-protocol/reference/core/auctions/rewards.mdx index 604f017..9dd948a 100644 --- a/cow-protocol/reference/core/auctions/rewards.mdx +++ b/cow-protocol/reference/core/auctions/rewards.mdx @@ -1,6 +1,6 @@ --- title: "Solver rewards" -description: "The protocol is currently subsidizing the solver competition on all chains it operates on, by rewarding solvers on a weekly basis (currently, every Tuesday) with rewards paid in COW. Solvers are rewarded based on their performance as solvers (i.e., when participating in the standard solver competition) as specified by , , , , and . Solver rewards for participating in the price estimation competition and providing quotes that are needed for the gas estimates and limit price computations of market orders are specified in , , , and ." +description: "How CoW Protocol rewards solvers weekly in COW tokens based on competition performance, quote accuracy, and participation." --- diff --git a/cow-protocol/reference/core/auctions/schema.mdx b/cow-protocol/reference/core/auctions/schema.mdx index df4d05b..a9fd86d 100644 --- a/cow-protocol/reference/core/auctions/schema.mdx +++ b/cow-protocol/reference/core/auctions/schema.mdx @@ -39,11 +39,11 @@ This key lists all tokens that appear in some order or AMM in the batch auction We now share two example token entries corresponding to [WETH](https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) and [USDC](https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48): -``` +```json "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": { "decimals": 18, "symbol": "WETH", "referencePrice": "1000000000000000000", "availableBalance": "590308372204674634", "trusted": true} ``` -``` +```json "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": { "decimals": 6, "symbol": "USDC", "referencePrice": "449666048539228625975640064", "availableBalance": "2625685411", "trusted": true} ``` @@ -105,7 +105,7 @@ This key maps to a list containing the set of orders in the batch. Each entry in An example Fill-or-Kill user limit buy order that sells 1000 [COW](https://etherscan.io/token/0xdef1ca1fb7fbcdc777520aa7f396b4e015f497ab) for at least 284.138335 USDC [USDC](https://etherscan.io/token/0xba100000625a3754423978a60c9317c58a424e3d) is given below: -``` +```json { "uid": "0xaa4eb7b4da14b93ce42963ac4085fd8eee4a04170b36454f9f8b91b91f69705387a04752e516548b0d5d4df97384c0b22b64917965a801c1", "sellToken": "0xdef1ca1fb7fbcdc777520aa7f396b4e015f497ab", "buyToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "sellAmount": "1000000000000000000000", "buyAmount": "284138335", "feeAmount": "0", "kind": "sell", "partiallyFillable": false, "class": "limit"} ``` @@ -119,7 +119,7 @@ This key is a single entry that is a string corresponding to a time stamp. This The response of a solver engine is a dictionary that contains all the information that is needed to execute the proposed solution. There is a single key, "solutions", that maps to a list of proposed solutions; this means that a solver can propose multiple solutions. The simplest possible response is the *empty solution*, which corresponds to the case where no orders are executed, and is described by the empty list as follows: -``` +```json {"solutions": []} ``` @@ -135,7 +135,7 @@ This key specifies the uniform clearing price vector (UCP) that governs the prop An example containing the computed prices of [USDC](https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48), [COW](https://etherscan.io/token/0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB) and [WETH](https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) is given below. -``` +```json "prices": { "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": "389193245742363509576247472", "0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB": "137298311435590", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": "1000000000000000000"} ``` @@ -171,7 +171,7 @@ We now discuss some additional functionality that solvers are allowed to use. Si If both conditions are satisfied, a solver can set the `internalize` flag to `true` in order to internalize the interaction: -``` +```json "internalize": true ``` diff --git a/cow-protocol/reference/core/auctions/the-problem.mdx b/cow-protocol/reference/core/auctions/the-problem.mdx index a23faa5..222fd91 100644 --- a/cow-protocol/reference/core/auctions/the-problem.mdx +++ b/cow-protocol/reference/core/auctions/the-problem.mdx @@ -1,6 +1,7 @@ --- title: "What is solving? A mathematical, high-level description" -description: "At a high level, a solver is an algorithm that takes as inputs the orders that are valid for an auction, the state of the liquidity sources that the solver can access, the rules set by the protocol (including those specifying the protocol fees), and returns one or multiple solutions, where a solution selects a subset of the orders valid in an auction and specifies feasible in and out amounts for each of those orders. The solutions proposed by each solver during a given auction are the outcome of a two-step optimization problem: optimal routing and then optimal bidding." +sidebarTitle: "What is Solving?" +description: "Mathematical overview of CoW Protocol solving — how solvers optimize order routing and bidding in batch auctions." --- In this section, we describe mathematically the different components of the "solving" problem. We discuss optimal routing and optimal bidding [in the solvers' strategy section](/cow-protocol/reference/core/auctions/rewards#solvers-strategy). diff --git a/cow-protocol/reference/core/definitions.mdx b/cow-protocol/reference/core/definitions.mdx index 884430d..f2cf731 100644 --- a/cow-protocol/reference/core/definitions.mdx +++ b/cow-protocol/reference/core/definitions.mdx @@ -1,5 +1,6 @@ --- title: "Definitions" +description: "Glossary of key CoW Protocol terms — orders, intents, batch auctions, solvers, settlements, and other core concepts." --- #### Intent diff --git a/cow-protocol/reference/core/intents/app-data.mdx b/cow-protocol/reference/core/intents/app-data.mdx index a4ecf6b..281f453 100644 --- a/cow-protocol/reference/core/intents/app-data.mdx +++ b/cow-protocol/reference/core/intents/app-data.mdx @@ -15,7 +15,7 @@ The AppData document is a JSON file that follows a specific JSON [schema](#schem An example of an AppData document is: -``` +```json { "version": "1.6.0", "appCode": "MyAwesomeUi", "metadata": { "referral": "0x1234567890123456789012345678901234567890" }} ``` diff --git a/cow-protocol/reference/core/intents/hooks.mdx b/cow-protocol/reference/core/intents/hooks.mdx index 14f236a..a79130a 100644 --- a/cow-protocol/reference/core/intents/hooks.mdx +++ b/cow-protocol/reference/core/intents/hooks.mdx @@ -1,6 +1,6 @@ --- title: "Hooks" -description: "The allows users to request the solvers to execute user-defined Ethereum calls (also known as an \"inner/internal transaction\") before and after the execution of an order in a settlement." +description: "CoW Protocol hooks — user-defined Ethereum calls executed before and after order settlement via the HooksTrampoline contract." --- ## Specification diff --git a/cow-protocol/reference/core/rate-limits.mdx b/cow-protocol/reference/core/rate-limits.mdx index d1397bc..41834d7 100644 --- a/cow-protocol/reference/core/rate-limits.mdx +++ b/cow-protocol/reference/core/rate-limits.mdx @@ -59,7 +59,7 @@ When you exceed a rate limit, the API responds with: - **HTTP 429 Too Many Requests** status code - **`Retry-After`** header indicating the number of seconds until your next request will be accepted -``` +```http HTTP/1.1 429 Too Many Requests Retry-After: 2 Content-Type: application/json diff --git a/cow-protocol/reference/core/signing-schemes.mdx b/cow-protocol/reference/core/signing-schemes.mdx index a4b6772..b4af88a 100644 --- a/cow-protocol/reference/core/signing-schemes.mdx +++ b/cow-protocol/reference/core/signing-schemes.mdx @@ -1,6 +1,6 @@ --- title: "Signing schemes" -description: "As CoW Protocol handles user's orders that were provided off-chain, the authenticity of a user's order needs to be asserted. Authenticity is asserted by the user their order. A user may be an EOA or a smart contract." +description: "Signing schemes in CoW Protocol — how order authenticity is verified for EOA wallets (EIP-712) and smart contracts (ERC-1271)." --- ## Order digest @@ -13,7 +13,7 @@ Replay protection for the signing schemes is achieved by using an [`EIP-712`](ht When computing the domain separator, the following parameters are used: -``` +```javascript { name: "Gnosis Protocol", version: "v2", chainId: /* chain ID for the current network: e.g. 1 for mainnet */, verifyingContract: "0x9008D19f58AAbD9eD0D60971565AA8510560ab41"} ``` @@ -33,7 +33,7 @@ The actual domain separator is the result of hashing the previous `EIP712Domain` To encode the order into the order digest, the [`EIP-712`](https://eips.ethereum.org/EIPS/eip-712#specification) specification is used: -``` +```text orderDigest = keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(orderStruct)) ``` @@ -46,7 +46,7 @@ The components are: * `hashStruct`, the [identically named function in the EIP-712 standard](https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct) - ``` + ```text hashStruct(typeHash, data) = keccak256(typeHash ‖ encodeData(data)) ``` @@ -66,7 +66,7 @@ Phew, that was a lot of hashing! Feeling dizzy? Don't worry, we got you covered. The [`@cowprotocol/contracts`](https://www.npmjs.com/package/@cowprotocol/contracts) package provides a function to compute the order digest for you: -``` +```typescript import { Order, OrderBalance, OrderKind, domain, hashOrder} from "@cowprotocol/contracts"// Define an orderconst order: Order = { sellToken: "0x6b175474e89094c44da98b954eedeac495271d0f", // dai buyToken: "0xdef1ca1fb7fbcdc777520aa7f396b4e015f497ab", // cow sellAmount: "10000000000000000000000000", // 10m dai buyAmount: "10000", // 10k cow validTo: 1704067200, appData: "0xc85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf4", // keccak256("cow") feeAmount: "0", kind: OrderKind.SELL, partiallyFillable: false, sellTokenBalance: OrderBalance.ERC20, buyTokenBalance: OrderBalance.ERC20,};// hash the order to generate the order digestconst digest = hashOrder(domain(1, "0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), order);// output the digestconsole.log(`Order digest: ${digest}`) ``` @@ -109,7 +109,7 @@ This signature type is the most commonly supported signing mechanism for EOAs. The signature is computed as: -``` +```text signature = ethSign(orderDigest) ``` @@ -126,7 +126,7 @@ This signing method, also known as typed structured data signing, is the recomme The signature is computed as: -``` +```text signature = ecdsaSign(orderDigest) ``` @@ -145,7 +145,7 @@ This signing mechanism is the only option that can be used by smart contracts to In order to support smart-contract orders, the trading smart contract (the user) must implement the [EIP-1271](https://eips.ethereum.org/EIPS/eip-1271#specification) interface. -``` +```text signature = eip1271Signature ``` @@ -159,7 +159,7 @@ The components are: For an order to be accepted, the `eip1271Signature` must be valid for the `orderDigest` message, that is in Solidity: -``` +```solidity isValidSignature(orderDigest, eip1271Signature) == MAGICVALUE ``` @@ -169,7 +169,7 @@ This is the only signing method that supports both EOA and smart-contract trader Together with submitting a `PreSign` order, the user must submit the order on-chain. This is done by calling the settlement contract `setPreSignature` function: -``` +```solidity setPreSignature(orderUid, true); ``` @@ -180,7 +180,7 @@ The components are: The signature is an empty `bytes` string: -``` +```text signature = 0x ``` diff --git a/cow-protocol/reference/core/tokens.mdx b/cow-protocol/reference/core/tokens.mdx index cd1cdfc..b29495b 100644 --- a/cow-protocol/reference/core/tokens.mdx +++ b/cow-protocol/reference/core/tokens.mdx @@ -1,6 +1,6 @@ --- title: "Supported tokens" -description: "CoW Protocol supports tokens. However, not all token contracts are created equal, despite the idea of a standard interface. Some contracts introduce issues, such as fee on transfer or lockup periods, which make them unsuitable." +description: "Which ERC-20 tokens CoW Protocol supports, and known issues with non-standard contracts like fee-on-transfer tokens." --- ## Requirements diff --git a/cow-protocol/reference/sdks/cow-sdk.mdx b/cow-protocol/reference/sdks/cow-sdk.mdx index c9f2c6f..2a7d4e2 100644 --- a/cow-protocol/reference/sdks/cow-sdk.mdx +++ b/cow-protocol/reference/sdks/cow-sdk.mdx @@ -1,5 +1,6 @@ --- title: "CoW SDK" +description: "Reference for the CoW SDK — the official TypeScript library for interacting with the CoW Protocol orderbook and trading." hidden: true --- @@ -56,11 +57,11 @@ The SDK supports all CoW Protocol enabled networks: ### Installation -``` +```bash pnpm add @cowprotocol/cow-sdk ``` -``` +```bash yarn add @cowprotocol/cow-sdk ``` @@ -91,25 +92,25 @@ The versions are 99% backward compatible. The only difference is that in v7 you **Before (v6):** -``` +```typescript import { SupportedChainId, TradingSdk, MetadataApi, OrderBookApi } from '@cowprotocol/cow-sdk'const options = {}const sdk = new TradingSdk({ chainId: SupportedChainId.SEPOLIA, appCode: 'YOUR_APP_CODE',}, options) ``` **After (v7):** -``` +```typescript import { SupportedChainId, OrderKind, TradeParameters, TradingSdk } from '@cowprotocol/cow-sdk'import { ViemAdapter } from '@cowprotocol/sdk-viem-adapter'import { createPublicClient, http, privateKeyToAccount } from 'viem'import { sepolia } from 'viem/chains'// NEW: Instantiate and set adapterconst adapter = new ViemAdapter({ provider: createPublicClient({ chain: sepolia, transport: http('YOUR_RPC_URL') }), // You can also set `walletClient` instead of `signer` using `useWalletClient` from wagmi signer: privateKeyToAccount('YOUR_PRIVATE_KEY' as `0x${string}`)})const options = {}const sdk = new TradingSdk({ chainId: SupportedChainId.SEPOLIA, appCode: 'YOUR_APP_CODE',}, options, adapter) ``` Most other packages (e.g., `MetadataApi` or `BridgingSdk`) have a parameter to set an adapter. You can also set an adapter using `setGlobalAdapter`: -``` +```typescript import { setGlobalAdapter, CowShedSdk } from '@cowprotocol/cow-sdk'const adapter = {...}// Set global adaptersetGlobalAdapter(adapter)const cowShedSdk = new CowShedSdk() ``` You will likely also need to bind the SDK to your app's account state. When the account or network changes in the app/wallet, it should be updated in the SDK as well. Here's an example for `WAGMI` (see `examples/react/wagmi`): -``` +```typescript import { useAccount, usePublicClient, useWalletClient } from 'wagmi'import { useEffect, useState } from 'react'import { ViemAdapter, ViemAdapterOptions } from '@cowprotocol/sdk-viem-adapter'import { tradingSdk } from '../cowSdk.ts'import { setGlobalAdapter } from '@cowprotocol/cow-sdk'export function useBindCoWSdkToWagmi(): boolean { const { chainId } = useAccount() const { data: walletClient } = useWalletClient() const publicClient = usePublicClient() const [isSdkReady, setIsSdkReady] = useState(false) /** * Sync Trading SDK with wagmi account state (chainId and signer) */ useEffect(() => { if (!walletClient || !chainId) return setGlobalAdapter( new ViemAdapter({ provider: publicClient, walletClient, } as unknown as ViemAdapterOptions), ) tradingSdk.setTraderParams({ chainId }) setIsSdkReady(true) }, [publicClient, walletClient, chainId]) return isSdkReady} ``` @@ -122,7 +123,7 @@ This example demonstrates the main use case of creating a swap and shows how to: * Adjust swap parameters * Sign and post an order -``` +```typescript import { SupportedChainId, OrderKind, TradeParameters, TradingSdk } from '@cowprotocol/cow-sdk'import { ViemAdapter } from '@cowprotocol/sdk-viem-adapter'import { createPublicClient, http, privateKeyToAccount } from 'viem'import { sepolia } from 'viem/chains'// EthersV5Adapter and EthersV6Adapter are also available// @cowprotocol/sdk-ethers-v5-adapter, @cowprotocol/sdk-ethers-v6-adapterconst adapter = new ViemAdapter({ provider: createPublicClient({ chain: sepolia, transport: http('YOUR_RPC_URL') }), // You can also set `walletClient` instead of `signer` using `useWalletClient` from wagmi signer: privateKeyToAccount('YOUR_PRIVATE_KEY' as `0x${string}`)})const sdk = new TradingSdk({ chainId: SupportedChainId.SEPOLIA, appCode: 'YOUR_APP_CODE',}, {}, adapter)const parameters: TradeParameters = { kind: OrderKind.SELL, sellToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', sellTokenDecimals: 18, buyToken: '0x0625afb445c3b6b7b929342a04a22599fd5dbb59', buyTokenDecimals: 18, amount: '120000000000000',}// Get quoteconst { quoteResults, postSwapOrderFromQuote } = await sdk.getQuote(parameters)const buyAmount = quoteResults.amountsAndCosts.afterSlippage.buyAmount// Verify amountif (confirm(`You will receive at least: ${buyAmount}. Proceed?`)) { // Sign and post order const orderId = await postSwapOrderFromQuote() console.log('Order created, ID:', orderId)} ``` @@ -134,13 +135,13 @@ For more advanced use cases, you can use additional parameters such as `receiver The SDK automatically includes UTM tracking in all orders to attribute trading volume to developers. Default parameters: -``` +```javascript { utmSource: 'cowmunity', utmMedium: 'cow-sdk@7.1.6', // SDK version utmCampaign: 'developer-cohort', utmContent: '', utmTerm: 'js'} ``` **Customize or disable** via `advancedSettings.appData.metadata.utm`: -``` +```typescript // Custom UTMawait sdk.getQuote(parameters, { appData: { metadata: { utm: { utmContent: 'my-integration-v2' } } }})// Disable UTMawait sdk.getQuote(parameters, { appData: { metadata: { utm: {} } }}) ``` @@ -152,7 +153,7 @@ The SDK automatically includes UTM tracking in all orders to attribute trading v Partners can use authenticated API access with higher rate limits via the Partner API gateway. Pass your API key when creating an `OrderBookApi` instance: -``` +```typescript import { OrderBookApi, SupportedChainId } from '@cowprotocol/cow-sdk'const orderBookApi = new OrderBookApi({ chainId: SupportedChainId.MAINNET, apiKey: 'your-partner-api-key',}) ``` @@ -172,7 +173,7 @@ The CoW SDK supports multiple blockchain adapters to work with different Web3 li ### Installation -``` +```bash # For ethers v6pnpm add @cowprotocol/sdk-ethers-v6-adapter ethers# For ethers v5pnpm add @cowprotocol/sdk-ethers-v5-adapter ethers@^5.7.0# For viempnpm add @cowprotocol/sdk-viem-adapter viem ``` @@ -180,19 +181,19 @@ The CoW SDK supports multiple blockchain adapters to work with different Web3 li #### EthersV6Adapter -``` +```typescript import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter'import { JsonRpcProvider, Wallet } from 'ethers'const provider = new JsonRpcProvider('YOUR_RPC_URL')const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)const adapter = new EthersV6Adapter({ provider, signer: wallet }) ``` #### EthersV5Adapter -``` +```typescript import { EthersV5Adapter } from '@cowprotocol/sdk-ethers-v5-adapter'import { ethers } from 'ethers'const provider = new ethers.providers.JsonRpcProvider('YOUR_RPC_URL')const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider)const adapter = new EthersV5Adapter({ provider, signer: wallet }) ``` #### ViemAdapter -``` +```typescript import { ViemAdapter } from '@cowprotocol/sdk-viem-adapter'import { http, createPublicClient, privateKeyToAccount } from 'viem'import { sepolia } from 'viem/chains'const account = privateKeyToAccount('YOUR_PRIVATE_KEY' as `0x${string}`)const transport = http('YOUR_RPC_URL')const provider = createPublicClient({ chain: sepolia, transport })// You can also set `walletClient` instead of `signer` using `useWalletClient` from wagmiconst adapter = new ViemAdapter({ provider, signer: account }) ``` @@ -211,6 +212,6 @@ We will perform the following operations: > Try it live: [https://codesandbox.io/p/devbox/cow-sdk-example-forked-x63k52](https://codesandbox.io/p/devbox/cow-sdk-example-forked-x63k52) -``` +```typescript import { OrderBookApi, OrderSigningUtils, SupportedChainId, OrderQuoteSideKindSell, SigningScheme, setGlobalAdapter } from '@cowprotocol/cow-sdk'import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter'import { JsonRpcProvider, Wallet } from 'ethers'const account = 'YOUR_WALLET_ADDRESS'const chainId = 100 // Gnosis Chainconst provider = new JsonRpcProvider('YOUR_RPC_URL')const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)const adapter = new EthersV6Adapter({ provider, signer: wallet })setGlobalAdapter(adapter)const receiver = accountconst quoteRequest = { sellToken: '0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1', // WETH on Gnosis Chain buyToken: '0x9c58bacc331c9aa871afd802db6379a98e80cedb', // GNO on Gnosis Chain from: account, receiver, sellAmountBeforeFee: (0.4 * 10 ** 18).toString(), // 0.4 WETH kind: OrderQuoteSideKindSell.SELL,}const orderBookApi = new OrderBookApi({ chainId: SupportedChainId.GNOSIS_CHAIN })async function main() { const { quote } = await orderBookApi.getQuote(quoteRequest) const orderData = { ...quote, // Add fee to sellAmount for sell orders sellAmount: (BigInt(quote.sellAmount) + BigInt(quote.feeAmount)).toString(), receiver, feeAmount: "0", }; const orderSigningResult = await OrderSigningUtils.signOrder(orderData, chainId, adapter.signer) const orderId = await orderBookApi.sendOrder({ ...orderData, ...orderSigningResult, signingScheme: SigningScheme.EIP712, }) const order = await orderBookApi.getOrder(orderId) const trades = await orderBookApi.getTrades({ orderId }) const orderCancellationSigningResult = await OrderSigningUtils.signOrderCancellations([orderId], chainId, adapter.signer) const cancellationResult = await orderBookApi.sendSignedOrderCancellations({ ...orderCancellationSigningResult, orderUids: [orderId], }) console.log('Results:', { orderId, order, trades, orderCancellationSigningResult, cancellationResult })} ``` diff --git a/cow-protocol/tutorials/cow-amm-deployer.mdx b/cow-protocol/tutorials/cow-amm-deployer.mdx index c1e8a83..9760cef 100644 --- a/cow-protocol/tutorials/cow-amm-deployer.mdx +++ b/cow-protocol/tutorials/cow-amm-deployer.mdx @@ -1,6 +1,6 @@ --- title: "CoW AMM Deployer" -description: "The is a user-friendly Safe App that simplifies the process of deploying and managing (Automated Market Makers) from Safe wallets. It enables users without programming skills to take advantage of the benefits of CoW AMM." +description: "Tutorial for deploying and managing CoW AMM pools using the CoW AMM Deployer Safe App — no programming required." --- The app was developed by [bleu](https://github.com/bleu-fi) with sponsorship from the [CoW Grants DAO](https://grants.cow.fi/). diff --git a/cow-protocol/tutorials/cow-explorer/address.mdx b/cow-protocol/tutorials/cow-explorer/address.mdx index 6dcf44b..806fed3 100644 --- a/cow-protocol/tutorials/cow-explorer/address.mdx +++ b/cow-protocol/tutorials/cow-explorer/address.mdx @@ -1,6 +1,6 @@ --- title: "By user address" -description: "A user may want to see the details of all orders that they have placed. When searching for their address, they will be presented with an overview of all orders that they have placed." +description: "View all your CoW Protocol orders by searching your wallet address in CoW Explorer — open, filled, and cancelled orders." --- For example, below the user has searched for their address [`0x2557...3af7`](https://explorer.cow.fi/gc/address/0x2557ed03e34f0141722a643589f007836a683af7) that contains multiple orders that were placed on CoW Protocol on Gnosis Chain: diff --git a/cow-protocol/tutorials/cow-explorer/batch-auction.mdx b/cow-protocol/tutorials/cow-explorer/batch-auction.mdx index 1bbe93d..ee25e4f 100644 --- a/cow-protocol/tutorials/cow-explorer/batch-auction.mdx +++ b/cow-protocol/tutorials/cow-explorer/batch-auction.mdx @@ -1,6 +1,6 @@ --- title: "By batch auction" -description: "A batch auction is settled on-chain as a single transaction, and it is this transaction hash that is used to query the details of the batch auction. By simply searching for the transaction hash, the user will be presented with an overview of the batch auction." +description: "Inspect a CoW Protocol batch auction settlement by searching its transaction hash in CoW Explorer." --- The batch auction details page provides: diff --git a/cow-protocol/tutorials/cow-explorer/order.mdx b/cow-protocol/tutorials/cow-explorer/order.mdx index 7acfe8a..3f2f2b7 100644 --- a/cow-protocol/tutorials/cow-explorer/order.mdx +++ b/cow-protocol/tutorials/cow-explorer/order.mdx @@ -1,6 +1,6 @@ --- title: "By order" -description: "A user may want to see the details of a specific order that they have placed. They can search for this order by its unique identifier, the . This identifier is returned when an order is placed and can be used to query the details of the order." +description: "Look up a specific CoW Protocol order by its unique order UID in CoW Explorer to view status and execution details." --- diff --git a/cow-protocol/tutorials/quickstart-curl.mdx b/cow-protocol/tutorials/quickstart-curl.mdx index d8abc3c..332c563 100644 --- a/cow-protocol/tutorials/quickstart-curl.mdx +++ b/cow-protocol/tutorials/quickstart-curl.mdx @@ -332,7 +332,7 @@ curl -X POST "https://api.cow.fi/sepolia/api/v1/orders" \ A successful response returns the **order UID** as a plain string: -``` +```text "0x2a3f1c9e8b7d6a5e4f3c2b1a09d8e7f6c5b4a3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2" ``` diff --git a/cow-protocol/tutorials/solvers/local_test.mdx b/cow-protocol/tutorials/solvers/local_test.mdx index 3a97f5e..6c1a7ef 100644 --- a/cow-protocol/tutorials/solvers/local_test.mdx +++ b/cow-protocol/tutorials/solvers/local_test.mdx @@ -1,6 +1,7 @@ --- title: "Locally testing a solver with the CoW Protocol orderflow" -description: "CoW Protocol infrastructure is a lot of services running together in herd harmony, which is a bit intimidating at the beginning. Before proceeding, it would be advisable to read the architectural overview to get a better understanding of how CoW Protocol works and its entities." +sidebarTitle: "Local Solver Testing" +description: "Set up a local environment to test and debug a CoW Protocol solver against real orderflow from the protocol infrastructure." --- In order to test a solver against CoW Protocol's orderflow, one needs to locally run the following components @@ -17,7 +18,7 @@ The repository where all the backend services can be found is this one: [https:/ For the autopilot, we run -``` +```bash cargo run --bin autopilot -- --native-price-estimators "Driver|baseline|http://driver/baseline" --skip-event-sync true --node-url $NODE_URL --shadow https://barn.api.cow.fi/mainnet --drivers "mysolver1|http://localhost:11088|0x0000000000000000000000000000000000000000|0" ``` @@ -29,7 +30,7 @@ where one needs to set the NODE\_URL appropriately (e.g., a free Infura endpoint For the driver, we run -``` +```bash cargo run -p driver -- --config driver.config.toml --ethrpc $NODE_URL ``` diff --git a/cow-protocol/tutorials/token-approvals.mdx b/cow-protocol/tutorials/token-approvals.mdx index b6169dc..e285763 100644 --- a/cow-protocol/tutorials/token-approvals.mdx +++ b/cow-protocol/tutorials/token-approvals.mdx @@ -1,5 +1,6 @@ --- title: "Token Approvals & GPv2VaultRelayer" +sidebarTitle: "Token Approvals" description: "How to approve tokens for trading on CoW Protocol — standard approvals, gasless approvals, and per-chain VaultRelayer addresses." --- diff --git a/cow-py/api/contracts.mdx b/cow-py/api/contracts.mdx index 2cbeb5a..5300dd3 100644 --- a/cow-py/api/contracts.mdx +++ b/cow-py/api/contracts.mdx @@ -1,6 +1,6 @@ --- title: "Contracts API" -description: "Order creation, signing, and domain utilities" +description: "CoW Protocol Python SDK contracts API — order creation, EIP-712 signing, and domain separation utilities." --- ## Order diff --git a/cow-py/api/subgraph.mdx b/cow-py/api/subgraph.mdx index 078e991..894891a 100644 --- a/cow-py/api/subgraph.mdx +++ b/cow-py/api/subgraph.mdx @@ -1,6 +1,6 @@ --- title: "SubgraphClient" -description: "Client for querying CoW Protocol subgraph data" +description: "Python SDK SubgraphClient for querying CoW Protocol on-chain data — trades, settlements, and order history." --- The `SubgraphClient` class provides methods to query historical data from the CoW Protocol subgraph, including trading volumes, totals, and other aggregated metrics. diff --git a/cow-py/installation.mdx b/cow-py/installation.mdx index 13844ed..94da843 100644 --- a/cow-py/installation.mdx +++ b/cow-py/installation.mdx @@ -1,6 +1,6 @@ --- title: "Installation" -description: "Learn how to install the CoW Protocol Python SDK" +description: "Install cow-py, the official CoW Protocol Python SDK — pip setup, optional dependencies, and environment configuration." --- ## Prerequisites diff --git a/cow-sdk/guides/erc1271-signing.mdx b/cow-sdk/guides/erc1271-signing.mdx index 925856b..a59e913 100644 --- a/cow-sdk/guides/erc1271-signing.mdx +++ b/cow-sdk/guides/erc1271-signing.mdx @@ -1,5 +1,6 @@ --- title: "ERC-1271 Signing (Custom Contracts)" +sidebarTitle: "ERC-1271 Signing" description: "How to place CoW Protocol orders from custom smart contracts using ERC-1271 off-chain signatures — for vaults, DAOs, treasuries, and any non-EOA wallet." --- diff --git a/cow-swap/features.mdx b/cow-swap/features.mdx index e7e9255..019df40 100644 --- a/cow-swap/features.mdx +++ b/cow-swap/features.mdx @@ -1,6 +1,6 @@ --- title: "CoW Swap" -description: "CoW Swap is the first interface built on top of CoW Protocol and serves as a reference implementation for developers wishing to build user interfaces for CoW Protocol." +description: "CoW Swap is the first trading interface built on CoW Protocol — a reference implementation for building on the protocol." --- The interface may look very familiar to the average DeFi user, as it is originally based on the [Uniswap](https://uniswap.org) interface. This provides users with a familiar user experience, while benefiting from the unique features of CoW Protocol. diff --git a/cow-swap/hooks/hook-dapp.mdx b/cow-swap/hooks/hook-dapp.mdx index a9ade83..a0bea61 100644 --- a/cow-swap/hooks/hook-dapp.mdx +++ b/cow-swap/hooks/hook-dapp.mdx @@ -1,5 +1,6 @@ --- title: "CoW Hook dApp" +description: "Build a CoW Hook dApp to extend CoW Swap orders with custom pre- and post-trade actions using the hooks framework." --- ### [What are CoW Hooks?](/cow-protocol/explanation/order-types/cow-hooks) @@ -37,11 +38,11 @@ CoW Hook dApp is a web application that communicates with CoW Swap using [post-m ### Install -``` +```bash yarn add @cowprotocol/hook-dapp-lib ``` -``` +```bash npm install @cowprotocol/hook-dapp-lib ``` diff --git a/cow-swap/hooks/post-hook-examples.mdx b/cow-swap/hooks/post-hook-examples.mdx index 6d19a6f..b9875fb 100644 --- a/cow-swap/hooks/post-hook-examples.mdx +++ b/cow-swap/hooks/post-hook-examples.mdx @@ -11,7 +11,7 @@ Post-hooks let you chain actions after a swap settles — stake received tokens, ## How Post-Hooks Work -``` +```text 1. Order settles → tokens sent to receiver 2. Post-hook executes in HooksTrampoline context diff --git a/cow-swap/reference/custom-links.mdx b/cow-swap/reference/custom-links.mdx index 9404bb5..6e9d681 100644 --- a/cow-swap/reference/custom-links.mdx +++ b/cow-swap/reference/custom-links.mdx @@ -1,6 +1,6 @@ --- title: "Custom Links" -description: "CoW Swap supports URL query parameters to allow anyone to create a custom link for sharing a specific trade with a friend or on social media, or for creating a custom link to a specific trade for your own use." +description: "Create custom CoW Swap trade links with URL parameters to pre-fill token pairs, amounts, and settings for sharing." --- ### Examples diff --git a/cow-swap/tutorials/dca-twap.mdx b/cow-swap/tutorials/dca-twap.mdx index c6b2d08..eed933d 100644 --- a/cow-swap/tutorials/dca-twap.mdx +++ b/cow-swap/tutorials/dca-twap.mdx @@ -1,5 +1,6 @@ --- title: "Dollar-Cost Averaging with TWAP" +sidebarTitle: "DCA with TWAP" description: "Build a dollar-cost averaging strategy using TWAP orders to accumulate tokens over time" --- @@ -9,7 +10,7 @@ Dollar-cost averaging (DCA) is a strategy where you invest a fixed amount at reg A TWAP order splits your total sell amount into `N` equal parts, each executed at a fixed interval: -``` +```text Total: 10,000 USDC → WETH over 10 hours ├── Part 1: 1,000 USDC → WETH (hour 0) ├── Part 2: 1,000 USDC → WETH (hour 1) @@ -247,7 +248,7 @@ print(f"DCA cancelled: {tx_hash.hex()}") The `buy_amount` parameter serves as price protection — it sets the **minimum total** amount of buy tokens you'll receive across all parts. Each individual part gets a proportional minimum: -``` +```text Total buy_amount: 3 WETH (for 10,000 USDC across 10 parts) Per-part minimum: 0.3 WETH (for 1,000 USDC) Effective max price: ~3,333 USDC/WETH per part diff --git a/cow-swap/tutorials/flash-loans.mdx b/cow-swap/tutorials/flash-loans.mdx index 68fe7b1..f1c0d34 100644 --- a/cow-swap/tutorials/flash-loans.mdx +++ b/cow-swap/tutorials/flash-loans.mdx @@ -49,13 +49,13 @@ We need to define a [pre-hook](/cow-protocol/reference/core/intents/hooks) to re As part of the settlement, we want to call the [`repay` function on Aave's pool](https://aave.com/docs/developers/smart-contracts/pool#write-methods-repay): -``` +```solidity function repay( address asset, uint256 amount, uint256 interestRateMode, address onBehalfOf) public virtual override returns (uint256) ``` The following Typescript code generates the corresponding function data using [`viem`](https://viem.sh/): -``` +```typescript const repayTxData = encodeFunctionData({ abi, // ABI definition for the repay function functionName: 'repay', args: [ '0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0', // asset: USDT '5000000000', // amount: 5,000 USDT (USDT has 6 decimals) 2, // interestRateMode: 2 for variable '0x35eD9A9D1122A1544e031Cc92fCC7eA599e28D9C', // onBehalfOf: Safe address ] }); ``` @@ -63,7 +63,7 @@ The `repay` call (as well as the `withdraw` call later on) must be executed as a To enable this, the pre-hook defines a transaction that will be sent to the Safe wallet. The Safe then executes the actual repay call to the Aave pool. The transaction can be built using the [Safe Protocol Kit](https://docs.safe.global/sdk/protocol-kit) as shown below: -``` +```typescript const repaySafeTxData: SafeTransactionDataPartial = { to: '0x6Ae43d3271ff6888e7Fc43Fd7321a503ff738951', // Aave pool address in Sepolia value: '0', data: repayTxData, // created previously operation: OperationType.Call, nonce, // current Safe nonce + 1 }; const safeTransaction = await safe.createTransaction({ transactions: [repaySafeTxData] }); const signedSafeTransaction = await safe.signTransaction(safeTransaction, SigningMethod.ETH_SIGN); const encodedSafeTransaction = await safe.getEncodedTransaction(signedSafeTransaction); ``` @@ -77,19 +77,19 @@ We need to define another pre-hook to withdraw 400,000 USDC from the Aave deposi For this, we need to call the [`withdraw` function on Aave's pool](https://aave.com/docs/developers/smart-contracts/pool#write-methods-withdraw): -``` +```solidity function withdraw( address asset, uint256 amount, address to) public virtual override returns (uint256) ``` The corresponding function data can be created as follows: -``` +```typescript const txData = encodeFunctionData({ abi, // ABI definition for the withdraw function functionName: 'withdraw', args: [ '0x94a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c8', // asset: USDC '400000000000', // amount: 400,000 USDC (USDC has 6 decimals) '0x35eD9A9D1122A1544e031Cc92fCC7eA599e28D9C', // to: Safe address ] }); ``` Like in the previous section, the `withdraw` call will be executed during the order settlement process via a Safe transaction, and can be built with: -``` +```typescript const safeTxData: SafeTransactionDataPartial = { to: '0x6Ae43d3271ff6888e7Fc43Fd7321a503ff738951', // Aave pool address in Sepolia value: '0', data: txData, // created previously operation: OperationType.Call, nonce, // current Safe nonce + 2 } const safeTransaction = await safe.createTransaction({ transactions: [safeTxData] }) const signedSafeTransaction = await safe.signTransaction(safeTransaction, SigningMethod.ETH_SIGN); const encodedSafeTransaction = await safe.getEncodedTransaction(signedSafeTransaction); return encodedSafeTransaction; ``` @@ -101,13 +101,13 @@ Like in the previous section, the `withdraw` call will be executed during the or With both the `repay` and `withdraw` pre-hooks in place, we can now build the metadata of our order: -``` +```typescript const appData = { metadata: { flashloan: { lender: config.AAVE_POOL_ADDRESS, token: USDT_ADDRESS, amount: "5000000000" // 5,000 USDT }, hooks: { pre: [ { target: config.SAFE_ADDRESS, value: "0", callData: repayTx, // repay pre-hook data gasLimit: "1000000" }, { target: config.SAFE_ADDRESS, value: "0", callData: withdrawTx, // withdraw pre-hook data gasLimit: "1000000" } ], "post": [] }, signer: config.SAFE_ADDRESS, }, }; ``` To programmatically create and submit a CoW Swap order, we can use [cow-sdk](https://github.com/cowprotocol/cow-sdk): -``` +```typescript // Setup CoW SDK const sdk = new TradingSdk({ chainId: SupportedChainId.SEPOLIA, signer: new VoidSigner(config.SAFE_ADDRESS, new JsonRpcProvider(config.RPC_URL)), appCode: 'Our flashloan example', }); // Define trade parameters const parameters: TradeParameters = { env: 'staging', // Required for Sepolia kind: OrderKind.BUY, sellToken: USDC_ADDRESS, sellTokenDecimals: 6, // USDC has 6 decimals buyToken: USDT_ADDRESS, buyTokenDecimals: 6, // USDT has 6 decimals as well amount: '5002500000', // 5,002.5 USDT (borrowed amount + 0.05% Aaave flash loan fee) // receiver is always the settlement contract because the driver takes // funds from the settlement contract to pay back the loan receiver: '0x9008D19f58AAbD9eD0D60971565AA8510560ab41', // cow settlement contract address on sepolia } const advancedParameters: SwapAdvancedSettings = { quoteRequest: { // An EIP-1271 signature could also be used instead signingScheme: SigningScheme.PRESIGN, }, appData, } const orderId = await sdk.postSwapOrder(parameters, advancedParameters); console.log('Order created, id: ', orderId); ``` @@ -117,13 +117,13 @@ We've now placed our order on CoW Swap. You can track its progress on [CoW Explo After placing the order, its pre-signature must be submitted by calling the [`setPresignature` function on the CoW Settlement contract](https://docs.cow.fi/cow-protocol/reference/contracts/core/settlement#setpresignature): -``` +```solidity function setPreSignature(bytes calldata orderUid, bool signed) external; ``` To build and send the transaction through our Safe wallet: -``` +```typescript const txData = encodeFunctionData({ abi, // ABI for the setPresignature function functionName: 'setPreSignature', args: [ orderId, true, ] }); const safeTransactionData: SafeTransactionDataPartial = { to: "0x9008D19f58AAbD9eD0D60971565AA8510560ab41", // CoW settlement contract on Sepolia value: '0', data: txData, operation: OperationType.Call, } const safeTransaction = await safe.createTransaction({ transactions: [safeTransactionData] }); const signedSafeTransaction = await safe.signTransaction(safeTransaction, SigningMethod.ETH_SIGN); const transactionResult = await safe.executeTransaction(signedSafeTransaction); console.log('setPreSignature transaction hash: ' + transactionResult.hash); ``` diff --git a/cow-swap/tutorials/multi-sig-orders.mdx b/cow-swap/tutorials/multi-sig-orders.mdx index 82d5ee8..26ed71c 100644 --- a/cow-swap/tutorials/multi-sig-orders.mdx +++ b/cow-swap/tutorials/multi-sig-orders.mdx @@ -284,7 +284,7 @@ const safeTx = await safe.createTransaction({ transactions }) ## Order Lifecycle -``` +```text 1. Create order (signingScheme: PRESIGN) └── Status: presignaturePending diff --git a/cow-swap/tutorials/native.mdx b/cow-swap/tutorials/native.mdx index b719305..fe44714 100644 --- a/cow-swap/tutorials/native.mdx +++ b/cow-swap/tutorials/native.mdx @@ -1,6 +1,6 @@ --- title: "Native tokens" -description: "In blockchain networks the \"native token\" - for example, Ether (ETH) on Ethereum, Arbitrum One and Base, and xDAI (xDAI) on Gnosis Chain - is the primary digital currency. It's essential for network operations, like paying transaction fees." +description: "How native tokens like ETH and xDAI work on CoW Swap — wrapping, the Eth-flow contract, and direct native token trading." --- "Wrapped" tokens - for example, Wrapped Ether (WETH) & Wrapped xDAI (wxDAI) - are [`ERC-20`-compatible](https://ethereum.org/en/developers/docs/standards/tokens/%60ERC-20%60/) versions of these native tokens. diff --git a/cow-swap/tutorials/safe-app.mdx b/cow-swap/tutorials/safe-app.mdx index fb7aa97..762e53f 100644 --- a/cow-swap/tutorials/safe-app.mdx +++ b/cow-swap/tutorials/safe-app.mdx @@ -46,7 +46,7 @@ This will create a copy of the project so you can safely make modifications on i Once you have forked the project, clone it to your local machine. -``` +```bash git clone ``` @@ -54,7 +54,7 @@ git clone Launch the Dapp on port 9999 (for example). -``` +```bash # Install dependenciesyarn# Run the appPORT=9999 yarn start ``` diff --git a/cow-swap/tutorials/twap.mdx b/cow-swap/tutorials/twap.mdx index e1ac4ec..d2aac89 100644 --- a/cow-swap/tutorials/twap.mdx +++ b/cow-swap/tutorials/twap.mdx @@ -1,6 +1,6 @@ --- title: "TWAP orders" -description: "Time-Weighted Average Price (TWAP) orders are an advanced feature of CoW Protocol, ideal for executing large trades with minimal price impact by distributing the order over a specified time." +description: "Place TWAP orders on CoW Swap to execute large trades with minimal price impact by distributing them over a specified time." --- ## Introduction diff --git a/cow-swap/widget/overview.mdx b/cow-swap/widget/overview.mdx index 5c669bc..f478ab7 100644 --- a/cow-swap/widget/overview.mdx +++ b/cow-swap/widget/overview.mdx @@ -1,6 +1,6 @@ --- title: "Widget Integration" -description: "The CoW Widget is the fastest way to integrate CoW Protocol's trading functionality into your application. It provides a complete, pre-built trading interface that can be embedded with just a few lines of code." +description: "Embed CoW Protocol trading in your app with the CoW Widget — a pre-built, customizable interface with just a few lines of code." --- ## Overview @@ -18,13 +18,13 @@ The CoW Widget is a ready-to-use React component that provides the full CoW Swap ## Quick Start Example -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'// HTML element where the widget will be renderedconst widgetContainer = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { appCode: 'YOUR-APP-NAME', // Required: identifies your app width: 600, height: 640, sell: { asset: 'USDC' }, buy: { asset: 'WETH', amount: '0.1' }, theme: 'light', // 'light' | 'dark' | custom theme object partnerFee: { bps: 50, // 0.5% fee recipient: '0xYourFeeRecipientAddress', },}createCowSwapWidget(widgetContainer, { params }) ``` ## Installation -``` +```bash # Install the widget librarynpm install @cowprotocol/widget-lib ``` @@ -41,7 +41,7 @@ The widget supports extensive customization: ## Example with Custom Theme -``` +```typescript import { createCowSwapWidget, CowSwapWidgetPalette } from '@cowprotocol/widget-lib'const customTheme: CowSwapWidgetPalette = { baseTheme: 'light', primary: '#00ff85', background: '#f7f7f7', paper: '#1a4435', text: '#ffffff',}const params = { appCode: 'YOUR-APP-NAME', theme: customTheme, // ... other params}createCowSwapWidget(widgetContainer, { params }) ``` diff --git a/cow-swap/widget/params.mdx b/cow-swap/widget/params.mdx index 01dd1a1..7c3deb2 100644 --- a/cow-swap/widget/params.mdx +++ b/cow-swap/widget/params.mdx @@ -1,6 +1,6 @@ --- title: "CoW Swap Widget" -description: "Integrate the power of into your product! With the widget, you can create an incredible trading interface. Specify the required pair of currencies, customize the look and much more!" +description: "Configuration parameters for the CoW Swap Widget — customize token pairs, themes, fees, and trading options for your integration." --- Create your own widget using the configurator [https://widget.cow.fi](https://widget.cow.fi). @@ -9,17 +9,17 @@ Create your own widget using the configurator [https://widget.cow.fi](https://wi ## Install -``` +```bash yarn add @cowprotocol/widget-lib ``` -``` +```bash npm install @cowprotocol/widget-lib ``` ## Quick start -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'// HTML element where the widget will be renderedconst widgetContainer = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { appCode: 'NAME-OF-YOU-APP', // Add here the name of your app. e.g. "Pig Swap" width: 600, height: 640, sell: { asset: 'DAI' }, buy: { asset: 'USDC', amount: '0.1' },}createCowSwapWidget(widgetContainer, { params }) ``` @@ -31,7 +31,7 @@ You must specify the `appCode` parameter when initializing the widget. This para You may participate in the Partner Fee program to collect fee on [Market order](https://docs.cow.fi/cow-protocol/explanation/order-types/market-orders) trades executed by your users through the Widget by adding the following parameter to your Widget: -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const widgetContainer = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { partnerFee: { bps: 50, // 0.5% recipient: '0x0000000000000000000000000000000000000000', // Fee destination address },}createCowSwapWidget(widgetContainer, { params }) ``` @@ -43,7 +43,7 @@ Both `bps` and `recipient` can be set for different chains and different trade t Bellow you can see the `partnerFee` configuration variations: -``` +```typescript import { PartnerFee, SupportedChainId, TradeType } from '@cowprotocol/widget-lib'// The fee is 1% for all trades on all chainsconst a: PartnerFee = { bps: 100, recipient: '0x0000000000000000000000000000000000000000' }// Different fee per network and per trade type, same recipient for allconst b: PartnerFee = { bps: { [SupportedChainId.MAINNET]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, [SupportedChainId.ARBITRUM_ONE]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, [SupportedChainId.BASE]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, [SupportedChainId.GNOSIS_CHAIN]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, [SupportedChainId.AVALANCHE]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, [SupportedChainId.POLYGON]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, [SupportedChainId.BNB]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, [SupportedChainId.LINEA]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, [SupportedChainId.PLASMA]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, [SupportedChainId.SEPOLIA]: { [TradeType.SWAP]: 100, [TradeType.LIMIT]: 50, [TradeType.ADVANCED]: 30 }, }, recipient: '0x0000000000000000000000000000000000000000',}// Same fee for all, different recipient per network and per trade typeconst c: PartnerFee = { bps: 100, recipient: { [TradeType.SWAP]: { [SupportedChainId.MAINNET]: '0x...a', [SupportedChainId.ARBITRUM_ONE]: '0x...b', [SupportedChainId.BASE]: '0x...bb', [SupportedChainId.GNOSIS_CHAIN]: '0x...c', [SupportedChainId.AVALANCHE]: '0x...c', [SupportedChainId.POLYGON]: '0x...c', [SupportedChainId.BNB]: '0x...c', [SupportedChainId.LINEA]: '0x...c', [SupportedChainId.PLASMA]: '0x...c', [SupportedChainId.SEPOLIA]: '0x...d', }, [TradeType.LIMIT]: { [SupportedChainId.MAINNET]: '0x...e', [SupportedChainId.ARBITRUM_ONE]: '0x...f', [SupportedChainId.BASE]: '0x...ff', [SupportedChainId.GNOSIS_CHAIN]: '0x...g', [SupportedChainId.AVALANCHE]: '0x...x', [SupportedChainId.POLYGON]: '0x...y', [SupportedChainId.BNB]: '0x...y', [SupportedChainId.LINEA]: '0x...y', [SupportedChainId.PLASMA]: '0x...y', [SupportedChainId.SEPOLIA]: '0x...h', }, [TradeType.ADVANCED]: { [SupportedChainId.MAINNET]: '0x...j', [SupportedChainId.ARBITRUM_ONE]: '0x...i', [SupportedChainId.BASE]: '0x...ii', [SupportedChainId.GNOSIS_CHAIN]: '0x...k', [SupportedChainId.AVALANCHE]: '0x...z', [SupportedChainId.POLYGON]: '0x...t', [SupportedChainId.BNB]: '0x...t', [SupportedChainId.LINEA]: '0x...t', [SupportedChainId.PLASMA]: '0x...t', [SupportedChainId.SEPOLIA]: '0x...l', }, },} ``` @@ -53,7 +53,7 @@ See [FlexibleConfig](https://github.com/cowprotocol/cowswap/blob/develop/libs/wi The `partnerFee` parameter can be set in a more advanced way using events. For example, you can define different fees for different assets: -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams, CowEventListeners, CowEvents } from '@cowprotocol/widget-lib'let updateParams = nullconst recipient = '0x0000000000000000000000000000000000000000'const defaultPartnerFee = { bps: 50, recipient }const params: CowSwapWidgetParams = { appCode: 'YOUR_APP_ID', partnerFee: defaultPartnerFee }const listeners: CowEventListeners = [ { event: CowEvents.ON_CHANGE_TRADE_PARAMS, handler: (event) => { if (!updateParams) return if (event.sellToken.symbol === 'DAI') { updateParams({ partnerFee: { bps: 20, recipient } }) } else if (event.sellToken.symbol === 'USDC') { updateParams({ partnerFee: { bps: 10, recipient } }) } else { updateParams({ partnerFee: defaultPartnerFee }) } }, },]const widget = createCowSwapWidget(container, { params, listeners })updateParams = widget.updateParams ``` @@ -73,7 +73,7 @@ Make sure that the fee recipient address exists on the respective network define As a fee recipient, you can specify either string or a key-value pair in the format `chainId: recipientAddress`: -``` +```typescript import type { CowSwapWidgetParams, SupportedChainId } from '@cowprotocol/widget-lib'const params: CowSwapWidgetParams = { partnerFee: { bps: 50, // 0.5% recipient: { 1: '0x0000000000000000000000000000000000000001', 100: '0x0000000000000000000000000000000000000002' }, },} ``` @@ -93,8 +93,8 @@ The widget supports declarative slippage settings. This allows you to fine‑tun ### Types -``` -/** Slippage expressed in basis points (1 % = 100 bps) */export interface SlippageConfig { /** Lower bound. Values below this will be clamped */ min?: number /** Upper bound. Values above this will be clamped */ max?: number /** Default slippage */ defaultValue?: number}export type FlexibleSlippageConfig = FlexibleConfig +```typescript +/** Slippage expressed in basis points (1 % = 100 bps) */export interface SlippageConfig { /** Lower bound. Values below this will be clamped */ min?: number /** Upper bound. Values above this will be clamped */ max?: number /** Default slippage */ defaultValue?: number}export type FlexibleSlippageConfig = FlexibleConfig ``` *All values are **basis points** (bps).* @@ -103,13 +103,13 @@ The widget supports declarative slippage settings. This allows you to fine‑tun Add the `slippage` field to `CowSwapWidgetParams`: -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const params: CowSwapWidgetParams = { appCode: 'YOUR_APP_ID', slippage: { // Global rule – applies to every network min: 50, // 0.50 % max: 300, // 3.00 % defaultValue: 100, // 1.00 % },} ``` Or configure per‑network rules using the same [FlexibleConfig](https://github.com/cowprotocol/cowswap/blob/develop/libs/widget-lib/src/types.ts) pattern as `partnerFee`: -``` +```typescript import { SupportedChainId } from '@cowprotocol/widget-lib'const params: CowSwapWidgetParams = { slippage: { [SupportedChainId.MAINNET]: { min: 1, max: 3900, defaultValue: 3000 }, [SupportedChainId.BASE]: { min: 500, max: 5000, defaultValue: 600 }, },} ``` @@ -124,7 +124,7 @@ import { SupportedChainId } from '@cowprotocol/widget-lib'const params: CowSwapW ### Example JSON (Configurator ready) -``` +```json { "slippage": { "1": { "min": 1, "max": 3900, "defaultValue": 3000 }, "8453": { "min": 500, "max": 5000, "defaultValue": 600 } }} ``` @@ -138,13 +138,13 @@ You can pass the wallet provider from your application to seamlessly use the wid A provider must comply with [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) and implement the interface: -``` +```typescript interface EthereumProvider { on(event: string, args: unknown): void request(params: JsonRpcRequest): Promise enable(): Promise}interface JsonRpcRequest { id: number method: string params: unknown[]} ``` An example of connecting a widget to Rabby Wallet or Metamask: -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'createCowSwapWidget(document.getElementById('cowswap-widget'), { params: { appCode: 'NAME-OF-YOU-APP' }, // Add here the name of your app. e.g. "Pig Swap" provider: window.ethereum, // <-------}) ``` @@ -194,7 +194,7 @@ You actually can specify only 2 or 3 basic colors, the rest of the palette is ef Example: -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams, CowSwapWidgetPalette } from '@cowprotocol/widget-lib'const widgetContainer = document.getElementById('cowswap-widget')// Set custom colorsconst theme: CowSwapWidgetPalette = { baseTheme: 'light', primary: '#00ff85', background: '#f7f7f7', paper: '#1a4435', text: '#ffffff', warning: '#ffb700', alert: '#b8ffb2', success: '#19ff64',}const params: CowSwapWidgetParams = { appCode: 'NAME-OF-YOU-APP', // Add here the name of your app. e.g. "Pig Swap" theme,}createCowSwapWidget(widgetContainer, { params }) ``` @@ -219,7 +219,7 @@ In this parameter you can specify the URL or ENS address of the token list. > How to create and deploy your own token list you can find in the [guide](https://hackmd.io/@mastercow/creating-custom-token-lists). -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const container = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { tokenLists: ['https://files.cow.fi/tokens/CowSwap.json'] }createCowSwapWidget(container, { params }) ``` @@ -227,7 +227,7 @@ import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-li If you want to use tokens that are not included in the default token lists, you can add them programmatically by passing an array of ERC-20 tokens info. -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams, TokenInfo } from '@cowprotocol/widget-lib'const container = document.getElementById('cowswap-widget')const customTokens: TokenInfo = [ { chainId: 1, address: '0x69D29F1b0cC37d8d3B61583c99Ad0ab926142069', name: 'ƎԀƎԀ', decimals: 9, symbol: 'ƎԀƎԀ', logoURI: 'https://assets.coingecko.com/coins/images/31948/large/photo_2023-09-25_14-05-49.jpg?1696530754', }, { chainId: 1, address: '0x9F9643209dCCe8D7399D7BF932354768069Ebc64', name: 'Invest Club Global', decimals: 18, symbol: 'ICG', logoURI: 'https://assets.coingecko.com/coins/images/34316/large/thatone_200%281%29.png?1704621005', },]const params: CowSwapWidgetParams = { customTokens }createCowSwapWidget(container, { params }) ``` @@ -241,7 +241,7 @@ Separately, it is worth noting the `ON_TOAST_MESSAGE` event; it occurs every tim ### Events usage example -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams, CowEventListeners, CowEvents } from '@cowprotocol/widget-lib'const params: CowSwapWidgetParams = { appCode: 'YOUR_APP_ID' }const listeners: CowEventListeners = [ { event: CowEvents.ON_TOAST_MESSAGE, handler: (event) => console.log('[ON_TOAST_MESSAGE]', event.message) }, { event: CowEvents.ON_EXPIRED_ORDER, handler: (event) => console.log('Order was expired:', event.order) },]const { updateListeners } = createCowSwapWidget(container, { params, listeners })// If you want to change listeners at some point, you can do it like:updateListeners([ { event: CowEvents.ON_CANCELLED_ORDER, handler: (event) => console.log('Order was cancelled:', event.order) },]) ``` @@ -249,7 +249,7 @@ import { createCowSwapWidget, CowSwapWidgetParams, CowEventListeners, CowEvents You can change all possible widget options on the fly: -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const container = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { appCode: 'NAME-OF-YOU-APP', // Add here the name of your app. e.g. "Pig Swap" logoUrl: 'YOUR_LOGO_URL',}const updateWidget = createCowSwapWidget(container, { params })// Update the widgetupdateWidget({ ...params, theme: 'dark', // <- Change theme to dark hideNetworkSelector: true, // <- Hide the network selector}) ``` @@ -257,7 +257,7 @@ import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-li Most of the widget parameters are controlled via the URL, which means that you can create the URL yourself and embed the iframe. An example of URL: -``` +```text https://swap.cow.fi/#/100/swap/WXDAI/GNO?sellAmount=200&theme=dark ``` @@ -265,7 +265,7 @@ https://swap.cow.fi/#/100/swap/WXDAI/GNO?sellAmount=200&theme=dark ### Sounds -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const container = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { sounds: { // The sound that will be played when the order is placed postOrder: 'https://swap.cow.fi/audio/send-winterTheme.mp3', // Nothing will be played when the order is executed orderExecuted: null, // Since `orderError` is not specified, the default sound will be played },}createCowSwapWidget(container, { params }) ``` @@ -273,7 +273,7 @@ import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-li In the example below, we replace the image that is displayed when there are no orders in the limit orders table. You can replace any image in the widget in the same way. -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const container = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { images: { emptyOrders: 'https://cow.fi/images/cowamm-illustration-lvr.svg' } }createCowSwapWidget(container, { params }) ``` @@ -283,7 +283,7 @@ import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-li In some cases, you may want to hide some banners in the CoW Swap interface. To do this, you need to specify the `banners` parameter in the widget configuration. -``` +```typescript import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const container = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { banners: { hideSafeWebAppBanner: true } }createCowSwapWidget(container, { params }) ``` diff --git a/diataxis.mdx b/diataxis.mdx index 5d3f3be..e399816 100644 --- a/diataxis.mdx +++ b/diataxis.mdx @@ -47,7 +47,7 @@ Reference material provides **technical descriptions** of the system — APIs, c ## Which Section Should I Read? -``` +```text Do you want to learn or do something? ├── Learn / Understand │ ├── New to CoW Protocol? → Start with Explanation diff --git a/flash-loan-router/getting-started/quickstart.mdx b/flash-loan-router/getting-started/quickstart.mdx index 3e99290..6126fd4 100644 --- a/flash-loan-router/getting-started/quickstart.mdx +++ b/flash-loan-router/getting-started/quickstart.mdx @@ -35,7 +35,7 @@ This guide will help you quickly build, test, and understand the Flash-Loan Rout Expected output: - ``` + ```text [⠊] Compiling... [⠒] Compiling 25 files with 0.8.28 [⠒] Solc 0.8.28 finished in 3.45s diff --git a/flash-loan-router/operations/testing.mdx b/flash-loan-router/operations/testing.mdx index 3186458..b45299d 100644 --- a/flash-loan-router/operations/testing.mdx +++ b/flash-loan-router/operations/testing.mdx @@ -68,7 +68,7 @@ This is useful for: Tests are typically organized in the following structure: -``` +```text test/ ├── e2e/ # End-to-end integration tests │ ├── AaveFlashLoan.t.sol @@ -120,7 +120,7 @@ forge test Benchmark data is saved to the `snapshots/` directory: -``` +```text snapshots/ ├── FlashLoanRouterTest.snap ├── AaveBorrowerTest.snap @@ -137,7 +137,7 @@ forge test --gas-report Example output: -``` +```text | Contract | Function | min | avg | max | calls | |-------------------|--------------------|------|-------|-------|-------| | FlashLoanRouter | flashLoanAndSettle | 1234 | 12456 | 23456 | 45 | diff --git a/flash-loan-router/operations/verification.mdx b/flash-loan-router/operations/verification.mdx index 2ad0c02..6e89bbc 100644 --- a/flash-loan-router/operations/verification.mdx +++ b/flash-loan-router/operations/verification.mdx @@ -135,7 +135,7 @@ After running the verification command, you'll see one of these outputs: - ``` + ```text Start verifying contract `0x9da8B48441583a2b93e2eF8213aAD0EC0b392C69` deployed on mainnet Submitting verification for [src/FlashLoanRouter.sol:FlashLoanRouter] "0x9da8B48441583a2b93e2eF8213aAD0EC0b392C69". Submitted contract for verification: @@ -151,7 +151,7 @@ After running the verification command, you'll see one of these outputs: - ``` + ```text Contract source code already verified ``` @@ -159,7 +159,7 @@ After running the verification command, you'll see one of these outputs: - ``` + ```text Error: Verification failed Response: `NOTOK` Details: `Error message here` diff --git a/governance.mdx b/governance.mdx index 2fdb162..007dc7d 100644 --- a/governance.mdx +++ b/governance.mdx @@ -1,5 +1,6 @@ --- title: "Governance" +description: "Overview of CoW DAO governance — forums, Snapshot voting, and how the community guides CoW Protocol and CoW Swap development." --- > This site represents the current governance structure of CoW DAO. diff --git a/governance/explanation/grants/grant-types.mdx b/governance/explanation/grants/grant-types.mdx index 207a88d..3804d78 100644 --- a/governance/explanation/grants/grant-types.mdx +++ b/governance/explanation/grants/grant-types.mdx @@ -1,6 +1,6 @@ --- title: "Grant Types" -description: "The CoW Grants Program offers different types of grants to accommodate various project needs. Understanding the differences will help you choose the most appropriate structure for your proposal." +description: "Types of grants in the CoW Grants Program — choosing the right structure and funding model for your proposal." --- ## Milestone-Based Grants diff --git a/governance/explanation/mission.mdx b/governance/explanation/mission.mdx index c282543..51fee92 100644 --- a/governance/explanation/mission.mdx +++ b/governance/explanation/mission.mdx @@ -1,6 +1,6 @@ --- title: "Mission statement" -description: "CoW DAO is an open organization of developers, market makers, and community contributors on a mission to create a fairer, more-protective financial system. CoW DAO currently supports CoW Swap and CoW Protocol – decentralized trading products that leverage order flow auctions to shield users from MEV attacks and give them more than they ask for." +description: "CoW DAO's mission — building fairer finance through decentralized trading products like CoW Swap and CoW Protocol." --- ## Vision diff --git a/governance/explanation/process.mdx b/governance/explanation/process.mdx index 0ffa715..09caa5f 100644 --- a/governance/explanation/process.mdx +++ b/governance/explanation/process.mdx @@ -1,5 +1,6 @@ --- title: "Governance Process" +description: "How CoW DAO governance proposals progress from forum discussion through Snapshot vote to on-chain execution." --- > This site represents the current governance structure of CoW DAO. diff --git a/governance/explanation/token.mdx b/governance/explanation/token.mdx index d43f91b..7fbd0e9 100644 --- a/governance/explanation/token.mdx +++ b/governance/explanation/token.mdx @@ -1,6 +1,6 @@ --- title: "Token" -description: "At the core of CoW Protocol lies the COW token, which serves as a governance token within the CoW Protocol ecosystem, allowing stakeholders to participate directly in the decision-making processes that guide the protocol's development and evolution. The governance framework is designed to align incentives between the protocol's users, developers, and supporters, creating a robust and community-driven governance system." +description: "The COW token powers CoW DAO governance — enabling stakeholders to vote on proposals guiding CoW Protocol's development." --- ### Contract Address diff --git a/governance/reference/cip-template.mdx b/governance/reference/cip-template.mdx index 869358a..c989c0e 100644 --- a/governance/reference/cip-template.mdx +++ b/governance/reference/cip-template.mdx @@ -1,5 +1,6 @@ --- title: "CIP Template" +description: "Template and guidelines for CoW Improvement Proposals (CIPs) — the standard format for submitting governance changes to CoW DAO." --- > 📜 This template is to be used to create any new CoW DAO Improvement Proposal. diff --git a/governance/reference/fees.mdx b/governance/reference/fees.mdx index 27b1be3..2f9a089 100644 --- a/governance/reference/fees.mdx +++ b/governance/reference/fees.mdx @@ -1,5 +1,6 @@ --- title: "Fees" +description: "Reference for CoW Protocol fee structures — protocol fees, network costs, and how trading fees are calculated and distributed." --- diff --git a/governance/reference/partner-fee.mdx b/governance/reference/partner-fee.mdx index 4f7dff0..e2c2293 100644 --- a/governance/reference/partner-fee.mdx +++ b/governance/reference/partner-fee.mdx @@ -1,5 +1,6 @@ --- title: "Partner fee" +description: "How CoW Protocol partner fees work — configuration, revenue sharing, and integration guide for partners building on the protocol." --- ### Partner Fee Calculation diff --git a/hooks-trampoline/api/errors.mdx b/hooks-trampoline/api/errors.mdx index 65ff352..25f57bd 100644 --- a/hooks-trampoline/api/errors.mdx +++ b/hooks-trampoline/api/errors.mdx @@ -1,6 +1,6 @@ --- title: "Errors" -description: "Error types in the HooksTrampoline contract" +description: "Reference for error types in the CoW Protocol HooksTrampoline contract — revert reasons, causes, and debugging." --- The HooksTrampoline contract defines custom errors for access control and execution failures. diff --git a/hooks-trampoline/architecture/gas-management.mdx b/hooks-trampoline/architecture/gas-management.mdx index 09208e4..c6dc75f 100644 --- a/hooks-trampoline/architecture/gas-management.mdx +++ b/hooks-trampoline/architecture/gas-management.mdx @@ -270,7 +270,7 @@ From `GasLimitEnforcement.t.sol:154-160`, this calculation: For a hook needing 100,000 gas: -``` +```text Required gas = (100,000 + 4,000) * 64/63 = 104,000 * 64/63 = 105,650 gas (approximately) diff --git a/mevblocker.mdx b/mevblocker.mdx index 14d9964..12262b5 100644 --- a/mevblocker.mdx +++ b/mevblocker.mdx @@ -1,6 +1,6 @@ --- title: "MEV Blocker" -description: "MEV Blocker Update" +description: "MEV Blocker has been acquired — this page redirects to the new documentation at docs.mevblocker.io." hidden: true --- diff --git a/services/api/autopilot.mdx b/services/api/autopilot.mdx index 229d5e9..53ed20b 100644 --- a/services/api/autopilot.mdx +++ b/services/api/autopilot.mdx @@ -44,7 +44,7 @@ Solvers must implement four endpoints: Solutions are ranked using: -``` +```text User Surplus + Protocol Fees - Gas Cost (in native token) ``` diff --git a/services/api/solver.mdx b/services/api/solver.mdx index c4d5287..49bad90 100644 --- a/services/api/solver.mdx +++ b/services/api/solver.mdx @@ -54,7 +54,7 @@ Solutions must satisfy: ## Scoring Formula -``` +```text Score = sum(user_surplus) + sum(protocol_fees) - gas_cost_in_native_token ``` diff --git a/services/architecture.mdx b/services/architecture.mdx index cd998d8..4120481 100644 --- a/services/architecture.mdx +++ b/services/architecture.mdx @@ -444,17 +444,17 @@ block_time = 12 # seconds ### Read Paths **User Queries Order Status**: -``` +```text User -> Orderbook API -> PostgreSQL -> Response ``` **Autopilot Reads Orders**: -``` +```text Autopilot -> PostgreSQL -> Filter -> Create Auction ``` **Driver Fetches Liquidity**: -``` +```text Driver -> Uniswap API -> Cache -> Solver Driver -> Balancer API -> Cache -> Solver Driver -> 1inch API -> Cache -> Solver @@ -463,17 +463,17 @@ Driver -> 1inch API -> Cache -> Solver ### Write Paths **User Submits Order**: -``` +```text User -> Orderbook API -> Validate -> PostgreSQL ``` **Autopilot Stores Auction**: -``` +```text Autopilot -> Create Auction -> PostgreSQL -> Send to Solvers ``` **Settlement Execution**: -``` +```text Driver -> Blockchain -> Settlement Contract -> Events -> Database ``` diff --git a/services/deployment/configuration.mdx b/services/deployment/configuration.mdx index bc80845..b3a44f9 100644 --- a/services/deployment/configuration.mdx +++ b/services/deployment/configuration.mdx @@ -24,7 +24,7 @@ Services use PostgreSQL with sqlx connection pooling. The default pool size is 1 Connection strings follow PostgreSQL format: -``` +```text postgresql://[user[:password]@][host][:port][/database] ``` @@ -49,7 +49,7 @@ It is recommended to include "Native" and "Web3" for compatibility across all EV The system uses `tracing-subscriber` with flexible EnvFilter syntax: -``` +```text target[span{field=value}]=level ``` @@ -62,7 +62,7 @@ target[span{field=value}]=level Connect to UNIX sockets to modify log filtering without restart: -``` +```text /tmp/log_filter_override__.sock ``` diff --git a/services/deployment/database.mdx b/services/deployment/database.mdx index e409ba2..64a1fb2 100644 --- a/services/deployment/database.mdx +++ b/services/deployment/database.mdx @@ -71,7 +71,7 @@ GRANT ALL PRIVILEGES ON DATABASE cow_mainnet TO cow; Connection strings follow the format: -``` +```text postgresql://user:password@host:port/database?sslmode=require ``` diff --git a/services/development/playground.mdx b/services/development/playground.mdx index 74d53e1..442b410 100644 --- a/services/development/playground.mdx +++ b/services/development/playground.mdx @@ -60,7 +60,7 @@ Connect your wallet to `localhost:8545` and import test accounts from the provid All test accounts derive from: -``` +```text test test test test test test test test test test test junk ``` diff --git a/services/quickstart.mdx b/services/quickstart.mdx index 863f4f8..b3b139f 100644 --- a/services/quickstart.mdx +++ b/services/quickstart.mdx @@ -74,7 +74,7 @@ Once running, you can reach the following interfaces: The playground provides test accounts with 10,000 ETH each, derived from the standard mnemonic: -``` +```text test test test test test test test test test test test junk ``` diff --git a/watch-tower/advanced/metrics.mdx b/watch-tower/advanced/metrics.mdx index 39045aa..c4ad2f1 100644 --- a/watch-tower/advanced/metrics.mdx +++ b/watch-tower/advanced/metrics.mdx @@ -13,7 +13,7 @@ The Watch Tower exposes Prometheus metrics for monitoring and alerting. When running the watch-tower in watch mode, a metrics endpoint is automatically exposed: -``` +```text http://localhost:8080/metrics ``` diff --git a/watch-tower/advanced/notifications.mdx b/watch-tower/advanced/notifications.mdx index d095ad9..ffd1f69 100644 --- a/watch-tower/advanced/notifications.mdx +++ b/watch-tower/advanced/notifications.mdx @@ -48,7 +48,7 @@ When the watch-tower encounters an error during execution: Example notification: -``` +```text Error: Failed to process block 12345678. More info https://dashboard.tenderly.co/devcow/project/actions ``` @@ -90,7 +90,7 @@ This prevents flooding your Slack channel during incidents while still ensuring When a notification is rate limited, you'll see a log message: -``` +```text Last error notification happened earlier than 120 minutes ago. Next notification will happen after 2024-03-04T14:34:56.789Z ``` @@ -130,7 +130,7 @@ Slack notifications require one of: If neither condition is met, the watch-tower will throw an error: -``` +```text SLACK_WEBHOOK_URL must be set if not running in silent mode ``` diff --git a/watch-tower/advanced/storage.mdx b/watch-tower/advanced/storage.mdx index a215ca5..0f36d56 100644 --- a/watch-tower/advanced/storage.mdx +++ b/watch-tower/advanced/storage.mdx @@ -1,6 +1,6 @@ --- title: "Storage Architecture" -description: "How the Watch Tower persists state using LevelDB" +description: "How the CoW Protocol Watch Tower persists order and registry state using LevelDB for programmatic order monitoring." --- # Storage Architecture @@ -74,7 +74,7 @@ The watch-tower may reprocess blocks after a crash. Your programmatic order hand By default, the database is stored at: -``` +```bash $PWD/database ``` diff --git a/watch-tower/deployment/dappnode.mdx b/watch-tower/deployment/dappnode.mdx index bf1921e..cc5dfc1 100644 --- a/watch-tower/deployment/dappnode.mdx +++ b/watch-tower/deployment/dappnode.mdx @@ -1,6 +1,6 @@ --- title: "DAppNode Deployment" -description: "Deploy the CoW Protocol Watch Tower on DAppNode" +description: "Step-by-step guide to deploying the CoW Protocol Watch Tower on DAppNode for decentralized programmatic order monitoring." --- # DAppNode Deployment diff --git a/watch-tower/deployment/docker.mdx b/watch-tower/deployment/docker.mdx index d1893cc..96392bf 100644 --- a/watch-tower/deployment/docker.mdx +++ b/watch-tower/deployment/docker.mdx @@ -1,6 +1,6 @@ --- title: "Docker Deployment" -description: "Deploy the CoW Protocol Watch Tower using Docker" +description: "Deploy and configure the CoW Protocol Watch Tower using Docker and Docker Compose for programmatic order monitoring." --- # Docker Deployment diff --git a/watch-tower/development/architecture/overview.mdx b/watch-tower/development/architecture/overview.mdx index 094824b..43f3ea2 100644 --- a/watch-tower/development/architecture/overview.mdx +++ b/watch-tower/development/architecture/overview.mdx @@ -9,7 +9,7 @@ description: "Watch-tower codebase structure, execution flow, and key modules" The watch-tower project is organized as follows: -``` +```text src/ ├── commands/ # CLI command implementations ├── domain/ # Business logic and domain models diff --git a/watch-tower/development/building.mdx b/watch-tower/development/building.mdx index 90fc5d8..08c20ff 100644 --- a/watch-tower/development/building.mdx +++ b/watch-tower/development/building.mdx @@ -57,7 +57,7 @@ typechain --target ethers-v5 --out-dir src/types/generated/ "abi/*.json" Build output is organized in the `dist/` directory: -``` +```text dist/ ├── src/ │ ├── commands/ diff --git a/watch-tower/development/testing.mdx b/watch-tower/development/testing.mdx index 02608d5..52bc1ef 100644 --- a/watch-tower/development/testing.mdx +++ b/watch-tower/development/testing.mdx @@ -42,7 +42,7 @@ Jest testing is configured through `package.json`: Test files are colocated with source files using the `.spec.ts` extension: -``` +```text src/ ├── utils/ │ ├── utils.ts diff --git a/watch-tower/getting-started/installation.mdx b/watch-tower/getting-started/installation.mdx index 82b141f..8695975 100644 --- a/watch-tower/getting-started/installation.mdx +++ b/watch-tower/getting-started/installation.mdx @@ -62,7 +62,7 @@ Before installing the Watch Tower, ensure you have the following: Expected output: - ``` + ```text 2.14.0 ``` diff --git a/watch-tower/getting-started/running-locally.mdx b/watch-tower/getting-started/running-locally.mdx index 3e486a2..a1dd993 100644 --- a/watch-tower/getting-started/running-locally.mdx +++ b/watch-tower/getting-started/running-locally.mdx @@ -116,7 +116,7 @@ yarn cli dump-db --chain-id 1 --database-path ./database When you start the Watch Tower, you should see output similar to: -``` +```log [INFO] commands:run - Starting Rest API server... [INFO] ApiService - REST API server started on port 8080 [INFO] commands:run - Starting chain mainnet... @@ -311,7 +311,7 @@ To gracefully stop the Watch Tower, press `Ctrl+C`. The Watch Tower will: 4. Close the database connection 5. Exit cleanly -``` +```log [INFO] commands:stop - Caught interrupt signal. [INFO] ApiService - Stopping REST API server... [INFO] DBService - Closing database...