• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ArtBlocks / artblocks-contracts / dc5439cd-b8d4-44ce-a6bd-39ec585cadde

14 Mar 2025 05:25PM UTC coverage: 86.275% (+0.005%) from 86.27%
dc5439cd-b8d4-44ce-a6bd-39ec585cadde

push

circleci

web-flow
Merge pull request #1775 from ArtBlocks/ryley/pro-1064-pmp-on-chain-generator-updates

On-Chain Generator support of Web3Call

1952 of 2572 branches covered (75.89%)

Branch coverage included in aggregate %.

10 of 10 new or added lines in 1 file covered. (100.0%)

6 existing lines in 1 file now uncovered.

3416 of 3650 relevant lines covered (93.59%)

340.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/contracts/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2.sol
1
// SPDX-License-Identifier: LGPL-3.0-only
2
pragma solidity 0.8.22;
3

4
// Created By: Art Blocks Inc.
5

6
import {IBytecodeStorageReaderV2} from "../interfaces/v0.8.x/IBytecodeStorageReaderV2.sol";
7

8
import {BytecodeStorageReader} from "../libs/v0.8.x/BytecodeStorageV2.sol";
9

10
/**
11
 * @title Art Blocks Bytecode Storage Reader Contract V2
12
 * @author Art Blocks Inc.
13
 * @notice This contract is used to read the bytecode of a contract deployed by Art Blocks' BytecodeStorage library,
14
 * for versions 0, 1, and 2 of the Art Blocks BytecodeStorage library.
15
 * It is permissionless and can be used by anyone to read the bytecode of any contract deployed by Art Blocks.
16
 * Future versions of BytecodeStorage will not be compatible with this reader.
17
 * For a single location to read current and future versions of the Art Blocks BytecodeStorage library, see
18
 * the UniversalBytecodeStorageReader contract, maintained by the Art Blocks team.
19
 * Additional functionality is provided to read bytes data stored using the SSTORE2 library.
20
 * This contract also provides an interface to read additional metadata stored by the Art Blocks BytecodeStorage
21
 * library, such as the contract's version, deployer, and other metadata.
22
 * @dev For simplicity and reduce code changes, this contract uses the BytecodeStorageReader external library to
23
 * perform many operations. Future reader contract versions may choose to make the library internal to this contract to
24
 * improve read operation performance.
25
 */
26
contract BytecodeStorageReaderContractV2 is IBytecodeStorageReaderV2 {
27
    using BytecodeStorageReader for address;
28

29
    string public constant VERSION = "BytecodeStorageReaderContractV2";
30

31
    /**
32
     * @notice Read a string from a data contract deployed via BytecodeStorage V2 or earlier.
33
     * @param address_ address of contract deployed via BytecodeStorage to be read
34
     * @return The string data stored at the specific address.
35
     */
36
    function readFromBytecode(
37
        address address_
38
    ) external view returns (string memory) {
UNCOV
39
        return address_.readFromBytecode();
×
40
    }
41

42
    /**
43
     * @notice Read a bytes array from the SSTORE2-formatted bytecode of a contract.
44
     * Note that this function is only compatible with contracts that have been deployed using the popular SSTORE2
45
     * library.
46
     * @param address_ address of contract with SSTORE2-formatted bytecode to be read
47
     * @return data The bytes data stored at the specific address.
48
     */
49
    function readBytesFromSSTORE2Bytecode(
50
        address address_
51
    ) external view returns (bytes memory) {
UNCOV
52
        return address_.readBytesFromSSTORE2Bytecode();
×
53
    }
54

55
    /**
56
     * @notice Read a bytes array from the a contract deployed via BytecodeStorage V2 or earlier.
57
     * @param address_ address of contract with valid bytecode to be read
58
     * @param offset offset to read from in contract bytecode, explicitly provided (not calculated)
59
     * @return The bytes data stored at the specific address.
60
     */
61
    function readBytesFromBytecode(
62
        address address_,
63
        uint256 offset
64
    ) external view returns (bytes memory) {
UNCOV
65
        return address_.readBytesFromBytecode(offset);
×
66
    }
67

68
    //------ Metadata Functions ------//
69

70
    /**
71
     * @notice Get address of deployer for given contract deployed via BytecodeStorage V2 or earlier.
72
     * @param address_ address of deployed contract
73
     * @return writerAddress address of deployer
74
     */
75
    function getWriterAddressForBytecode(
76
        address address_
77
    ) external view returns (address) {
UNCOV
78
        return address_.getWriterAddressForBytecode();
×
79
    }
80

81
    /**
82
     * @notice Get version for given contract deployed via BytecodeStorage V2 or earlier.
83
     * @param address_ address of deployed contract
84
     * @return version version of the contract
85
     */
86
    function getLibraryVersionForBytecode(
87
        address address_
88
    ) external view returns (bytes32) {
UNCOV
89
        return address_.getLibraryVersionForBytecode();
×
90
    }
91

92
    /**
93
     * @notice Get if data are stored in compressed format for given contract deployed via BytecodeStorage V2 or
94
     * earlier.
95
     * @param _address address of deployed contract
96
     * @return isCompressed boolean indicating if the stored data are compressed
97
     */
98
    function getIsCompressedForBytecode(
99
        address _address
100
    ) external view returns (bool) {
UNCOV
101
        return _address.getIsCompressedForBytecode();
×
102
    }
103
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc