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

Add Liquidity on BSC: Reading price impact on a BSC swap: the reserve math

Updated 2026-12-02 · YESswap

Short answer. The number a DEX shows you as price impact is not an estimate. It is the output of a formula the router evaluates against two storage slots on the pair contract, and you can call the same function yourself at the same block.
Best match for this articleProvide liquidityAdd or remove liquidity and see the pool you would trade against.

The pair holds two numbers, and the router does the rest

Knowing how add liquidity on BSC works is what separates a clean trade from a costly one. A constant-product pair stores exactly two reserves and enforces x*y=k across every trade. The router never guesses. It calls getReserves() on the pair, receives reserve0, reserve1 and blockTimestampLast, then evaluates amountOut = (amountIn * 997 * reserveOut) / (reserveIn * 1000 + amountIn * 997). The 997/1000 factor is the 0.

Price impact falls out of comparing two ratios. The marginal price is reserveOut/reserveIn, the rate you would get for an infinitesimal trade. The effective price is amountOut/amountIn, the rate you actually receive. Their gap, expressed as a percentage, is the cost of your size. Nothing else enters the calculation.

Verify it without trusting any interface. Open the pair on BscScan, hit. Read Contract, call getReserves(), and note both values. Then call getAmountsOut(amountIn, path) on the router as a read function using the identical path your swap will use. Divide amountIn by reserveIn to see what fraction of the pool you are about to consume. That fraction is the honest measure of how far the effective price will sit from the marginal one.

The formula has an edge case worth knowing before you size anything. As amountIn approaches reserveIn, the denominator is dominated by the input term and the effective price collapses toward zero, so impact is not linear in trade size. A trade consuming a small fraction of the pool costs roughly that fraction; a trade consuming a large one costs far more than the fraction suggests. On a pool with thin liquidity, the curve bends before you expect it to, which is why a size that felt fine on a deep pair can be ruinous on a shallow one.

Adding liquidity is the only lever that moves your cost

Price impact is inversely proportional to reserveIn, which makes depth the entire story. When a provider calls addLiquidity or addLiquidityETH on the router, the router pulls both tokens into the pair and calls mint(to). The pair issues LP tokens proportional to the contribution and rewrites reserve0 and reserve1 to the new balances. Doubling reserveIn roughly halves the impact of the same trade size.

Removal runs the same machinery backward. A burn(to) call shrinks both reserves, and the identical amountIn now eats a larger slice of a thinner pool. This is why a quote captured before a large withdrawal is worthless afterward, and why the quote's age matters more than its precision.

The pair's. Events tab gives you the audit trail. Mint(sender, amount0, amount1) fires on every addition and Burn(sender, amount0, amount1, to) on every removal, with exact amounts. Plot those against block time and you can see precisely when depth changed. If the largest LP position at the time of writing is a single wallet, treat depth as revocable and size your trade against the withdrawal scenario, not the current reserves.

Decision rule: if the Mint and Burn history shows depth concentrated in one provider, assume the pool can halve between your quote and your inclusion, and set your tolerance for that case rather than the calm one. If depth is spread across many providers with staggered entry blocks, the ordinary drift assumption is defensible.

amountOutMin is the only parameter that binds the trade

The router computes output from live reserves at execution, not from your screen. swapExactTokensForTokens accepts amountOutMin and reverts with 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT' when the computed result falls below it. The deadline argument produces 'UniswapV2Router: EXPIRED' if inclusion lands past its timestamp. Those two checks are the whole of your protection.

Setting amountOutMin to the exact quoted output is a mistake. Any reserve movement between quote and inclusion, whether from another trade or a liquidity pull, will revert the transaction and burn gas for nothing. Setting it far below the quote converts the guardrail into decoration. Choose a tolerance you can defend and derive the minimum from it rather than typing a round number.

Decode your own pending transaction to confirm what you signed. Pull the input data via eth_getTransactionByHash or the BscScan transaction view and read the amountOutMin argument positionally in the swapExactTokensForTokens call. Then compare the pair's Swap(sender, amount0In, amount1In, amount0Out, amount1Out, to) event after mining against your pre-signing figure. The event is the executed truth. The quote is only a prediction.

Decision rule: if the decoded amountOutMin sits at or near zero, do not broadcast; the transaction will fill at whatever rate the pool offers. If it sits exactly at the quoted output, expect a revert on any drift and re-quote instead of signing.

Reproduce the quote yourself in four read calls

Every input the router consumes is public, so the whole quote is reproducible. Call getPair(tokenA, tokenB) on the factory to get the pair address, call getReserves() on that pair, call getAmountsOut on the router with your amountIn and path, and compare against what the interface displayed. A mismatch means the UI is stale or is routing somewhere you did not expect.

Pin the call to a block. Use eth_call with the router's getAmountsOut selector and pass an explicit block number as the block parameter, so your reproduction and the UI quote refer to the same state. Comparing a call at the latest block against a screenshot from an earlier block proves nothing.

Aggregated routes break the single-pair formula. When a swap hops through multiple pools, the effective impact is a weighted combination across hops and the direct reserveOut/reserveIn comparison no longer applies. Reconstruct the executed route instead by reading every Swap event emitted by every involved pair inside the same transaction. YESswap's swap product aggregates across DEX venues, which makes this reconstruction step mandatory rather than optional when you audit a fill.

Two RPC endpoints can disagree about the same block. One may lag behind the chain head while another has already indexed the block you are querying, so an eth_call pinned to a block number can return different reserves on each. If your reproduction disagrees with the UI, re-run it against a second endpoint at the same pinned block before concluding the interface is wrong. A disagreement between endpoints is a sync problem, not a pricing problem, and the fix is to wait for both to reach the same height.

Three ways the signed swap diverges from the quote

Sandwiching is the adversarial case. A searcher sees your pending swap in the mempool, buys ahead of it to push the price against you, lets your transaction execute at the degraded rate, then sells back. The signature is unmistakable in the logs: a buy from one sender in the block before your Swap event and a sell from the same sender in the block after, bracketing yours. A loose amountOutMin is the only thing that makes the extraction profitable.

Route staleness is the aggregator case. A multi-hop quote computed against reserves that moved mid-route produces a worse combined rate than the screen showed, because each hop's output feeds the next hop's input. Confirm the router address in your transaction matches the one you intended before you sign anything, and confirm the token contract matches the published address rather than a lookalike. On BSC the YES token is 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 and the fee router is 0x0c9a2351e6e982b16559a68767003e7f4d02fb0d. Any other address is not ours. All signing happens in your wallet at yesswap. vip, and no page should ever request a private key or seed phrase.

A missing receipt is not proof of failure. If eth_getTransactionReceipt returns null, the transaction is still pending or the endpoint has not indexed it yet; query the hash again after the next block rather than re-broadcasting. Re-broadcasting a swap you already signed can execute twice if the first one lands. Wait for the receipt, then read the Swap event to learn what actually filled.

Decision rule: if the receipt is null past several blocks, check the hash on a second endpoint before touching the wallet again. If the Swap event shows a fill materially worse than your decoded amountOutMin, the transaction did not come from the parameters you inspected, and you should treat the signing path as compromised. 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

Which contract actually computes the price impact shown in a quote?

The pair supplies the reserves through getReserves(), and the router computes the output through getAmountsOut using the 997/1000 fee formula. Price impact is the gap between reserveOut/reserveIn and amountOut/amountIn.

Should I set amountOutMin to exactly the quoted output?

Any reserve movement between quote and inclusion will revert with INSUFFICIENT_OUTPUT_AMOUNT and cost you gas. Derive the minimum from a tolerance you can defend instead.

Why does the same trade size cost more after a liquidity removal?

Price impact is inversely proportional to reserveIn. A burn(to) shrinks reserves, so the identical amountIn consumes a larger fraction of the pool and the effective price drifts further from the marginal price.

How do I check whether my swap was sandwiched?

Read the pair's Swap events in the blocks immediately before and after yours.

Does an aggregator route use the same price impact formula?

Not directly. Multi-hop routes produce an effective impact that is a weighted combination across hops. Reconstruct it from the Swap events of every pair touched inside the transaction.

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: add liquidity on bsc.

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