Use Arbswap when your integration needs token trading on Arbitrum, or when users intend to supply assets to a pool and farm with the resulting position. Confirm the chain and token contracts first, quote against live liquidity, set execution bounds, then handle the swap, liquidity deposit, and farm stake as distinct actions.
What does Arbswap execute?
A token swap trades against liquidity held by an automated market maker, while a liquidity deposit gives the provider a claim on a pool. Staking that claim in a farm is a further action: swap fees depend on trading volume, whereas farming rewards depend on the farm’s emissions and its share of staked positions. An integrator should model those balances separately.
For a constant-product pool, the reserves determine both the quote and its price impact. Before a trade, say a pool holds 1,000 ETH and 2 million USDC, implying a spot price of 2,000 USDC per ETH. After a 1 ETH input with an illustrative 0.3% pool fee, the constant-product calculation returns about 1,992 USDC; the difference from 2,000 includes the fee and the movement along the curve. Read the actual pool type and fee before applying that model: stable-asset pools can use different pricing.
How do you execute swaps, deposits, and farms?
Implement the flow in the order below so each transaction uses current state and leaves a position your application can account for.
- Resolve the chain and assets. Check the wallet’s chain ID, token contract addresses, decimals, and balances before quoting; Arbitrum One uses chain ID 42161 and ETH for gas. Resolve tokens by address rather than symbol, since symbols are neither unique nor proof that a bridged asset is the one your user expects.
- Read the candidate pools. Find liquidity for the requested pair, then compare direct and multi-hop quotes using the amount that will actually enter each pool. Arbswap liquidity pools can differ in depth and pricing model, so a shorter path is not automatically cheaper. Reject a route whose reserves cannot support the trade at the user’s acceptable price.
- Set the execution bounds. Convert the quote into a minimum output for an exact-input swap, and attach a deadline; around 0.1–0.5% slippage tolerance and a 5–20 minute deadline are starting values for a liquid pair, not protocol defaults. A thin pool may need a wider bound, but widening it also increases the price deterioration the user accepts. Requote if reserves change materially before signing.
- Submit and reconcile the swap. Obtain any required token allowance, simulate the call, then send it with the chosen minimum output and recipient. For Arbswap, compare the resulting token balance or transfer logs with the amount your application quoted. Choose Arbswap token swaps when the user wants the DEX to exchange the assets; choose a direct router call when your integration must construct and submit that transaction itself.
- Deposit the paired assets. For a constant-product pool, supply both tokens at the current reserve ratio; sending an arbitrary 50/50 token quantity can leave one side unused when their prices differ. Set minimum accepted deposit amounts and account for approvals on both tokens. Record the LP position received, because it represents a share of changing reserves rather than a fixed claim to the deposited quantities.
- Stake the LP position if farming fits. Check that the farm accepts that exact LP asset, then inspect reward emissions, total stake, and any lock terms before depositing. An illustrative reward APR is daily reward tokens multiplied by token price and 365, divided by the value staked across the farm; it changes when emissions, price, or competing stake changes. Pool trading fees and farm rewards are separate returns.
- Unstake and remove liquidity at exit. Claim or account for accrued rewards, withdraw the LP position under its lock conditions, and redeem it with minimum amounts for each underlying token. Compare the received token mix with the original deposit, since trading changes pool reserves while the user holds a proportional share. A successful unstake alone does not return the underlying pair.
What costs and edge cases decide the route?
Arbswap fees are only one part of execution cost: include price impact, transaction gas, and any extra trade along a multi-hop route. The relevant comparison is the final amount received for the same input, after all route costs, at a quote size close to the intended trade. For a large order, splitting it can reduce price impact, but extra transactions add gas and expose later pieces to price changes.
A cross-network trade through Symbiosis has a different completion model from a swap within one pool. Its source transaction can succeed while later settlement or the destination exchange is still pending; destination slippage can also prevent delivery of the intended final token. Track the cross-network operation through its final state before crediting a user with that token.
For an integrator, the deciding test is whether the live quote and its execution bounds meet the user’s outcome: execute the swap for a trade, add liquidity for fee exposure, and stake the LP position only when the farm’s terms justify the additional commitment.
Top comments (0)