Files
smom-dbis-138/scripts/deployment/deploy-z-chain-contracts.js
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

75 lines
2.9 KiB
JavaScript

const { ethers } = require('hardhat');
const fs = require('fs');
const path = require('path');
require('dotenv').config();
const ROOT = path.resolve(__dirname, '../..');
function syncAddresses(cUsdc, registry) {
const today = new Date().toISOString().slice(0, 10);
const deployedPath = path.join(ROOT, 'config/z-chain-deployed.v1.json');
const deployed = JSON.parse(fs.readFileSync(deployedPath, 'utf8'));
deployed.updated = today;
deployed.status = 'active';
deployed.contracts.cUSDC = cUsdc;
deployed.contracts.accountWalletRegistry = registry;
fs.writeFileSync(deployedPath, `${JSON.stringify(deployed, null, 2)}\n`);
const integrationPath = path.join(ROOT, 'config/z-chain-integration.v1.json');
const integration = JSON.parse(fs.readFileSync(integrationPath, 'utf8'));
integration.contracts.cUSDC = cUsdc;
integration.contracts.accountWalletRegistry = registry;
fs.writeFileSync(integrationPath, `${JSON.stringify(integration, null, 2)}\n`);
const hybxPath = path.join(ROOT, 'config/hybx-omnl-cross-chain-lines.json');
const hybx = JSON.parse(fs.readFileSync(hybxPath, 'utf8'));
for (const line of hybx.lines || []) {
if (line.chains?.['900002']) {
line.chains['900002'].tokenM1 = cUsdc;
}
}
fs.writeFileSync(hybxPath, `${JSON.stringify(hybx, null, 2)}\n`);
const broadcastDir = path.join(ROOT, 'broadcast/DeployZChainEmoney.s.sol/900002');
fs.mkdirSync(broadcastDir, { recursive: true });
const broadcast = {
transactions: [
{ contractName: 'ZChainUSDC', contractAddress: cUsdc },
{ contractName: 'AccountWalletRegistryZ', contractAddress: registry },
],
};
fs.writeFileSync(path.join(broadcastDir, 'run-latest.json'), `${JSON.stringify(broadcast, null, 2)}\n`);
console.log('\nConfig updated:');
console.log(' cUSDC:', cUsdc);
console.log(' AccountWalletRegistry:', registry);
}
async function main() {
const [deployer] = await ethers.getSigners();
const network = await ethers.provider.getNetwork();
console.log('Deployer:', deployer.address);
console.log('Chain ID:', network.chainId.toString());
console.log('Balance:', ethers.formatEther(await ethers.provider.getBalance(deployer.address)));
const ZChainUSDC = await ethers.getContractFactory('ZChainUSDC');
const cUsdc = await ZChainUSDC.deploy(deployer.address);
await cUsdc.waitForDeployment();
const cUsdcAddress = await cUsdc.getAddress();
console.log('ZChainUSDC deployed:', cUsdcAddress);
const AccountWalletRegistry = await ethers.getContractFactory('AccountWalletRegistryZ');
const registry = await AccountWalletRegistry.deploy(deployer.address);
await registry.waitForDeployment();
const registryAddress = await registry.getAddress();
console.log('AccountWalletRegistry deployed:', registryAddress);
syncAddresses(cUsdcAddress, registryAddress);
}
main().catch((err) => {
console.error(err);
process.exit(1);
});