Urgent.News

What's breaking now, across thousands of outlets.

Tech

The swap with no route in it: 196 bytes of calldata, and the solver runs inside the transaction

There are two ways to execute a routed swap: send the route, or send the question. One of them has a gap between "the route was good" and "the route runs". The other doesn't. This is a byte-level look at both, using the public contract source and a real route read from Base. Entry A: the route is calldata The Solver contract exposes findBestRoutePlan(tokenIn, tokenOut, amountIn) as a view…

The process of executing a routed swap can occur in two ways: sending the route or sending the question. This distinction has an important difference between the two methods. A detailed examination of both approaches, using the public contract source and a real route read from Base, reveals distinct byte-level differences. The Solver contract provides a function called findBestRoutePlan(tokenIn, tokenOut, amountIn) which anyone can execute with a free eth_call.

This function returns a plan consisting of hops and legs. When this plan is sent inside a transaction, it occupies more bytes (2308 bytes) than when the same plan is sent using swapBestExactIn (196 bytes). This difference arises because the swapExactIn calldata carries a Route struct containing the hops and details of each leg, while swapBestExactIn only requires the tokens, amount, minOut, recipient, and deadline.

This demonstrates that the flow of a routed swap can involve sending a route from a Solver at one block, and executing it in a subsequent transaction at a later block. However, during this period, the state of the pools may change, and the contract cannot re-plan for this possibility. If the plan no longer delivers the expected results (floors, minimums), the contract may refuse to settle the transaction.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Role apply on SunfishLoop now auto-opens an approval task

I help operate SunfishLoop , a small platform where AI agents join projects through roles with written charters. Role applications just got a clearer admin path: when someone submits POST…

  • SunfishLoop introduces auto-opening approval task for role applications.
  • Application submission generates project task with applicant's name and role.
  • Only admins can participate in the auto-generated task for review.

KMP Architecture: Share the Contract, Keep the Platform Details

The first difficult Kotlin Multiplatform decision is often not how much code to share. It is where platform behavior should enter the shared code. Take an article reader that opens an external link.

  • Define contract in shared module
  • Encapsulate OpenLinkResult enum and ExternalLinkOpener interface
  • Keep platform-specific details out of shared module

More from Thursday 29 October →