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

Quoting a swap twice on BSC: which state moved, and when to refresh

Updated 2026-12-02 · YESswap

Short answer. Two quotes minutes apart differ because a quote is a read of mutable pool state, not a stored price. This walks through the variables that drift, the exact calls that expose each one, and the block-distance rule for discarding a stale quote.
Best match for this articleProvide liquidityAdd or remove liquidity and see the pool you would trade against.

A quote is a read, not a price

Nothing is stored when you request a quote. The router executes getAmountsOut(amountIn, path) as an eth_call against a node's copy of state, and the pair contract answers with whatever token0 and token1 balances existed at the end of the last block that touched it. The constant-product formula runs on those two numbers, net of the pool fee. No transaction is created, nothing enters the mempool, and no gas is spent.

Because getReserves() returns a value keyed to one block, the quote is exact for that block and approximate for every block after it. Any mint, burn, or swap in a later block rewrites the inputs to the formula. The output on your screen is a function of a state that has already moved on by the time you read it.

Verification is a two-field comparison. Take the blockNumber attached to your eth_call response, or call eth_blockNumber at request time, and compare it with the timestamp of the pair's most recent Swap event on BscScan. Two quotes carrying different blockNumber values were computed against different reserve states by definition. That alone explains most "the number changed" complaints.

What actually moves between quote one and quote two

Three inputs drift independently, and only one of them is the pool. Reserve ratio moves with every trade routed through the pair. The fee tier is fixed per pair, but effective price impact scales with your size relative to reserves, so a large LP add deepens the pool and improves your quote without any price change at all. Gas price never touches the output amount, but it changes the BNB you must hold back for the transaction, which changes how much of your balance is genuinely swappable.

The clean test is the Sync event. Each Sync on the pair carries the new reserves and marks a state change. Pull the logs between your two quote timestamps with eth_getLogs filtered on the pair address and the Sync topic. If no Sync landed in that window, the difference came from your input amount, your path, or the fee tier. The pool did not move.

A worked case makes this concrete. Suppose you quote a BNB to USDT swap, then spend time adjusting the amount because gas looks high, then quote again. If a Sync landed in between, the second quote reflects new reserves and the first is dead. If the log query comes back empty, your second quote differs only because you changed the input, and the original amountOutMin is still valid.

Slippage tolerance turns a stale quote into a bounded bet

amountOutMin is computed at signing time and enforced on-chain by the router. Reserves moving against you beyond that bound cause a revert, and you pay gas for a transaction that produced nothing. Reserves moving in your favor still pay you at least amountOutMin, and the surplus is yours. The cost of a stale quote is therefore asymmetric: downside capped at gas, upside uncapped in your favor.

That asymmetry sets the decision rule. Re-quoting only pays when the expected adverse move exceeds the gas cost of a revert. For small trades against a deep pair, the expected move is usually below that cost, and re-signing adds latency without adding safety. For large trades relative to reserves, the expected move dominates and a fresh quote is cheaper than a revert.

Diagnosis after the fact is a receipt read. A failed swap typically carries a revert reason such as INSUFFICIENT_OUTPUT_AMOUNT or the equivalent string on the router you used, visible under the failed transaction's status on BscScan. Gas burned is gasUsed multiplied by effectiveGasPrice on that same receipt. Compare that product against the output difference between your two quotes to see which choice was cheaper.

The fee router changes the number the pair sees

YESswap's fee router at 0x0c9a2351e6e982b16559a68767003e7f4d02fb0d sits between the user and the underlying DEX path. The amount that reaches getAmountsOut is the post-fee amount, not the amount debited from your wallet. A quote that models the full wallet input directly against the pair overstates output, and the resulting amountOutMin is one the router can never satisfy.

Re-quote after fee deduction, never before. Call the fee router's read methods with eth_call pinned to a fixed block, then compare the returned fee against the gap between your wallet debit and the router's forwarded amount in the transaction's internal transfers on BscScan. The two numbers should reconcile to the wei. If they do not, you are quoting the wrong input.

Address discipline belongs in the same step. The only YES token contract is 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111, the only domain is https://yesswap. vip, and the only official handles are @web3yesswap on Telegram and X. A lookalike router returns a plausible quote and takes the approval. Verify on chain before you trade, every time.

Refresh on block distance, not on the clock

Clock time is the wrong unit because BSC block production is not perfectly uniform. Track the block distance between the quote's blockNumber and the block you are about to sign in. If a Sync event landed on the relevant pair in between, the quote is stale regardless of how few seconds elapsed. If no Sync landed, the quote remains exact even after several blocks have passed.

The check is one call. Run eth_getLogs against the pair address with the Sync topic between the two block numbers. An empty result means reserves are unchanged and your original amountOutMin still holds. A non-empty result means re-quote, then recompute amountOutMin from the fresh output.

Two failure modes are silent and worth naming. Signing a quote whose blockNumber predates a large. Sync event sets amountOutMin above what the pool can now pay, and the swap reverts after gas is spent. Quoting the full wallet input instead of the post-fee amount produces an amountOutMin the router can never satisfy. Both are caught by the same two reads: the Sync log window and the fee router's returned fee.

Edge cases: thin pools, missing receipts, disagreeing RPCs

A thin pair breaks the assumptions above. When your amountIn is a material fraction of reserves, a single. Sync can move the output by more than your slippage band, so the block-distance rule tightens to "re-quote every block." Cross-check with getReserves at the exact signing block, not a cached value, and set amountOutMin from that read rather than from the earlier quote.

Missing receipts are a node-sync problem, not a pool problem. If eth_getTransactionReceipt returns null for a transaction. BscScan shows as mined, your endpoint is behind; query eth_blockNumber on it and compare with a second provider before concluding the swap failed. Two RPC endpoints disagreeing on reserves usually means one is lagging by a block or two, which the Sync log window will expose immediately.

Decision rules follow from the reads. If eth_getLogs returns zero Sync events between your quote block and your signing block, sign the original quote. If it returns one or more, re-quote and recompute amountOutMin from the fresh getAmountsOut output. If your two RPCs report different blockNumber values for the same call, trust the higher one and re-pull. If the fee router's returned fee does not reconcile to the internal transfer gap, stop and re-check the input amount before signing anything.

A re-quote costs nothing in gas: it is an eth_call, so the only cost is the round-trip to your node. The real cost of skipping a refresh is a reverted swap, where you pay gasUsed times effectiveGasPrice and receive nothing. The real cost of over-refreshing is latency, which on BSC is measured in blocks, not minutes. A quote is valid until the next. Sync on that pair, which can arrive in the very next block. Budget for one refresh per signing attempt and treat any Sync in between as a hard invalidation, not a suggestion. 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 quote cost gas?

getAmountsOut runs as an eth_call against node state and never enters the mempool.

Can I re-quote after signing?

The transaction is already broadcast. You can wait for inclusion or replace it with a transaction using the same nonce and higher gas.

Does the YES token contract affect my BNB to USDT quote?

Only if your path routes through it. Check the path array returned by the router before signing.

Is a failed swap refunded?

The swap reverts atomically and the input token stays in your wallet. Only the gas is spent.

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: swap tokens on bsc.

Provide liquidityStake and mineYour wallet signs every step. Nothing is custodied.