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

Automated Trading Bot BSC: Post-Revoke Verification: Proving allowance() Returns

Updated 2026-12-02 · YESswap

Short answer. A revoke is a state write, not a checkbox. Here is how to prove the write landed, at which block, and why a zero read can still be a lie.
Best match for this articleWallet toolsBatch balance, batch transfer, approvals and wallet creation.

allowance() is a storage read, and the returned word is the whole answer

Knowing how automated trading bot BSC works is what separates a clean trade from a costly one. ERC-20 keeps allowances in a nested mapping, keyed by owner then spender. The function allowance(address owner, address spender) is declared view and returns uint256. A revoke is nothing more exotic than approve(spender, 0): it overwrites that one storage slot with zero and emits. Approval(owner, spender, 0) in the same transaction.

Reading it involves no signature and no gas. You issue eth_call against the token contract with selector 0xdd62ed3e and the owner and spender ABI-encoded as two 32-byte words. Decode the returned word as uint256. For YES on BSC the contract is 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 with 18 decimals, so a return of 1 wei is a live allowance, not a rounding artefact. Treat any non-zero word as an open door.

Verify it yourself: call eth_call with to set to the token address and data set to 0xdd62ed3e followed by the padded owner and spender. Compare the hex word against 0x0. A revert here usually means you pointed at a non-contract address, so check that eth_getCode returns non-empty bytes first.

Pin every read to a block, or the answer belongs to a different chain state

eth_call with no block parameter resolves to latest on whichever node answered the request. Load-balanced RPC pools route consecutive calls to different backends, and those backends sit at different heights. A read served by a lagging node can return the pre-revoke value minutes after your transaction was mined.

The mirror-image failure is more dangerous for a bot. You broadcast approve(spender, 0), a node with a rich mempool view returns zero, and you conclude the revoke is final while the transaction is still pending. It can still revert, be replaced at the same nonce, or be dropped. Zero from an unmined state is a forecast, not a fact.

Pin the block. Call eth_getTransactionReceipt on the revoke transaction, require status equal to 0x1, and record blockNumber. Then repeat the eth_call with that blockNumber as the block parameter. A zero at or after the receipt's block is proof. A zero before it is noise.

Two endpoints disagreeing is the common case, not the exotic one. Query the same pinned block against a second RPC and compare the raw hex words byte for byte. If one endpoint returns a block it has not indexed yet, it errors rather than lying, so treat an error as "unknown" and never as zero. Missing receipts are their own signal: eth_getTransactionReceipt returning null after a broadcast means the transaction is not mined on that node's view, so wait and re-poll rather than inferring success from a pending-state read.

A running signer re-approves faster than you can revoke

Most bots do not approve per trade. They call approve(router, amount) once at startup and reuse the standing allowance for every swap. Revoke while that process is alive and its next trade calls approve again. Your revoke was correct at its block and obsolete one block later.

Aggregators multiply the problem. Each router or aggregator address is a separate spender with a separate slot, so revoking the one you remember leaves the rest funded. The decision rule: stop the signer process first, then enumerate every spender the owner has ever approved, then revoke each one.

Enumerate from logs, not memory. Run eth_getLogs on 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 with topic0 set to keccak256('Approval(address,address,uint256)') and topic1 set to the padded owner address, spanning the owner's first activity block to latest. Every distinct topic2 is a spender. Re-check each with allowance() at a pinned block. BscScan's Events tab, filtered by owner address, shows the same set if you prefer to eyeball it.

Apply these rules as written. If the signer process is still running, stop it before broadcasting any revoke. If a spender appears in logs but not in your notes, revoke it anyway. If a pinned read returns non-zero after a confirmed revoke receipt, a later approve overwrote the slot, so re-enumerate from the receipt's block forward.

Cost is bounded and small. A revoke is one approve transaction paying BSC gas, and the verification itself is free: eth_call and eth_getLogs cost nothing, and a receipt lookup is a single request. Timing is one block for the receipt to appear, then one pinned read; budget a second confirmation block before you let the bot sign again.

Three artefacts, checked in order, constitute proof

The receipt proves the approve(spender, 0) call executed without revert. The Approval log inside that receipt proves which owner/spender pair was zeroed, because topics[1] is the owner, topics[2] is the spender, and the data field is an all-zero word. The allowance() read at or after that block proves stored state matches the event.

Each artefact alone is weaker than the set. A successful receipt could belong to a different call on the same contract. An event without a later read could have been overwritten by a subsequent approve from the same owner. A zero read without a receipt cannot tell you whether the revoke was mined or merely simulated.

BEP-20 does not mandate the return value of approve, which is why you verify through the event and the state read rather than trusting a boolean. Confirm that logs[]. address equals the token contract before decoding anything. A log emitted by an impostor contract with a similar name proves nothing about YES.

Thin liquidity changes the risk, not the proof. On a pair with little depth, a surviving allowance lets a spender move a large share of the pool in one transferFrom, so a non-zero read matters more there, not less. The verification steps are identical; only the urgency of the decision rule changes.

Gating a bot on a verified-zero allowance

Treat allowance as a precondition evaluated per trade, never as a cached constant. Before signing, the bot calls allowance(owner, spender) at latest and compares the uint256 against the exact amount it intends to authorise. On mismatch it re-approves explicitly instead of assuming. After a revoke, it refuses to sign until a fresh pinned read returns zero and the signer process is confirmed stopped.

This matters for YES specifically. Any spender holding a non-zero allowance on 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 can move balances without further consent. Verify the token address character-for-character against that string, and confirm the spender against the router actually used in the trade. YESswap signs only in the user wallet and never asks for a private key or seed phrase, so any flow that requests one is not the platform at https://yesswap. 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

What exact value does allowance() return after a successful revoke?

Zero, as a uint256 returned by the view function at selector 0xdd62ed3e, and the same transaction emits Approval(owner, spender, 0) with an all-zero data word.

My bot read zero but transferFrom still succeeded. Why?

The read was almost certainly served at a block before the revoke was mined, or from a node exposing pending state. Pin the eth_call to the revoke receipt's blockNumber and repeat.

Do I need to revoke every spender separately?

Allowances are keyed by owner and spender, so each router or aggregator address holds its own slot. Enumerate spenders from Approval logs filtered by your owner address.

Can I trust the Success badge on BscScan alone?

Pair it with the Approval log in the same transaction and a fresh allowance() read at or after that block height.

Which token address should the bot hard-code for YES?

0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 on BNB Smart Chain, chainId 56, 18 decimals. Any other address is not YES.

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: ai quant trading bsc.

Wallet toolsStake and mineYour wallet signs every step. Nothing is custodied.