mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
The hosted API answers ACCESS_DENIED without a contract, which made every market outside our own chain unquotable and turned a pair with no pool into an error about somebody else's quota. A pool answers anyone. So the gateway reads contracts: our chain through the V4 precompiles, with V2 beside them when a router is deployed, and every other chain through the V2 router and the V3 quoter Uniswap published there. The hosted provider is registered only when a key is given, because a provider that always refuses is worse than none. V3 was the missing arm and it is where the liquidity is. The gateway could read a V2 router and our precompiles and nothing in between, so most markets on most chains were invisible. The venue asks each of the four fee tiers and keeps the best — which tier holds a pair is a fact about that pair — and a tier with no pool reverts, which is the ordinary answer to three of the four rather than a failure to report. Venues are per chain now. One router for all of them could not tell which chain it was answering about, so the shape only ever fit a single-chain deployment. Each chain names its RPC, its router and its quoter, and any of them can be overridden by name. Quotes are cached for ten seconds. A pool moves when somebody trades in it, so the window is short by nature; what it saves is the second reader of the same pair in the same second, and every eth_call saved is one a public endpoint is entitled to refuse. Measured: 1.26s cold, 22ms warm. And a route names the venue that answered. The router's own routing label describes its strategy, so a V3 pool on Ethereum came back marked V4_NATIVE — our precompile, on somebody else's chain. That is the one thing a route must never misreport, since it is what a reader checks to see where their order goes. Measured live, no key: 1 WETH is 2494.500698 USDC on Ethereum via uniswap_v3, 2494.591730 on Base. Co-authored-by: Hanzo Dev <[email protected]>