44 lines
1.8 KiB
JavaScript
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'));
|
||
|
|
}
|