From 0b089f118144a8e392606fd6329dfed85d28ef2c Mon Sep 17 00:00:00 2001 From: defiQUG Date: Tue, 14 Apr 2026 07:13:17 -0700 Subject: [PATCH] Enforce native protocol inventory rules --- config/deployment-status.json | 345 ++++++++++++------ .../native-protocol-only.invalid.json | 76 ++++ .../native-protocol-only.valid.json | 110 ++++++ scripts/README.md | 9 + scripts/validate-deployment-status.cjs | 65 +++- 5 files changed, 501 insertions(+), 104 deletions(-) create mode 100644 config/validation-examples/native-protocol-only.invalid.json create mode 100644 config/validation-examples/native-protocol-only.valid.json diff --git a/config/deployment-status.json b/config/deployment-status.json index 2fd536c..011abc3 100644 --- a/config/deployment-status.json +++ b/config/deployment-status.json @@ -167,7 +167,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_mainnet", @@ -179,7 +182,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -190,9 +196,12 @@ "quote": "WETH", "venueAddress": "0x7111000000000000000000000000000000000001", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_mainnet", @@ -201,9 +210,12 @@ "quote": "USDC", "venueAddress": "0xba11000000000000000000000000000000000001", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_mainnet", @@ -212,9 +224,12 @@ "quote": "USDC", "venueAddress": "0xc711000000000000000000000000000000000001", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_mainnet", @@ -294,7 +309,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -306,7 +324,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -317,9 +338,12 @@ "quote": "WETH", "venueAddress": "0x712100000000000000000000000000000000000a", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -328,9 +352,12 @@ "quote": "USDC", "venueAddress": "0xba2100000000000000000000000000000000000a", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -339,9 +366,12 @@ "quote": "USDC", "venueAddress": "0xc72100000000000000000000000000000000000a", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -421,7 +451,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "cro", @@ -433,7 +466,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -444,9 +480,12 @@ "quote": "WCRO", "venueAddress": "0x7161000000000000000000000000000000000019", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "cro", @@ -530,7 +569,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "bnb", @@ -542,7 +584,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -553,9 +598,12 @@ "quote": "WBNB", "venueAddress": "0x7131000000000000000000000000000000000038", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "bnb", @@ -637,7 +685,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "xdai", @@ -649,7 +700,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -660,9 +714,12 @@ "quote": "WXDAI", "venueAddress": "0x7171000000000000000000000000000000000064", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "xdai", @@ -671,9 +728,12 @@ "quote": "USDC", "venueAddress": "0xba71000000000000000000000000000000000064", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "xdai", @@ -682,9 +742,12 @@ "quote": "USDC", "venueAddress": "0xc771000000000000000000000000000000000064", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "xdai", @@ -765,7 +828,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "pol", @@ -777,7 +843,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -788,9 +857,12 @@ "quote": "WPOL", "venueAddress": "0x7141000000000000000000000000000000000089", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "pol", @@ -799,9 +871,12 @@ "quote": "USDC", "venueAddress": "0xba41000000000000000000000000000000000089", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "pol", @@ -810,9 +885,12 @@ "quote": "USDC", "venueAddress": "0xc741000000000000000000000000000000000089", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "pol", @@ -832,11 +910,11 @@ } ] }, - "1111": { - "name": "Wemix", - "activationState": "deferred", - "cwTokens": { - "cWBTC": "0xcb7c000000000000000000000000000000000457" + "1111": { + "name": "Wemix", + "activationState": "deferred", + "cwTokens": { + "cWBTC": "0xcb7c000000000000000000000000000000000457" }, "anchorAddresses": { "USDC": "0xcebA9300f2b948710d2653dD7B07f33A8B32118C" @@ -861,7 +939,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "wemix", @@ -873,7 +954,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -884,9 +968,12 @@ "quote": "WWEMIX", "venueAddress": "0x7191000000000000000000000000000000000457", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "wemix", @@ -969,7 +1056,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -981,7 +1071,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -992,9 +1085,12 @@ "quote": "WETH", "venueAddress": "0x7121000000000000000000000000000000002105", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -1003,9 +1099,12 @@ "quote": "USDC", "venueAddress": "0xba21000000000000000000000000000000002105", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -1014,9 +1113,12 @@ "quote": "USDC", "venueAddress": "0xc721000000000000000000000000000000002105", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -1077,7 +1179,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -1089,7 +1194,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -1100,9 +1208,12 @@ "quote": "WETH", "venueAddress": "0x712100000000000000000000000000000000a4b1", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -1111,9 +1222,12 @@ "quote": "USDC", "venueAddress": "0xba2100000000000000000000000000000000a4b1", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -1122,9 +1236,12 @@ "quote": "USDC", "venueAddress": "0xc72100000000000000000000000000000000a4b1", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "eth_l2", @@ -1186,7 +1303,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "celo", @@ -1198,7 +1318,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -1209,9 +1332,12 @@ "quote": "WCELO", "venueAddress": "0x718100000000000000000000000000000000a4ec", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "celo", @@ -1231,9 +1357,12 @@ "quote": "USDC", "venueAddress": "0xc78100000000000000000000000000000000a4ec", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "celo", @@ -1295,7 +1424,10 @@ "role": "public_routing", "poolType": "wrapped_native", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "avax", @@ -1307,7 +1439,10 @@ "role": "public_routing", "poolType": "stable_quote", "venue": "dodo_pmm", - "publicRoutingEnabled": true + "publicRoutingEnabled": false, + "notes": [ + "placeholder_scaffold_not_live" + ] } ], "gasReferenceVenues": [ @@ -1318,9 +1453,12 @@ "quote": "WAVAX", "venueAddress": "0x715100000000000000000000000000000000a86a", "supported": true, - "live": true, - "routingVisible": true, - "reference": true + "live": false, + "routingVisible": false, + "reference": true, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "avax", @@ -1340,9 +1478,12 @@ "quote": "USDC", "venueAddress": "0xc75100000000000000000000000000000000a86a", "supported": true, - "live": true, - "routingVisible": true, - "reference": false + "live": false, + "routingVisible": false, + "reference": false, + "notes": [ + "placeholder_scaffold_not_live" + ] }, { "familyKey": "avax", diff --git a/config/validation-examples/native-protocol-only.invalid.json b/config/validation-examples/native-protocol-only.invalid.json new file mode 100644 index 0000000..e52bcb9 --- /dev/null +++ b/config/validation-examples/native-protocol-only.invalid.json @@ -0,0 +1,76 @@ +{ + "version": "1.2.0", + "updated": "2026-04-14", + "homeChainId": 138, + "chains": { + "1": { + "name": "Example Chain", + "cwTokens": { + "cWUSDT": "0x1111111111111111111111111111111111111111", + "cWUSDC": "0x2222222222222222222222222222222222222222" + }, + "anchorAddresses": { + "USDC": "0x3333333333333333333333333333333333333333", + "USDT": "0x4444444444444444444444444444444444444444" + }, + "pmmPools": [ + { + "base": "cWUSDT", + "quote": "USDC", + "poolAddress": "0xd011000000000000000000000000000000000001", + "feeBps": 3, + "k": 1, + "role": "public_routing", + "publicRoutingEnabled": true + } + ], + "gasQuoteAddresses": { + "WETH": "0x5555555555555555555555555555555555555555", + "USDC": "0x3333333333333333333333333333333333333333" + }, + "gasPmmPools": [ + { + "familyKey": "example", + "base": "cWUSDT", + "quote": "WETH", + "poolAddress": "0xd021000000000000000000000000000000000001", + "feeBps": 30, + "k": 1, + "role": "public_routing", + "poolType": "wrapped_native", + "venue": "dodo_pmm", + "publicRoutingEnabled": true + } + ], + "gasReferenceVenues": [ + { + "familyKey": "example", + "protocol": "uniswap_v3", + "base": "cWUSDT", + "quote": "WETH", + "venueAddress": "0x7111000000000000000000000000000000000001", + "supported": true, + "live": true, + "routingVisible": true, + "reference": true + }, + { + "familyKey": "example", + "protocol": "1inch", + "base": "cWUSDT", + "quote": "USDC", + "venueAddress": null, + "supported": true, + "live": true, + "routingVisible": true, + "aggregatorOnly": true, + "dependsOn": [ + "dodo_pmm", + "uniswap_v3" + ], + "indexRequired": true + } + ] + } + } +} diff --git a/config/validation-examples/native-protocol-only.valid.json b/config/validation-examples/native-protocol-only.valid.json new file mode 100644 index 0000000..dd589ea --- /dev/null +++ b/config/validation-examples/native-protocol-only.valid.json @@ -0,0 +1,110 @@ +{ + "version": "1.2.0", + "updated": "2026-04-14", + "homeChainId": 138, + "chains": { + "1": { + "name": "Example Chain", + "cwTokens": { + "cWUSDT": "0x1111111111111111111111111111111111111111", + "cWUSDC": "0x2222222222222222222222222222222222222222" + }, + "anchorAddresses": { + "USDC": "0x3333333333333333333333333333333333333333", + "USDT": "0x4444444444444444444444444444444444444444" + }, + "pmmPools": [ + { + "base": "cWUSDT", + "quote": "USDC", + "poolAddress": "0x1234567890123456789012345678901234567890", + "feeBps": 3, + "k": 1, + "role": "public_routing", + "publicRoutingEnabled": true + } + ], + "gasQuoteAddresses": { + "WETH": "0x5555555555555555555555555555555555555555", + "USDC": "0x3333333333333333333333333333333333333333" + }, + "gasPmmPools": [ + { + "familyKey": "example", + "base": "cWUSDT", + "quote": "WETH", + "poolAddress": "0x6666666666666666666666666666666666666666", + "feeBps": 30, + "k": 1, + "role": "public_routing", + "poolType": "wrapped_native", + "venue": "dodo_pmm", + "publicRoutingEnabled": true + }, + { + "familyKey": "example", + "base": "cWUSDT", + "quote": "USDC", + "poolAddress": "0x7777777777777777777777777777777777777777", + "feeBps": 30, + "k": 1, + "role": "public_routing", + "poolType": "stable_quote", + "venue": "dodo_pmm", + "publicRoutingEnabled": true + } + ], + "gasReferenceVenues": [ + { + "familyKey": "example", + "protocol": "uniswap_v3", + "base": "cWUSDT", + "quote": "WETH", + "venueAddress": "0x8888888888888888888888888888888888888888", + "supported": true, + "live": false, + "routingVisible": false, + "reference": true + }, + { + "familyKey": "example", + "protocol": "balancer", + "base": "cWUSDT", + "quote": "USDC", + "venueAddress": null, + "supported": true, + "live": false, + "routingVisible": false, + "reference": false + }, + { + "familyKey": "example", + "protocol": "curve", + "base": "cWUSDT", + "quote": "USDC", + "venueAddress": null, + "supported": true, + "live": false, + "routingVisible": false, + "reference": false + }, + { + "familyKey": "example", + "protocol": "1inch", + "base": "cWUSDT", + "quote": "USDC", + "venueAddress": null, + "supported": true, + "live": false, + "routingVisible": false, + "aggregatorOnly": true, + "dependsOn": [ + "dodo_pmm", + "uniswap_v3" + ], + "indexRequired": true + } + ] + } + } +} diff --git a/scripts/README.md b/scripts/README.md index c866691..92a69b5 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -40,6 +40,15 @@ node scripts/validate-deployment-status.cjs **Exit code:** 0 if valid, 1 if invalid (errors to stderr). +**Native protocol-only examples:** + +```bash +node scripts/validate-deployment-status.cjs config/validation-examples/native-protocol-only.valid.json +node scripts/validate-deployment-status.cjs config/validation-examples/native-protocol-only.invalid.json +``` + +The invalid example intentionally includes a placeholder scaffold and a non-native live `1inch` row to exercise the rejection path. + **Parent proxmox repo:** live Mainnet cW/TRUU pool deploy and ratio-matched top-up scripts live under `scripts/deployment/` (`deploy-mainnet-pmm-cw-truu-pool.sh`, `add-mainnet-truu-pmm-topup.sh`); see `docs/03-deployment/MAINNET_PMM_TRUU_CWUSD_PEG_AND_BOT_RUNBOOK.md` ยง11. --- diff --git a/scripts/validate-deployment-status.cjs b/scripts/validate-deployment-status.cjs index dc8812a..266772a 100644 --- a/scripts/validate-deployment-status.cjs +++ b/scripts/validate-deployment-status.cjs @@ -8,6 +8,8 @@ * - For each pmmPool / pmmPoolsVolatile[]: role in {defense, public_routing, truu_routing}, * feeBps and k present, base/quote (or tokenIn/tokenOut) exist in cwTokens or anchorAddresses. * TRUU must be listed under anchorAddresses when used as quote (e.g. mainnet chain 1). + * - Any row marked live/routingVisible/publicRoutingEnabled must use a native protocol contract, + * not a placeholder scaffold or aggregator-only/non-native lane. * * Exit code: 0 if valid, 1 if invalid (and prints errors to stderr). */ @@ -16,11 +18,27 @@ const fs = require('fs'); const path = require('path'); const CONFIG_DIR = path.join(__dirname, '..', 'config'); -const DEPLOYMENT_STATUS_PATH = path.join(CONFIG_DIR, 'deployment-status.json'); +let DEPLOYMENT_STATUS_PATH = path.join(CONFIG_DIR, 'deployment-status.json'); const PHASE1_CW = ['cWUSDT', 'cWUSDC']; const VALID_ROLES = ['defense', 'public_routing', 'truu_routing']; const VALID_REFERENCE_PROTOCOLS = ['uniswap_v3', 'balancer', 'curve', '1inch']; +const VALID_NATIVE_REFERENCE_PROTOCOLS = ['uniswap_v3', 'balancer', 'curve']; + +function looksPlaceholderAddress(address) { + if (!address || typeof address !== 'string') return false; + const normalized = address.toLowerCase(); + if (!/^0x[0-9a-f]{40}$/.test(normalized)) return false; + if (normalized === '0x0000000000000000000000000000000000000000') return true; + const body = normalized.slice(2); + const placeholderPrefixes = ['d0', '71', 'ba', 'c7']; + const zeroCount = body.split('0').length - 1; + return placeholderPrefixes.some((prefix) => body.startsWith(prefix)) && zeroCount >= 24; +} + +function isLiveRow(row) { + return row?.live === true || row?.routingVisible === true || row?.publicRoutingEnabled === true; +} function loadJson(p) { return JSON.parse(fs.readFileSync(p, 'utf8')); @@ -50,6 +68,12 @@ function validatePoolEntries(chainId, pools, listLabel, knownTokens, errors) { if (z === '0x0000000000000000000000000000000000000000') { errors.push(`Chain ${chainId} ${listLabel}[${i}]: poolAddress must not be zero when set`); } + if (pool.publicRoutingEnabled === true && looksPlaceholderAddress(z)) { + errors.push(`Chain ${chainId} ${listLabel}[${i}]: live public routing poolAddress must use a native protocol contract, not a placeholder scaffold (${addr})`); + } + } + if (pool.publicRoutingEnabled === true && pool.venue && pool.venue !== 'dodo_pmm') { + errors.push(`Chain ${chainId} ${listLabel}[${i}]: public routing rows must use the native dodo_pmm venue, not "${pool.venue}"`); } } } @@ -121,6 +145,14 @@ function main() { } if (!referenceVenuesByFamily.has(venue.familyKey)) referenceVenuesByFamily.set(venue.familyKey, []); referenceVenuesByFamily.get(venue.familyKey).push(venue); + if (isLiveRow(venue)) { + if (!VALID_NATIVE_REFERENCE_PROTOCOLS.includes(venue.protocol)) { + errors.push(`Chain ${chainId} gasReferenceVenues[${i}]: live/routingVisible rows must use a native protocol contract, not "${venue.protocol}"`); + } + if (looksPlaceholderAddress(venue.venueAddress)) { + errors.push(`Chain ${chainId} gasReferenceVenues[${i}]: live/routingVisible venueAddress must use a native protocol contract, not a placeholder scaffold (${venue.venueAddress})`); + } + } } for (const [familyKey, venues] of referenceVenuesByFamily.entries()) { @@ -146,4 +178,33 @@ function main() { process.exit(0); } -main(); +function resolveInputPath(argv) { + const candidate = argv[2]; + if (!candidate || candidate === '-h' || candidate === '--help') { + return DEPLOYMENT_STATUS_PATH; + } + return path.isAbsolute(candidate) ? candidate : path.join(process.cwd(), candidate); +} + +function printUsage() { + process.stdout.write('Usage: node scripts/validate-deployment-status.cjs [path/to/deployment-status.json]\n'); +} + +if (require.main === module) { + const argv = process.argv; + if (argv[2] === '-h' || argv[2] === '--help') { + printUsage(); + process.exit(0); + } + if (argv[2]) { + DEPLOYMENT_STATUS_PATH = resolveInputPath(argv); + } + main(); +} + +module.exports = { + looksPlaceholderAddress, + isLiveRow, + validatePoolEntries, + main, +};