YESswap
English简体中文繁體中文日本語한국어РусскийالعربيةEspañolPortuguêsFrançaisDeutschTiếng ViệtBahasa IndonesiaTürkçe

How to Read a Token Contract: How to derive YESswap referral earnings from BSC logs

Updated 2026-12-02 · YESswap

Short answer. A referral earning on YESswap is not a row in a database. It is a BEP-20 Transfer event on the YES token, and you can reconstruct every one of them yourself.
Best match for this articleSwap tokens on BSCBuy or sell YES and any BEP-20 token directly from your wallet.

The payout is a Transfer event, not a stored balance

Knowing how how to read a token contract works is what separates a clean trade from a costly one. Nothing on the YES token contract holds a "referral balance" for you. The token at 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 records outcomes only, and the outcome that matters is the standard ERC-20. Transfer event. Every raw amount inside that event is a uint256 in wei, and the contract carries 18 decimals, so the number in the log is eighteen orders of magnitude larger than the number a dashboard prints. Divide before you compare, always.

A dashboard figure is a derived view assembled by an indexer. The Transfer event is the primitive, and primitives do not lie about settlement. When the two disagree, assume the view is counting something different, not that the chain is wrong.

Confirm you are reading the right asset before anything else. Paste 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 into the BscScan token filter and open the Transfer tab. Set your own address as the "to" field, and count the rows. A copycat BEP-20 will happily produce a plausible-looking history, and summing it proves nothing about YESswap.

Verify the contract itself, not just the address string. Call symbol() and decimals() via eth_call against 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 and confirm the returns match the token page. A clone can copy the symbol; it cannot occupy the same address on chainId 56. If your RPC returns a different decimals value, you are talking to the wrong contract and every downstream number is void.

Two reads reproduce most of the dashboard

The first read is eth_getLogs against the token contract. Set topic0 to the keccak256 hash of Transfer(address,address,uint256), set topic2 to your address left-padded to 32 bytes, and bound the range with fromBlock and toBlock. Topic1 is the sender, topic2 is the recipient, and the data field holds the amount. Sum every data value where topic2 matches you, then divide the total by 10^18.

The second read is eth_call to balanceOf(yourAddress) on the same contract. That returns a point-in-time balance, not a history. The difference between your inbound Transfer sum and the current balanceOf is what you have since moved out, spent, or staked. That gap is expected and is not evidence of a missing payout.

Any BSC RPC with chainId 56 will serve both calls. Keep the block range bounded, because most public endpoints reject an unbounded eth_getLogs against a busy token. Walk the history in windows and concatenate the results.

A missing receipt is not a missing payout. eth_getLogs returns logs from finalized blocks; a transaction you just signed may sit in the mempool with no receipt yet, and your window will simply not contain it. Re-query the same range after the next block confirms, and the row appears without any change to the contract state. If a hash stays receiptless across many blocks, treat it as dropped or replaced, not as a payout the dashboard owes you.

Run the same query against two independent RPC endpoints before you trust a total. Providers prune differently, lag differently, and occasionally return a stale head, so a window that looks empty on one endpoint can return rows on another. When the two disagree, compare their reported blockNumber from eth_blockNumber and re-query the lagging one at the higher head. A persistent gap in the same window on both endpoints is a real discrepancy; a gap on one endpoint only is an infrastructure artifact.

The router decides whether your number is net or gross

Fees are split before they reach you. The router at 0x0c9a2351e6e982b16559a68767003e7f4d02fb0d participates in the same transaction as the payout, and the Transfer you receive is already net of its split. Reading only your inbound. Transfers therefore gives net earnings, while the router's own logs around that transaction hash carry the gross and the ratio applied.

Two numbers, two questions. A dashboard showing gross while you expect net looks inflated, and a dashboard showing net while you expect gross looks short. Neither is a bug until you know which definition the dashboard uses.

Pick any transaction hash where YES landed in your wallet and open it on BscScan. Read the logs and internal transactions for that hash and look for 0x0c9a2351e6e982b16559a68767003e7f4d02fb0d among the participants. If the router is absent, that particular payout did not route through it, and the gross-versus-net question does not apply to that row.

Thin liquidity changes the size of the split, not its existence. A payout routed through a shallow pool can clear at a worse effective rate than the same nominal referral on a deep one, so two identical referral events can land as different YES amounts. That is price impact inside the swap leg, and it is visible in the same transaction as the Transfer. Do not read it as a router error. If you want the nominal figure, decode the router's event for that hash and compare it against the net. Transfer you received.

Twenty levels leave no trace in the token log

The Transfer event carries three things: sender, recipient, amount. There is no level field. A reader who sums token logs and expects the total to reproduce a per-level breakdown will find a mismatch every single time, even when every payout settled correctly through the router.

Level attribution, where it exists, lives in the router's event signatures or in the transaction calldata. Open the "Input Data" view on a payout transaction and decode the bytes. If a level is encoded there, calldata is your source. If it is not, the token log genuinely cannot tell you the level, and no amount of re-summing will recover it.

This is the most common false alarm in the whole reconciliation. The per-level dashboard is not wrong and the logs are not wrong. They are answering different questions, and only the router's events bridge them.

Decision rule: if the calldata decodes to a function selector you can match against the router's published ABI, trust the level it encodes. If it does not decode, stop attributing levels from token logs and treat the per-level view as unverifiable from primitives alone. The 20-level program is a router-side construct; the token only ever sees a recipient and an amount.

Reconciling a disagreement in the right order

Three causes explain almost every mismatch, and they get cheaper to rule out in a fixed order. First, a block-range boundary: the dashboard counts from a start block you have not matched. Second, a decimals error: a raw integer compared against a formatted number. Third, a definitional difference: net versus gross, or settled versus pending.

Only after all three are excluded does a real discrepancy remain. At that point the useful evidence is the transaction hash, the block number, and the two figures, not a screenshot of the dashboard. A wallet action worth testing deliberately: send a small amount of YES out and watch how your inbound-sum-to-balanceOf gap widens by exactly that amount. That single check separates "the dashboard is miscounting" from "I forgot what I spent."

Cost and timing: the reads themselves are free. eth_getLogs and eth_call cost nothing on a public endpoint, and no gas is spent until you sign a transaction. The only paid step is the deliberate test transfer, which costs BNB gas at whatever the current base fee is, plus the amount you move. Windowed queries over a long history take minutes, not seconds, because each window is a separate round trip; a single unbounded call would be faster and will be rejected.

Decision rules to apply today. If two endpoints disagree on a window, re-query at the higher head before believing either. If the inbound sum exceeds balanceOf by exactly your last outbound transfer, the dashboard is fine and your memory is not. If the gross figure matches the dashboard and the net does not, the dashboard reports gross and you expected net. If neither matches after all three causes are excluded, escalate with the transaction hash and block number, because a screenshot cannot be replayed. Every claim above is checkable on BscScan for 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 on BNB Smart Chain (chain id 56); treat https://yesswap.vip and @web3yesswap as the only official channels.

Open YESswap

Frequently asked questions

Does a referral earning appear as a Transfer event on the YES token contract, or somewhere else?

It appears as a standard ERC-20 Transfer event on 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111, with your address in topic2. The fee router at 0x0c9a2351e6e982b16559a68767003e7f4d02fb0d may also emit events in the same transaction, but the token Transfer is the settlement record.

What block range should I use when calling eth_getLogs for my referral history?

Use a bounded range and walk it in windows, starting from the block the dashboard claims as its start. Public BSC RPC endpoints reject unbounded queries against busy tokens, so windowed calls are the only reliable pattern.

Why does the sum of my inbound YES Transfers differ from my balanceOf result?

Because balanceOf is a point-in-time figure and the Transfer sum is a history. Anything you have moved out, spent, or staked since receiving sits in the gap. The gap is expected and is not a missing payout.

Can I tell which of the 20 referral levels a payout came from using only token logs?

The Transfer event has no level field.

How do I confirm I am looking at the real YES token and not a copycat address?

Compare the contract address character by character against 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 and confirm 18 decimals on the token page. Any other address is a different asset, and summing its Transfers says nothing about YESswap.

Keep reading

Where do you want to go?

Every card below opens the live product with your own wallet — no signup, no custody.

Go straight to the tool

Everything above is one page away: smart money tracker bsc.

Swap tokens on BSCStake and mineYour wallet signs every step. Nothing is custodied.