Sample data. Built from the compile survey; nothing on this site is deployed or attested yet.
hyperdriveregistry

Uniswap

UniversalRouter v1.2

failingdex

Previous Universal Router, still heavily used by aggregators and wallets.

Not on Starknet yet. UniversalRouter is 141835 CASM felts, over the 81920 limit, and has no selector dispatcher to split by.
Ethereum
0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD
Starknet Sepolia
Not deployed yet
Same code, not same state. The Starknet contract runs the same code as the Ethereum one, but it starts empty: balances, positions, owners and settings on Ethereum do not carry over.

What is different on Starknet#

hyperdrive check reports every place this contract depends on the EVM, at its Solidity line. Exact counts operations; the other tiers count findings. About tiers.

exact3,007

proved equivalent, no assumption

mapped98

equivalent under a recorded assumption

divergent1

behaves differently on Starknet

blocked0

cannot be preserved; the source must change

divergent 1 finding

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/UniversalRouter.sol:13
if (block.timestamp > deadline) revert TransactionDeadlinePassed();

acknowledge if your logic uses wall-clock windows, not block counts

Acknowledged: survey: auto-acknowledged to measure the build

mapped Mapped: equivalent under the assumptions below

HD0160external call routed through the alias registry45

target addresses resolve through aliases or link symbols in hyperdrive.toml

contracts/base/Dispatcher.sol:91PERMIT2.permit(lockedBy, permitBatch, data);
contracts/base/Dispatcher.sol:170PERMIT2.permit(lockedBy, permitSingle, data);
contracts/base/Dispatcher.sol:203success = (ERC20(token).balanceOf(owner) >= minBalance);
contracts/base/Dispatcher.sol:223(success, output) = SEAPORT_V1_5.call{value: value}(data);
contracts/base/Dispatcher.sol:231(success, output) = LOOKS_RARE_V2.call{value: value}(data);
contracts/base/Dispatcher.sol:235(success, output) = NFTX_ZAP.call{value: value}(data);
contracts/base/Dispatcher.sol:246(success, output) = CRYPTOPUNKS.call{value: value}(
contracts/base/Dispatcher.sol:249if (success) ICryptoPunksMarket(CRYPTOPUNKS).transferPunk(map(recipient), punkId);
contracts/base/Dispatcher.sol:261success = (ERC721(token).ownerOf(id) == owner);
contracts/base/Dispatcher.sol:275success = (ERC1155(token).balanceOf(owner, id) >= minBalance);
contracts/base/Dispatcher.sol:296(success, output) = SUDOSWAP.call{value: value}(data);
contracts/base/Dispatcher.sol:300(success, output) = NFT20_ZAP.call{value: value}(data);
contracts/base/Dispatcher.sol:321(success, output) = ELEMENT_MARKET.call{value: value}(data);
contracts/base/Dispatcher.sol:339(success, output) = SEAPORT_V1_4.call{value: value}(data);
contracts/base/Dispatcher.sol:344(address(this)).call(abi.encodeWithSelector(Dispatcher.execute.selector, _commands, _inputs));
contracts/base/Dispatcher.sol:385(success, output) = protocol.call{value: value}(data);
contracts/base/Dispatcher.sol:386if (success) ERC721(token).safeTransferFrom(address(this), map(recipient), id);
contracts/base/Dispatcher.sol:411(success, output) = protocol.call{value: value}(data);
contracts/base/Dispatcher.sol:412if (success) ERC1155(token).safeTransferFrom(address(this), map(recipient), id, amount, new bytes(0));
contracts/base/RewardsCollector.sol:18(bool success,) = LOOKS_RARE_REWARDS_DISTRIBUTOR.call(looksRareClaim);
contracts/base/RewardsCollector.sol:21uint256 balance = LOOKS_RARE_TOKEN.balanceOf(address(this));
contracts/base/RewardsCollector.sol:22LOOKS_RARE_TOKEN.transfer(ROUTER_REWARDS_DISTRIBUTOR, balance);
contracts/modules/Payments.sol:33value = ERC20(token).balanceOf(address(this));
contracts/modules/Payments.sol:66uint256 balance = ERC20(token).balanceOf(address(this));
contracts/modules/Payments.sol:83balance = ERC20(token).balanceOf(address(this));
contracts/modules/Payments.sol:94ERC721(token).safeTransferFrom(address(this), recipient, id);
contracts/modules/Payments.sol:103uint256 balance = ERC1155(token).balanceOf(address(this), id);
contracts/modules/Payments.sol:105ERC1155(token).safeTransferFrom(address(this), recipient, id, balance, bytes(''));
contracts/modules/Payments.sol:118WETH9.deposit{value: amount}();
contracts/modules/Payments.sol:120WETH9.transfer(recipient, amount);
contracts/modules/Payments.sol:129uint256 value = WETH9.balanceOf(address(this));
contracts/modules/Payments.sol:134WETH9.withdraw(value);
contracts/modules/Permit2Payments.sol:22PERMIT2.transferFrom(from, to, amount, token);
contracts/modules/Permit2Payments.sol:34PERMIT2.transferFrom(batchDetails);
contracts/modules/uniswap/v2/UniswapV2Library.sol:81(uint256 reserve0, uint256 reserve1,) = IUniswapV2Pair(pair).getReserves();
contracts/modules/uniswap/v2/V2SwapRouter.sol:28(uint256 reserve0, uint256 reserve1,) = IUniswapV2Pair(pair).getReserves();
contracts/modules/uniswap/v2/V2SwapRouter.sol:31uint256 amountInput = ERC20(input).balanceOf(pair) - reserveInput;
contracts/modules/uniswap/v2/V2SwapRouter.sol:41IUniswapV2Pair(pair).swap(amount0Out, amount1Out, nextPair, new bytes(0));
contracts/modules/uniswap/v2/V2SwapRouter.sol:69uint256 balanceBefore = tokenOut.balanceOf(recipient);
contracts/modules/uniswap/v2/V2SwapRouter.sol:73uint256 amountOut = tokenOut.balanceOf(recipient) - balanceBefore;
contracts/modules/uniswap/v3/V3SwapRouter.sol:86amountIn = ERC20(tokenIn).balanceOf(address(this));
contracts/modules/uniswap/v3/V3SwapRouter.sol:151(amount0Delta, amount1Delta) = IUniswapV3Pool(computePoolAddress(tokenIn, tokenOut, fee)).swap(
lib/solmate/src/utils/SafeTransferLib.sol:19assembly {
lib/solmate/src/utils/SafeTransferLib.sol:73assembly {
lib/solmate/src/utils/SafeTransferLib.sol:105assembly {
HD0102address(this) is this contract's 160-bit alias21

no action needed

contracts/base/Dispatcher.sol:58address payer = payerIsUser ? lockedBy : address(this);
contracts/base/Dispatcher.sol:74address payer = payerIsUser ? lockedBy : address(this);
contracts/base/Dispatcher.sol:145address payer = payerIsUser ? lockedBy : address(this);
contracts/base/Dispatcher.sol:161address payer = payerIsUser ? lockedBy : address(this);
contracts/base/Dispatcher.sol:344(address(this)).call(abi.encodeWithSelector(Dispatcher.execute.selector, _commands, _inputs));
contracts/base/Dispatcher.sol:386if (success) ERC721(token).safeTransferFrom(address(this), map(recipient), id);
contracts/base/Dispatcher.sol:412if (success) ERC1155(token).safeTransferFrom(address(this), map(recipient), id, amount, new bytes(0));
contracts/base/LockAndMsgSender.sol:13if (msg.sender != address(this)) {
contracts/base/LockAndMsgSender.sol:30return address(this);
contracts/base/RewardsCollector.sol:21uint256 balance = LOOKS_RARE_TOKEN.balanceOf(address(this));
contracts/modules/Payments.sol:33value = ERC20(token).balanceOf(address(this));
contracts/modules/Payments.sol:66uint256 balance = ERC20(token).balanceOf(address(this));
contracts/modules/Payments.sol:83balance = ERC20(token).balanceOf(address(this));
contracts/modules/Payments.sol:94ERC721(token).safeTransferFrom(address(this), recipient, id);
contracts/modules/Payments.sol:103uint256 balance = ERC1155(token).balanceOf(address(this), id);
contracts/modules/Payments.sol:119if (recipient != address(this)) {
contracts/modules/Payments.sol:129uint256 value = WETH9.balanceOf(address(this));
contracts/modules/Permit2Payments.sol:43if (payer == address(this)) pay(token, recipient, amount);
contracts/modules/uniswap/v3/V3SwapRouter.sol:86amountIn = ERC20(tokenIn).balanceOf(address(this));
contracts/modules/uniswap/v3/V3SwapRouter.sol:96hasMultiplePools ? address(this) : recipient, // for intermediate swaps, this contract custodies
contracts/modules/uniswap/v3/V3SwapRouter.sol:106payer = address(this);
HD0161a failing external call returns false with its revert data (Starknet v0.13.4 or later)13

no action needed; deploy to a network running Starknet v0.13.4 or later

contracts/base/Dispatcher.sol:223(success, output) = SEAPORT_V1_5.call{value: value}(data);
contracts/base/Dispatcher.sol:231(success, output) = LOOKS_RARE_V2.call{value: value}(data);
contracts/base/Dispatcher.sol:235(success, output) = NFTX_ZAP.call{value: value}(data);
contracts/base/Dispatcher.sol:246(success, output) = CRYPTOPUNKS.call{value: value}(
contracts/base/Dispatcher.sol:296(success, output) = SUDOSWAP.call{value: value}(data);
contracts/base/Dispatcher.sol:300(success, output) = NFT20_ZAP.call{value: value}(data);
contracts/base/Dispatcher.sol:321(success, output) = ELEMENT_MARKET.call{value: value}(data);
contracts/base/Dispatcher.sol:339(success, output) = SEAPORT_V1_4.call{value: value}(data);
contracts/base/Dispatcher.sol:344(address(this)).call(abi.encodeWithSelector(Dispatcher.execute.selector, _commands, _inputs));
contracts/base/Dispatcher.sol:385(success, output) = protocol.call{value: value}(data);
contracts/base/Dispatcher.sol:411(success, output) = protocol.call{value: value}(data);
lib/solmate/src/utils/SafeTransferLib.sol:73assembly {
lib/solmate/src/utils/SafeTransferLib.sol:105assembly {
HD0140code size check means 'is deployed' on Starknet12

every Starknet account is a contract: code-length checks on users are always true

contracts/base/Dispatcher.sol:91PERMIT2.permit(lockedBy, permitBatch, data);
contracts/base/Dispatcher.sol:170PERMIT2.permit(lockedBy, permitSingle, data);
contracts/base/Dispatcher.sol:249if (success) ICryptoPunksMarket(CRYPTOPUNKS).transferPunk(map(recipient), punkId);
contracts/base/Dispatcher.sol:386if (success) ERC721(token).safeTransferFrom(address(this), map(recipient), id);
contracts/base/Dispatcher.sol:412if (success) ERC1155(token).safeTransferFrom(address(this), map(recipient), id, amount, new bytes(0));
contracts/modules/Payments.sol:94ERC721(token).safeTransferFrom(address(this), recipient, id);
contracts/modules/Payments.sol:105ERC1155(token).safeTransferFrom(address(this), recipient, id, balance, bytes(''));
contracts/modules/Payments.sol:118WETH9.deposit{value: amount}();
contracts/modules/Payments.sol:134WETH9.withdraw(value);
contracts/modules/Permit2Payments.sol:22PERMIT2.transferFrom(from, to, amount, token);
contracts/modules/Permit2Payments.sol:34PERMIT2.transferFrom(batchDetails);
contracts/modules/uniswap/v2/V2SwapRouter.sol:41IUniswapV2Pair(pair).swap(amount0Out, amount1Out, nextPair, new bytes(0));
HD0111balance reads the value token balance4

no action needed

contracts/modules/Payments.sol:62uint256 balance = address(this).balance;
contracts/modules/Payments.sol:79balance = address(this).balance;
contracts/modules/Payments.sol:113amount = address(this).balance;
contracts/modules/Payments.sol:114} else if (amount > address(this).balance) {
HD0101msg.sender is the caller's 160-bit alias2

no action needed; Ethereum-key accounts keep their Ethereum address

contracts/base/LockAndMsgSender.sol:13if (msg.sender != address(this)) {
contracts/modules/uniswap/v3/V3SwapRouter.sol:48if (computePoolAddress(tokenIn, tokenOut, fee) != msg.sender) revert V3InvalidCaller();
HD0130EVM log emitted as a Starknet event1

indexers read topics from event keys and data from event data

contracts/base/RewardsCollector.sol:23emit RewardsSent(balance);

The other 3,007 operations translate exactly: proved equivalent, with no assumption.

Assumptions#

From the build's certificate: what this contract's equivalence rests on, beyond the Lean proof. What these mean.

  • A-STORAGE-HASHhyperdrive's Poseidon hashes have no collisions on reachable inputs: storage slots (HD0120), keccak256 cache keys and Poseidon slot hashes (HD0123).
  • A-ALIASContracts are registered with the HdRegistry passed to their constructor, and an unregistered account's low 160 bits are not a registered alias. Registered addresses never share an alias (proved: RegistryProof.alias_injective).

Tested against the EVM#

The same calls run on the compiled Cairo and on revm, compared on return data, reverts, events, storage and balances.

Differential runs: not yet measured.

Cost#

EVM gas on Ethereum next to Starknet L2 gas for the same call. They are different units with different prices, so compare contracts, not the two columns. Raw is the EVM calldata entry point; typed is the Starknet ABI entry point. About costs.

Per-call cost: not yet measured.

Classes#

Starknet limits a class to 81,920 CASM felts. A larger contract is split by function selector into classes that call each other by library call.

ClassClass hashCASM felts of 81,920
UniversalRouternot declared
141,835

Build time: 10.0 s (wall time, depends on the compile cache).

Reproduce#

Rebuild from the Sourcify source and compare class hashes with the deployed ones. Nothing here needs trusting the registry.

hyperdrive verify 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD
solc (deployed)
0.8.17
Optimizer runs
1,000,000
Via IR (deployed)
yes
Compilation target
contracts/UniversalRouter.sol:UniversalRouter
Sourcify match
full

Attestations#

Each attestation is an on-chain record that someone rebuilt this contract and got the deployed class hashes. Anyone who runs hyperdrive verify can add one.

No attestations yet.