Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
7591180 | 97 days ago | 0 ETH | ||||
7591150 | 97 days ago | 0 ETH | ||||
7590496 | 97 days ago | 0 ETH | ||||
4903048 | 128 days ago | 0 ETH | ||||
4903026 | 128 days ago | 0 ETH | ||||
4902996 | 128 days ago | 0 ETH | ||||
4816605 | 129 days ago | 0 ETH | ||||
4816594 | 129 days ago | 0 ETH | ||||
4816580 | 129 days ago | 0 ETH | ||||
4643810 | 131 days ago | 0 ETH | ||||
4643798 | 131 days ago | 0 ETH | ||||
4643785 | 131 days ago | 0 ETH | ||||
4643775 | 131 days ago | 0 ETH | ||||
4557366 | 132 days ago | 0 ETH | ||||
4557365 | 132 days ago | 0 ETH | ||||
4557364 | 132 days ago | 0 ETH | ||||
4557363 | 132 days ago | 0 ETH | ||||
4470964 | 133 days ago | 0 ETH | ||||
4470964 | 133 days ago | 0 ETH | ||||
4470963 | 133 days ago | 0 ETH | ||||
4384564 | 134 days ago | 0 ETH | ||||
4384564 | 134 days ago | 0 ETH | ||||
4384563 | 134 days ago | 0 ETH | ||||
4298216 | 135 days ago | 0 ETH | ||||
4298202 | 135 days ago | 0 ETH |
Loading...
Loading
Contract Name:
HeaderStorage
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 10000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.20; import { IHeaderStorage } from "../interfaces/IHeaderStorage.sol"; contract HeaderStorage is IHeaderStorage { mapping(uint256 => bytes32) public headers; /// @inheritdoc IHeaderStorage function storeBlockHeader(uint256 blockNumber) public returns (bytes32) { bytes32 blockHeader = headers[blockNumber]; if (blockHeader == 0) { blockHeader = blockhash(blockNumber); if (blockHeader == 0) revert HeaderOutOfRange(blockNumber); headers[blockNumber] = blockHeader; emit HeaderStored(blockNumber, blockHeader); } return blockHeader; } /// @inheritdoc IHeaderStorage function storeBlockHeaders(uint256[] memory blockNumbers) public returns (bytes32[] memory) { bytes32[] memory blockHeaders = new bytes32[](blockNumbers.length); for (uint256 i = 0; i < blockNumbers.length; ) { blockHeaders[i] = storeBlockHeader(blockNumbers[i]); unchecked { ++i; } } return blockHeaders; } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; /** * @title IHeaderStorage */ interface IHeaderStorage { error HeaderOutOfRange(uint256 blockNumber); /** * @dev Emitted when a block header is stored. * @param blockNumber - The block number associated with the stored header. * @param blockHeader - The stored block header as a bytes32 value. */ event HeaderStored(uint256 indexed blockNumber, bytes32 indexed blockHeader); /** * @dev Retrieves the stored block header for a specific block number. * @param blockNumber - The block number as a uint256 value. * @return The block header as a bytes32 value. */ function headers(uint256 blockNumber) external view returns (bytes32); /** * @dev Stores and returns the header for the given block. * @param blockNumber - Block number. * @return blockHeader - Block header stored. * @notice Reverts if the given block header was not previously stored and is now out of range. */ function storeBlockHeader(uint256 blockNumber) external returns (bytes32); /** * @dev Stores and returns the header for an array of given blocks. * @param blockNumbers - Array of block numbers. * @return blockHeaders - Array of block headers stored. * @notice Reverts if the given block header was not previously stored and is now out of range. */ function storeBlockHeaders(uint256[] memory blockNumbers) external returns (bytes32[] memory); }
{ "viaIR": true, "optimizer": { "enabled": true, "runs": 10000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"HeaderOutOfRange","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"blockNumber","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"blockHeader","type":"bytes32"}],"name":"HeaderStored","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"headers","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"storeBlockHeader","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"blockNumbers","type":"uint256[]"}],"name":"storeBlockHeaders","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60808060405234610016576103be908161001c8239f35b600080fdfe608080604052600436101561001357600080fd5b600090813560e01c90816356f90d79146101ea575080636c1e8a95146101a55763ceee6e551461004257600080fd5b3461019e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a1576004359167ffffffffffffffff831161019e573660238401121561019e578260040135926100a76100a2856102a1565b61022e565b9360248486838152019160051b8301019136831161019a576024859101915b83831061018a57505050508251906100ec6100e36100a2846102a1565b928084526102a1565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08484019101368237815b8551811015610147578061013661013060019389610345565b516102b9565b6101408287610345565b5201610117565b508390839260405193838594850191818652518092526040850193925b82811061017357505050500390f35b835185528695509381019392810192600101610164565b82358152918101918591016100c6565b8380fd5b80fd5b5080fd5b503461019e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261019e5760206101e26004356102b9565b604051908152f35b9050346101a15760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a1576040602092600435815280845220548152f35b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f604051930116820182811067ffffffffffffffff82111761027257604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b67ffffffffffffffff81116102725760051b60200190565b60008181528060205260408120549182156102d357505090565b8040925090821561031457907ff7df17dce0093aedfcbae24b4f04e823f9e863c97986ab1ba6c5267ace49ddea82828594528060205283604082205580a390565b602482604051907f9c97e72e0000000000000000000000000000000000000000000000000000000082526004820152fd5b80518210156103595760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea2646970667358221220d3fd9ff35d5d0d15d6d3ea691302fb6f310e704e481e0f7c3166ec085bfa057764736f6c63430008140033
Deployed Bytecode
0x608080604052600436101561001357600080fd5b600090813560e01c90816356f90d79146101ea575080636c1e8a95146101a55763ceee6e551461004257600080fd5b3461019e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a1576004359167ffffffffffffffff831161019e573660238401121561019e578260040135926100a76100a2856102a1565b61022e565b9360248486838152019160051b8301019136831161019a576024859101915b83831061018a57505050508251906100ec6100e36100a2846102a1565b928084526102a1565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08484019101368237815b8551811015610147578061013661013060019389610345565b516102b9565b6101408287610345565b5201610117565b508390839260405193838594850191818652518092526040850193925b82811061017357505050500390f35b835185528695509381019392810192600101610164565b82358152918101918591016100c6565b8380fd5b80fd5b5080fd5b503461019e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261019e5760206101e26004356102b9565b604051908152f35b9050346101a15760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a1576040602092600435815280845220548152f35b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f604051930116820182811067ffffffffffffffff82111761027257604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b67ffffffffffffffff81116102725760051b60200190565b60008181528060205260408120549182156102d357505090565b8040925090821561031457907ff7df17dce0093aedfcbae24b4f04e823f9e863c97986ab1ba6c5267ace49ddea82828594528060205283604082205580a390565b602482604051907f9c97e72e0000000000000000000000000000000000000000000000000000000082526004820152fd5b80518210156103595760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea2646970667358221220d3fd9ff35d5d0d15d6d3ea691302fb6f310e704e481e0f7c3166ec085bfa057764736f6c63430008140033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.