ETH Price: $3,615.68 (+3.69%)
Gas: 74 Gwei

Contract

0xFc7453dA7bF4d0c739C1c53da57b3636dAb0e11e
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60a06040164224322023-01-16 22:47:35413 days ago1673909255IN
 Create: ETHFSFileStorage
0 ETH0.0099485930.92660467

Advanced mode:
Parent Txn Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ETHFSFileStorage

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 500 runs

Other Settings:
default evmVersion
File 1 of 5 : ETHFSFileStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

///////////////////////////////////////////////////////////
// β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ•— //
// β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β•šβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•”β• //
// β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•‘β–‘β–‘β•šβ•β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–‘ //
// β–‘β•šβ•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β•šβ–ˆβ–ˆβ•”β•β–‘β–‘ //
// β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘ //
// β•šβ•β•β•β•β•β•β–‘β–‘β•šβ•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β•šβ•β•β•šβ•β•β•šβ•β•β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β•šβ•β•β–‘β–‘β–‘β–‘β–‘β–‘β•šβ•β•β–‘β–‘β–‘ //
///////////////////////////////////////////////////////////

import {IFileStore} from "./../../dependencies/ethfs/IFileStore.sol";
import {IContractScript} from "./../../IContractScript.sol";

contract ETHFSFileStorage is IContractScript {
    IFileStore public immutable fileStore;

    constructor(address _fileStoreAddress) {
        fileStore = IFileStore(_fileStoreAddress);
    }

    // =============================================================
    //                            GETTERS
    // =============================================================

    /**
     * @notice Get the full script from ethfs's FileStore contract
     * @param name - Name given to the script. Eg: threejs.min.js_r148
     * @param data - Arbitrary data. Not used by this contract.
     * @return script - Full script from merged chunks
     */
    function getScript(
        string calldata name,
        bytes memory data
    ) external view returns (bytes memory script) {
        return bytes(fileStore.getFile(name).read());
    }
}

File 2 of 5 : IContractScript.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

///////////////////////////////////////////////////////////
// β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ•— //
// β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β•šβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•”β• //
// β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•‘β–‘β–‘β•šβ•β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–‘ //
// β–‘β•šβ•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β•šβ–ˆβ–ˆβ•”β•β–‘β–‘ //
// β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘ //
// β•šβ•β•β•β•β•β•β–‘β–‘β•šβ•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β•šβ•β•β•šβ•β•β•šβ•β•β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β•šβ•β•β–‘β–‘β–‘β–‘β–‘β–‘β•šβ•β•β–‘β–‘β–‘ //
///////////////////////////////////////////////////////////

interface IContractScript {
    // =============================================================
    //                            GETTERS
    // =============================================================

    /**
     * @notice Get the full script
     * @param name - Name given to the script. Eg: threejs.min.js_r148
     * @param data - Arbitrary data to be passed to storage
     * @return script - Full script from merged chunks
     */
    function getScript(string calldata name, bytes memory data)
        external
        view
        returns (bytes memory script);
}

File 3 of 5 : IFileStore.sol
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.13;

import {File} from "./File.sol";
import {IContentStore} from "./IContentStore.sol";

interface IFileStore {
    event FileCreated(
        string indexed indexedFilename,
        bytes32 indexed checksum,
        string filename,
        uint256 size,
        bytes metadata
    );
    event FileDeleted(
        string indexed indexedFilename,
        bytes32 indexed checksum,
        string filename
    );

    error FileNotFound(string filename);
    error FilenameExists(string filename);
    error EmptyFile();

    function contentStore() external view returns (IContentStore);

    function files(string memory filename)
        external
        view
        returns (bytes32 checksum);

    function fileExists(string memory filename) external view returns (bool);

    function getChecksum(string memory filename)
        external
        view
        returns (bytes32 checksum);

    function getFile(string memory filename)
        external
        view
        returns (File memory file);

    function createFile(string memory filename, bytes32[] memory checksums)
        external
        returns (File memory file);

    function createFile(
        string memory filename,
        bytes32[] memory checksums,
        bytes memory extraData
    ) external returns (File memory file);

    function deleteFile(string memory filename) external;
}

File 4 of 5 : IContentStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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);
}

File 5 of 5 : File.sol
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.13;

struct Content {
    bytes32 checksum;
    address pointer;
}

struct File {
    uint256 size; // content length in bytes, max 24k
    Content[] contents;
}

function read(File memory file) view returns (string memory contents) {
    Content[] memory chunks = file.contents;

    // Adapted from https://gist.github.com/xtremetom/20411eb126aaf35f98c8a8ffa00123cd
    assembly {
        let len := mload(chunks)
        let totalSize := 0x20
        contents := mload(0x40)
        let size
        let chunk
        let pointer

        // loop through all pointer addresses
        // - get content
        // - get address
        // - get data size
        // - get code and add to contents
        // - update total size

        for { let i := 0 } lt(i, len) { i := add(i, 1) } {
            chunk := mload(add(chunks, add(0x20, mul(i, 0x20))))
            pointer := mload(add(chunk, 0x20))

            size := sub(extcodesize(pointer), 1)
            extcodecopy(pointer, add(contents, totalSize), 1, size)
            totalSize := add(totalSize, size)
        }

        // update contents size
        mstore(contents, sub(totalSize, 0x20))
        // store contents
        mstore(0x40, add(contents, and(add(totalSize, 0x1f), not(0x1f))))
    }
}

using {
    read
} for File global;

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 500
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_fileStoreAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"fileStore","outputs":[{"internalType":"contract IFileStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"getScript","outputs":[{"internalType":"bytes","name":"script","type":"bytes"}],"stateMutability":"view","type":"function"}]

60a060405234801561001057600080fd5b5060405161056438038061056483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104d4610090600039600081816040015260a601526104d46000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806321ea07e11461003b578063f96355941461007f575b600080fd5b6100627f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61009261008d36600461021b565b61009f565b6040516100769190610306565b606061013c7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e0876aa886866040518363ffffffff1660e01b81526004016100f2929190610354565b600060405180830381865afa15801561010f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101379190810190610383565b610144565b949350505050565b60208082015180516040519260008080805b8581101561018c57602081026020018701519250602083015191506001823b039350836001868a01843c93830193600101610156565b50505050602081038452601f19601f8201168401604052505050919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156101e4576101e46101ab565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610213576102136101ab565b604052919050565b60008060006040848603121561023057600080fd5b833567ffffffffffffffff8082111561024857600080fd5b818601915086601f83011261025c57600080fd5b81358181111561026b57600080fd5b6020888183860101111561027e57600080fd5b80840196508195508088013593508284111561029957600080fd5b838801935088601f8501126102ad57600080fd5b83359150828211156102c1576102c16101ab565b6102d3601f8301601f191682016101ea565b925081835288818386010111156102e957600080fd5b818185018285013760009183010152939692955092935090915050565b600060208083528351808285015260005b8181101561033357858101830151858201604001528201610317565b506000604082860101526040601f19601f8301168501019250505092915050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6000602080838503121561039657600080fd5b825167ffffffffffffffff808211156103ae57600080fd5b818501915060408083880312156103c457600080fd5b6103cc6101c1565b8351815284840151838111156103e157600080fd5b80850194505087601f8501126103f657600080fd5b835183811115610408576104086101ab565b610416868260051b016101ea565b818152868101945060069190911b85018601908982111561043657600080fd5b948601945b8186101561048c5783868b0312156104535760008081fd5b61045b6101c1565b86518152878701516001600160a01b03811681146104795760008081fd5b818901528552948301949386019361043b565b9582019590955297965050505050505056fea264697066735822122099b62884b0ee3f18956cdac8cf26ef4d1a7794868d9a2d092d6094c25c5f682564736f6c634300081100330000000000000000000000009746fd0a77829e12f8a9dbe70d7a322412325b91

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100365760003560e01c806321ea07e11461003b578063f96355941461007f575b600080fd5b6100627f0000000000000000000000009746fd0a77829e12f8a9dbe70d7a322412325b9181565b6040516001600160a01b0390911681526020015b60405180910390f35b61009261008d36600461021b565b61009f565b6040516100769190610306565b606061013c7f0000000000000000000000009746fd0a77829e12f8a9dbe70d7a322412325b916001600160a01b031663e0876aa886866040518363ffffffff1660e01b81526004016100f2929190610354565b600060405180830381865afa15801561010f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101379190810190610383565b610144565b949350505050565b60208082015180516040519260008080805b8581101561018c57602081026020018701519250602083015191506001823b039350836001868a01843c93830193600101610156565b50505050602081038452601f19601f8201168401604052505050919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156101e4576101e46101ab565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610213576102136101ab565b604052919050565b60008060006040848603121561023057600080fd5b833567ffffffffffffffff8082111561024857600080fd5b818601915086601f83011261025c57600080fd5b81358181111561026b57600080fd5b6020888183860101111561027e57600080fd5b80840196508195508088013593508284111561029957600080fd5b838801935088601f8501126102ad57600080fd5b83359150828211156102c1576102c16101ab565b6102d3601f8301601f191682016101ea565b925081835288818386010111156102e957600080fd5b818185018285013760009183010152939692955092935090915050565b600060208083528351808285015260005b8181101561033357858101830151858201604001528201610317565b506000604082860101526040601f19601f8301168501019250505092915050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6000602080838503121561039657600080fd5b825167ffffffffffffffff808211156103ae57600080fd5b818501915060408083880312156103c457600080fd5b6103cc6101c1565b8351815284840151838111156103e157600080fd5b80850194505087601f8501126103f657600080fd5b835183811115610408576104086101ab565b610416868260051b016101ea565b818152868101945060069190911b85018601908982111561043657600080fd5b948601945b8186101561048c5783868b0312156104535760008081fd5b61045b6101c1565b86518152878701516001600160a01b03811681146104795760008081fd5b818901528552948301949386019361043b565b9582019590955297965050505050505056fea264697066735822122099b62884b0ee3f18956cdac8cf26ef4d1a7794868d9a2d092d6094c25c5f682564736f6c63430008110033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000009746fd0a77829e12f8a9dbe70d7a322412325b91

-----Decoded View---------------
Arg [0] : _fileStoreAddress (address): 0x9746fD0A77829E12F8A9DBe70D7a322412325B91

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000009746fd0a77829e12f8a9dbe70d7a322412325b91


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.