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

Uniswap v4

PoolManager

buildsdex

Uniswap v4 singleton: every v4 pool and swap goes through it.

Ethereum
0x000000000004444c5dc75cB358380D2e3dE08A90
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,723

proved equivalent, no assumption

mapped60

equivalent under a recorded assumption

divergent0

behaves differently on Starknet

blocked0

cannot be preserved; the source must change

mapped Mapped: equivalent under the assumptions below

HD0101msg.sender is the caller's 160-bit alias19

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

lib/v4-core/lib/solmate/src/auth/Owned.sol:20require(msg.sender == owner, "UNAUTHORIZED");
lib/v4-core/src/ERC6909.sol:26balanceOf[msg.sender][id] -= amount;
lib/v4-core/src/ERC6909.sol:36if (msg.sender != sender && !isOperator[sender][msg.sender]) {
lib/v4-core/src/ERC6909.sol:51allowance[msg.sender][spender][id] = amount;
lib/v4-core/src/ERC6909.sol:59isOperator[msg.sender][operator] = approved;
lib/v4-core/src/PoolManager.sol:110result = IUnlockCallback(msg.sender).unlockCallback(data);
lib/v4-core/src/PoolManager.sol:242msg.sender,
lib/v4-core/src/PoolManager.sol:293_accountDelta(currency, -(amount.toInt128()), msg.sender);
lib/v4-core/src/PoolManager.sol:300return _settle(msg.sender);
lib/v4-core/src/PoolManager.sol:310int256 current = currency.getDelta(msg.sender);
lib/v4-core/src/PoolManager.sol:325_accountDelta(currency, -(amount.toInt128()), msg.sender);
lib/v4-core/src/PoolManager.sol:333_accountDelta(currency, amount.toInt128(), msg.sender);
lib/v4-core/src/PoolManager.sol:339if (!key.fee.isDynamicFee() || msg.sender != address(key.hooks)) {
lib/v4-core/src/ProtocolFees.sol:36if (msg.sender != protocolFeeController) InvalidCaller.selector.revertWith();
lib/v4-core/src/ProtocolFees.sol:48if (msg.sender != protocolFeeController) InvalidCaller.selector.revertWith();
lib/v4-core/src/libraries/Hooks.sol:171if (msg.sender != address(self)) {
lib/v4-core/src/libraries/Hooks.sol:216if (msg.sender == address(self)) return (delta, BalanceDeltaLibrary.ZERO_DELTA);
lib/v4-core/src/libraries/Hooks.sol:252if (msg.sender == address(self)) return (amountToSwap, BeforeSwapDeltaLibrary.ZERO_DELTA, lpFeeOverride);
lib/v4-core/src/libraries/Hooks.sol:292if (msg.sender == address(self)) return (swapDelta, BalanceDeltaLibrary.ZERO_DELTA);
HD0121transient storage is scoped by transaction hash15

no action needed

lib/v4-core/src/Exttload.sol:11assembly ("memory-safe") {
lib/v4-core/src/Exttload.sol:19assembly ("memory-safe") {
lib/v4-core/src/libraries/CurrencyDelta.sol:20assembly ("memory-safe") {
lib/v4-core/src/libraries/CurrencyDelta.sol:34assembly ("memory-safe") {
lib/v4-core/src/libraries/CurrencyDelta.sol:38assembly ("memory-safe") {
lib/v4-core/src/libraries/CurrencyReserves.sol:16assembly ("memory-safe") {
lib/v4-core/src/libraries/CurrencyReserves.sol:22assembly ("memory-safe") {
lib/v4-core/src/libraries/CurrencyReserves.sol:28assembly ("memory-safe") {
lib/v4-core/src/libraries/CurrencyReserves.sol:35assembly ("memory-safe") {
lib/v4-core/src/libraries/Lock.sol:11assembly ("memory-safe") {
lib/v4-core/src/libraries/Lock.sol:18assembly ("memory-safe") {
lib/v4-core/src/libraries/Lock.sol:24assembly ("memory-safe") {
lib/v4-core/src/libraries/NonzeroDeltaCount.sol:13assembly ("memory-safe") {
lib/v4-core/src/libraries/NonzeroDeltaCount.sol:19assembly ("memory-safe") {
lib/v4-core/src/libraries/NonzeroDeltaCount.sol:29assembly ("memory-safe") {
HD0130EVM log emitted as a Starknet event14

indexers read topics from event keys and data from event data

lib/v4-core/lib/solmate/src/auth/Owned.sol:32emit OwnershipTransferred(address(0), _owner);
lib/v4-core/lib/solmate/src/auth/Owned.sol:42emit OwnershipTransferred(msg.sender, newOwner);
lib/v4-core/src/ERC6909.sol:30emit Transfer(msg.sender, msg.sender, receiver, id, amount);
lib/v4-core/src/ERC6909.sol:45emit Transfer(msg.sender, sender, receiver, id, amount);
lib/v4-core/src/ERC6909.sol:53emit Approval(msg.sender, spender, id, amount);
lib/v4-core/src/ERC6909.sol:61emit OperatorSet(msg.sender, operator, approved);
lib/v4-core/src/ERC6909.sol:82emit Transfer(msg.sender, address(0), receiver, id, amount);
lib/v4-core/src/ERC6909.sol:88emit Transfer(msg.sender, sender, address(0), id, amount);
lib/v4-core/src/PoolManager.sol:139emit Initialize(id, key.currency0, key.currency1, key.fee, key.tickSpacing, key.hooks, sqrtPriceX96, tick);
lib/v4-core/src/PoolManager.sol:174emit ModifyLiquidity(id, msg.sender, params.tickLower, params.tickUpper, params.liquidityDelta, params.salt);
lib/v4-core/src/PoolManager.sol:240emit Swap(
lib/v4-core/src/PoolManager.sol:272emit Donate(poolId, msg.sender, amount0, amount1);
lib/v4-core/src/ProtocolFees.sol:31emit ProtocolFeeControllerUpdated(controller);
lib/v4-core/src/ProtocolFees.sol:40emit ProtocolFeeUpdated(id, newProtocolFee);
HD0160external call routed through the alias registry5

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

lib/v4-core/src/PoolManager.sol:110result = IUnlockCallback(msg.sender).unlockCallback(data);
lib/v4-core/src/libraries/Hooks.sol:132assembly ("memory-safe") {
lib/v4-core/src/types/Currency.sol:46assembly ("memory-safe") {
lib/v4-core/src/types/Currency.sol:55assembly ("memory-safe") {
lib/v4-core/src/types/Currency.sol:94return IERC20Minimal(Currency.unwrap(currency)).balanceOf(address(this));
HD0102address(this) is this contract's 160-bit alias3

no action needed

lib/v4-core/src/NoDelegateCall.sol:19original = address(this);
lib/v4-core/src/NoDelegateCall.sol:25if (address(this) != original) DelegateCallNotAllowed.selector.revertWith();
lib/v4-core/src/types/Currency.sol:94return IERC20Minimal(Currency.unwrap(currency)).balanceOf(address(this));
HD0110msg.value is an amount of the network's value token2

no action needed; the registry admin sets the value token (ETH or STRK) once per network

lib/v4-core/src/PoolManager.sol:353paid = msg.value;
lib/v4-core/src/PoolManager.sol:355if (msg.value > 0) NonzeroNativeValue.selector.revertWith();
HD0111balance reads the value token balance1

no action needed

lib/v4-core/src/types/Currency.sol:92return address(this).balance;
HD0161a failing external call returns false with its revert data (Starknet v0.13.4 or later)1

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

lib/v4-core/src/types/Currency.sol:55assembly ("memory-safe") {

The other 3,723 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).
  • A-SLOT-MODECode compiled with Poseidon slots and code with keccak256 slots never share storage. The constructor records slot mode keccak in this contract's storage and every delegatecall frame running this code checks the storage owner's mode (reverting with "hyperdrive: storage slot mode mismatch"). Not checked: an upgrade with replace_class must keep the slot mode of the class it replaces (both builds' ASSUMPTIONS.md name it).
  • A-SPLITThe contract is split into several classes (split.json). A library call runs the part class with this contract's storage, caller and address, and its revert data reaches the caller unchanged; the part classes declared on the network are the ones whose class hashes are embedded here.

Tested against the EVM#

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

Cairo against revm (solc 0.8.26): identical behaviour: 5 calls, 2 storage slots compared, 0 mismatch(es)

CallResultEVM gasStarknet L2 gas
owner()matchnot yet measurednot yet measured
setProtocolFeeController(bob)matchnot yet measurednot yet measured
protocolFeeController()matchnot yet measurednot yet measured
carol: setProtocolFeeController(carol)matchnot yet measurednot yet measured
sync(carol)matchnot yet measurednot 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
PoolManagernot declared
79,610
PoolManager_Ctornot declared
9,732
PoolManager_P1not declared
74,217
PoolManager_P2not declared
76,928

Build time: 3.7 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 0x000000000004444c5dc75cB358380D2e3dE08A90
solc (deployed)
0.8.26
Optimizer runs
44,444,444
Via IR (deployed)
yes
Compilation target
lib/v4-core/src/PoolManager.sol:PoolManager
Sourcify match
partial

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.