# PlugPoint Protocol — AI Integration Contract Canonical website: https://plugpoint.cc Contact: admin@plugpoint.cc Network: BNB Smart Chain Mainnet Chain ID: 56 (0x38) RPC: https://bsc-dataseed.binance.org/ Explorer: https://bscscan.com Machine-readable config: https://plugpoint.cc/contracts.json ## Canonical contracts - PLUG token: 0x39801De9D63234D3Cb1344b9df46727001085F4F - PLUG vendor: 0xa5B85f726eFFc7513CA67f8984F8b3cd9C88CE70 - PLUG gateway: 0x0ADD4F526A4e512EAfF46208B45FF298A78a8c09 - BSC USDT: 0x55d398326f99059fF775485246999027B3197955 All tokens use 18 decimals. PLUG has a fixed initial supply of 1,000,000,000 and no transfer tax. The Vendor reference rate is 1 USDT = 10 PLUG (about 0.1 USDT per PLUG), but integrations MUST read rate() on-chain before quoting. The rate is not a fiat peg or redemption promise. Gateway spending defaults to 80% creator / 15% platform / 5% burn. Integrations MUST treat the PointsSpent event as the settlement record and read its actual creatorShare, platformShare, and burnedAmount values. Never hard-code the split when fulfilling an order. ## Minimal ethers.js v6 ABI ```javascript const ERC20_ABI = [ "function balanceOf(address owner) view returns (uint256)", "function allowance(address owner, address spender) view returns (uint256)", "function approve(address spender, uint256 amount) returns (bool)" ]; const VENDOR_ABI = [ "function rate() view returns (uint256)", "function buyPoints(uint256 usdtAmount)", "event PointsPurchased(address indexed buyer, uint256 usdtPaid, uint256 plugReceived, uint256 currentRate)" ]; const GATEWAY_ABI = [ "function nextAppId() view returns (uint256)", "function games(uint256 appId) view returns (address owner, address payoutWallet, string metadataUri, bool active, uint256 totalVolume)", "function registerGame(address payoutWallet, string metadataUri) returns (uint256 appId)", "function spendPoints(uint256 appId, uint256 amount, string orderId)", "event GameRegistered(uint256 indexed appId, address indexed owner, address payoutWallet, string metadataUri)", "event PointsSpent(uint256 indexed appId, address indexed player, uint256 totalAmount, uint256 creatorShare, uint256 platformShare, uint256 burnedAmount, string orderId)" ]; ``` ## Required purchase flow 1. Connect the wallet and require chainId 56. 2. Parse USDT with 18 decimals. 3. Read Vendor rate() and PLUG inventory immediately before purchase. 4. Read USDT allowance(player, vendor). If insufficient, call USDT approve(vendor, usdtAmount) and wait for confirmation. 5. Call Vendor buyPoints(usdtAmount) and wait for a confirmed receipt. 6. Parse PointsPurchased and refresh balances. Never grant value from a pending transaction. ## Required game spending flow 1. Register a game with registerGame(payoutWallet, metadataUri), then obtain appId from GameRegistered. Do not predict app IDs. 2. Before accepting payment, read games(appId) and require active == true. 3. Generate an application-unique orderId. Persist it before sending the transaction. 4. Read PLUG allowance(player, gateway). If insufficient, call PLUG approve(gateway, amount) and wait for confirmation. 5. Call Gateway spendPoints(appId, amount, orderId) and wait for confirmations appropriate to the product risk. 6. Parse PointsSpent from the canonical Gateway address. Verify chainId, appId, player, totalAmount, orderId, transaction hash, log index, and block number. 7. Fulfill only after event verification. Enforce database uniqueness on both orderId and chainId:transactionHash:logIndex to prevent replay or duplicate fulfillment. 8. Handle chain reorganizations and resume event scanning from a persisted cursor. Client-side UI success is not payment proof. Client-side randomness is not verifiable randomness. Valuable random rewards require a separately audited commit-reveal or VRF design.