Files
smom-dbis-138/scripts/deployment/smoke-chain138-oracle-pricing.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

32 lines
1.0 KiB
JavaScript

#!/usr/bin/env node
/**
* Smoke: settlement middleware can fetch live cBTC/USD from chain138-oracle.
*
* CHAIN138_ORACLE_URL=http://127.0.0.1:3500 node scripts/deployment/smoke-chain138-oracle-pricing.mjs
*/
const oracleBase = (process.env.CHAIN138_ORACLE_URL || 'http://127.0.0.1:3500').replace(/\/$/, '');
const cbtc = '0xe94260c555ac1d9d3cc9e1632883452ebdf0082e';
async function main() {
const health = await fetch(`${oracleBase}/health`);
console.log('health', health.status, await health.json());
const url =
`${oracleBase}/api/v1/prices/metamask/v2/chains/138/spot-prices` +
`?tokenAddresses=${cbtc}&vsCurrency=usd`;
const spot = await fetch(url);
const body = await spot.json();
console.log('cBTC spot', spot.status, body);
const rate = body[cbtc]?.usd ?? body[cbtc.toLowerCase()]?.usd;
if (!(rate > 0)) {
console.error('FAIL: no live cBTC/USD from oracle');
process.exit(1);
}
console.log('OK: live BTC/USD =', rate);
}
main().catch((err) => {
console.error(err);
process.exit(1);
});