1inch

1inch is a Decentralized Exchange Aggregator for Routed Swaps and Portfolio Rebalancing

1inch is a swap-routing interface for entering a token balance, reading the settled output in the same wallet, rebalancing that holding with a fresh quote, and unwinding it through another swap. Each step creates or updates on-chain state; a portfolio valuation remains a separate, price-derived view.

Updated
A token's raw decimals and contract address decide whether the received balance matches the routed output.

Run the routed entry from quote to settlement

The routed entry is a self-custodial 1inch swap that converts one source balance into one destination balance through a quoted path. Treat the quote, authorization, signed transaction, and receipt as four separate checkpoints, because each answers a different operational question.

Prepare the source record

Start with the network, wallet address, source token contract, destination token contract, and raw input amount. Ethereum uses chain ID 1, while Base uses 8453; an identical ticker on those networks points to different ledger entries. Every EVM address is 20 bytes, rendered as 40 hexadecimal characters after the 0x prefix. Reserve the network's native coin for a Classic transaction fee.

Execute the quoted route

Pathfinder builds a route across available liquidity, and the 1inch Aggregation Router executes it. With a standard separate approval, a first Classic ERC-20 swap takes two on-chain transactions: one approval, followed by one swap. If the allowance already covers the exact source amount, only the swap transaction remains. Review source amount, destination token, recipient, minimum receive amount, and network before signing; these five fields bind the lifecycle to the intended balance.

Confirm the new holding

Wait for receipt success before treating the output as spendable. Compare the recipient's pre-swap and post-swap raw balances, then normalize by token decimals. The quoted estimate is not the ledger record; the confirmed balance delta is. Save the transaction hash and route summary for the later rebalance or unwind.

Read the received balance without confusing display units

The received-token balance is an on-chain asset record, not a 1inch account position, and its contract decimals control the human-readable amount. Read the raw integer and normalized display before setting the next action.

USDC and USDT use 6 decimal places on Ethereum, while DAI, WETH, and 1INCH use 18. One USDC equals 1 000 000 raw units; one DAI equals 10 18 raw units. That 12-place difference turns the same integer into radically different displays. Tickers are labels, so bind every record to a network and contract address. Native ETH uses 18 places without an ERC-20 contract. MetaMask, Etherscan, and the 1inch Balance API resolve ERC-20 balance views against the same chain state.

At a glance: Read the received balance without confusing display units
Asset Ethereum asset type Balance source Decimal places
USDC ERC-20 token balanceOf(address) 6
USDT ERC-20 token balanceOf(address) 6
DAI ERC-20 token balanceOf(address) 18
WETH ERC-20 token balanceOf(address) 18
1INCH ERC-20 token balanceOf(address) 18
ETH Native coin Account state 18

The table separates six common Ethereum balance representations that matter during entry and unwind. It also keeps WETH distinct from ETH: wrapping creates an ERC-20 balance, while unwrapping restores the native account balance.

Choose aggregation, a direct pool, or an intent fill

The execution choice is a routing decision among Classic aggregation, a single liquidity venue, and Fusion's resolver-filled intent. The 1inch Swap API separates three modes: Classic, intent-based, and cross-chain. Classic routing lets Pathfinder split a swap among Uniswap v3, Curve, Balancer, and other network sources. A direct pool confines execution to one venue. Fusion encodes an EIP-712 order for resolvers; its four tracked events include created, filled, partially filled, and invalid. Cross-chain Fusion+ starts a separate, two-ledger lifecycle.

Set the rebalance from confirmed wallet state

The rebalance is a new swap decision that starts from the confirmed wallet balance and a fresh target allocation. It neither edits the entry transaction nor preserves its route; it sells part or all of the asset through new execution.

Measure the amount available

Use the raw balance, subtract any amount reserved for another purpose, and choose the exact units to sell. A percentage control resolves to an integer no larger than balanceOf for an ERC-20 token. Do not carry the entry quote forward: Uniswap v3 ticks, Curve pool balances, and gas conditions have changed since settlement, so 1inch must construct a new route.

Authorize the next action

An ERC-20 allowance is a 256-bit integer assigned to one spender. Setting it to 0 clears the authorization; setting the maximum uint256 value produces 2 256 −1 units. For a routine rebalance, a finite amount keeps the operational record legible. An approve call replaces the prior value for that spender, while transferFrom is constrained by the allowance. Read the post-trade destination balance and remaining allowance separately.

What proves that an unwind has finished?

An unwind is a closing swap whose completion requires a higher destination balance, a lower source balance, and a successful settlement record. A quote or pending wallet notification does not establish completion.

On EVM networks, capture the transaction hash, chain ID, block number, receipt status, and Transfer logs. A transaction hash contains 32 bytes and is shown as 64 hexadecimal characters after 0x. Receipt status 1 marks successful EVM execution, while 0 marks failure. Inclusion gives a usable result; finality gives stronger assurance against a later chain reorganization. Finality relies on voted epoch checkpoints, so a transaction's slot and validator participation set the actual wait. Ethereum slots last 12 seconds and an epoch spans 32 slots, so two full epochs span 64 slots, or 768 seconds (12.8 minutes).

If the unwind returns ETH from WETH, confirm both the WETH decrease and native ETH increase, then separate gas from swap proceeds. A partial Fusion fill leaves residual source tokens and a nonfinal order state, so reconcile the filled amount before placing another unwind. Compare the resulting wallet balances with the selected recipient, not with an exchange price chart.

Track approval and receipt state beneath the display

The underlying state is an ERC-20 ledger plus transaction receipts, while 1inch supplies routing, calldata, and intent-order status around that ledger. These layers explain why a displayed balance, allowance, and order status answer different questions.

Balance and allowance calls

The ERC-20 interface defines six core functions, three optional metadata functions, and two events. balanceOf reads holdings; allowance reads a spender limit; approve sets that limit; and transferFrom moves an authorized amount. The decimals function is optional in the standard, although major tokens expose it. The 1inch Balance API returns balances and allowances, which connects entry and unwind state for the same wallet.

Router execution

A Classic quote does not alter on-chain state. The wallet sends one transaction to the Aggregation Router with calldata that identifies the route and minimum output. A split route distributes the amount over several pools and intermediary tokens. Each hop belongs to one atomic transaction on that chain: every call succeeds, or the whole transaction reverts. One visible swap therefore contains multiple pool interactions without creating multiple wallet positions.

Intent status

Fusion begins with signed typed data rather than a user-submitted swap transaction. The user signs one EIP-712 order, and a resolver submits settlement; required token authorization remains a separate prerequisite. A partially filled status requires reconciliation between the filled and remaining amounts. Cancellation, expiry, or insufficient balance produces an invalid status. A replacement order starts a new lifecycle record with its own identifier (more in 1inch tutorial ).

Maintain a chain-aware lifecycle ledger

The maintenance record is a chain-aware ledger that connects each 1inch action to the wallet state it actually changed. Store it after entry, every rebalance, and the final unwind.

Keep balances partitioned by chain. Ethereum uses chain ID 1, Polygon uses 137, Arbitrum uses 42161, and Base uses 8453. Moving between them changes both the ledger and native gas asset, even when an interface shows the same ticker. Cross-chain Fusion+ closes with two records linked by one order identifier. For a same-chain lifecycle, the final record shows either zero source units or a deliberate remainder alongside the desired destination balance. A portfolio tracker such as the 1inch Portfolio API aggregates the view, while the chain receipt remains the execution record.

1inch - common questions

Does a 1inch entry create a separate position token?

A standard 1inch swap does not create a separate position token; it leaves the received asset in the recipient wallet. On an EVM network, an ERC-20 output appears under that token contract's balanceOf record, while native output changes the account balance. A position token appears only when the asset being received is itself a tokenized claim from another protocol, which is outside a plain routed swap.

Can I rebalance only part of the received balance?

You can rebalance any integer amount that does not exceed the confirmed token balance. The interface converts the display amount into raw units using that token's decimals, then requests a new route for the selected portion. Unused tokens remain at the same wallet address. If the source is ERC-20, the spender allowance must cover the portion sold; an existing larger allowance remains available after the transfer uses the selected amount.

Can the unwind return a token different from the entry asset?

The unwind can target any supported destination token for which 1inch finds an executable route on the selected network. Returning WETH to USDC is one choice; routing WETH to DAI is another, and neither must mirror the original source asset. The new quote determines liquidity sources and minimum receive amount from present conditions, while the old entry transaction remains useful only as a record of acquired units.

Are balances moved automatically when I switch networks?

Switching the wallet's network does not move a token balance to the newly selected chain. Ethereum, Polygon, Arbitrum, and Base maintain separate ledgers, and the same ticker may represent contracts on several of them. A same-chain rebalance changes balances only on that chain. Moving value across networks requires a cross-chain execution path such as Fusion+, followed by separate source-chain and destination-chain verification.

What remains after I unwind less than the full balance?

The unsold token amount remains in the wallet as an ordinary balance after a partial unwind. Calculate it from the confirmed pre-swap balance minus the amount actually transferred, then account for any token mechanics reported by the transaction. The destination balance increases by the settled output. Treat the remainder as an active holding with its own next decision, not as part of the closed portion's completion record.
White sports car driving on a mountain racetrack
White sports car driving on a mountain racetrack.