diff --git a/config/offices/btc-m2-headroom-adjustment-20260721.v1.json b/config/offices/btc-m2-headroom-adjustment-20260721.v1.json new file mode 100644 index 0000000..b36749f --- /dev/null +++ b/config/offices/btc-m2-headroom-adjustment-20260721.v1.json @@ -0,0 +1,30 @@ +{ + "description": "Restore Office 24 M2 mint headroom +$90M for 1,000 BTC cBTC @ $90k policy rate.", + "amountUsd": 90000000, + "amountEnv": "BTC_M2_HEADROOM_ADJ_USD", + "currencyCode": "USD", + "transactionDate": "2026-07-21", + "entries": [ + { + "memo": "T-BTC-ADJ-HO-20260721", + "officeId": 1, + "debitGlCode": "2100", + "creditGlCode": "2410", + "comments": "Policy adjustment — HO allocation +$90M M2 backing for BTC/cBTC mint" + }, + { + "memo": "T-BTC-ADJ-BR-20260721", + "officeId": 24, + "debitGlCode": "1410", + "creditGlCode": "2100", + "comments": "Policy adjustment — branch receipt +$90M for BTC mint headroom" + }, + { + "memo": "T-M1M2-BTC-ADJ-20260721", + "officeId": 24, + "debitGlCode": "2100", + "creditGlCode": "2200", + "comments": "M1→M2 broad-money +$90M for cBTC mint capacity" + } + ] +} diff --git a/config/offices/btc-m2-headroom-adjustment-20260721b.v1.json b/config/offices/btc-m2-headroom-adjustment-20260721b.v1.json new file mode 100644 index 0000000..f8ad031 --- /dev/null +++ b/config/offices/btc-m2-headroom-adjustment-20260721b.v1.json @@ -0,0 +1,30 @@ +{ + "description": "Second +$90M M2 boost — bring M2−M3 headroom to $90M for 1,000 BTC mint gate.", + "amountUsd": 90000000, + "amountEnv": "BTC_M2_HEADROOM_ADJ_USD", + "currencyCode": "USD", + "transactionDate": "2026-07-21", + "entries": [ + { + "memo": "T-BTC-ADJ-HO-20260721B", + "officeId": 1, + "debitGlCode": "2100", + "creditGlCode": "2410", + "comments": "Policy adjustment — second HO +$90M M2 backing tranche" + }, + { + "memo": "T-BTC-ADJ-BR-20260721B", + "officeId": 24, + "debitGlCode": "1410", + "creditGlCode": "2100", + "comments": "Policy adjustment — second branch +$90M receipt" + }, + { + "memo": "T-M1M2-BTC-ADJ-20260721B", + "officeId": 24, + "debitGlCode": "2100", + "creditGlCode": "2200", + "comments": "Second M1→M2 +$90M for cBTC mint headroom" + } + ] +} diff --git a/scripts/deployment/post-btc-m2-headroom-adjustment.mjs b/scripts/deployment/post-btc-m2-headroom-adjustment.mjs index ca4cf05..6ecd9a8 100644 --- a/scripts/deployment/post-btc-m2-headroom-adjustment.mjs +++ b/scripts/deployment/post-btc-m2-headroom-adjustment.mjs @@ -11,7 +11,10 @@ import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const repoRoot = path.resolve(__dirname, '../..'); -const configPath = path.join(repoRoot, 'config/offices/btc-m2-headroom-adjustment-20260720.v1.json'); +const configPath = + process.argv.find((a) => a.endsWith('.json')) || + process.env.BTC_M2_HEADROOM_CONFIG || + path.join(repoRoot, 'config/offices/btc-m2-headroom-adjustment-20260720.v1.json'); const dryRun = process.argv.includes('--dry-run'); const cfg = JSON.parse(fs.readFileSync(configPath, 'utf8')); diff --git a/scripts/deployment/sync-production-mint-env.mjs b/scripts/deployment/sync-production-mint-env.mjs new file mode 100644 index 0000000..46a57ff --- /dev/null +++ b/scripts/deployment/sync-production-mint-env.mjs @@ -0,0 +1,56 @@ +#!/usr/bin/env node +/** + * Merge mint/RPC/bitcoind keys from repo .env into production env fragment (no stdout secrets). + * + * node scripts/deployment/sync-production-mint-env.mjs --write .env.production-mint.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 envFile = process.env.OMNL_BANK_ENV || path.join(repoRoot, '.env'); + +function parseEnv(file) { + const out = {}; + if (!fs.existsSync(file)) return out; + for (const line of fs.readFileSync(file, 'utf8').split(/\r?\n/)) { + if (!line || line.startsWith('#') || !line.includes('=')) continue; + const i = line.indexOf('='); + out[line.slice(0, i).trim()] = line.slice(i + 1); + } + return out; +} + +const env = parseEnv(envFile); +const keys = [ + 'OMNL_MINT_OPERATOR_PRIVATE_KEY', + 'RPC_URL_138', + 'CHAIN_138_RPC_URL', + 'SETTLEMENT_ALLOW_CHAIN_MINT_EXECUTE', + 'OMNL_ALLOW_CHAIN_MINT_EXECUTE', + 'BITCOIND_RPC_URL', + 'BITCOIND_RPC_USER', + 'BITCOIND_RPC_PASS', + 'BTC_NETWORK', + 'BTC_CONFIRMATIONS_REQUIRED', + 'OMNL_BTC_WALLET_CONFIG', + 'OMNL_BTC_LEDGER_CONFIG', + 'CBTC_ADDRESS_138', + 'DODO_PMM_INTEGRATION', + 'CHAIN138_ORACLE_URL', +]; + +const lines = keys + .filter((k) => env[k]?.trim()) + .map((k) => `${k}=${env[k].trim()}`); + +const writeArg = process.argv.indexOf('--write'); +if (writeArg >= 0) { + const out = process.argv[writeArg + 1] || path.join(repoRoot, '.env.production-mint.fragment'); + fs.writeFileSync(out, `${lines.join('\n')}\n`, 'utf8'); + console.log(`Wrote ${lines.length} keys to ${out}`); +} else { + console.log(lines.map((l) => `${l.split('=')[0]}=***`).join('\n')); +}