Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 19281157 | 155 days ago | IN | 0 ETH | 0.01989024 |
Latest 25 internal transactions (View All)
Advanced mode:
Loading...
Loading
Contract Name:
ContentStore
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
No with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.20; import {SSTORE2} from "./solady/utils/SSTORE2.sol"; import {IContentStore} from "./IContentStore.sol"; contract ContentStore is IContentStore { // content checksum => sstore2 pointer mapping(bytes32 => address) public pointers; function checksumExists(bytes32 checksum) public view returns (bool) { return pointers[checksum] != address(0); } function contentLength(bytes32 checksum) public view returns (uint256 size) { if (!checksumExists(checksum)) { revert ChecksumNotFound(checksum); } return SSTORE2.read(pointers[checksum]).length; } function addPointer(address pointer) public returns (bytes32 checksum) { bytes memory content = SSTORE2.read(pointer); checksum = keccak256(content); if (pointers[checksum] != address(0)) { return checksum; } pointers[checksum] = pointer; emit NewChecksum(checksum, content.length); return checksum; } function addContent(bytes memory content) public returns (bytes32 checksum, address pointer) { checksum = keccak256(content); if (pointers[checksum] != address(0)) { return (checksum, pointers[checksum]); } pointer = SSTORE2.write(content); pointers[checksum] = pointer; emit NewChecksum(checksum, content.length); return (checksum, pointer); } function getPointer(bytes32 checksum) public view returns (address pointer) { if (!checksumExists(checksum)) { revert ChecksumNotFound(checksum); } return pointers[checksum]; } }
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.20; interface IContentStore { event NewChecksum(bytes32 indexed checksum, uint256 contentSize); error ChecksumExists(bytes32 checksum); error ChecksumNotFound(bytes32 checksum); function pointers(bytes32 checksum) external view returns (address pointer); function checksumExists(bytes32 checksum) external view returns (bool); function contentLength(bytes32 checksum) external view returns (uint256 size); function addPointer(address pointer) external returns (bytes32 checksum); function addContent(bytes memory content) external returns (bytes32 checksum, address pointer); function getPointer(bytes32 checksum) external view returns (address pointer); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Read and write to persistent storage at a fraction of the cost. /// @author Solady (https://github.com/vectorized/solmady/blob/main/src/utils/SSTORE2.sol) /// @author Saw-mon-and-Natalie (https://github.com/Saw-mon-and-Natalie) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SSTORE2.sol) /// @author Modified from 0xSequence (https://github.com/0xSequence/sstore2/blob/master/contracts/SSTORE2.sol) library SSTORE2 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ error DeploymentFailed(); error InvalidPointer(); error ReadOutOfBounds(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* WRITE LOGIC */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ function write(bytes memory data) internal returns (address pointer) { // Note: The assembly block below does not expand the memory. assembly { let originalDataLength := mload(data) // Add 1 to data size since we are prefixing it with a STOP opcode. let dataSize := add(originalDataLength, 1) /** * ------------------------------------------------------------------------------+ * Opcode | Mnemonic | Stack | Memory | * ------------------------------------------------------------------------------| * 61 codeSize | PUSH2 codeSize | codeSize | | * 80 | DUP1 | codeSize codeSize | | * 60 0xa | PUSH1 0xa | 0xa codeSize codeSize | | * 3D | RETURNDATASIZE | 0 0xa codeSize codeSize | | * 39 | CODECOPY | codeSize | [0..codeSize): code | * 3D | RETURNDATASZIE | 0 codeSize | [0..codeSize): code | * F3 | RETURN | | [0..codeSize): code | * 00 | STOP | | | * ------------------------------------------------------------------------------+ * @dev Prefix the bytecode with a STOP opcode to ensure it cannot be called. * Also PUSH2 is used since max contract size cap is 24,576 bytes which is less than 2 ** 16. */ mstore( data, or( 0x61000080600a3d393df300, // Left shift `dataSize` by 64 so that it lines up with the 0000 after PUSH2. shl(0x40, dataSize) ) ) // Deploy a new contract with the generated creation code. pointer := create(0, add(data, 0x15), add(dataSize, 0xa)) // If `pointer` is zero, revert. if iszero(pointer) { // Store the function selector of `DeploymentFailed()`. mstore(0x00, 0x30116425) // Revert with (offset, size). revert(0x1c, 0x04) } // Restore original length of the variable size `data`. mstore(data, originalDataLength) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* READ LOGIC */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ function read(address pointer) internal view returns (bytes memory data) { assembly { let pointerCodesize := extcodesize(pointer) if iszero(pointerCodesize) { // Store the function selector of `InvalidPointer()`. mstore(0x00, 0x11052bb4) // Revert with (offset, size). revert(0x1c, 0x04) } // Offset all indices by 1 to skip the STOP opcode. let size := sub(pointerCodesize, 1) // Get the pointer to the free memory and allocate // enough 32-byte words for the data and the length of the data, // then copy the code to the allocated memory. // Masking with 0xffe0 will suffice, since contract size is less than 16 bits. data := mload(0x40) mstore(0x40, add(data, and(add(size, 0x3f), 0xffe0))) mstore(data, size) extcodecopy(pointer, add(data, 0x20), 1, size) } } function read(address pointer, uint256 start) internal view returns (bytes memory data) { assembly { let pointerCodesize := extcodesize(pointer) if iszero(pointerCodesize) { // Store the function selector of `InvalidPointer()`. mstore(0x00, 0x11052bb4) // Revert with (offset, size). revert(0x1c, 0x04) } // If `!(pointer.code.size > start)`, reverts. // This also handles the case where `start + 1` overflows. if iszero(gt(pointerCodesize, start)) { // Store the function selector of `ReadOutOfBounds()`. mstore(0x00, 0x84eb0dd1) // Revert with (offset, size). revert(0x1c, 0x04) } let size := sub(pointerCodesize, add(start, 1)) // Get the pointer to the free memory and allocate // enough 32-byte words for the data and the length of the data, // then copy the code to the allocated memory. // Masking with 0xffe0 will suffice, since contract size is less than 16 bits. data := mload(0x40) mstore(0x40, add(data, and(add(size, 0x3f), 0xffe0))) mstore(data, size) extcodecopy(pointer, add(data, 0x20), add(start, 1), size) } } function read( address pointer, uint256 start, uint256 end ) internal view returns (bytes memory data) { assembly { let pointerCodesize := extcodesize(pointer) if iszero(pointerCodesize) { // Store the function selector of `InvalidPointer()`. mstore(0x00, 0x11052bb4) // Revert with (offset, size). revert(0x1c, 0x04) } // If `!(pointer.code.size > end) || (start > end)`, revert. // This also handles the cases where `end + 1` or `start + 1` overflow. if iszero( and( gt(pointerCodesize, end), // Within bounds. iszero(gt(start, end)) // Valid range. ) ) { // Store the function selector of `ReadOutOfBounds()`. mstore(0x00, 0x84eb0dd1) // Revert with (offset, size). revert(0x1c, 0x04) } let size := sub(end, start) // Get the pointer to the free memory and allocate // enough 32-byte words for the data and the length of the data, // then copy the code to the allocated memory. // Masking with 0xffe0 will suffice, since contract size is less than 16 bits. data := mload(0x40) mstore(0x40, add(data, and(add(size, 0x3f), 0xffe0))) mstore(data, size) extcodecopy(pointer, add(data, 0x20), add(start, 1), size) } } }
{ "evmVersion": "paris", "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"bytes32","name":"checksum","type":"bytes32"}],"name":"ChecksumExists","type":"error"},{"inputs":[{"internalType":"bytes32","name":"checksum","type":"bytes32"}],"name":"ChecksumNotFound","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"checksum","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"contentSize","type":"uint256"}],"name":"NewChecksum","type":"event"},{"inputs":[{"internalType":"bytes","name":"content","type":"bytes"}],"name":"addContent","outputs":[{"internalType":"bytes32","name":"checksum","type":"bytes32"},{"internalType":"address","name":"pointer","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pointer","type":"address"}],"name":"addPointer","outputs":[{"internalType":"bytes32","name":"checksum","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"checksum","type":"bytes32"}],"name":"checksumExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"checksum","type":"bytes32"}],"name":"contentLength","outputs":[{"internalType":"uint256","name":"size","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"checksum","type":"bytes32"}],"name":"getPointer","outputs":[{"internalType":"address","name":"pointer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"pointers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506109ce806100206000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063093e9839146100675780631bf226ac1461009857806331654b09146100c85780633a77c6c9146100f85780634641dce614610128578063f97406f714610158575b600080fd5b610081600480360381019061007c919061077a565b610188565b60405161008f92919061081d565b60405180910390f35b6100b260048036038101906100ad9190610872565b6102d3565b6040516100bf919061089f565b60405180910390f35b6100e260048036038101906100dd9190610872565b610306565b6040516100ef91906108d3565b60405180910390f35b610112600480360381019061010d919061091a565b610395565b60405161011f9190610947565b60405180910390f35b610142600480360381019061013d9190610872565b6104aa565b60405161014f919061089f565b60405180910390f35b610172600480360381019061016d9190610872565b610530565b60405161017f919061097d565b60405180910390f35b60008082805190602001209150600073ffffffffffffffffffffffffffffffffffffffff1660008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610238578160008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915091506102ce565b6102418361059b565b90508060008084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550817fa1011c3aaafa54b70d8ca12f3b9257ca9a4fe1f6a02196819ea1dcaee1932ca084516040516102c591906108d3565b60405180910390a25b915091565b60006020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061031182610530565b61035257816040517f3001a1900000000000000000000000000000000000000000000000000000000081526004016103499190610947565b60405180910390fd5b61038d60008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166105e0565b519050919050565b6000806103a1836105e0565b905080805190602001209150600073ffffffffffffffffffffffffffffffffffffffff1660008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461041957506104a5565b8260008084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550817fa1011c3aaafa54b70d8ca12f3b9257ca9a4fe1f6a02196819ea1dcaee1932ca0825160405161049b91906108d3565b60405180910390a2505b919050565b60006104b582610530565b6104f657816040517f3001a1900000000000000000000000000000000000000000000000000000000081526004016104ed9190610947565b60405180910390fd5b60008083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008073ffffffffffffffffffffffffffffffffffffffff1660008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60008151600181018060401b6a61000080600a3d393df300178452600a8101601585016000f09250826105d65763301164256000526004601cfd5b8184525050919050565b6060813b806105f7576311052bb46000526004601cfd5b60018103604051925061ffe0603f820116830160405280835280600160208501863c5050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106878261063e565b810181811067ffffffffffffffff821117156106a6576106a561064f565b5b80604052505050565b60006106b9610620565b90506106c5828261067e565b919050565b600067ffffffffffffffff8211156106e5576106e461064f565b5b6106ee8261063e565b9050602081019050919050565b82818337600083830152505050565b600061071d610718846106ca565b6106af565b90508281526020810184848401111561073957610738610639565b5b6107448482856106fb565b509392505050565b600082601f83011261076157610760610634565b5b813561077184826020860161070a565b91505092915050565b6000602082840312156107905761078f61062a565b5b600082013567ffffffffffffffff8111156107ae576107ad61062f565b5b6107ba8482850161074c565b91505092915050565b6000819050919050565b6107d6816107c3565b82525050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610807826107dc565b9050919050565b610817816107fc565b82525050565b600060408201905061083260008301856107cd565b61083f602083018461080e565b9392505050565b61084f816107c3565b811461085a57600080fd5b50565b60008135905061086c81610846565b92915050565b6000602082840312156108885761088761062a565b5b60006108968482850161085d565b91505092915050565b60006020820190506108b4600083018461080e565b92915050565b6000819050919050565b6108cd816108ba565b82525050565b60006020820190506108e860008301846108c4565b92915050565b6108f7816107fc565b811461090257600080fd5b50565b600081359050610914816108ee565b92915050565b6000602082840312156109305761092f61062a565b5b600061093e84828501610905565b91505092915050565b600060208201905061095c60008301846107cd565b92915050565b60008115159050919050565b61097781610962565b82525050565b6000602082019050610992600083018461096e565b9291505056fea26469706673582212200577a90655ff7e492c180bfa2ebdb95943f87b14724e2449c3c26d94036b0ea464736f6c63430008160033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063093e9839146100675780631bf226ac1461009857806331654b09146100c85780633a77c6c9146100f85780634641dce614610128578063f97406f714610158575b600080fd5b610081600480360381019061007c919061077a565b610188565b60405161008f92919061081d565b60405180910390f35b6100b260048036038101906100ad9190610872565b6102d3565b6040516100bf919061089f565b60405180910390f35b6100e260048036038101906100dd9190610872565b610306565b6040516100ef91906108d3565b60405180910390f35b610112600480360381019061010d919061091a565b610395565b60405161011f9190610947565b60405180910390f35b610142600480360381019061013d9190610872565b6104aa565b60405161014f919061089f565b60405180910390f35b610172600480360381019061016d9190610872565b610530565b60405161017f919061097d565b60405180910390f35b60008082805190602001209150600073ffffffffffffffffffffffffffffffffffffffff1660008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610238578160008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915091506102ce565b6102418361059b565b90508060008084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550817fa1011c3aaafa54b70d8ca12f3b9257ca9a4fe1f6a02196819ea1dcaee1932ca084516040516102c591906108d3565b60405180910390a25b915091565b60006020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061031182610530565b61035257816040517f3001a1900000000000000000000000000000000000000000000000000000000081526004016103499190610947565b60405180910390fd5b61038d60008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166105e0565b519050919050565b6000806103a1836105e0565b905080805190602001209150600073ffffffffffffffffffffffffffffffffffffffff1660008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461041957506104a5565b8260008084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550817fa1011c3aaafa54b70d8ca12f3b9257ca9a4fe1f6a02196819ea1dcaee1932ca0825160405161049b91906108d3565b60405180910390a2505b919050565b60006104b582610530565b6104f657816040517f3001a1900000000000000000000000000000000000000000000000000000000081526004016104ed9190610947565b60405180910390fd5b60008083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008073ffffffffffffffffffffffffffffffffffffffff1660008084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60008151600181018060401b6a61000080600a3d393df300178452600a8101601585016000f09250826105d65763301164256000526004601cfd5b8184525050919050565b6060813b806105f7576311052bb46000526004601cfd5b60018103604051925061ffe0603f820116830160405280835280600160208501863c5050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106878261063e565b810181811067ffffffffffffffff821117156106a6576106a561064f565b5b80604052505050565b60006106b9610620565b90506106c5828261067e565b919050565b600067ffffffffffffffff8211156106e5576106e461064f565b5b6106ee8261063e565b9050602081019050919050565b82818337600083830152505050565b600061071d610718846106ca565b6106af565b90508281526020810184848401111561073957610738610639565b5b6107448482856106fb565b509392505050565b600082601f83011261076157610760610634565b5b813561077184826020860161070a565b91505092915050565b6000602082840312156107905761078f61062a565b5b600082013567ffffffffffffffff8111156107ae576107ad61062f565b5b6107ba8482850161074c565b91505092915050565b6000819050919050565b6107d6816107c3565b82525050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610807826107dc565b9050919050565b610817816107fc565b82525050565b600060408201905061083260008301856107cd565b61083f602083018461080e565b9392505050565b61084f816107c3565b811461085a57600080fd5b50565b60008135905061086c81610846565b92915050565b6000602082840312156108885761088761062a565b5b60006108968482850161085d565b91505092915050565b60006020820190506108b4600083018461080e565b92915050565b6000819050919050565b6108cd816108ba565b82525050565b60006020820190506108e860008301846108c4565b92915050565b6108f7816107fc565b811461090257600080fd5b50565b600081359050610914816108ee565b92915050565b6000602082840312156109305761092f61062a565b5b600061093e84828501610905565b91505092915050565b600060208201905061095c60008301846107cd565b92915050565b60008115159050919050565b61097781610962565b82525050565b6000602082019050610992600083018461096e565b9291505056fea26469706673582212200577a90655ff7e492c180bfa2ebdb95943f87b14724e2449c3c26d94036b0ea464736f6c63430008160033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ 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.