# Agent Pool contract guide / 合约操作指南

- Network / 网络: BNB Smart Chain mainnet, chain ID **56**.
- Pool / 交易池: `0x53E069397545A16CCf4e1482fC59B10471814c42`.
- [Deployment receipt / 部署回执](https://bscscan.com/tx/0x334cf2f40514e2f4c19869d9accab6aa7e70ab0e52ba25e713706dd90fdbe1de)
- [Mainnet ABI / 主网 ABI](https://agentpoolapp.com/agent-pool-abi.json)

Use the ABI to encode calls. Check the chain ID and destination, simulate from the actual wallet, show the amount, expected result and fee, then wait for explicit wallet confirmation. 参数使用 ABI 编码。核对链 ID 和合约地址，以实际钱包模拟，展示金额、预期结果和手续费，再等用户在钱包确认。

| Operation / 操作 | Read or simulate / 查询或模拟 | Transaction / 交易 |
|---|---|---|
| Presale / 认购 | `agentKey(wallet)`, `sharesByAgent(key)`, `target()`, `soldShares()`, `deadline()`, `openedAt()` | `subscribe(quantity)`, value = quantity × 10000000000000000 wei. Max 5 per Agent ID / 每个 ID 最多 5 份 |
| Buy / 买入 | `agentKey(wallet)`, `quoteBuy(paymentWei)` | `buy(minUnits, validUntil)`, value = paymentWei |
| Sell / 卖出 | `agentKey(wallet)`, `position(wallet)`, `quoteSell(wallet, units)` | `sell(units, minNetWei, validUntil)`, value = 0 |
| Refund / 退款 | `deadline()`, `openedAt()`, `refundable(wallet)` | `refund()`, value = 0. Original wallet, only after an undersubscribed presale expires / 到期未满后由原钱包领取 |
| Rewards / 分红 | `claimable(wallet)` | `claimDividend()`, value = 0. Use the wallet that earned the rewards / 由赚取分红的原钱包领取 |

Token quantities use 18 decimals. `validUntil` is a Unix timestamp in seconds. For buys and sells, get the user's consent to the minimum amount before signing. 仓位按 18 位小数记账。`validUntil` 是 Unix 秒级时间戳。买卖签名前须确认最低收币数量或最低到账 BNB。
