DataReader

Git Source

Inherits: PathFinder

Functions

readFile

Reads a file from the filesystem and returns its content.

Returns an empty string or reverts if the file is not found based on the flag.

function readFile(string memory path, bool revertIfNotFound) internal view returns (string memory);

readContractArtifact

Tries to read the full contract artifact JSON generated by forge.

Returns an empty string or reverts if the artifact is not found based on the flag.

function readContractArtifact(
    string memory contractName,
    bool revertIfNotFound
)
    internal
    view
    returns (string memory);

readDeploymentArtifact

Returns the saved deployment artifact JSON for a contract.

Returns an empty string or reverts if the artifact is not found based on the flag.

function readDeploymentArtifact(
    string memory chain,
    string memory contractName,
    bool revertIfNotFound
)
    internal
    view
    returns (string memory artifact);

readDeployConfig

Returns the deployment configuration JSON for a contract.

Returns an empty string or reverts if the artifact is not found based on the flag.

function readDeployConfig(
    string memory chain,
    string memory contractName,
    bool revertIfNotFound
)
    internal
    view
    returns (string memory deployConfig);

readGlobalDeployConfig

Returns the global deployment configuration JSON.

Returns an empty string or reverts if the artifact is not found based on the flag.

function readGlobalDeployConfig(
    string memory contractName,
    string memory environment,
    bool revertIfNotFound
)
    internal
    view
    returns (string memory deployConfig);

readGlobalDeployProdConfig

Returns the global deployment configuration JSON for the production environment.

Returns an empty string or reverts if the artifact is not found based on the flag.

function readGlobalDeployProdConfig(
    string memory contractName,
    bool revertIfNotFound
)
    internal
    view
    returns (string memory deployConfig);

getContractBytecode

Returns the contract bytecode extracted from the artifact generated by forge.

Returns an empty string or reverts if the artifact is not found based on the flag.

function getContractBytecode(
    string memory contractName,
    bool revertIfNotFound
)
    internal
    view
    returns (bytes memory bytecode);

getDeploymentAddress

Returns the deployment address for a contract on a given chain.

Returns address(0) or reverts if the artifact is not found based on the flag.

function getDeploymentAddress(
    string memory chain,
    string memory contractName,
    bool revertIfNotFound
)
    internal
    view
    returns (address);

isDeployed

Checks if a contract is deployed on a given chain without reverting.

function isDeployed(string memory chain, string memory contractName) internal view returns (bool);