Decoding SCW swaps

With smart contract wallets (SCWs), swaps take a very different path than with traditional Ethereum/EVM wallets. That difference can be confusing, especially when something goes wrong. But once you understand the key players in the flow — and how to read what happened step-by-step in the app and on the explorer — things start to make sense.

Let’s walk through it all, together.


From one tap to on-chain execution: what actually happens

When you tap “Swap” in the app, it feels like a single action. In reality, you’re launching a multi-layered process built on top of Ethereum’s account abstraction (ERC-4337). Your transaction doesn’t go straight to the blockchain like in a normal wallet. Instead, it takes a detour:

  1. We build the route. We ask the routing engine (like 1inch) to find the best path for your swap, and simulate it to ensure it will work. We estimate gas, validate you have the tokens, and package the instructions into a special format: a UserOperation.

  2. A bundler steps in. This is an off-chain actor responsible for submitting UserOperations to the blockchain. It checks your op, makes sure it’s safe, and prepays the gas for you (it gets reimbursed for it later).

  3. Your UserOp enters the blockchain via the EntryPoint smart contract. Think of EntryPoint as the one gate all SCW transactions pass through. EntryPoint runs final checks, and if everything looks good…

  4. It tells your Smart Contract Wallet (SCW) to execute the swap. Your SCW calls the router (e.g., 1inch), the router calls the pools, tokens move, and the output lands back in your wallet.

So, to sum up: you tap swap → we simulate → bundler submits → EntryPoint validates → your SCW executes.


Let’s look at a real example

Now that we understand the high-level flow, let’s look at how this plays out in a real swap — first in the app, then on-chain:

Here’s what we see:

  • We swapped 1 USDC for 0.765 KTA.

  • The swap was executed on Base (see Base icon on top of coin icons).

  • We paid:

    • $0.03 gas (in ETH)

    • 0.22% swap fee to goodcryptoX

    • 0.05% router fee to 1inch

  • The route was simple: 100% through a Uniswap v4 pool.

  • Bundler: Alchemy (see Step 2 above for recap)

  • Explorer links: appear if the transaction had reached the blockchain and was recorded in the block (even if it fails)

So far, so good. Now let’s click into the BaseScan link and see what this transaction looks like on-chain:

From: this isn’t your wallet — it’s Alchemy’s bundler. That’s expected: the bundler submitted the transaction.

To: EntryPoint (v0.6.0). Again, expected. All SCW transactions enter through here.

Internal Transactions: Shows flows of native blockchain token (ETH on Base) within the transaction. Here we can see ETH flowing:

  • Our wallet (…0A5) sent ETH for the gas fee to EntryPoint.

  • EntryPoint reimbursed the bundler with the actual gas cost (since the bundler prepaid gas for you - see Step 2 above). Any leftover ETH stays on EntryPoint as your deposit for future transactions.

ERC-20 Transfers: this shows the actual token movements:

Our wallet didn’t send USDC directly. Instead, the USDC token contract (…2A8) processed and dispatched all USDC transfers. This is normal — on EVM chains, token transfers are handled by the token contract itself after receiving an instruction from the smart contract wallet.

  1. The USDC contract sent our 1 USDC to three destinations:

    • 0.0022 USDC to our protocol’s fee wallet (…608A)

    • 0.0005 USDC to 1inch’s fee wallet (…1DE5)

    • The remaining 0.9973 USDC to the Uniswap v4 router (…Universal Router)

  2. The Uniswap v4 router passed it to the Uniswap v4 Pool Manager (single contract handling all v4 pools).

  3. The Pool Manager executed the swap: USDC in → KTA out.

  4. The KTA was routed back through 1inch’s Aggregation Router, which forwarded it to our wallet (…0A5).


🧩 How to decode a failed SCW transaction

Now that we understand how smart-contract-wallet (SCW) swaps work — and we’ve walked through a successful trade — let’s use the same tools to decipher a failed one.

We’ll use another real case: an ETH → token swap on Ethereum that failed inside EntryPoint contract because there wasn’t enough ETH to cover both the swap and the gas fee.

Ok, so you see "Error" as your swap status in the app or get a push notification that your swap failed. What do you do?


Step 1: Check the order details in goodcryptoX

Here is what you see in this case:

Using the framework we've developed earlier, you quickly notice:

  • The swap status is Error (failed?)

  • No error message is shown (that's unusual)

  • There is gas fee (reached blockchain?)

  • There is route shown (simulation went ok?)

  • There are links to blockchain explorers (I can check the tx on the blockchain!).

Let's check your intuition:

  • The Error status means the swap failed

  • There should be both a human-readable error message (translated from raw) and the raw one. Absent error message definitely means something unusual happened

  • Gas fee indeed means that the transaction had reached the blockchain and some on-chain activity had happened (that consumed gas)

  • Route confirms that the transaction simulation passed and resulted in a clear path to execution

  • Explorer links confirm the transaction reached the blockchain — even if it failed. We should definitely open one of them and investigate further


Step 2 – Open the transaction in the blockchain explorer

You tap the Etherscan link to see what happened:

At first glance, things get even more confusing:

  • The status says ✅ Success (what?!)

  • But we already know the swap didn’t go through

  • Under the “To” field (EntryPoint), there’s a tiny yellow message in essense saying:

    One or more errors occurred during contract execution

This is the moment where most people give up — but now you know better.

Last updated