SecurityAdvanced

Smart Contract Wallets: Using Safe and Other Multisigs to Swap

What works when you swap from a Safe or another contract wallet, why signature-based routes like gasless and Permit2 are excluded, and how to batch safely.

ChainBridge ResearchUpdated 5 min read

On this page6 sections

Key takeaways

  • A smart contract wallet such as Safe has no private key of its own, so it cannot sign messages the way a regular wallet does.
  • ChainBridge detects contract wallets and keeps every on-chain route available, such as KyberSwap and ParaSwap swaps.
  • Routes that depend on an off-chain signature, 0x Gasless and 0x Permit2 routes, are excluded and labelled “Not available for smart wallets”.
  • Multisig signing takes time: collect signers first and execute quickly, or the quote may expire or fall outside your slippage.
  • For cross-chain transfers, make sure you control the same address on the destination network before sending.

What makes a contract wallet different

A regular wallet (an externally owned account, or EOA) is a key pair. Your private key signs transactions and messages, and anyone can check that signature with the public address alone.

A smart contract wallet is a contract deployed at your address. Safe is the best known example: a multisig where, say, two of three owners must approve each transaction. Other smart accounts add spending limits, recovery or session keys. The contract decides what is allowed, which is what makes them safer for treasuries and large balances.

The trade-off is signatures. A contract has no private key. When an app asks it to sign a message, the “signature” is checked by calling the wallet contract itself, using the ERC-1271 standard. That only works if the app or protocol verifying the signature supports ERC-1271 and the wallet can produce a signature it accepts, which for a multisig often means several owners approving the message first.

ChainBridge reads the code at your address when you review a swap. No code means a regular wallet. Code means a contract wallet, with one exception: an EOA upgraded with EIP-7702 is treated as a regular wallet, because its own key still signs.

What works and what does not

ChainBridge routes from a smart contract wallet
RouteStatusWhy
KyberSwap and ParaSwap swapsWorksA plain on-chain transaction: approve, then swap.
0x, selling the native coinWorksNo approval and no signature, just a transaction with value.
0x, selling an ERC-20 tokenNot availableThe route needs a Permit2 signature.
0x GaslessNot availableYou sign an off-chain order that a relayer executes.
Cross-chain via Relay or LI.FIWorks, with careOn-chain transactions, but funds arrive at the same address on the destination network.
Native BTC, LTC, DOGE, BCH via THORChainWorksAn on-chain deposit; you enter the destination address yourself.

The rule behind the table is simple: anything that is just a transaction from your wallet works, because a contract wallet can send any transaction its owners approve. Anything that needs a signed message is excluded.

Why signature routes are excluded

Two kinds of route depend on an off-chain signature:

  • Gasless orders. You sign an order, and a relayer submits it and pays the gas. The order is only valid if the relayer's settlement contract accepts your signature. See gasless trading.
  • Permit2 routes. Instead of a fresh approval for each router, you approve the Permit2 contract once and then sign a short-lived permit per swap. The swap transaction carries that signature. See Permit2 explained.

With a contract wallet, those signatures depend on ERC-1271 support at every step: the wallet, the app that requests the signature and the contract that verifies it. A multisig also has to collect several approvals for a message that typically expires within minutes. Rather than let you start a flow that is likely to fail, ChainBridge removes these routes for contract wallets.

Smart accounts that are not deployed yet (a “counterfactual” address) have a related limit: their signatures cannot be checked until the contract exists. ChainBridge stops with “Smart wallet not deployed” and suggests making one on-chain transaction first, or picking an on-chain route.

Swapping from a Safe

Connect your Safe to ChainBridge through WalletConnect (or open ChainBridge from the Safe interface if your setup supports it). Then:

  1. Pick an on-chain route

    Enter the trade and check the source in the quote. If the review screen says the route is not available, choose another one in the quotes panel.

  2. Review the steps

    Selling an ERC-20 needs an approval for the exact amount. If your wallet connection reports support for batched calls, approval and swap arrive as one proposal; otherwise as two, one after the other. See one-click swaps.

  3. Collect signatures quickly

    The swap transaction contains a minimum amount out and often a deadline. If owners sign an hour later and the market has moved, the swap reverts and the Safe still pays gas. Line up your co-signers before you propose.

  4. Execute and verify

    Once the threshold is reached, execute the transaction and check the result in the Safe history and on the block explorer.

Cross-chain transfers from a contract wallet

Cross-chain routes through Relay, LI.FI and THORChain are on-chain transactions, so they can be sent from a contract wallet. There is one important trap for transfers between EVM networks.

Swaps to native Bitcoin, Litecoin, Dogecoin or Bitcoin Cash do not have this problem: you type the destination address yourself, and it is validated before you can continue. See THORChain explained.

Tips for contract wallet users

  • Run a small test swap the first time you use a new route or network from a Safe. A failed multisig transaction is slow and still costs gas.
  • Prefer moderate trade sizes. A large swap with high price impact needs a wider slippage tolerance, which a slow signing process makes riskier.
  • Check what each owner is asked to sign. The proposal should show an approval for the exact amount and a call to a router you recognise.
  • Review allowances regularly on the approvals page, and read wallet security for the owners' own keys.

Put it into practice

Compare 0x, KyberSwap and ParaSwap in one quote, with every route checked before you sign.

Start swapping