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.

An Overdraft is created when a solver’s total outgoing native token liability (e.g. negative slippage reimbursements) exceeds its inbound rewards for an accounting period, resulting in a net-negative figure. Rather than skipping the period silently, the pipeline records the deficit on-chain via a dedicated overdraft management contract. Defined in src/models/overdraft.py.

When overdrafts are created

During payout computation, if total_outgoing_eth() < 0 for a solver, a new Overdraft is constructed instead of a Transfer. This signals that the solver owes funds to the protocol rather than the other way around.

Overdraft dataclass

@dataclass
class Overdraft:
    """
    Contains the data for a solver's overdraft;
    Namely, overdraft = |transfer - negative slippage| when the difference is negative
    """

    period: AccountingPeriod
    account: Address
    name: str
    wei: int

Fields

period
AccountingPeriod
required
The AccountingPeriod during which the overdraft was incurred. Used for human-readable logging and the __str__ output.
account
Address
required
The dune_client.types.Address of the solver that is in overdraft.
name
str
required
Human-readable name of the solver (used in log messages and string representation).
wei
int
required
The absolute value of the deficit in wei (native token atoms). Always a positive integer representing how much the solver owes.

Properties

eth
float
The overdraft amount converted to native token units by dividing by 10¹⁸.
@property
def eth(self) -> float:
    return self.wei / 10**18

Methods

as_multisend_tx()

Encodes the overdraft as a MultiSendTx that calls addOverdraft(address, uint256) on the overdraft management contract.
def as_multisend_tx(self) -> MultiSendTx:
    network = Network(os.getenv("NETWORK"))
    config = OverdraftConfig.from_network(network)
    contract_address = Web3.to_checksum_address(config.contract_address.address)
    return MultiSendTx(
        operation=MultiSendOperation.CALL,
        to=contract_address,
        value=0,
        data=OVERDRAFTS_CONTRACT.encode_abi(
            abi_element_identifier="addOverdraft",
            args=[Web3.to_checksum_address(self.account.address), self.wei],
        ),
    )
Contract address (all networks): 0x8Fd67Ea651329fD142D7Cfd8e90406F133F26E8a
FieldValue
operationMultiSendOperation.CALL
to0x8Fd67Ea651329fD142D7Cfd8e90406F133F26E8a
value0 (no ETH sent)
dataABI-encoded addOverdraft(address solver, uint256 amount)
The contract address is read from OverdraftConfig.from_network() at call time, not stored on the dataclass. The NETWORK environment variable must be set when as_multisend_tx() is called.

__str__()

Returns a human-readable summary of the overdraft:
def __str__(self) -> str:
    return (
        f"Overdraft(solver={self.account} ({self.name}),"
        f"period={self.period},owed={self.eth} native token units)"
    )
Example output:
Overdraft(solver=0xabc...def (SolverName),period=2024-01-01-to-2024-01-08,owed=0.005 native token units)

Build docs developers (and LLMs) love