Enum ethcontract_generate::source::Source [−][src]
Expand description
A source of an artifact JSON.
Variants
File on the local file system.
Tuple Fields of Local
0: PathBufResource in the internet, available via HTTP(S).
Tuple Fields of Http
0: UrlAn address of a mainnet contract, available via Etherscan.
Artifacts loaded from etherstan can be parsed using the truffle loader.
Note that Etherscan rate-limits requests to their API, to avoid this,
provide an Etherscan API key via the ETHERSCAN_API_KEY
environment variable.
The package identifier of an NPM package with a path to an artifact or ABI to be retrieved from unpkg.
Tuple Fields of Npm
0: StringImplementations
Parses an artifact source from a string.
This method accepts the following:
-
relative path to a contract JSON file on the local filesystem, for example
build/IERC20.json. This relative path is rooted in the current working directory. To specify the root for relative paths, use [with_root] function; -
absolute path to a contract JSON file on the local filesystem, or a file URL, for example
/build/IERC20.json, or the same path using URL:file:///build/IERC20.json; -
an HTTP(S) URL pointing to artifact JSON or contract ABI JSON;
-
a URL with
etherscanscheme and a mainnet contract address. For exampleetherscan:0xC02AA.... Alternatively, specify an etherscan URL:https://etherscan.io/address/0xC02AA.... The contract artifact or ABI will be retrieved through [Etherscan]; -
a URL with
npmscheme, NPM package name, an optional version and a path (defaulting to the latest version andindex.js). For examplenpm:@openzeppelin/contracts/build/contracts/IERC20.json. The contract artifact or ABI will be retrieved through [unpkg].
Parses an artifact source from a string and uses the specified root
directory for resolving relative paths. See [parse] for more details
on supported source strings.
Creates a local filesystem source from a path string.
Creates an Etherscan source from contract address on mainnet.
Retrieves the source JSON of the artifact.
This will either read the JSON from the file system or retrieve a contract ABI from the network, depending on the source type.
Contract ABIs will be wrapped into a JSON object, so that you can load them using the truffle loader.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Source
impl UnwindSafe for Source
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self