Traderjoedex swap fees from quote to final cost

Updated -

On LFJ, formerly Trader Joe, reconcile a completed swap using the input actually spent, the tokens credited to the recipient and the separate network gas charge. For Liquidity Book pools, the trading fee combines a pool-specific base component with a volatility-dependent component, calculated on the amount exchanged in each bin.

The network and pool model determine which explanation applies. LFJ has announced that Liquidity Book on Monad is moving to withdrawal-only mode while its separate POE PropAMM continues operating there.

Which costs are already reflected in the quote?

Liquidity Book's base and variable swap fees enter its input-to-output calculation. The base component depends on the pool's configured base factor and bin step. The variable component responds to volatility and can increase as a trade crosses bins. A fixed exchange rate within one bin still carries swap fees.

For a Liquidity Book getSwapOut simulation, the reported fee is denominated in the input token and is already included in the input that the simulation can exchange. Adding it again double counts it. Gas is a separate network charge.

Price impact affects the exchange rate that a trade obtains. Slippage describes the difference between the expected and executed result. Their effects can already appear in the quoted or received output, so adding their percentages to the pool fee does not produce a reliable total cost.


From a Liquidity Book quote to the final record

Table details: From a Liquidity Book quote to the final record
Stage Relevant amounts and checks Cost interpretation
Quote review getSwapOut estimates amountOut and fee , and returns amountInLeft for input that available liquidity cannot exchange. The result describes simulated pool state. A positive input remainder means that liquidity does not cover the full requested input.
Execution The documented LBRouter functions enforce minimum output for exact-input swaps, an input cap and requested output for exact-output swaps, and a transaction deadline. These limits bound execution. They do not fix the pool's fee or guarantee that an earlier quote remains unchanged.
Output confirmation and reconciliation Actual token movements, pool Swap events and the network gas charge. These records establish the executed exchange and its gas cost. A reverted swap reverses its token changes but can still consume gas.

In the V2.2 LBPair implementation, execution reverts if input remains to be swapped and no further liquidity bin is available. A remainder reported by a simulation therefore does not establish that a submitted swap will complete as a partial fill.

How do per-bin records reconcile with the input?

In the V2.2 LBPair swap implementation , a trade that uses several bins can generate several Swap events. Each event distinguishes totalFees from protocolFees . The protocol share is part of the total fee, so counting both as separate charges duplicates that share.

The emitted amountsIn has already had the protocol share subtracted. Read it together with protocolFees when reconstructing the input consumed by that bin. The amount and fee fields encode token X and token Y quantities; decode them and retain each token's identity and decimals when interpreting the amounts.

For a route through several pairs, intermediate tokens pass between pools. Keep those movements separate from the payer's initial input and the final recipient's output when reconciling the whole trade.

Recipient output for transfer-tax tokens

A token's own transfer fee can affect the amount credited to the recipient. In the documented V2.2 LBRouter method swapExactTokensForTokensSupportingFeeOnTransferTokens , the router measures the recipient's output-token balance increase and applies amountOutMin to that increase. This measurement belongs to that specific method. Keep any token transfer charge distinct from the pool's trading fee.

What changes for a POE swap on Monad?

OraclePool's POE swap quote returns amountOut , actualAmountIn and feeIn . The quoted input that will be consumed can be smaller than the requested input when using the full amount would drain allocated reserves. The fee is deducted from the input consumed.

POE pricing depends on both oracle parameters and allocated pool reserves. Its fee parameter belongs to that model; Liquidity Book's base-plus-variable fee explanation does not establish the fee for a POE trade. Compare POE quotes using their quoted consumed input, then reconcile the completed trade against its actual token movements and gas charge.

Which figures make a fair cost comparison?

For LBRouter swaps, exact-input mode suits a fixed spend, with execution constrained by a minimum output. Exact-output mode targets a required output under an input cap, provided the route can supply it. In the documented V2.2 LBRouter, token-input exact-output calls use amountInMax . For swapNATIVEForExactTokens , the native currency sent provides the cap, and a successful call refunds any unused excess to the caller.

Which figures make a fair cost comparison? (Traderjoedex swap fees) - diagram

Open full-size image

For fixed-input alternatives, hold the input amount actually spent, network and token contracts constant, then compare net recipient output. For fixed-output alternatives, compare the input required for the same output target and account for any transfer-tax effect on the recipient's net credit. Record gas separately; combining it with token amounts requires an explicit conversion into the same valuation unit.

A lower displayed pool-fee percentage can be outweighed by a worse exchange rate or a larger gas charge. The final reconciliation uses the executed input, net recipient output and gas charged. A maximum-input limit or native value sent is a spending bound; refunds and actual token movements determine how much was spent.