1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//! ElFomoFi on Base, BSC and Robinhood: per-pair books quoted by an operator and filled from one
//! shared vault.
//!
//! The feed polls one view per chain over JSON-RPC, the helper's `getAllOrderbooks()`, which
//! returns every pair's cumulative ask and bid ladders (net of fees, cut at the vault's balance
//! of the output token) and the block it read them at. The states price swaps by interpolating
//! those ladders; they do not model the venue's pricing contracts, whose quoter and engine are
//! unverified and replaced without events, so the helper's answer is the whole model.
//!
//! # What this integration depends on
//!
//! The same three contracts sit at the same addresses on every chain:
//!
//! | Contract | Address | Notes |
//! |----------|----------------------------------------------|------------------------------------|
//! | Router | `0xf0f0F0F0FB0d738452EfD03A28e8be14C76d5f73` | not upgradeable; the fill entry |
//! | Pricing | `0xffffffbb2d432b8acb4c57d556c0c721a431d038` | transparent proxy, router-only |
//! | Vault | `0xbb1b19f138db3925883a96ff7a304277460e0c99` | Safe; every pair's inventory |
//!
//! The helper is per chain (`models::ElfomofiSupportedChain::helper`). The pricing proxy was last
//! upgraded on 2026-11-20 on all three chains (Base 59,985,486, BSC 134,716,965, Robinhood
//! 119,145,799); the recordings in `testdata/` postdate it.
//!
//! # Known limits
//!
//! - Quotes worsen in steps from 4-5 s after the block a poll reads and empty after 10-16 s
//! (`models::ElfomofiSupportedChain::max_read_lag` has the per-chain figures), and a pair
//! following a reference AMM pool drops to zero when that pool moves about 1%. The feed withdraws
//! books that are 2 s old. A swap carries no minimum of its own, so a quote that goes stale in
//! flight fills worse until the route's `min_amount_out` reverts it; through the fallback router
//! the on-chain quote shows it and the fallback pool fills instead when it pays more.
//! - Every pair's ladder is cut at the vault's whole balance of its output token, so pairs that
//! share a token each claim all of it. When two fills in one block together exceed it, the second
//! pays only what is left of the balance and keeps the whole input, which the route's
//! `min_amount_out` catches; with the vault empty the venue reverts it.
//! - A fill moves the rest of the same-direction ladder about 0.1% worse at the next levels
//! (measured on a Base fork); a continued fill priced on the pre-fill ladder does not include
//! that, and the route's slippage absorbs it. How the opposite direction moves after a fill is
//! not known, so a state that has filled one way refuses the other.
//! - The gas a swap reports (`models::ElfomofiSupportedChain::swap_gas`) is a measured constant,
//! and the real cost drifts with the venue's state: on Base it rose about 20% in the four days
//! from 2026-11-27 to 2026-12-01 as the venue's fee registry grew. The estimate only ranks
//! routes; the transaction's gas limit comes from the node, so a stale value makes ElFomoFi look
//! cheaper or dearer than it is, not revert.
//! - The feed reads the books with no caller (`from` unset), and the books assume the caller does
//! not change the price. The router hands the caller to the venue's pricing, which may charge a
//! caller-dependent term; it was zero for the TychoRouter when measured (fork fills match the
//! books to the wei on Base and BSC, and within 1.5e-9 on Robinhood). A nonzero term would make
//! fills worse than quoted, down to the route's `min_amount_out`.
pub use ElfomofiSupportedChain;
/// Protocol system stamped on every component this integration emits.
pub const PROTOCOL_SYSTEM: &str = "pamm:elfomofi";
/// Protocol system of the components a feed built
/// [`with_fallback_router`](feed::ElfomofiFeedBuilder::with_fallback_router) emits.
pub const FALLBACK_PROTOCOL_SYSTEM: &str = "fallback:pamm:elfomofi";
/// Component type stamped on every pair this integration emits.
pub const PROTOCOL_TYPE: &str = "elfomofi_pair";