mirror of
https://github.com/luxfi/migration.git
synced 2026-10-30 15:25:07 +00:00
DEX LP migration toolkit for Lux C-Chain 96369. Contract (LiquidityDeployer.sol) unchanged and RED-approved (16/16 tests). All hardening is in the Python executor, plan builder, Makefile, and RUNBOOK. FIX 1 (HIGH #4) oracle sanity bound — BLOCKED BROADCAST. The old one-sided guard (tick_o < v3edge-1000) only fired at ~25,000x error; a 10x oracle typo cloned a honeypot and let an LBTC-seller drain 4.29M WLUX. oracle.json is now a dual-control object per base {price, expected_tick(, band_ticks)}: the executor recomputes the tick from `price` and ABORTS if it strays > ORACLE_TICK_BAND (2000 ticks ~= +/-22%) from the SECOND operator's independent expected_tick. A hard ONESIDED_MAX_WLUX cap (5,000,000e18) bounds per-pool WLUX at risk. The honeypot-edge check is kept as a backstop. Oracle validation runs BEFORE any V3 decrease. tools/execute.py: onesided_band_ok(), compute_onesided_bid(); tools/oracle.example.json. FIX 2 (HIGH #5b) freeze baseline — prevents double-decrease to 75%. Re-running `make snapshot && make plan` mid-migration used to read already-halved liquidity as the new baseline and remove 50% of the remainder. build_plan.py now freezes tools/baseline.json (original liquidity + one-shot 50% target per tokenId) on first plan and reads it thereafter; a position already <= its baseline target is a no-op via the executor's on-chain precheck. Regenerating the plan is idempotent. FIX 3 (MED #6) per-tx nonce + stop masking nonce errors. Re-read the live pending nonce before every tx and ABORT on drift (concurrent signer on treasury 0x9011); preflight asserts nonce stable across two reads 3s apart. A nonce too low/high is now FATAL (abort before the 240s receipt wait) instead of being masked as "sent"; benign "already known" still counts as accepted; 0/5 acceptance aborts. FIX 4 (LOW) finalize + gas gate. Opt-in FINALIZE=1: after all adds, zero residual LD approvals and transferOwnership LD -> DAO Safe (0x51284...). Execute-mode preflight aborts if baseFee > gasPrice. state.json pools deduped (upsert by v4PoolId). Verify: make test 16/16; tools/test_red_oracle.py PASS (K>=1.5x REJECT, 10x aborts); make migrate dry-run clean end-to-end; fat-finger oracle aborts before touching V3. Co-authored-by: Hanzo Dev <[email protected]>
20 lines
472 B
TOML
20 lines
472 B
TOML
[profile.default]
|
|
src = "src"
|
|
out = "out"
|
|
test = "test"
|
|
libs = ["lib"]
|
|
solc = "0.8.26"
|
|
evm_version = "cancun"
|
|
via_ir = true
|
|
optimizer = true
|
|
optimizer_runs = 44444444
|
|
bytecode_hash = "none"
|
|
fs_permissions = [{ access = "read", path = "out" }]
|
|
|
|
# Fast profile for iterating tests (no via_ir). Bytecode from this profile is
|
|
# NOT the deployment artifact — the default profile above is the canonical one.
|
|
[profile.test]
|
|
via_ir = false
|
|
optimizer = true
|
|
optimizer_runs = 200
|