Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m3s
CI/CD Pipeline / Security Scanning (push) Successful in 2m58s
CI/CD Pipeline / Lint and Format (push) Failing after 46s
CI/CD Pipeline / Terraform Validation (push) Failing after 26s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 29s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 41s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 22s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 24s
Validation / validate-genesis (push) Successful in 32s
Validation / validate-terraform (push) Failing after 28s
Validation / validate-kubernetes (push) Failing after 13s
Validation / validate-smart-contracts (push) Failing after 12s
Validation / validate-security (push) Failing after 1m31s
Validation / validate-documentation (push) Failing after 23s
Verify Deployment / Verify Deployment (push) Failing after 1m4s
Add BTC L1 settle/reconcile/ledger APIs, bitcoind intake, cBTC PMM hot-LP scripts, and custody credential smoke tests (secrets stay gitignored). Enables full-prod local green health and server pull-deploy for secure.omdnl.org /btc/*. Co-authored-by: Cursor <cursoragent@cursor.com>
65 lines
2.2 KiB
JavaScript
65 lines
2.2 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Verify cBTC is tradable on the hot cUSDT PMM via classic DODO DVM pattern:
|
|
* transfer base → pool, then pool.sellBase(trader).
|
|
*
|
|
* Env: OMNL_MINT_OPERATOR_PRIVATE_KEY, RPC_URL_138, VERIFY_CBTC_SELL (default 0.0001)
|
|
*/
|
|
import { Contract, JsonRpcProvider, Wallet, parseUnits, formatUnits } from 'ethers';
|
|
|
|
const CBTC = '0xe94260c555ac1d9d3cc9e1632883452ebdf0082e';
|
|
const POOL = process.env.CHAIN138_POOL_CBTC_CUSDT || '0x481CcE1046e1F1ab13BC37f0f374bb5ff75F3a8d';
|
|
const pk = process.env.OMNL_MINT_OPERATOR_PRIVATE_KEY?.trim() || process.env.PRIVATE_KEY?.trim();
|
|
if (!pk) {
|
|
console.error('OMNL_MINT_OPERATOR_PRIVATE_KEY required');
|
|
process.exit(1);
|
|
}
|
|
|
|
const provider = new JsonRpcProvider(
|
|
process.env.RPC_URL_138 || process.env.CHAIN_138_RPC_URL || 'https://rpc.d-bis.org',
|
|
);
|
|
const wallet = new Wallet(pk, provider);
|
|
const sellHuman = process.env.VERIFY_CBTC_SELL || '0.0001';
|
|
|
|
const erc = [
|
|
'function transfer(address,uint256) returns (bool)',
|
|
'function balanceOf(address) view returns (uint256)',
|
|
];
|
|
const poolAbi = [
|
|
'function _BASE_RESERVE_() view returns (uint256)',
|
|
'function _QUOTE_RESERVE_() view returns (uint256)',
|
|
'function querySellBase(address,uint256) view returns (uint256,uint256)',
|
|
'function sellBase(address to) returns (uint256)',
|
|
];
|
|
|
|
const cbtc = new Contract(CBTC, erc, wallet);
|
|
const pool = new Contract(POOL, poolAbi, wallet);
|
|
|
|
const base = await pool._BASE_RESERVE_();
|
|
const quote = await pool._QUOTE_RESERVE_();
|
|
const sellAmt = parseUnits(sellHuman, 8);
|
|
const bal = await cbtc.balanceOf(wallet.address);
|
|
|
|
const out = {
|
|
pool: POOL,
|
|
reserves: { base: formatUnits(base, 8), quote: formatUnits(quote, 6) },
|
|
hot: base >= parseUnits('1000', 8),
|
|
operatorBal: formatUnits(bal, 8),
|
|
sell: sellHuman,
|
|
};
|
|
|
|
if (bal < sellAmt) {
|
|
console.log(JSON.stringify({ ...out, ok: false, error: 'insufficient operator cBTC' }, null, 2));
|
|
process.exit(1);
|
|
}
|
|
|
|
const q = await pool.querySellBase(wallet.address, sellAmt);
|
|
out.quotedUsdt = formatUnits(q[0], 6);
|
|
|
|
const t = await cbtc.transfer(POOL, sellAmt);
|
|
await t.wait();
|
|
const tx = await pool.sellBase(wallet.address);
|
|
await tx.wait();
|
|
|
|
console.log(JSON.stringify({ ...out, ok: true, transferTx: t.hash, sellTx: tx.hash }, null, 2));
|