# AGC Last3 (AGC 搶秒池) — AI Agent Integration Guide On-chain countdown pool settled in AGC on BNB Smart Chain (Chain ID: 56). ## Contracts (BNB Smart Chain) - Stake Token (AGC): `0x63dea5aCdbE1F27c968907D08610A5f0A0284bA6` (18 decimals, standard ERC-20) - AGCLast3 Contract: `0xb6c1fcfF1b58458A9c96F12b85b087fc664b6e6F` - Burn Address: `0x000000000000000000000000000000000000dEaD` ## Game Rules 1. Fixed bid amount per call to `bid()` / `bidRound()` (default `10,000 AGC = 10000000000000000000000` wei). 2. First bid starts a round with `baseBlocks` countdown (~10 min = 1,333 blocks on BSC at 0.45s/block). Each subsequent bid extends `endBlock` by `extendBlocks` (~10 sec = 22 blocks), capped at `block.number + maxBlocks`. 3. Contract tracks the **Last 3 UNIQUE addresses** `[1st, 2nd, 3rd]`. - Current 1st place (`last3[0]`) cannot bid again until someone else takes 1st (`AlreadyFirst()`). - If 2nd or 3rd bids again, they move to 1st without occupying duplicate seats. 4. Settlement (`settle()`, or automatically triggered by the next round's first `bid()` once `block.number > endBlock`): - **If `uniqueCount < 3`**: 100% full refund to all participants. 0% burn, 0% fee, Reserve Pool untouched. - **If `uniqueCount >= 3`**: - Deposits split: **92.0%** player pot, **5.0%** Reserve Pool refill, **2.5%** burned, **0.5%** dev. - Deterministic Settlement Wheel derived from `keccak256(blockhash(endBlock), roundId, totalBids) % 100` draws a bonus from `reservePool`: - `0..44` (45%): `0.5x` -> `0.25%` of Reserve Pool (also fallback if >255 blocks elapsed after `endBlock`) - `45..76` (32%): `1.0x` -> `0.50%` of Reserve Pool - `77..90` (14%): `2.0x` -> `1.00%` of Reserve Pool - `91..97` (7%): `5.0x` -> `2.50%` of Reserve Pool - `98..99` (2%): `10.0x`-> `5.00%` of Reserve Pool - `playerPot + poolBonus` is paid directly to `last3`: **50% / 35% / 15%**. ## Key Function Signatures (Verified 4-Byte Selectors) - `0x1865c57d` — `getState()` -> `(uint256 roundId, uint8 phase, uint256 bidAmount, uint64 endBlock, uint64 blocksLeft, uint32 totalBids, uint32 uniqueCount, uint256 totalDeposited, uint256 currentReservePool, address[3] last3)` - `phase`: `0 = WAITING`, `1 = ACTIVE`, `2 = ENDED_PENDING_SETTLE` - `0x1998aeef` — `bid()` (requires prior ERC-20 `approve(contract, amount)` on AGC, no BNB attached) - `0x32021651` — `bidRound(uint256 expectedRoundId, uint256 maxBidAmount)` (reverts if round changed/ended or bidAmount > maxBidAmount) - `0x11da60b4` — `settle()` (permissionless once `phase == 2`, no BNB attached) - `0xb976b2a2` — `previewWheel(uint256 roundId)` — preview deterministic wheel outcome once `block.number > endBlock` - `0x8f1327c0` — `getRound(uint256 roundId)` — read historical settled/refunded round details - `0x025d26bd` — `seedPool(uint256 amount)` — permanently add AGC into the Reserve Pool ## Recommended Agent Flow 1. Call `getState()`. 2. Check `allowance(agent, AGCLast3)` on AGC (`0x63dea5aCdbE1F27c968907D08610A5f0A0284bA6`). Approve if `< bidAmount`. 3. If `phase == 2`, call `settle()` (or call `bid()` directly to auto-settle and open the next round). 4. If `phase == 0` or (`phase == 1` and `last3[0] != agent`), call `bidRound(roundId, bidAmount)` or `bid()`.