Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/cowprotocol/solver-rewards/llms.txt

Use this file to discover all available pages before exploring further.

The pipeline is configured entirely through environment variables, loaded via python-dotenv at import time in src/config.py. Copy .env.sample to .env and fill in the required values before running any script.
cp .env.sample .env

Network setup

body.NETWORK
string
required
The network to run accounting for. Must be one of: mainnet, gnosis, arbitrum, base, avalanche, polygon, bnb, linea, plasma, ink.This value determines which network-specific reward caps, Safe addresses, wrapped token addresses, and Dune blockchain identifiers are used. COW token rewards are always settled on Ethereum Mainnet regardless of this value.
NETWORK=mainnet
body.NODE_URL
string
required
RPC endpoint URL for the network specified by NETWORK. Used by the Safe Ethereum client when building and submitting native-token multisend transactions.
NODE_URL=https://mainnet.infura.io/v3/YOUR_KEY
body.NODE_URL_MAINNET
string
required
RPC endpoint URL for Ethereum Mainnet. Required even when NETWORK is not mainnet because COW token transfers are always executed on Mainnet.
NODE_URL_MAINNET=https://mainnet.infura.io/v3/YOUR_KEY

Dune Analytics

body.DUNE_API_KEY
string
required
API key for Dune Analytics. Used by DuneFetcher to execute parameterized queries that retrieve on-chain block ranges and supplementary solver metrics.Obtain a key from dune.com under your account settings.
DUNE_API_KEY=your_dune_api_key

Safe / payment

body.PAYOUTS_SAFE_ADDRESS
string
default:"0xA03be496e67Ec29bC62F01a428683D7F9c204930"
Checksum address of the Safe on the target NETWORK used for native-token reimbursements. Defaults to the CoW Protocol payout Safe.
PAYOUTS_SAFE_ADDRESS=0xA03be496e67Ec29bC62F01a428683D7F9c204930
body.PAYOUTS_SAFE_ADDRESS_MAINNET
string
default:"0xA03be496e67Ec29bC62F01a428683D7F9c204930"
Checksum address of the Safe on Ethereum Mainnet used for COW token transfers. Defaults to the CoW Protocol payout Safe.
PAYOUTS_SAFE_ADDRESS_MAINNET=0xA03be496e67Ec29bC62F01a428683D7F9c204930
body.PROPOSER_PK
string
Private key of the proposer account used to sign and submit multisend transactions to the Safe Transaction Service. Only required when running with --post-tx.The expected proposer account is 0xd8Ca5FE380b68171155C7069B8df166db28befdd.
Keep this value secret. Never commit a file containing a real private key. Leave this blank for dry runs or CSV-only payout generation.
PROPOSER_PK=0xabc123...
body.SAFE_API_KEY
string
API key for the Safe Transaction Service (https://developer.safe.global). Required when posting transactions to the Safe API via --post-tx.
SAFE_API_KEY=your_safe_api_key

Slack notifications

body.SLACK_TOKEN
string
Slack bot token used by the slackclient library to post notifications. When --post-tx is set and the transaction is submitted, a message with Safe queue URLs and transaction nonces is posted to SLACK_CHANNEL.
SLACK_TOKEN=xoxb-your-bot-token
body.SLACK_CHANNEL
string
Slack channel ID where payout notifications are posted. The CoW Protocol team uses #dev-multisig for payout transaction alerts.
SLACK_CHANNEL=C01234ABCDE

Database

body.ANALYTICS_DB_URL
string
required
Connection string for the CoW Protocol analytics PostgreSQL database, excluding the database name. The pipeline appends /{environment}_{network} (e.g. prod_mainnet, staging_xdai) dynamically to target each environment.The URL must not include a trailing database name. The pipeline constructs the full connection string by appending /{environment}_{network_db_name} (e.g. prod_mainnet, staging_xdai) at runtime.The database must expose the dbt schema with the following tables:
  • fct_data_per_solver_and_accounting_period
  • fct_partner_and_protocol_fees
ANALYTICS_DB_URL=user:password@host:5432
body.BARN_DB_URL
string
Connection string for the CoW Protocol staging (barn) orderbook PostgreSQL database. Used in legacy or direct-query contexts.
BARN_DB_URL=postgresql://user:password@barn-db-host:5432/barn
body.PROD_DB_URL
string
Connection string for the CoW Protocol production orderbook PostgreSQL database. Used in legacy or direct-query contexts.
PROD_DB_URL=postgresql://user:password@prod-db-host:5432/prod

Output path

body.FILE_OUT_PATH
string
default:"./out"
Directory where CSV transfer files are written. Defaults to ./out relative to the project root. The directory is created if it does not exist.
FILE_OUT_PATH=./out

AccountingConfig and sub-configs

All environment variables are consumed through a hierarchy of frozen dataclasses defined in src/config.py. The top-level object is AccountingConfig, assembled via AccountingConfig.from_network(network).
config = AccountingConfig.from_network(Network(os.environ["NETWORK"]))

AccountingConfig.from_network(network: Network)

The factory method composes all sub-configs for the given network and returns a single frozen AccountingConfig instance:
@dataclass(frozen=True)
class AccountingConfig:
    payment_config: PaymentConfig
    orderbook_config: OrderbookConfig
    dune_config: DuneConfig
    node_config: NodeConfig
    reward_config: RewardConfig
    protocol_fee_config: ProtocolFeeConfig
    buffer_accounting_config: BufferAccountingConfig
    io_config: IOConfig
    overdraft_config: OverdraftConfig
Each sub-config is instantiated by its own from_network() or from_env() static method:
Sub-configFactorySource
PaymentConfigfrom_network(network)PAYOUTS_SAFE_ADDRESS, PAYOUTS_SAFE_ADDRESS_MAINNET, PROPOSER_PK, network-specific token addresses
OrderbookConfigfrom_network(network)ANALYTICS_DB_URL, network-derived network_db_name, schema dbt
DuneConfigfrom_network(network)DUNE_API_KEY, network-derived dune_blockchain
NodeConfigfrom_env()NODE_URL, NODE_URL_MAINNET
RewardConfigfrom_network(network)Network-specific quote_reward_cow, quote_reward_cap_native, service fee 15%
ProtocolFeeConfigfrom_network(network)Protocol fee Safe 0x22af3D38E50ddedeb7C47f36faB321eC3Bb72A76 (all networks)
BufferAccountingConfigfrom_network()Hardcoded bonding pool addresses
IOConfigfrom_env()NETWORK, SLACK_CHANNEL, SLACK_TOKEN, derived project paths
OverdraftConfigfrom_network(network)Overdrafts contract 0x8Fd67Ea651329fD142D7Cfd8e90406F133F26E8a (all networks)

Reward parameters by network

The RewardConfig sets the COW quote reward and a per-network native-token cap. The service fee is fixed at 15% across all networks (service_fee_factor = Fraction(15, 100)).
Networkquote_reward_cowquote_reward_cap_native
mainnet6 COW0.0007 ETH
gnosis6 COW0.15 xDAI
arbitrum6 COW0.00024 ETH
base6 COW0.00024 ETH
avalanche6 COW0.006 AVAX
polygon6 COW0.0006 POL
bnb6 COW0.001 BNB
linea6 COW0.00003 ETH
plasma6 COW0.0006 XPL
ink6 COW0.00003 ETH

Minimum transfer thresholds

Transfers below the following amounts are excluded from the final output. Thresholds are set in PaymentConfig:
NetworkMin native-token transferMin COW transfer
mainnet0.001 ETH10 COW
gnosis0.01 xDAI1 COW
arbitrum0.0001 ETH1 COW
base0.0001 ETH1 COW
avalanche0.0001 AVAX1 COW
polygon0.0001 POL1 COW
bnb0.0001 BNB1 COW
linea0.0001 ETH1 COW
plasma0.0001 XPL1 COW
ink0.0001 ETH1 COW

Buffer accounting pools

Solvers whose bonding pool address appears in the following list have their buffer accounting results forwarded to their reward_target address instead of the solver submission address:
  • 0x5d4020b9261f01b6f8a45db929704b0ad6f5e9e6 — CoW DAO bonding pool
  • 0x0deb0ae9c4399c51289adb1f3ed83557a56df657 — Rizzolver bonding pool
  • 0x7719c9c0d35d460b00487a1744394e9525e8a42c — Fractal bonding pool
This list is hardcoded in BufferAccountingConfig.from_network() and applies to all networks.