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

Ethena

StakedUSDeV2

failingstablecoin

Ethena staked USDe (ERC4626 with cooldown).

Not on Starknet yet. StakedUSDeV2 is 163507 CASM felts, over the 81920 limit, and has no selector dispatcher to split by.
Ethereum
0x9D39A5DE30e57443BfF2A8307A4256c8797A3497
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,321

proved equivalent, no assumption

mapped38

equivalent under a recorded assumption

divergent6

behaves differently on Starknet

blocked0

cannot be preserved; the source must change

divergent 6 findings

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/StakedUSDe.sol:169
uint256 timeSinceLastDistribution = block.timestamp - lastDistributionTimestamp;

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

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/StakedUSDe.sol:243
lastDistributionTimestamp = block.timestamp;

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

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/StakedUSDeV2.sol:84
if (block.timestamp >= userCooldown.cooldownEnd || cooldownDuration == 0) {

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

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/StakedUSDeV2.sol:101
cooldowns[msg.sender].cooldownEnd = uint104(block.timestamp) + cooldownDuration;

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

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/StakedUSDeV2.sol:114
cooldowns[msg.sender].cooldownEnd = uint104(block.timestamp) + cooldownDuration;

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

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencelib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Permit.sol:58
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

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 event13

indexers read topics from event keys and data from event data

contracts/SingleAdminAccessControl.sol:28emit AdminTransferRequested(_currentDefaultAdmin, newAdmin);
contracts/SingleAdminAccessControl.sol:74emit AdminTransferred(_currentDefaultAdmin, account);
contracts/StakedUSDe.sol:92emit RewardsReceived(amount);
contracts/StakedUSDe.sol:150emit LockedAmountRedistributed(from, to, amountToDistribute);
contracts/StakedUSDeV2.sol:129emit CooldownDurationUpdated(previousDuration, cooldownDuration);
lib/openzeppelin-contracts/contracts/access/AccessControl.sol:231emit RoleGranted(role, account, _msgSender());
lib/openzeppelin-contracts/contracts/access/AccessControl.sol:245emit RoleRevoked(role, account, _msgSender());
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:237emit Transfer(from, to, amount);
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:261emit Transfer(address(0), account, amount);
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:290emit Transfer(account, address(0), amount);
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:313emit Approval(owner, spender, amount);
lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol:224emit Deposit(caller, receiver, assets, shares);
lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol:250emit Withdraw(caller, receiver, owner, assets, shares);
HD0101msg.sender is the caller's 160-bit alias6

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

contracts/SingleAdminAccessControl.sol:26if (newAdmin == msg.sender) revert InvalidAdminChange();
contracts/SingleAdminAccessControl.sol:32if (msg.sender != _pendingDefaultAdmin) revert NotPendingAdmin();
contracts/StakedUSDeV2.sol:81UserCooldown storage userCooldown = cooldowns[msg.sender];
contracts/StakedUSDeV2.sol:97if (assets > maxWithdraw(msg.sender)) revert ExcessiveWithdrawAmount();
contracts/StakedUSDeV2.sol:110if (shares > maxRedeem(msg.sender)) revert ExcessiveRedeemAmount();
lib/openzeppelin-contracts/contracts/utils/Context.sol:18return msg.sender;
HD0102address(this) is this contract's 160-bit alias6

no action needed

contracts/StakedUSDe.sol:90IERC20(asset()).safeTransferFrom(msg.sender, address(this), amount);
contracts/StakedUSDe.sol:162return IERC20(asset()).balanceOf(address(this)) - getUnvestedAmount();
lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol:221SafeERC20.safeTransferFrom(_asset, caller, address(this), assets);
lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol:82if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol:90return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol:137address(this),
HD0152block.chainid is the Starknet chain id4

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

lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol:73_cachedChainId = block.chainid;
lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol:82if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol:90return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol:136block.chainid,
HD0160external call routed through the alias registry4

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

contracts/StakedUSDe.sol:162return IERC20(asset()).balanceOf(address(this)) - getUnvestedAmount();
contracts/StakedUSDeV2.sol:88silo.withdraw(receiver, assets);
lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol:69(bool success, bytes memory encodedDecimals) = address(asset_).staticcall(
lib/openzeppelin-contracts/contracts/utils/Address.sol:135(bool success, bytes memory returndata) = target.call{value: value}(data);
HD0140code size check means 'is deployed' on Starknet2

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

contracts/StakedUSDeV2.sol:88silo.withdraw(receiver, assets);
lib/openzeppelin-contracts/contracts/utils/Address.sol:45return account.code.length > 0;
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/contracts/token/ERC20/extensions/ERC4626.sol:69(bool success, bytes memory encodedDecimals) = address(asset_).staticcall(
lib/openzeppelin-contracts/contracts/utils/Address.sol:135(bool success, bytes memory returndata) = target.call{value: value}(data);
HD0163new Contract deploys the child's class declared in the alias registry1

declare each child class once per network: registry.declare(selector(name), class_hash)

contracts/StakedUSDeV2.sol:45silo = new USDeSilo(address(this), address(_asset));

The other 3,321 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
StakedUSDeV2not declared
163,507

Build time: 11.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 0x9D39A5DE30e57443BfF2A8307A4256c8797A3497
solc (deployed)
0.8.19
Optimizer runs
20,000
Via IR (deployed)
no
Compilation target
contracts/StakedUSDeV2.sol:StakedUSDeV2
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.