File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,6 +90,10 @@ func (c *costEstimator) Get(token string) costEstimate {
9090// over the configured lookback window. This is the only method that touches
9191// the database; intended to be called periodically by a background goroutine.
9292func (c * costEstimator ) Refresh (ctx context.Context ) error {
93+ // Filter to ETH-input rows so per_row_oh isolates pure sweep_overhead.
94+ // ERC20-input rows have user_gas baked into (surplus_eth - net_profit_eth),
95+ // which would inflate the estimate and cause the miles formula (which
96+ // deducts user_gas separately) to over-deduct.
9397 rows , err := c .db .QueryContext (ctx , fmt .Sprintf (`
9498SELECT output_token,
9599 COUNT(*) as n,
@@ -105,6 +109,7 @@ FROM (
105109 AND surplus_eth > 0
106110 AND surplus_eth IS NOT NULL
107111 AND surplus_eth < 1.0
112+ AND input_token = '0x0000000000000000000000000000000000000000'
108113 AND block_timestamp >= NOW() - INTERVAL %d DAY
109114) t
110115GROUP BY output_token` , costEstimateLookbackDays ))
You can’t perform that action at this time.
0 commit comments