Merge pull request 'fix: deployments-local.json committed to repo (#589)' (#1049) from fix/issue-589 into master
This commit is contained in:
commit
26957dae88
5 changed files with 39 additions and 25 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -39,3 +39,6 @@ logs/
|
||||||
|
|
||||||
# Holdout scenarios (cloned at runtime by evaluate.sh)
|
# Holdout scenarios (cloned at runtime by evaluate.sh)
|
||||||
.holdout-scenarios/
|
.holdout-scenarios/
|
||||||
|
|
||||||
|
# Local deployment addresses (generated per-run by bootstrap scripts)
|
||||||
|
onchain/deployments-local.json
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"contracts": {
|
|
||||||
"Kraiken": "0xff196f1e3a895404d073b8611252cf97388773a7",
|
|
||||||
"Stake": "0xc36e784e1dff616bdae4eac7b310f0934faf04a4",
|
|
||||||
"LiquidityManager": "0x33d10f2449ffede92b43d4fba562f132ba6a766a",
|
|
||||||
"OptimizerProxy": "0x1cf34658e7df9a46ad61486d007a8d62aec9891e"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -178,22 +178,29 @@ fi
|
||||||
log "Optimizer deployed and upgraded"
|
log "Optimizer deployed and upgraded"
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Step 4 — Read deployment addresses
|
# Step 4 — Read deployment addresses from broadcast JSON
|
||||||
#
|
#
|
||||||
# DeployLocal.sol writes deterministic addresses to deployments-local.json when
|
# deploy-optimizer.sh runs DeployLocal.sol which writes a broadcast JSON file.
|
||||||
# run against a fresh Anvil + standard mnemonic.
|
# We read contract addresses from there rather than relying on a potentially
|
||||||
|
# stale committed deployments-local.json.
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
DEPLOYMENTS="$ONCHAIN_DIR/deployments-local.json"
|
CHAIN_ID="$(cast chain-id --rpc-url "$RPC_URL")"
|
||||||
[ -f "$DEPLOYMENTS" ] || fail2 "deployments-local.json not found — did DeployLocal.sol run?"
|
BROADCAST_JSON="$ONCHAIN_DIR/broadcast/DeployLocal.sol/$CHAIN_ID/run-latest.json"
|
||||||
|
[ -f "$BROADCAST_JSON" ] || fail2 "Broadcast JSON not found at $BROADCAST_JSON — did DeployLocal.sol run?"
|
||||||
|
|
||||||
LM_ADDR=$(python3 -c "
|
LM_ADDR="$(python3 - "$BROADCAST_JSON" <<'PYEOF'
|
||||||
import json
|
import json, sys
|
||||||
d = json.load(open('$DEPLOYMENTS'))
|
with open(sys.argv[1]) as f:
|
||||||
print(d['contracts']['LiquidityManager'])
|
data = json.load(f)
|
||||||
" 2>/dev/null) || fail2 "Failed to read LiquidityManager from deployments-local.json"
|
for tx in data.get('transactions', []):
|
||||||
|
if (tx.get('contractName') or '').lower() == 'liquiditymanager':
|
||||||
|
print(tx.get('contractAddress', ''))
|
||||||
|
break
|
||||||
|
PYEOF
|
||||||
|
)" || fail2 "Failed to read LiquidityManager from broadcast JSON"
|
||||||
|
|
||||||
[ -n "$LM_ADDR" ] || fail2 "LiquidityManager address is empty in deployments-local.json"
|
[ -n "$LM_ADDR" ] || fail2 "LiquidityManager address not found in broadcast JSON"
|
||||||
log "LiquidityManager: $LM_ADDR"
|
log "LiquidityManager: $LM_ADDR"
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"rootDir": "."
|
"rootDir": ".."
|
||||||
},
|
},
|
||||||
"include": ["./**/*.ts"],
|
"include": ["./**/*.ts", "../push3-transpiler/src/**/*.ts"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import deploymentsLocal from '../../onchain/deployments-local.json';
|
|
||||||
|
|
||||||
const env = import.meta.env;
|
const env = import.meta.env;
|
||||||
|
|
||||||
const LOCAL_PONDER_PATH = '/api/graphql';
|
const LOCAL_PONDER_PATH = '/api/graphql';
|
||||||
|
|
@ -16,8 +14,22 @@ interface DeploymentInfrastructure {
|
||||||
weth?: string;
|
weth?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const localContracts = (deploymentsLocal as { contracts?: DeploymentContracts })?.contracts ?? {};
|
interface DeploymentsLocal {
|
||||||
const localInfra = (deploymentsLocal as { infrastructure?: DeploymentInfrastructure })?.infrastructure ?? {};
|
contracts?: DeploymentContracts;
|
||||||
|
infrastructure?: DeploymentInfrastructure;
|
||||||
|
}
|
||||||
|
|
||||||
|
// deployments-local.json is gitignored (generated per-run by bootstrap scripts).
|
||||||
|
// Use a glob pattern (brace expansion) so Vite treats it as dynamic — returns {}
|
||||||
|
// when the file is absent (CI, production) instead of a hard import error.
|
||||||
|
const _localFiles = import.meta.glob<DeploymentsLocal>('../../onchain/deployments-local{.json}', {
|
||||||
|
eager: true,
|
||||||
|
import: 'default',
|
||||||
|
});
|
||||||
|
const deploymentsLocal: DeploymentsLocal = _localFiles['../../onchain/deployments-local.json'] ?? {};
|
||||||
|
|
||||||
|
const localContracts = deploymentsLocal.contracts ?? {};
|
||||||
|
const localInfra = deploymentsLocal.infrastructure ?? {};
|
||||||
const LOCAL_KRAIKEN = (env.VITE_KRAIKEN_ADDRESS ?? localContracts.Kraiken ?? '').trim();
|
const LOCAL_KRAIKEN = (env.VITE_KRAIKEN_ADDRESS ?? localContracts.Kraiken ?? '').trim();
|
||||||
const LOCAL_STAKE = (env.VITE_STAKE_ADDRESS ?? localContracts.Stake ?? '').trim();
|
const LOCAL_STAKE = (env.VITE_STAKE_ADDRESS ?? localContracts.Stake ?? '').trim();
|
||||||
const LOCAL_LM = (env.VITE_LIQUIDITY_MANAGER ?? localContracts.LiquidityManager ?? '').trim();
|
const LOCAL_LM = (env.VITE_LIQUIDITY_MANAGER ?? localContracts.LiquidityManager ?? '').trim();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue