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

Sky

Usds

buildsstablecoin

Sky (Maker) USDS stablecoin implementation.

Ethereum
0x1923DfeE706A8E78157416C29cBCCFDe7cdF4102

Implementation behind proxy 0xdC03…384F

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.

exact990

proved equivalent, no assumption

mapped38

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 cadencesrc/Usds.sol:227
require(block.timestamp <= deadline, "Usds/permit-expired");

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

HD0130EVM log emitted as a Starknet event12

indexers read topics from event keys and data from event data

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:130emit Initialized(1);
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:201emit Initialized(type(uint64).max);
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol:85emit Upgraded(newImplementation);
src/Usds.sol:70emit Rely(msg.sender);
src/Usds.sol:98emit Rely(usr);
src/Usds.sol:103emit Deny(usr);
src/Usds.sol:117emit Transfer(msg.sender, to, value);
src/Usds.sol:143emit Transfer(from, to, value);
src/Usds.sol:151emit Approval(msg.sender, spender, value);
src/Usds.sol:164emit Transfer(address(0), to, value);
src/Usds.sol:187emit Transfer(from, address(0), value);
src/Usds.sol:250emit Approval(owner, spender, value);
HD0102address(this) is this contract's 160-bit alias8

no action needed

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:118bool construction = initialized == 1 && address(this).code.length == 0;
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:22address private immutable __self = address(this);
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:104address(this) == __self || // Must be called through delegatecall
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:116if (address(this) != __self) {
src/Usds.sol:86address(this)
src/Usds.sol:108require(to != address(0) && to != address(this), "Usds/invalid-address");
src/Usds.sol:123require(to != address(0) && to != address(this), "Usds/invalid-address");
src/Usds.sol:158require(to != address(0) && to != address(this), "Usds/invalid-address");
HD0101msg.sender is the caller's 160-bit alias6

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

src/Usds.sol:56require(wards[msg.sender] == 1, "Usds/not-authorized");
src/Usds.sol:69wards[msg.sender] = 1;
src/Usds.sol:109uint256 balance = balanceOf[msg.sender];
src/Usds.sol:127if (from != msg.sender) {
src/Usds.sol:149allowance[msg.sender][spender] = value;
src/Usds.sol:171if (from != msg.sender) {
HD0140code size check means 'is deployed' on Starknet4

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

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:118bool construction = initialized == 1 && address(this).code.length == 0;
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol:70if (newImplementation.code.length == 0) {
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Address.sol:124if (returndata.length == 0 && target.code.length == 0) {
src/Usds.sol:210if (signer.code.length > 0) {
HD0152block.chainid is the Starknet chain id2

no action needed; EIP-712 domains will use the Starknet chain id

src/Usds.sol:92return _calculateDomainSeparator(block.chainid);
src/Usds.sol:236_calculateDomainSeparator(block.chainid),
HD0160external call routed through the alias registry2

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

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:143try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
src/Usds.sol:211(bool success, bytes memory result) = signer.staticcall(
HD0161a failing external call returns false with its revert data (Starknet v0.13.4 or later)2

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

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:143try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
src/Usds.sol:211(bool success, bytes memory result) = signer.staticcall(
HD0110msg.value is an amount of the network's value token1

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

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol:189if (msg.value > 0) {
HD0162delegatecall runs the target's class on this contract's storage (library call)1

no action needed

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Address.sol:105(bool success, bytes memory returndata) = target.delegatecall(data);

The other 990 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).

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
Usdsnot declared
69,207

Build time: 1.1 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 0x1923DfeE706A8E78157416C29cBCCFDe7cdF4102
solc (deployed)
0.8.21
Optimizer runs
200
Via IR (deployed)
no
Compilation target
src/Usds.sol:Usds
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.