deviant/contracts/EscalatingVoteNFT.cash
walerikus 518a3ce174 chore: initial project baseline — full Deviant codebase under version control
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>
2026-06-13 20:38:07 +02:00

54 lines
2.7 KiB
Text

pragma cashscript ^0.12.0;
// EscalatingVoteNFT — anti-plutocracy GOVERNANCE asset (1 identity, escalating votes).
//
// NOT a classic MBA. A classic MBA is fungible money with a bounded (<=5%) fee,
// built to trade. This is built to RESIST CAPTURE of a poll/election:
//
// - Each vote carries a FIXED, always-redeemable backing (`baseBacking`,
// e.g. 100,000 sats = "1 vote"). Honest single-vote participation is ~free:
// the voter can redeem that 100,000 back afterwards.
// - The ACQUISITION PRICE escalates x10 per additional vote, carried in the
// voter's identity NFT commitment (per-identity, not per-address).
// - The premium above the base, `fee = price - baseBacking`, is NON-recoverable
// and goes to the treasury. So buying the Nth vote burns ~baseBacking*10^(N-1):
// a geometric wall against a plutocrat buying a majority.
//
// The NFT returns to this contract each buy, so the price ratchet can't be reset.
// Per-identity sybil-resistance comes from gated NFT issuance (designed separately).
// No pow/loops: one x10 multiply per buy.
contract EscalatingVoteNFT(
bytes tokenCategory,
bytes founderLockingBytecode, // treasury — receives the escalating non-recoverable fee
int baseBacking // redeemable sats per vote, AND the unit-1 price (e.g. 100000)
) {
function buy(bytes recipientLockingBytecode) {
int price = int(tx.inputs[this.activeInputIndex].nftCommitment);
require(price >= baseBacking);
int reservoir = tx.inputs[this.activeInputIndex].tokenAmount;
require(reservoir >= 1);
int fee = price - baseBacking; // escalating, non-recoverable (0 for vote 1)
// [0] identity position back to THIS contract: price 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] the VOTE unit to the voter: ALWAYS baseBacking sats (redeemable), 1 FT.
require(tx.outputs[1].lockingBytecode == recipientLockingBytecode);
require(tx.outputs[1].tokenCategory == tokenCategory);
require(tx.outputs[1].tokenAmount == 1);
require(tx.outputs[1].value == baseBacking);
// [2] escalating non-recoverable fee → treasury (only vote 2+).
if (fee > 0) {
require(tx.outputs[2].lockingBytecode == founderLockingBytecode);
require(tx.outputs[2].value == fee);
require(tx.outputs[2].tokenCategory == 0x);
}
}
}