The solver rewards pipeline divides time into discrete accounting periods — fixed-width windows over which all batch settlements, quote rewards, and slippage are aggregated before a single weekly payout is computed and posted.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.
Definition
An accounting period is a half-open interval of the form:block_time falls within this range, then produces a single set of transfers (COW + native token) to be executed via multisend.
The string representation of a period uses the format YYYY-MM-DD-to-YYYY-MM-DD:
The AccountingPeriod class
The class lives in src/models/accounting_period.py and handles all date arithmetic and string conversions:
Constructor
Constructor
AccountingPeriod(start, length_days=7) accepts a date string in YYYY-MM-DD format and an optional length_days integer (default 7). It uses datetime.strptime to parse the start date and timedelta to compute the end date.__str__
__str__
Produces a human-readable, filename-safe string like
2024-01-09-to-2024-01-16 by joining the formatted start and end dates with the literal -to- separator.__hash__
__hash__
Converts the period into an integer by concatenating the
%Y%m%d-formatted digits of both dates. For example, (1985-03-10, 1994-04-05) becomes 1985031019940405. This allows AccountingPeriod instances to be used as dictionary keys or in sets.as_query_params()
as_query_params()
Returns a two-element list of
QueryParameter objects (start_time and end_time) that are passed directly to Dune Analytics queries. This is the primary integration point between the accounting period and every parameterized Dune query.Default period vs. custom periods
The pipeline is designed to run every Tuesday. The default accounting period is always the previous 7 days ending at today’s date:--start explicitly:
If you omit
--start, the period start defaults to exactly 7 days before today. Make sure you are running the script on the correct day, or the period boundaries will be off by one or more days.Block interval mapping
Block timestamps on EVM chains do not map 1:1 to wall-clock dates. The pipeline resolves this by querying Dune for the block numbers that correspond to the period’sstart_time and end_time.
This happens in DuneFetcher.__init__ immediately after the period is set:
start_block/end_block rather than timestamps, ensuring consistency across chains with different block times.
Timing considerations
Several upstream data sources do not finalize immediately after a block is produced. The following data must settle before the pipeline produces accurate results:prices.usd
Dune’s
prices.usd table is populated from off-chain price feeds with a lag. Slippage values evaluated in ETH will be incorrect if the pipeline runs too soon after period end.Transaction data
The
ethereum.transactions table and on-chain event logs may not yet index the final blocks of the period.Orderbook analytics
The analytics database (
ANALYTICS_DB_URL) is populated by a separate dbt pipeline that runs on its own schedule.Tuesday cadence
Payouts are executed each Tuesday. Running the script on Tuesday (one week after the period opened) gives all data sources time to finalize.
