117 lines
8.5 KiB
JavaScript
117 lines
8.5 KiB
JavaScript
|
|
#!/usr/bin/env node
|
|||
|
|
/**
|
|||
|
|
* sim-anthemus-fx-shared.mjs — the 3-way risk split (desk 40 / swapper 30 / withdrawer 30) and
|
|||
|
|
* the competitive-fee thesis: even the WORST-case shared fee is smaller than a single Ethereum
|
|||
|
|
* transaction, so users migrate TO Bitcoin Cash and STAY.
|
|||
|
|
*
|
|||
|
|
* Answers directly: a $100 covenant swap, rate moves 5%, imbalance capped at 10% of the pool, the
|
|||
|
|
* withdrawer share spread pro-rata across the 90% base. What does the swapper pay? the withdrawer?
|
|||
|
|
*
|
|||
|
|
* Real-world fee benchmarks are approximate/illustrative (2026); the point is the ORDER OF MAGNITUDE.
|
|||
|
|
* Run: node scripts/sim-anthemus-fx-shared.mjs
|
|||
|
|
*/
|
|||
|
|
const $=(n)=>(n<0?'-':'')+'$'+Math.abs(Math.round(n*10000)/10000).toLocaleString('en-US',{minimumFractionDigits:2,maximumFractionDigits:4});
|
|||
|
|
const pct=(n)=>(n*100).toFixed(3)+'%';
|
|||
|
|
const div=(c='=')=>console.log(c.repeat(94));
|
|||
|
|
const head=(t)=>{console.log('\n');div();console.log(t);div();};
|
|||
|
|
|
|||
|
|
// ---- the split (pinned by the user) ----
|
|||
|
|
const SPLIT={desk:0.40, swapper:0.30, withdrawer:0.30};
|
|||
|
|
|
|||
|
|
// ════════════════════════════════════════════════════════════════════════════
|
|||
|
|
head('PART 1 — the exact calculation: $100 swap, 5% rate move, 40/30/30 split.');
|
|||
|
|
{
|
|||
|
|
const swap=100, move=0.05;
|
|||
|
|
const pool=1000; // $100 swap = 10% of pool (the imbalance cap)
|
|||
|
|
const baseFrac=0.90; // 90% reserve base the withdrawer share is spread over
|
|||
|
|
const drift=swap*move; // FX drift on the swapped notional
|
|||
|
|
const dDesk=drift*SPLIT.desk, dSwap=drift*SPLIT.swapper, dWith=drift*SPLIT.withdrawer;
|
|||
|
|
const withdrawBase=pool*baseFrac;
|
|||
|
|
const withdrawFeeRate=dWith/withdrawBase;
|
|||
|
|
console.log(` $${swap} covenant swap (oracle mid, NO market spread). Rate moves ${pct(move)} adversely.`);
|
|||
|
|
console.log(` Total FX drift on the position = $${swap} × ${pct(move)} = ${$(drift)}. Split 40/30/30:\n`);
|
|||
|
|
console.log(` DESK bears 40% = ${$(dDesk)} (${pct(dDesk/pool)} of the $${pool} pool — mostly paper, bounded)`);
|
|||
|
|
console.log(` SWAPPER bears 30% = ${$(dSwap)} = ${pct(dSwap/swap)} of their $${swap} swap <-- the swapper's fee`);
|
|||
|
|
console.log(` WITHDRAWERS bear 30% = ${$(dWith)} spread across 90% base ($${withdrawBase})`);
|
|||
|
|
console.log(` => withdrawal fee = ${pct(withdrawFeeRate)} = ${$(100*withdrawFeeRate)} on a $100 withdrawal\n`);
|
|||
|
|
console.log(` ANSWER:`);
|
|||
|
|
console.log(` • Swapper's loss/fee : ${$(dSwap)} (${pct(dSwap/swap)}) — and ONLY in a 5% adverse move; ~0 normally.`);
|
|||
|
|
console.log(` • Withdrawer's loss : ${pct(withdrawFeeRate)} of their withdrawal (${$(100*withdrawFeeRate)} per $100) — "just a withdrawal fee".`);
|
|||
|
|
console.log(` • Desk's cost : ${$(dDesk)} (${pct(dDesk/pool)} of pool) — and usually paper, not realized (report-6).`);
|
|||
|
|
console.log(`\n Note: the withdrawer need not know the fee's origin (FX rebalancing) — it is simply a small,`);
|
|||
|
|
console.log(` bounded withdrawal fee, socialized across the large stable base exactly like any payment network.`);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ════════════════════════════════════════════════════════════════════════════
|
|||
|
|
head('PART 2 — sensitivity: the fees stay small even in big moves (band caps exposure).');
|
|||
|
|
{
|
|||
|
|
const swap=100, pool=1000, baseFrac=0.90;
|
|||
|
|
console.log(['rate move','drift on $100','swapper fee','withdrawer fee','desk % of pool'].map(s=>s.padStart(18)).join(''));
|
|||
|
|
div('-');
|
|||
|
|
for(const move of [0.01,0.05,0.10,0.20]){
|
|||
|
|
const drift=swap*move;
|
|||
|
|
const dSwap=drift*SPLIT.swapper, dWith=drift*SPLIT.withdrawer, dDesk=drift*SPLIT.desk;
|
|||
|
|
const wf=dWith/(pool*baseFrac);
|
|||
|
|
console.log([pct(move), $(drift), pct(dSwap/swap), pct(wf), pct(dDesk/pool)].map(s=>String(s).padStart(18)).join(''));
|
|||
|
|
}
|
|||
|
|
console.log('\n Even a 20% FX crash (the full 2022 parity move) → swapper 6%, withdrawer 0.67%, desk 0.8% of pool.');
|
|||
|
|
console.log(' And these are the TAIL. In the normal two-way regime the drift is ~0, so all three fees are ~0.');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ════════════════════════════════════════════════════════════════════════════
|
|||
|
|
head('PART 3 — the migration thesis: BCH fees vs the alternatives (a $100 cross-currency move).');
|
|||
|
|
{
|
|||
|
|
const rows=[
|
|||
|
|
['Ethereum USDC→EURC (DEX)', 'gas ~$3–20 + DEX 0.1–0.3% + slippage', '~3%–20%+ on $100'],
|
|||
|
|
['Bank / card FX', 'FX markup 1–3% + fixed fees', '~2%–4%'],
|
|||
|
|
['Wire / remittance', 'flat $15–40 + 1–2% FX', '~15%+ on $100'],
|
|||
|
|
['CEX (deposit→trade→withdraw)', 'trade 0.1% + withdraw $1–25 + KYC', '~1%–25%'],
|
|||
|
|
['— — —', '', ''],
|
|||
|
|
['BCH Anthemus — NORMAL', 'swap ~0% + withdraw ~0% + tx <$0.001', '≈ $0.00'],
|
|||
|
|
['BCH Anthemus — 5% STRESS', 'swapper 1.5% + withdraw 0.167% + tx <$0.001', '~$1.67 all-in'],
|
|||
|
|
['BCH Anthemus — 20% CRASH', 'swapper 6% + withdraw 0.67% + tx <$0.001', '~$6.67 all-in'],
|
|||
|
|
];
|
|||
|
|
for(const [venue,fees,allin] of rows){
|
|||
|
|
if(venue.startsWith('—')){ console.log(' '+'-'.repeat(88)); continue; }
|
|||
|
|
console.log(' '+venue.padEnd(30)+fees.padEnd(44)+allin);
|
|||
|
|
}
|
|||
|
|
console.log('\n => For SMALL/MEDIUM payments the Ethereum GAS ALONE ($3–20) often exceeds our entire STRESS-case');
|
|||
|
|
console.log(' all-in fee. On BCH the base tx is <$0.001, and even the tail risk-share fee undercuts a bank.');
|
|||
|
|
console.log(' In the normal regime the cost is effectively zero. There is no cheaper cross-currency rail.');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ════════════════════════════════════════════════════════════════════════════
|
|||
|
|
head('PART 4 — why 40/30/30 is a genuine balance, and the "stay, don\'t leave" flywheel.');
|
|||
|
|
console.log(`
|
|||
|
|
THE BALANCE (why sharing beats concentrating):
|
|||
|
|
• Desk 40% — small enough that the desk's worst exposure = 40% × band(10%) × maxMove(20%) = 0.8% of
|
|||
|
|
the reserve. Trivial capital; the desk can offer a NEAR-HARD peg without a big buffer or premium.
|
|||
|
|
• Swapper 30% — partial "polluter pays": the user who created the position bears some of its drift,
|
|||
|
|
which aligns incentives and needs only a tiny buffer (30% of a few-% drift). Not full de-risking,
|
|||
|
|
but for a payments user who just wants to spend, retaining a sliver of FX is a non-issue.
|
|||
|
|
• Withdrawer 30% — socialized as a tiny withdrawal fee across the 90% base. Universal in payments;
|
|||
|
|
the user need not know its origin. Bounded by the band; ~0 in the normal regime.
|
|||
|
|
No single party carries a dangerous share; the peg is "effectively hard" (worst withdrawer haircut
|
|||
|
|
~0.17% at 5%, ~0.67% at 20%) — smaller than any competitor's baseline fee.
|
|||
|
|
|
|||
|
|
THE REFRAME (you are right): "hard vs soft peg" is the wrong axis for a PAYMENTS product. Every
|
|||
|
|
payment network charges fees — often 2–3%. A peg that costs a BOUNDED, TRANSPARENT, sub-1% fee only
|
|||
|
|
in a stress tail is not "soft" in any way a user cares about; it is simply the cheapest withdrawal
|
|||
|
|
fee they will find. Call it a withdrawal fee, disclose the cap, move on.
|
|||
|
|
|
|||
|
|
THE FLYWHEEL — migrate IN, and STAY:
|
|||
|
|
• One uniform rail for 100+ fragmented stablecoins (USDT/USDC/EURC/… across Tron/ETH/BSC/Sol),
|
|||
|
|
all tradeable against each other on a chain with <$0.001 fees and offline-receivable settlement.
|
|||
|
|
• Leaving (withdrawing to a home chain) costs the small risk-share fee + that chain's gas; STAYING
|
|||
|
|
costs ~nothing and unlocks the whole hub (spend, swap, receive, the DEX, the ecosystem).
|
|||
|
|
• So the fee structure itself is a GRAVITY WELL: the rational move is to bring value ONTO BCH and
|
|||
|
|
keep it there, because every capability lives here and every exit pays the foreign chain's toll.
|
|||
|
|
The 90%-stays-on-chain assumption (report-6) is not just an accounting fact — it is the product's
|
|||
|
|
core incentive, and the risk-share fees are calibrated to reinforce it.
|
|||
|
|
|
|||
|
|
HONEST CAVEATS: the swapper/withdrawer shares are VARIABLE (state-dependent), unlike a fixed payment
|
|||
|
|
fee — bounded + on-chain-transparent, but not constant; disclose the cap. The swapper retains 30% of
|
|||
|
|
FX direction (fine for payments, not for a hedger). Fee benchmarks are illustrative 2026 orders of
|
|||
|
|
magnitude. Real path stress numbers from the 2021-23 sims; directional, not a forecast.
|
|||
|
|
`);
|