Files
smom-dbis-138/scripts/deployment/sync-z-chain-deployed-addresses.mjs
zaragoza444 e35ad9047c
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m13s
CI/CD Pipeline / Security Scanning (push) Successful in 2m30s
CI/CD Pipeline / Lint and Format (push) Failing after 45s
CI/CD Pipeline / Terraform Validation (push) Failing after 26s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 28s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 39s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 21s
Validation / validate-genesis (push) Successful in 30s
Validation / validate-terraform (push) Failing after 25s
Validation / validate-kubernetes (push) Failing after 13s
Validation / validate-smart-contracts (push) Failing after 16s
Validation / validate-security (push) Failing after 1m28s
Validation / validate-documentation (push) Failing after 19s
Verify Deployment / Verify Deployment (push) Failing after 53s
feat: add Z Chain 900002 ecosystem with wallet, Z Bot, and deploy scripts
Ship Z Chain slot, International Z Wallet routes, in-app Z Bot APIs, Besu bootstrap, and local/production deployment tooling for digital.omdnl.org.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 05:25:10 -07:00

70 lines
2.6 KiB
JavaScript

#!/usr/bin/env node
/**
* Sync forge broadcast output into z-chain-deployed.v1.json and hybx cross-chain lines.
* Usage: node scripts/deployment/sync-z-chain-deployed-addresses.mjs [broadcast-run.json]
*/
import { readFileSync, writeFileSync, existsSync } from 'fs';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, '../..');
const broadcastPath =
process.argv[2] ||
resolve(root, 'broadcast/DeployZChainEmoney.s.sol/900002/run-latest.json');
if (!existsSync(broadcastPath)) {
console.error(`Broadcast file not found: ${broadcastPath}`);
console.error('Deploy first: bash scripts/deployment/deploy-z-chain-contracts.sh');
process.exit(1);
}
const broadcast = JSON.parse(readFileSync(broadcastPath, 'utf8'));
const txs = broadcast.transactions || [];
let cUsdc = null;
let registry = null;
for (const tx of txs) {
const name = tx.contractName;
const addr = tx.contractAddress;
if (!addr) continue;
if (name === 'ZChainUSDC') cUsdc = addr;
if (name === 'AccountWalletRegistry' || name === 'AccountWalletRegistryZ') registry = addr;
}
if (!cUsdc || !registry) {
console.error('Could not find ZChainUSDC and AccountWalletRegistry in broadcast');
process.exit(1);
}
const deployedPath = resolve(root, 'config/z-chain-deployed.v1.json');
const deployed = JSON.parse(readFileSync(deployedPath, 'utf8'));
deployed.updated = new Date().toISOString().slice(0, 10);
deployed.status = 'active';
deployed.contracts.cUSDC = cUsdc;
deployed.contracts.accountWalletRegistry = registry;
writeFileSync(deployedPath, `${JSON.stringify(deployed, null, 2)}\n`);
const integrationPath = resolve(root, 'config/z-chain-integration.v1.json');
const integration = JSON.parse(readFileSync(integrationPath, 'utf8'));
integration.contracts.cUSDC = cUsdc;
integration.contracts.accountWalletRegistry = registry;
writeFileSync(integrationPath, `${JSON.stringify(integration, null, 2)}\n`);
const hybxPath = resolve(root, 'config/hybx-omnl-cross-chain-lines.json');
const hybx = JSON.parse(readFileSync(hybxPath, 'utf8'));
for (const line of hybx.lines || []) {
if (line.chains?.['900002']) {
line.chains['900002'].tokenM1 = cUsdc;
}
}
writeFileSync(hybxPath, `${JSON.stringify(hybx, null, 2)}\n`);
console.log('Updated:');
console.log(' cUSDC:', cUsdc);
console.log(' AccountWalletRegistry:', registry);
console.log(' config/z-chain-deployed.v1.json');
console.log(' config/z-chain-integration.v1.json');
console.log(' config/hybx-omnl-cross-chain-lines.json (chains.900002.tokenM1)');