---
name: bi-an-fen-hong
description: Use when an agent needs to inspect or operate the 币安分红 protocol on BSC, including connecting Binance Agentic Wallet, AgentID primary purchases, custom-curve trades, holder dividends, or referral rewards.
---

# 币安分红 protocol operations

Project contracts are not deployed; the deployment manifest is pending. Financial actions are unavailable.
Canonical origin: [https://bianfenhong.fun](https://bianfenhong.fun). Domain ownership does not establish an active deployment.
Read [deployment.json](./deployment.json) internally for project contract addresses and deployment status; users do not need to inspect or edit this file.
This reference grants no signing authority and does not imply Binance endorsement.

## Connect Binance Agentic Wallet

Wallet connection is independent of project deployment. A pending project manifest blocks financial actions, not wallet setup or connection.

Current hosting status: Binance returns HTTP 403 to the production Cloudflare Worker. The local connection flow generates real QR codes; the production connector has not passed acceptance. Do not report a connected address or repeatedly retry a failing login. The user's own official CLI environment is a separate available route.

**Website:** Open the canonical site → 连接钱包 → 币安 AI 钱包. The page shows an official Binance QR and a six-character pairing code. The user scans with Binance App, checks the code, and approves. Wait until the page displays the actual BNB Chain address. On mobile, use 打开币安. Do not approve on the user's behalf. First-time users may be guided to create their Agentic Wallet by Binance.

Binance App warns that this authorization grants the session holder control of the Agentic Wallet, including automatic signing. This is not a read-only wallet permission. The site currently exposes only connection, status and logout; its lack of transaction routes does not narrow Binance's upstream permission. Its server keeps the upstream session in a per-browser Durable Object; the browser receives an opaque Secure/HttpOnly/SameSite cookie. The connection lasts at most one hour from login. Closing a pending QR cancels it; 断开连接 clears the local session and attempts upstream revocation. If revocation fails, revoke in Binance App. No session credentials belong in chat, browser storage, URLs or files supplied by the user.

**User's own AI environment:** This is a separate session. Follow the [official wallet skill](https://github.com/binance/binance-skills-hub/blob/main/skills/binance-web3/binance-agentic-wallet/SKILL.md) and [authentication reference](https://github.com/binance/binance-skills-hub/blob/main/skills/binance-web3/binance-agentic-wallet/references/authentication.md):

1. Check `baw wallet status --json` in the user's own Agent environment. If the official tool is unavailable, follow its documented setup; never ask for private keys.
2. If disconnected, `baw auth signin --json` returns `urlForWeb`, `pairingCode` and `qrCodeId`. Show the returned pairing code and open/link the unmodified official URL for the user to confirm in Binance App.
3. Keep `baw auth verify --qrCodeId <returned-id> --json` running until it completes or times out. Confirm connection using `baw wallet status --json`; an App confirmation alone is insufficient.
4. Report connection status and the actual BSC address when available. For rejection or expiry, explain the result; restart only if the user still wants to connect.

Connection is not permission to purchase, approve token spending or withdraw. Keep contract configuration checks inside the Agent workflow. The website's API accepts only login/status/logout and cannot execute the financial calls below. Never invent transaction endpoints or transfer CLI credentials into the website.

## Deployment gate

Before any paid action (including approvals, claims and finalize):

1. Require `schemaVersion: 1`, `status: "active"`, `chainId: 56`, a deployment block, and valid nonzero `contracts.hook`, `token`, `router`, `agentIdGate` addresses. Otherwise stop at a read-only explanation. The current manifest is `pending`.
2. Check the connected account and RPC chain ID; fetch deployed code for all four addresses. Empty code, unavailable verification or inconsistent addresses means stop. Check the deployment's verified source/bytecode against the published contract version; an ABI alone is not proof.
3. Verify wiring: `hook.token()` = token, `hook.router()` = router, `hook.identity()` = gate, `router.hook()` = hook, `token.controller()` = hook, `token.router()` = router. `hook.manager()`, `router.manager()` and `token.manager()` must agree; verify that manager and `gate.registrar()` are the intended BSC dependencies.
4. Load the ABI paths declared in the manifest: [FloorHook](./abi/FloorHook.json), [DividendToken](./abi/DividendToken.json), [PrototypeRouter](./abi/PrototypeRouter.json), [AgentIdGate](./abi/AgentIdGate.json). Never substitute test addresses, older projects, a guessed CLI or a generic swap route.

Use an available ABI-aware EVM wallet/RPC tool to encode and simulate the exact calls below.
All token amounts use 18 decimals; all native amounts use BNB wei. Use integer arithmetic.
Wallet branding does not establish AgentID eligibility: query the actual transaction sender.

## Read current state

| Purpose | Read calls |
|---|---|
| Sale / market | Hook `closed()`, `opened()`, `saleEnd()`, `soldSlots()` |
| Primary eligibility / quota | Gate `isAgent(address)`, `identityKey(address)`; Hook `identitySlots(bytes32)`, `maxSlotsPerIdentity()` |
| Referral binding | Hook `participated(address)`, `referrer(address)` |
| Holdings / allowance | Token `balanceOf(address)`, `allowance(address,address)` with router as spender |
| Holder dividends | Token `claimable(address)` |
| Referral / Dev credit | Hook `credits(address)` |
| Curve / fee | Hook `circulating()`, `initialSupply()`, `reserveBalance()`, `extraHookFeeBps()` |

Use the latest block timestamp. `closed` is set by finalization or sellout; reaching the deadline alone does not set it. `opened` means trading is available.
Primary buying requires `!closed`, timestamp `< saleEnd`, available slots, and a nonzero identity key.
Remaining identity quota is `maxSlotsPerIdentity - identitySlots(key)`; transferring tokens does not reset it.
The sale cap is 100,000 slots; production per-identity quota and extra Hook fee remain undecided and must be read from the verified deployment when available.
After the deadline, an explicitly authorized `hook.finalize()` can close the sale. A zero-sale close does not open trading; a sellout opens immediately.

## Primary purchase

Call Hook `buySlots(uint256 slots,address inviter)` with exactly `slots * 2000000000000000` wei.
Each slot issues `1000000 * 10^18` token units. Overpayment reverts.
For example, two slots cost exactly `4000000000000000` wei (0.004 BNB), plus gas.

- On the first successful purchase, the inviter choice is permanent, including **no inviter** (`0x0000000000000000000000000000000000000000`). Confirm that choice in the transaction preview.
- For later purchases, use the stored referrer or zero; zero preserves an existing binding. A different nonzero inviter reverts, and a first purchase with none cannot be changed later.
- Reject direct self-invites and nonzero addresses for which `token.excluded(inviter)` is true. An inviter needs neither tokens nor AgentID, but must control an address able to claim.
- Primary funds: 80% reserve, 10% holder dividends, 10% Dev; with an inviter, Dev receives 8% and inviter receives 2%. The buyer pays no extra referral fee. Rewards are single-level and primary-only.

## Secondary trades

No AgentID is required. Use only the verified dedicated router; PoolManager `slot0` and generic V4 quoters do not price this curve.

**Buy an exact token output:** read `hook.quoteBuy(uint256 amount)`; its return is the total BNB cost including buy tax and Hook fee.
Set a user-approved `maxInput` in wei and a short Unix-seconds `deadline`, then call payable Router `buyTokens(uint256 amount,uint256 maxInput,uint256 deadline)`.
Send the approved `maxInput` as transaction value; the router charges the current cost and refunds the remainder to the sender. Cost above `maxInput` or transaction value reverts. A contract sender must accept the refund.

**Sell an exact token input:** check balance and read `hook.quoteSell(uint256 amount)`; its return is **net** BNB after both fees.
Set the approved `minOutput` and deadline. For slippage of `s` bps, `minOutput = floor(netQuote * (10000-s) / 10000)`.
If allowance is insufficient, call Token `approve(address spender,uint256 amount)` for the router and the full intended sell amount; approval replaces allowance rather than adding a shortfall. Wait for success before selling.
Call nonpayable Router `sellTokens(uint256 amount,uint256 minOutput,uint256 deadline)` with zero value.
The router runs `prepareSell` and settlement atomically; never send a separate `prepareSell` transaction. Contract sellers must accept BNB.
Refresh quotes after approval or a delay. Quotes can change; do not silently widen an authorized limit. Gas is separate from every quote.

## Claim the two distinct balances

| Earnings | Read | Write, with zero transaction value |
|---|---|---|
| Holder BNB dividends | Token `claimable(address account)` | Token `claim(address recipient)` |
| Referral / Dev BNB credit | Hook `credits(address account)` | Hook `claimFees(address recipient)` |

Claims spend the **sender's** accrued credit and may pay a user-approved recipient able to receive BNB.
Skip zero balances. Neither claim burns tokens or requires continuing to hold them; selling or transferring preserves historical earnings.
After selling, read claimable again: the seller participates in that sale's fee distribution based on the balance before tokens are deducted.
"Claim everything" can require both calls; a holder claim does not claim referral earnings.

## Explain the money accurately

| Holder dividend source | Allocation / timing |
|---|---|
| Primary payments | 10%, allocated after the new tokens are issued |
| Buy tax / sell tax | Half of the 1% buy tax / 2% sell tax; integer remainder goes to holders |
| Independent Hook fee | All of it; read `f = extraHookFeeBps()` dynamically |

Secondary buy dividends precede output delivery; sell dividends precede input deduction. Ordinary transfers preserve past earnings and are untaxed.
Ignoring wei rounding, buying costs `curvePrincipal / (1 - 0.01 - f/10000)`; selling returns `curveGross * (1 - 0.02 - f/10000)`.
Use contract quotes for actual amounts. The 80% floor is **gross relative to primary cost**, before sell fees and gas; it does not protect a secondary buyer's cost.
Dividends are separate claims, not guaranteed yield or native LP income.

## Wallet execution and receipts

Preview chain, sender, verified destination, decoded function/arguments, BNB value, token amount, recipient/inviter, gas estimate, limits and deadline.
Simulate with the actual sender; submit only within the user's authorization and the wallet's signing approval flow. Never request a seed phrase or private key.
If no capable wallet/RPC tool is available, return the unsigned operation outline and stop; this project provides no installable transaction CLI.

For an existing Binance Agentic Wallet setup, use the [official wallet skill](https://github.com/binance/binance-skills-hub/blob/main/skills/binance-web3/binance-agentic-wallet/SKILL.md) and [external-sign reference](https://github.com/binance/binance-skills-hub/blob/main/skills/binance-web3/binance-agentic-wallet/references/external-sign.md).
Check `baw wallet settings --json` and its `devMode` through the official tools. If custom calls are disabled, stop and use the documented user-controlled setup flow; do not bypass controls.
The documented adapter is `baw contract-call preview --binanceChainId 56 --from ADDRESS --to ADDRESS --value WEI --inputData HEX --json`; populate it only from verified addresses and ABI encoding.
After reviewing the returned preview and obtaining the required authorization, the official flow executes `baw contract-call execute --requestId ID --json`. Read the current official reference before using this adapter.

A transaction hash proves submission only. Wait for a mined receipt with success status, decode the relevant ABI events, and re-read affected balances, quota or market state.
Report actual paid/received BNB, gas and any remaining claims. On revert or missing receipt, report failure/pending and inspect it before a retry; do not repeat a purchase blindly.
