feat: SHEEP CHOICE routing, cross-chain deposits, and any-token ZAP

One commit because the pieces do not compile apart: the shared copy, the tab
shell and the data layer all changed together, and splitting them further would
mean inventing intermediate states that never existed.

SHEEP CHOICE — the terminal's own swap. Quotes come from a solver that splits
one trade across several pools instead of forcing it down a single path, and
returns a ready-to-sign Settler transaction; the UI draws the split leg by leg
and scores every venue against one shared fee-free baseline, so the card that
says it pays most actually does. The Kyber transaction path is gone — Kyber is
read-only USD valuation now, and there is no Kyber calldata to sign.

BRIDGE — deposits from other chains over Relay, Across and the native portal,
priced side by side and sorted by what actually reaches you. No fee on any of
them. In-flight transfers get a countdown and survive a reload.

ZAP — add liquidity holding neither side of the pair; whatever needs swapping
is done in the same flow, with an optional stake-after step. Uniswap V2
liquidity now shows up under POSITIONS.

Swaps in flight are persisted, so a refresh mid-swap no longer loses the
transaction. Pair labels copy their token and pool addresses, and jump to
DexScreener.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
labrinyang
2026-07-23 00:01:52 +08:00
co-authored by Claude Opus 4.8
parent d73eaf873a
commit bca538e7e3
100 changed files with 10658 additions and 1638 deletions
+2 -15
View File
@@ -8,21 +8,8 @@ import { uniV3FactoryAbi, uniV3PmAbi, uniV3PoolAbi } from '../src/abi/index'
import { ADDR, UNI } from '../src/config/addresses'
import { getLiquidityForAmounts, getSqrtRatioAtTick, minAmountsForLiquidity } from '../src/lib/clmath'
// duplicated rather than imported: src/config/env.ts reads import.meta.env,
// which is vite-only and does not load under node/tsx.
const PUBLIC_RPC = 'https://rpc.mainnet.chain.robinhood.com'
/** repo-root .env `RPC` (SECRET — never print it). No .env / no key: public RPC. */
const rpc = (() => {
const fromEnv = process.env.RPC?.trim()
if (fromEnv) return fromEnv
try {
const text = readFileSync(new URL('../.env', import.meta.url), 'utf8')
return text.match(/^\s*RPC\s*=\s*(\S+)\s*$/m)?.[1] ?? PUBLIC_RPC
} catch {
return PUBLIC_RPC
}
})()
const envText = readFileSync(new URL('../../.env', import.meta.url), 'utf8')
const rpc = envText.match(/^\s*RPC\s*=\s*(\S+)\s*$/m)?.[1] ?? 'https://rpc.mainnet.chain.robinhood.com'
const chain = defineChain({
id: 4663,
name: 'Robinhood Chain',