Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 1.33 KB

slippage_accounting.md

File metadata and controls

26 lines (17 loc) · 1.33 KB

Solver Slippage Accounting

Slippage accounting is performed on a per settlement/transaction basis according to the following two primary components. The SQL source code can be found on GitHub or Dune Analytics

1. Batch-wise Token Imbalance

The token balance sheet represents a classified account of all incoming and outgoing token transfers relative to the settlement contract. Classification categories are USER_{IN/OUT}, AMM_{IN/OUT}.

Transfer Type Classification

In all cases IN represents settlement contract as recipient and OUT as sender!

  • USER_{IN/OUT} transfers are those emitted by the Settlement contract's Trade Event (with USER_IN adjusted for fees).
  • AMM_{IN/OUT} classification is assigned to all on-chain transfers that are NOT user transfers

Note that AMM_IN/OUT also captures WETH and sDAI (un)wraps.

2. Evaluation in ETH (aka Token Prices)

Token prices are taken as the hourly mean over Dune's prices.usd table in combination with the "intrinsic" token prices provided in settlements. SQL code for price table is here