Adding and removing liquidity: what the transaction actually does
Adding liquidity mints a claim on a pool. Removing it burns the claim and takes back a share of whatever the pool holds at that moment, which is rarely what was deposited. This entry works through both transactions instruction by instruction, shows why the returned basket differs from the one supplied, and sets out the checks that belong on each side of the trip.
- Question
- What does a Solana pool actually do when someone adds or removes liquidity, and why does the basket returned on exit differ from the one supplied on entry?
- Balances used
- Both reserves before and after, LP token supply, the deposit ratio at entry, the pool ratio at exit, and any range parameters on concentrated venues.
- Out of reach
- Whether a position was profitable, since that depends on the provider position outside the pool as well as inside it.
- What would overturn it
- A redemption that returns the exact tokens deposited after the pool ratio has changed, which pro-rata accounting does not allow.
- Confidence
- Firm on the accounting, which follows from published program behaviour. Provisional on anything about why a provider entered or exited.
The short answer
Adding liquidity deposits both assets into the pool account and mints an LP token representing a pro-rata claim on everything the pool holds. Removing liquidity burns that token and returns the corresponding share of the current balances. The word current is doing most of the work in that sentence.
Because the claim is on the pool as it stands rather than on the specific tokens supplied, the basket that comes back is almost never the basket that went in. Trading during the stay rebalanced the pool, and the claim rebalanced with it. Fees, where the venue keeps them in the reserves, are already included in what comes back.
Everything else in this entry follows from that one structural fact. The transaction mechanics, the ratio requirement, the exit arithmetic and most of the mistakes providers make all trace back to treating an LP token as a receipt for deposited assets when it is a share of a moving balance.
What adding liquidity does
The add instruction takes both token amounts from the provider, transfers them into the pool's token accounts, and mints LP tokens to the provider in proportion to the increase in pool size. The claim itself is an ordinary SPL Token program mint, which is why an LP token appears in a wallet exactly like any other balance. If the pool held a certain amount and the deposit increases it by five per cent, the provider receives LP tokens equal to five per cent of the new supply.
Crucially the quoted price does not change. A deposit at the prevailing ratio increases both reserves proportionally, so the ratio is untouched and the pool quotes exactly what it quoted a moment earlier. What changes is the product, which is to say the depth. A deposit makes trades cheaper without moving the price, which is the whole function of liquidity provision.
The pool programs themselves document this proportional accounting rather than leaving it implicit, and Raydium's protocol documentation describes deposits and redemptions in those terms. For the very first deposit into an empty pool the situation is different, because there is no prevailing ratio. The initial depositor sets it by choosing the two amounts, and that choice is the pool's opening price. Every later trader is trading against a price that somebody simply picked, which is worth remembering when a newly created pool quotes something surprising.
On the reading side, an add is easy to identify: LP supply rises, both reserves rise, and the ratio between them barely moves. No swap can produce that combination, which makes it one of the cleanest signatures in pool data.
What removing liquidity does
The remove instruction burns some or all of the provider's LP tokens and transfers out the corresponding fraction of both reserves. A provider holding five per cent of supply receives five per cent of each reserve, whatever those reserves currently are.
Again the ratio is unchanged, because both reserves fall proportionally. The pool quotes the same price after a withdrawal as before it, but it is shallower, so the next trade of any size moves the price further than it would have. This is why withdrawals matter to traders who have no position in the pool at all: they change what everyone else's execution costs.
The signature is the mirror of a deposit and equally clean: LP supply falls, both reserves fall, and the ratio holds. Any reading that sees both balances shrink together should immediately stop attributing the change to trading, because no swap can take assets out of both sides at once.
Partial withdrawals and dilution
Nothing requires a provider to exit all at once. Burning part of a holding returns the corresponding share and leaves the rest in place, which is how most large positions are actually managed. The arithmetic is identical, applied to a smaller fraction.
What does change over time is the fraction itself. A provider's share falls whenever somebody else deposits, because supply grows while their holding does not. A position that began as a tenth of a pool can be a fortieth some weeks later without its owner doing anything at all, and any assessment that assumes the original share is measuring the wrong claim.
The ratio requirement
A classic pool requires deposits at the prevailing ratio. This sounds like a formality and has a practical consequence that catches people out constantly: to enter a pool you must already hold the two assets in the right proportion, or acquire them, and acquiring them means trading, which means price impact.
Interfaces that offer to deposit a single asset are doing the trade for you. That is convenient and entirely legitimate, but the cost is real and it is paid before the position exists. On a thin pool the swap needed to balance a deposit can cost more than several days of fee accrual, and it is invisible in any later accounting of how the position performed.
The same applies in reverse on exit. A provider who wants to end up holding one asset receives two and must trade one for the other, paying impact again, this time against a pool they have just made shallower by withdrawing from it. Planning the exit as a two-step operation rather than one is the difference between an expected outcome and an unpleasant surprise.
A worked round trip, illustrative
What comes back after the price moves
Illustrative figuresAll numbers are invented for teaching and describe no real pool or position. A pool holds 1,000 A and 100,000 B, so it quotes 100 B per A, with an LP supply of 10,000. A provider deposits 100 A and 10,000 B, a ten per cent increase, and receives 1,000 newly minted LP tokens. The pool now holds 1,100 A and 110,000 B against a supply of 11,000.
Over the following period trading moves the price of A up to 144 B. Ignoring fees for clarity, the constant-product pool must hold reserves whose ratio is 144 and whose product is unchanged at 121,000,000. That gives roughly 917 A and 132,000 B.
The provider now burns their 1,000 LP tokens, which is still a ten per cent claim. They receive about 91.7 A and 13,200 B. They deposited 100 A and 10,000 B. The pool sold roughly 8.3 units of A on their behalf as the price rose and handed back the proceeds in B.
Valued at the new price, the returned basket is worth about 26,400 B. Simply holding the original 100 A and 10,000 B would have been worth about 24,400 B. The position is up in nominal terms and it is down against holding, because holding would have kept all 100 units of the asset that rose. Fee income, excluded here for clarity, works against that gap without any guarantee of closing it.
Run the same example with the price of A falling instead and the pool hands back more A and less B, which is the same mechanism pointing the other way. In both directions the pool ends up holding more of whichever asset performed worse. That is not a flaw; it is what providing a two-sided quote means.
A sequence for adding
- Read the pool before the interface Pull both raw reserve balances and the LP supply. This establishes the ratio you will be depositing at and gives you a baseline to compare against later.
- Build the ladder for your own size Work out what your balancing swap will cost in price impact before you make it. On a thin pool this is frequently the largest single cost of the whole exercise.
- Decide the range if the venue has one A concentrated position needs an interval. Narrow earns more while the price stays inside and stops entirely when it leaves. Wide earns less per unit and keeps quoting.
- Check where the fee actually goes Confirm whether the venue retains fees in the reserves or accrues them separately, because that decides whether your claim grows on its own or requires a claim action.
- Record the entry state Write down both reserves, LP supply, your share and the ratio at the moment of deposit. Without that record no later assessment of the position is possible.
Checks before removing
- Recompute your share from current LP supply rather than assuming it is what it was at entry, since other deposits dilute it.
- Work out the basket you will receive at the current ratio, so the composition is not a surprise.
- Estimate the price impact of any swap you intend to make afterwards, against the pool as it will be once you have withdrawn from it.
- Check whether unclaimed fees exist separately and whether burning the position forfeits or transfers them.
- On concentrated venues, confirm whether the price is currently inside your range, because that determines which asset you receive.
- Compare the outcome against what holding both assets would have produced, so the comparison is made deliberately rather than avoided.
The last check is the one most often skipped, and it is the one that turns a provider into an informed provider. Being able to state plainly how a position performed against holding is uncomfortable in some periods and useful in all of them.
Concentrated positions differ
On a concentrated venue the position is not a fungible share of the whole pool. It is a specific interval with its own accounting, usually represented by a distinct position account rather than a fungible token, an arrangement set out in Orca's developer documentation. That difference propagates through everything.
While the price sits inside the range, the position earns fees at a rate reflecting its outsized contribution to depth in that region. When the price leaves the range, the position is entirely in one asset and earns nothing. It has not been liquidated and nothing has been lost beyond the opportunity, but it is now an idle holding of a single token rather than a liquidity position.
This makes range choice the dominant decision, and it makes the position an active one. Providers who set a narrow range and stop paying attention frequently find the position out of range and inert. Providers who reposition often pay swap costs each time. Neither is wrong and both are choices with a price, which is worth understanding before rather than after.
Fees follow flow, not capital
A position earns from swaps that route through it. Capital sitting in a range the price never visits earns nothing at all, however large it is. This is why depth, activity and fee accrual are one subject rather than three, and why the volume side of a market keeps appearing in entries about reserves.
Two position types compared
| Aspect | Full-range share | Concentrated interval |
|---|---|---|
| Represented by | Fungible LP token | Position account with range parameters |
| Quotes at | Every price, forever | Only inside the chosen interval |
| Capital efficiency | Low; most capital sits where price never goes | High while in range, zero while out |
| Attention required | Minimal after entry | Ongoing; ranges need review and repositioning |
| Exit composition | Both assets, at the current ratio | Both if in range, one asset if out of range |
| Main failure mode | Gap against holding grows with price divergence | Price leaves the range and the position stops earning |
Mistakes that cost real money
The first is treating the LP token as a claim on deposited assets. It is a claim on current balances, and every consequence of that follows automatically. Providers who understand this stop being surprised by their exit basket.
The second is ignoring the balancing swap. Entering and exiting both usually involve a trade, and on thin pairs those two trades can dominate the economics of the entire position. Counting them is straightforward and rarely done.
The third is assuming fee income covers the gap against holding. Sometimes it does; there is no rule that says it must, and the size of the gap depends on how far the price ratio moves, which nobody controls. Any framing that presents fee accrual as compensation guaranteed to arrive is describing a wish rather than a mechanism.
The fourth is confusing activity with earning. Fees accrue from flow through the specific position, so a pair that is busy on another venue or at another price does nothing for a position sitting outside that flow. Anyone studying the movement side of this, including operators of Solana volume automation who care where routed trades actually land, ends up looking at the same routing and range data that a provider should look at before choosing an interval.
The last is treating a lock as a guarantee. A locked position cannot be withdrawn for its term; every unlocked position in the same pool still can, and the lock ends. Reading a lock as a statement about the pool rather than about one position is a specific and common error, and it belongs on this list because the mistake is about accounting rather than judgement.
Questions this entry gets asked
What is an LP token?
It is a token representing a pro-rata claim on everything a pool holds. It is not a receipt for the specific assets you deposited and it does not entitle you to those assets back. When you burn it, the pool returns your share of its current balances, which reflects every trade that has happened since you entered as well as accumulated fees where the venue keeps them in reserves.
Why do I get back different amounts than I put in?
Because the pool rebalances continuously as people trade against it. If the price of one asset rose during your stay, the pool sold some of it, so your share now contains less of the risen asset and more of the other. That is the mechanism, not a fee and not an error, and it is the source of the gap against simply holding described in the impermanent loss entry.
Do I have to deposit both assets in equal value?
On a classic constant-product pool, yes, at the ratio prevailing when you deposit. Depositing at the wrong ratio either fails or leaves the excess unused, depending on the venue. Some interfaces will swap part of one asset for you first, which is a convenience layer performing an ordinary trade on your behalf, with the ordinary price impact that implies.
Are fees earned automatically?
They accrue automatically but they are not free money and they are not guaranteed. Where fees stay in the reserves, your claim grows because the reserves grow. Where they accrue separately, they must be claimed. In both cases fee income depends entirely on how much flow passed through your position, which is not something a provider controls.
Can I lose money providing liquidity?
Yes. An LP position can be worth less than the two assets would have been if held untouched, and fee income is not guaranteed to cover that gap. On top of that, the assets themselves can fall. Nothing on this site suggests providing liquidity is safe, and nothing here is advice about whether to do it.
What is a liquidity lock?
It is an arrangement that prevents a specific LP position from being withdrawn for a period, usually by placing the LP tokens somewhere the original owner cannot reach them. It constrains that position only. It says nothing about other positions in the same pool, nothing about the token itself, and nothing about what happens when the period ends.
Filed in Pools by The Depth Ledger Desk. Every quantity inside a worked example on this page is invented for teaching and describes no real pool. Nothing here is advice about what to buy, sell or supply, and liquidity provision can end with a position worth less than holding the two assets. Terms used above are defined in the liquidity glossary.