Brings the whole project into git (previously only the on-ramp feature and a few parallel files were tracked). Includes: wallet core (src/), CashScript contracts/, the Capacitor shell (shells/), scripts/, tests, and the docs corpus (wiki/, snapshots/, Parameters/, Archive/, KnowledgeBase text). Excluded via .gitignore: node_modules/, dist/, .env (secrets), testnet WIF key files (.chipnet-*.json, devWallets.ts), KnowledgeBase/RAW media (~9.6 GB), transcripts/ (session logs), and machine-local config (.claude/*.local, *.lock). Secret-scanned before commit — no credentials in the tree. Note: src/swapMath.ts, src/swapBuilder.ts, contracts/OpenMintToken.cash are legacy (OP_RETURN era) but still imported; committed as-is, flagged for a separate removal once de-referenced. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
2.9 KiB
Text
55 lines
2.9 KiB
Text
pragma cashscript ^0.12.0;
|
|
|
|
// EscalatingDualLadderNFT — DUAL escalation: rate x10 AND fee% x10, NFT-bound.
|
|
//
|
|
// The identity NFT commitment carries the next vote's RATE, ratcheting x10 each
|
|
// buy (100,000 -> 1,000,000 -> ...). The FEE PERCENT escalates in lockstep with
|
|
// the rate, derived so it needs no second stored value:
|
|
// feeBps = baseFeeBps * price / startPrice // = baseFeeBps * 10^(N-1)
|
|
// -> 1% -> 10% -> 100% -> 1000% -> ... (baseFeeBps = 100)
|
|
// fee = price * feeBps / 10000 // = rate * fee%
|
|
//
|
|
// Per buy the voter pays TOTAL = rate (redeemable backing in the unit) + fee
|
|
// (non-recoverable, to treasury). Both axes escalate, so the fee compounds ~x100
|
|
// per vote and the "total spent" wall arrives ~twice as fast as rate-only.
|
|
//
|
|
// The position returns to THIS contract each buy, so the rate ratchet (and thus
|
|
// the fee ladder) can't be reset. No pow/loops: one x10 multiply + arithmetic.
|
|
// Deliberately NON-standard (fees >> 5%): an anti-plutocracy governance asset,
|
|
// not a pegged MBA.
|
|
|
|
contract EscalatingDualLadderNFT(
|
|
bytes tokenCategory,
|
|
bytes founderLockingBytecode, // treasury — receives the escalating fee
|
|
int startPrice, // unit-1 rate (e.g. 100000); also the divisor for the fee ladder
|
|
int baseFeeBps // unit-1 fee in bps (e.g. 100 = 1%)
|
|
) {
|
|
function buy(bytes recipientLockingBytecode) {
|
|
int price = int(tx.inputs[this.activeInputIndex].nftCommitment); // the rate, x10 per buy
|
|
require(price >= startPrice);
|
|
int reservoir = tx.inputs[this.activeInputIndex].tokenAmount;
|
|
require(reservoir >= 1);
|
|
|
|
// Fee% ladder, locked to the rate tier: baseFeeBps * (price / startPrice).
|
|
int feeBps = baseFeeBps * price / startPrice; // 100, 1000, 10000, 100000, ...
|
|
int fee = price * feeBps / 10000; // = rate * fee% (can exceed the rate)
|
|
|
|
// [0] identity position back to THIS contract: rate x10, FT-1, mutable NFT preserved.
|
|
require(tx.outputs[0].lockingBytecode == tx.inputs[this.activeInputIndex].lockingBytecode);
|
|
require(tx.outputs[0].tokenCategory == tx.inputs[this.activeInputIndex].tokenCategory);
|
|
require(tx.outputs[0].tokenAmount == reservoir - 1);
|
|
require(tx.outputs[0].nftCommitment == bytes(price * 10));
|
|
require(tx.outputs[0].value >= 546);
|
|
|
|
// [1] vote unit to the voter: backed by `price` (the rate), redeemable.
|
|
require(tx.outputs[1].lockingBytecode == recipientLockingBytecode);
|
|
require(tx.outputs[1].tokenCategory == tokenCategory);
|
|
require(tx.outputs[1].tokenAmount == 1);
|
|
require(tx.outputs[1].value == price);
|
|
|
|
// [2] escalating fee -> treasury (non-recoverable; >= dust by construction).
|
|
require(tx.outputs[2].lockingBytecode == founderLockingBytecode);
|
|
require(tx.outputs[2].value == fee);
|
|
require(tx.outputs[2].tokenCategory == 0x);
|
|
}
|
|
}
|