{"compiler":{"version":"0.8.36+commit.8a079791"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"CapabilityOutOfBounds","type":"error"},{"inputs":[],"name":"InvalidBasisPoints","type":"error"},{"inputs":[],"name":"InvalidBuy","type":"error"},{"inputs":[],"name":"InvalidDestination","type":"error"},{"inputs":[],"name":"InvalidTax","type":"error"},{"inputs":[],"name":"MinimumGross","type":"error"},{"inputs":[],"name":"BUYBACK_TRIGGER_SATS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INSCRIPTION_TEXT_SHA256","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_USER_GROSS_SATS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PLATFORM_FEE_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"bps","type":"uint256"}],"name":"ceilBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"inscriptionText","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"T","type":"uint256"},{"internalType":"uint256","name":"C","type":"uint256"}],"name":"isValidRule","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"V","type":"uint256"},{"internalType":"uint256","name":"N","type":"uint256"}],"name":"planBuyback","outputs":[{"internalType":"bool","name":"shouldExecute","type":"bool"},{"internalType":"uint256","name":"spend","type":"uint256"},{"internalType":"uint256","name":"nextSequence","type":"uint256"},{"internalType":"uint256","name":"platformFee","type":"uint256"},{"internalType":"uint256","name":"ruleFee","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestedTotal","type":"uint256"},{"internalType":"uint256","name":"executedTotal","type":"uint256"},{"internalType":"uint256","name":"T","type":"uint256"},{"internalType":"bool","name":"postAtTradeStart","type":"bool"}],"name":"quoteUserBuy","outputs":[{"internalType":"uint256","name":"platformFee","type":"uint256"},{"internalType":"uint256","name":"ruleFee","type":"uint256"},{"internalType":"uint256","name":"totalFee","type":"uint256"},{"internalType":"uint256","name":"principal","type":"uint256"},{"internalType":"uint256","name":"totalDebit","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"G","type":"uint256"},{"internalType":"uint256","name":"T","type":"uint256"},{"internalType":"bool","name":"postAtTradeStart","type":"bool"}],"name":"quoteUserSell","outputs":[{"internalType":"uint256","name":"platformFee","type":"uint256"},{"internalType":"uint256","name":"ruleFee","type":"uint256"},{"internalType":"uint256","name":"totalFee","type":"uint256"},{"internalType":"uint256","name":"net","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"reservedCapabilityAt","outputs":[{"internalType":"string","name":"id","type":"string"},{"internalType":"string","name":"title","type":"string"},{"internalType":"string","name":"status","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"reservedCapabilityCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"ruleFee","type":"uint256"},{"internalType":"uint256","name":"C","type":"uint256"}],"name":"routeRuleFee","outputs":[{"internalType":"uint256","name":"creatorAmount","type":"uint256"},{"internalType":"uint256","name":"buybackAmount","type":"uint256"}],"stateMutability":"pure","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"notice":"Immutable pure reference; executors, not this contract, move or lock assets.","version":1}},"settings":{"compilationTarget":{"AIBTCInscription.sol":"AIBTCInscription"},"evmVersion":"paris","libraries":{},"metadata":{"bytecodeHash":"ipfs","useLiteralContent":true},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"sources":{"AIBTCInscription.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.36;\n\nimport {TEXT, TEXT_SHA256} from \"InscriptionText.sol\";\n\n/// @notice Immutable pure reference; executors, not this contract, move or lock assets.\ncontract AIBTCInscription {\n    uint256 public constant VERSION = 1;\n    uint256 public constant PLATFORM_FEE_BPS = 50;\n    uint256 public constant MIN_USER_GROSS_SATS = 1000;\n    uint256 public constant BUYBACK_TRIGGER_SATS = 1000;\n    bytes32 public constant INSCRIPTION_TEXT_SHA256 = TEXT_SHA256;\n\n    error InvalidBasisPoints();\n    error InvalidTax();\n    error InvalidBuy();\n    error InvalidDestination();\n    error MinimumGross();\n    error CapabilityOutOfBounds();\n\n    function inscriptionText() external pure returns (string memory) { return TEXT; }\n\n    function _validTax(uint256 T) internal pure returns (bool) {\n        return T <= 500 && T % 10 == 0;\n    }\n\n    function isValidRule(uint256 T, uint256 C) external pure returns (bool) {\n        return _validTax(T) && (C == 0 || C == 10000) && (T != 0 || C == 0);\n    }\n\n    function ceilBps(uint256 amount, uint256 bps) public pure returns (uint256) {\n        if (bps > 10000) revert InvalidBasisPoints();\n        uint256 remainderProduct = (amount % 10000) * bps;\n        return (amount / 10000) * bps + remainderProduct / 10000 + (remainderProduct % 10000 == 0 ? 0 : 1);\n    }\n\n    function _fees(uint256 base, uint256 T, bool postAtTradeStart) internal pure\n        returns (uint256 platformFee, uint256 ruleFee, uint256 totalFee)\n    {\n        if (!_validTax(T)) revert InvalidTax();\n        platformFee = ceilBps(base, 50);\n        totalFee = ceilBps(base, 50 + (postAtTradeStart ? T : 0));\n        ruleFee = totalFee - platformFee;\n    }\n\n    function quoteUserBuy(uint256 requestedTotal, uint256 executedTotal, uint256 T, bool postAtTradeStart)\n        external pure returns (uint256 platformFee, uint256 ruleFee, uint256 totalFee, uint256 principal, uint256 totalDebit)\n    {\n        if (requestedTotal < 1000) revert MinimumGross();\n        if (executedTotal == 0 || executedTotal > requestedTotal || (postAtTradeStart && executedTotal != requestedTotal)) revert InvalidBuy();\n        (platformFee, ruleFee, totalFee) = _fees(executedTotal, T, postAtTradeStart);\n        principal = executedTotal - totalFee;\n        if (principal == 0) revert InvalidBuy();\n        totalDebit = executedTotal;\n    }\n\n    function quoteUserSell(uint256 G, uint256 T, bool postAtTradeStart)\n        external pure returns (uint256 platformFee, uint256 ruleFee, uint256 totalFee, uint256 net)\n    {\n        if (G < 1000) revert MinimumGross();\n        (platformFee, ruleFee, totalFee) = _fees(G, T, postAtTradeStart);\n        net = G - totalFee;\n    }\n\n    function routeRuleFee(uint256 ruleFee, uint256 C)\n        external pure returns (uint256 creatorAmount, uint256 buybackAmount)\n    {\n        if (C != 0 && C != 10000) revert InvalidDestination();\n        return C == 10000 ? (ruleFee, uint256(0)) : (uint256(0), ruleFee);\n    }\n\n    function planBuyback(uint256 V, uint256 N) external pure\n        returns (bool shouldExecute, uint256 spend, uint256 nextSequence, uint256 platformFee, uint256 ruleFee)\n    {\n        if (V < 1000) return (false, 0, 0, 0, 0);\n        return (true, V, N + 1, 0, 0);\n    }\n\n    function reservedCapabilityCount() external pure returns (uint256) { return 15; }\n\n    function reservedCapabilityAt(uint256 index) external pure returns (string memory id, string memory title, string memory status) {\n        status = \"RESERVED_DOCUMENTATION_ONLY\";\n        if (index == 0) return (\"X402\", \"x402 payments\", status);\n        if (index == 1) return (\"AGENT\", \"AI Agent\", status);\n        if (index == 2) return (\"LLM\", \"language-model integration\", status);\n        if (index == 3) return (\"DAO\", \"governance\", status);\n        if (index == 4) return (\"STOCK\", \"stocks/RWA\", status);\n        if (index == 5) return (\"EXTERNAL_RECEIPT\", \"external receipts\", status);\n        if (index == 6) return (\"EXTERNAL_WALLET_CLAIM\", \"external wallet claims\", status);\n        if (index == 7) return (\"CERTIFIED_EXTERNAL_CONTRACT\", \"certified external contracts\", status);\n        if (index == 8) return (\"DIVIDEND\", \"dividends\", status);\n        if (index == 9) return (\"AUTO_LP\", \"automatic liquidity\", status);\n        if (index == 10) return (\"AIRDROP\", \"airdrops\", status);\n        if (index == 11) return (\"MISSION\", \"mission vault\", status);\n        if (index == 12) return (\"ORBIT\", \"satellite tokens\", status);\n        if (index == 13) return (\"BRIDGE\", \"bridges\", status);\n        if (index == 14) return (\"ORACLE\", \"oracles\", status);\n        revert CapabilityOutOfBounds();\n    }\n}\n","keccak256":"0xd19d0b200b95bedbb9e8f63a7b71108585c70505237a3559c28ab612a39c4a0e","license":"MIT"},"InscriptionText.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.36;\nstring constant TEXT = \"aibtc@R1\\n\\n01 [PARAMETERS] Fixed parameters.\\nThe canonical line is aibtc@R1:0x<40 lowercase hex address>:T<tax bps>:C<destination bps>. It is one ASCII line without whitespace, a newline or leading zeroes in integers. Field order is fixed; unknown, missing or duplicate fields are invalid. The address identifies the selected immutable reference contract.\\nT is 0 or a multiple of 10 from 10 through 500, shared by BUY and SELL. 10000 bps is 100%; T10=0.1%, T100=1%. C0 sends the entire asset rule fee to buyback-and-lock; C10000 assigns it to the creator. T0 has only C0. Entire means the rule fee, not the platform fee. Asset parameters cannot change after creation.\\nisValidRule(T,C) returns whether this combination is valid: T<=500 and T%10=0; C is 0 or 10000; T=0 requires C=0. Invalid combinations return false. This interface neither reads nor registers assets.\\n\\n02 [PURE_MATH] Fees and graduation.\\nAmounts are integer satoshis. ceilBps(a,b) accepts nonnegative amount a and basis points 0<=b<=10000, returning ceil(a*b/10000). With q=a div 10000 and r=a mod 10000, compute q*b+(r*b div 10000)+(r*b mod 10000 != 0 ? 1 : 0), without floating point or an overflowing intermediate a*b. Out-of-range b reverts.\\neffectiveTax = graduated at trade start ? T : 0.\\ntotalFee = ceilBps(base,50+effectiveTax).\\nplatformFee = ceilBps(base,50).\\nruleFee = totalFee-platformFee.\\nRound the total fee up once, determine the platform fee first, and allocate the difference to the rule fee; never sum two separately rounded charges. Before graduation only the 0.5% platform fee applies. The graduation-triggering trade still uses the pre-graduation rule; the next ordinary trade activates the rule fee.\\n\\n03 [PURE_MATH] quoteUserBuy(requestedTotal,executedTotal,T,postAtTradeStart).\\nInputs are requested total, executed total, rule tax and whether graduation preceded trade start. Require requestedTotal>=1000, 0<executedTotal<=requestedTotal and valid T; postAtTradeStart=true additionally requires executedTotal=requestedTotal.\\nUse base=executedTotal and section 02 to return platformFee, ruleFee, totalFee, principal=base-totalFee and totalDebit=executedTotal; principal must be positive. No fee is added outside the request and unexecuted amounts incur no fee. Invalid inputs revert.\\nThis pure function neither determines actual graduation or executed amount nor purchases assets. Input (1000,2,10,false), for example, returns (1,0,1,1,2): a fee result, not permission for partial execution.\\n\\n04 [PURE_MATH] quoteUserSell(G,T,postAtTradeStart).\\nInputs are gross BTC output G, rule tax and whether graduation preceded trade start. Require G>=1000 sats and valid T. Use base=G and section 02 to return platformFee, ruleFee, totalFee and net=G-totalFee. Invalid inputs revert; net>=1000 is not required. This function neither computes AMM prices nor executes a sale.\\n\\n05 [PURE_MATH] Example vectors.\\nAfter graduation at T10, base / platformFee / ruleFee / totalFee / AMM principal or SELL net are:\\n1000 / 5 / 1 / 6 / 994\\n1001 / 6 / 1 / 7 / 994\\n1200 / 6 / 2 / 8 / 1192\\n1201 / 7 / 1 / 8 / 1193\\nAt base=1000, T0 gives 5 / 0 / 5 / 995.\\nAt base=1000, T500 gives 5 / 0 / 5 / 995 before graduation and 5 / 50 / 55 / 945 after graduation.\\nAcross these rounding boundaries, increasing base does not reduce user output; the rule fee can decrease by one satoshi.\\n\\n06 [PURE_MATH] routeRuleFee(ruleFee,C).\\nInputs are a nonnegative rule fee and destination C. C10000 returns creatorAmount=ruleFee and buybackAmount=0; C0 returns creatorAmount=0 and buybackAmount=ruleFee; other C values revert. It only computes destination amounts, transferring no funds and allocating no accounts. A zero rule fee returns two zeroes.\\n\\n07 [BUYBACK] planBuyback(V,N) and lock meaning.\\nInputs are executor-supplied available buyback balance V and current event sequence N. Outputs are shouldExecute, spend, nextSequence, platformFee and ruleFee.\\nV<1000 returns (false,0,0,0,0); V>=1000 returns (true,V,N+1,0,0). Revert for N+1 overflow only when that result is required. A balance of 50000 specifies one full 50000-sat buyback, not split purchases, exempt from platform fee, rule fee and the ordinary-user minimum. Purchased quantity follows the asset's normal AMM BUY mathematics and is not calculated here.\\nBuyback-and-lock means acquired AIBRC is permanently inbound only, with no sale, transfer out, withdrawal or administrator release. Total supply is unchanged; this is not burning.\\nThe function only returns a plan. It neither verifies balances, allocates event slots, schedules or executes trades, nor locks assets. Its result proves no executed buyback and grants no caller a tax exemption.\\n\\n08 [RESERVED_DIRECTORY] Reserved directory.\\nAll fifteen entries are RESERVED_DOCUMENTATION_ONLY: X402 (x402 payments); AGENT (AI Agent); LLM (language-model integration); DAO (governance); STOCK (stocks/RWA); EXTERNAL_RECEIPT (external receipts); EXTERNAL_WALLET_CLAIM (external wallet claims); CERTIFIED_EXTERNAL_CONTRACT (certified external contracts); DIVIDEND (dividends); AUTO_LP (automatic liquidity); AIRDROP (airdrops); MISSION (mission vault); ORBIT (satellite tokens); BRIDGE (bridges); ORACLE (oracles).\\nThese names state only possible future topics, not implemented business functions, valid R1 parameters, automatically enabled capabilities or compatibility promises. STOCK is not a securities issuance, trading, custody or licensing promise.\\n\\n09 [VERSION] Version and scope.\\nOnly new assets explicitly created with this version and contract address use these rules; legacy assets and LP rights are unchanged. The address and public content identify an immutable version; neither the version nor asset parameters can later be substituted. Future extensions require a new version, new address and new assets with explicit new parameters. Existing assets never acquire undeclared capabilities through a software upgrade.\\n\\n10 [BOUNDARY] Implementation and trust boundary.\\nAIBTCInscription is an immutable rule and pure-calculation reference with no business state. It does not custody BTC or AIBRC, read external-chain state, execute trades or claims, or automatically enforce executor compliance.\\nAn executor applies the same mathematics to fixed parameters without requiring per-trade EVM calls; actual parameters, execution and custody remain the executor's responsibility. Anyone may independently recalculate results. A pure return value proves no completed trade, payment or asset lock. How parameters are recorded, transactions submitted, funds held or execution evidenced is outside this contract. This version implements neither actual asset burning nor the business capabilities in the reserved directory.\\n\\n11 [READ_API] Read-only information interfaces.\\nVERSION returns 1; PLATFORM_FEE_BPS returns 50; MIN_USER_GROSS_SATS and BUYBACK_TRIGGER_SATS each return 1000. inscriptionText() returns this complete text; INSCRIPTION_TEXT_SHA256 returns the SHA-256 of its UTF-8 bytes.\\nreservedCapabilityCount() returns 15. For 0<=index<15, reservedCapabilityAt(index) returns id, title and RESERVED_DOCUMENTATION_ONLY in section 08 order; out-of-range indices revert.\\nNumeric interfaces use uint256; unrepresentable results revert rather than wrap. There is no write interface for changing rules or parameters, and no executable business interface for the reserved directory.\\n\";\nbytes32 constant TEXT_SHA256 = hex\"3c0b91af6cbfce5ea8eb8c6d1174c117ff34233695f480f5e6c9b3db7ddaa73b\";\n","keccak256":"0x11ee38c14c35eec454402a42ccb77b8fb9a0ef2a27da3e17867e0378c3495978","license":"MIT"}},"version":1}
