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

Unlimited Allowance Risk: Proportional exit: what burn() pays

Updated 2026-12-02 · YESswap

Short answer. A pair contract has no function that pays you one token for LP. The withdrawal path is burn(), and the allowance you granted to reach it is a separate, longer-lived object.
Best match for this articleProvide liquidityAdd or remove liquidity and see the pool you would trade against.

burn() is the only exit, and it computes both legs from totalSupply

Knowing how unlimited allowance risk works is what separates a clean trade from a costly one. Start with the arithmetic, because the arithmetic is the constraint. A pair stores two reserves and mints LP supply against them. When burn() runs, it reads your LP amount, divides by totalSupply, and scales each reserve by that fraction. Two transfers leave the pair. No branch in the function asks which token you want.

The absence of a single-sided function is deliberate. Paying out one reserve while leaving the other untouched would break the product the pair is built to preserve. A swap is the sanctioned way to change the ratio, and a swap charges the pool fee and moves price. A router helper that swaps your withdrawn leg afterward is a second transaction with its own slippage, not a property of the pair.

Verification takes one pair of calls. Read getReserves() on the pair at a block, execute the withdrawal, then read getReserves() again. Both fields fall. The transaction's Logs tab on BscScan shows a Transfer with your address as the recipient of the LP amount, two Transfers of underlying tokens to you, and one Sync carrying the new reserves. If the receipt is missing from your node, re-query the same transaction hash against a second RPC endpoint and compare the log count before you conclude anything. A truncated receipt is an endpoint fault, not a failed burn.

The approval, not the burn, is the durable risk

Approving a router with the maximum uint256 authorizes transferFrom on your LP tokens indefinitely. The pair does not need that approval when you call burn() directly from your own address. The approval exists because the router pulls the LP tokens into its own custody first, then calls the pair. Everything the router can do later follows from that pull right.

Read the live value before you trust any interface. Call allowance(owner, spender) on the LP token through eth_call. A return equal to 2^256-1 is unlimited in practice. The Approval event on the LP contract records owner, spender and value at the granting block, so the history is reconstructible without any indexer you have to believe.

Compare the spender field against the router you actually used. A mismatch is the failure worth catching, because an approval granted to an address you did not intend is re-granted every time you sign again. Treat any domain, contract address or Telegram handle that differs from yesswap. vip and @web3yesswap as unverified until you have read the address on chain. Decision rule: if allowance(owner, spender) returns non-zero for a spender you cannot name, call approve(spender, 0) before any other action.

One-sided pulls fail at the invariant, then again at the slippage bound

Two gates stand between a caller and a malformed withdrawal. The first is the constant-product check the pair enforces after every state change. Remove one reserve without adding the other and the product lands below its prior value, so the accounting rejects the call. The second gate belongs to the router: amountAMin and amountBMin bound each leg, and a proportional output under either bound reverts with the router's own error string rather than the pair's.

Simulate before signing. An eth_call against the router's removeLiquidity function returns the revert reason without spending gas. On a confirmed withdrawal, take the Sync event's two reserve fields, multiply them, and compare against the product from the Sync that preceded your transaction. A proportional burn leaves the product at or above the earlier value. It never lands below.

Setting either minimum to zero removes the second gate entirely. The withdrawal then executes at whatever ratio the pool holds at inclusion, which can differ from the reserves you read before signing. That is the quiet version of the failure, because nothing reverts. In a thin pool the gap between your quoted ratio and the inclusion ratio widens with every pending swap, so a zero minimum is a decision to accept an unknown output rather than a decision to save gas.

Compute the payout from three numbers, then match it to the logs

The output is fully determined before you sign. Take your LP amount, the pair's totalSupply, and each reserve. Compute yourLP multiplied by reserve, divided by totalSupply, for both sides. That is what burn() transfers. The pair takes no withdrawal fee, because the fee was already charged on the swaps that built those reserves. Only gas applies at exit.

Read totalSupply(), balanceOf(yourAddress) and getReserves() at the same block, either batched or as three sequential calls pinned to one block number. Reading across blocks introduces drift you will mistake for a discrepancy. When the transaction confirms, the pair's. Transfer event to your address should equal your computed amounts to the wei. If two RPC endpoints disagree on totalSupply at the same block number, pin both reads to that block with eth_call's block parameter and trust the one whose block hash matches a second source; a head-tracking endpoint can serve a stale state.

A router in the middle changes what you compare against. The pair still pays the router proportionally, but the router's helper swap produces different final amounts, visible in the token. Transfer logs or the router's own event. Compute against the pair for the burn leg, and against the token logs for what actually reached your wallet. Decision rule: if the two figures differ by more than the swap fee and your stated slippage, stop and re-read the router call's parameters before repeating the withdrawal.

Allowances do not expire when the position does

Burn your entire LP balance and balanceOf returns zero. allowance(owner, spender) does not move. A later deposit into the same pair is immediately spendable by that spender without a new signature from you, which is the mechanism most providers never consider when they withdraw and walk away.

Two patterns close it. Approve the exact LP amount for the withdrawal instead of the maximum, so the pull consumes the allowance. Or call approve(spender, 0) after the burn, which emits a fresh Approval event with value zero. That zero-value event is the on-chain proof of revocation, and it is what you cite if you ever need to show the approval is dead.

Re-read allowance after the burn to confirm. A non-zero return means the approval persists. Check the spender against the router you used, and check the YES token contract at 0xc22955b28e092060bc5d1e1f3b9d4dcd81091111 only when the operation actually involves YES. The fee router at 0x0c9a2351e6e982b16559a68767003e7f4d02fb0d is a separate address from any LP token, and confusing the two is how people revoke the wrong thing. Decision rule: if the address you are about to approve is not one you have read on chain at the block of your transaction, do not sign. 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 the pair charge a fee when I remove liquidity?

The pair takes no withdrawal fee. The fee was charged on the swaps that built the reserves, so at exit only gas applies.

What happens to my LP tokens after burn()?

They are destroyed. The pair emits a Transfer event with your address as the sender and the zero address as the recipient, and totalSupply falls by the burned amount. Your share of both reserves is transferred to you in the same transaction.

Can a router withdraw my LP tokens without a new signature?

Yes, if an allowance is still live. An approval to the maximum uint256 lets that spender call transferFrom at any time. Revoke with approve(spender, 0) and confirm the zero-value Approval event on the LP token contract.

How do I revoke an LP approval on BscScan?

Open the LP token contract, go to Write Contract, connect the owner wallet, and call approve with the spender address and 0. Then read allowance(owner, spender) to confirm it returns zero.

Why did my withdrawal revert with an insufficient output amount error?

A proportional output fell below amountAMin or amountBMin. That is the router's slippage gate, not the pair's. Re-read the reserves at a recent block, recompute both legs, and set the minimums from those numbers rather than zero.

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: token approval checker bsc.

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