Files
smom-dbis-138/scripts/deployment/sync-btc-ledger-contract-env.mjs
zaragoza444 54ca9bea3b
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 52s
CI/CD Pipeline / Security Scanning (push) Successful in 2m40s
CI/CD Pipeline / Lint and Format (push) Failing after 49s
CI/CD Pipeline / Terraform Validation (push) Failing after 24s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 27s
Deploy ChainID 138 / Deploy ChainID 138 (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Verify Deployment / Verify Deployment (push) Has been cancelled
Validation / validate-smart-contracts (push) Failing after 14s
Validation / validate-security (push) Failing after 1m20s
Validation / validate-documentation (push) Failing after 18s
feat(settlement): wire real Chain 138 contracts for 1,000 BTC ledger
Add canonical btc-l1-ledger config, /btc/contracts API, Python chain138-oracle
service, and production deploy scripts so secure.omdnl.org can serve live cBTC,
DODO, and PMM pool addresses with headroom-aware mint gating.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 02:26:20 -07:00

44 lines
1.8 KiB
JavaScript

#!/usr/bin/env node
/**
* Emit .env lines for 1,000 BTC ledger real contract addresses from
* config/btc-l1-ledger-1000.chain138.v1.json
*
* node scripts/deployment/sync-btc-ledger-contract-env.mjs
* node scripts/deployment/sync-btc-ledger-contract-env.mjs --write .env.fragment
*/
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(__dirname, '../..');
const cfgPath = path.join(repoRoot, 'config/btc-l1-ledger-1000.chain138.v1.json');
const cfg = JSON.parse(fs.readFileSync(cfgPath, 'utf8'));
const lines = [
`OMNL_BTC_LEDGER_CONFIG=config/btc-l1-ledger-1000.chain138.v1.json`,
`CBTC_ADDRESS_138=${cfg.token.address}`,
`BTC_L1_RECIPIENT_ADDRESS=${cfg.recipients.primaryMintTarget}`,
`BTC_EXISTING_MINT_HOLDER=${cfg.recipients.existingMintHolder1000}`,
`DODO_PMM_INTEGRATION=${cfg.dodoEvm.pmmIntegration}`,
`CHAIN_138_DODO_PMM_INTEGRATION=${cfg.dodoEvm.pmmIntegration}`,
`RESERVE_SYSTEM=${cfg.oracle.reserveSystem}`,
`ORACLE_PRICE_FEED=${cfg.oracle.oraclePriceFeed}`,
`ORACLE_AGGREGATOR_ADDRESS=${cfg.oracle.aggregator}`,
`AGGREGATOR_ADDRESS=${cfg.oracle.aggregator}`,
`ORACLE_PROXY_ADDRESS=${cfg.oracle.proxy}`,
`PRICE_FEED_KEEPER_ADDRESS=${cfg.oracle.priceFeedKeeper}`,
`CHAIN138_POOL_CBTC_CUSDT=${cfg.pmmPools.cBTC_cUSDT}`,
`CHAIN138_POOL_CBTC_CUSDC=${cfg.pmmPools.cBTC_cUSDC}`,
`CHAIN138_POOL_CBTC_CXAUC=${cfg.pmmPools.cBTC_cXAUC}`,
];
const writeArg = process.argv.indexOf('--write');
if (writeArg >= 0) {
const out = process.argv[writeArg + 1] || path.join(repoRoot, '.env.btc-ledger.fragment');
fs.writeFileSync(out, `${lines.join('\n')}\n`, 'utf8');
console.log(`Wrote ${out}`);
} else {
console.log(lines.join('\n'));
}