Background¶
What are “Artifacts”?¶
Currently, Truffle artifacts are stored as JSON files in a project’s
build/contracts/
directory.
Artifact files follow a formally-specified JSON-Schema [1], available in the trufflesuite/truffle-contract-schema repository. This schema’s latest version is v3.0.1.
[1] | JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. |
Truffle’s Architecture¶
For background, there are a number of relevant existing components.
Truffle Artifactor¶
Provided by the truffle-artifactor package.
The artifactor saves contract abstractions to disk. Specifically, this writes
to the configured contracts_build_directory
.
Truffle Resolver¶
Provided by the truffle-resolver package.
The resolver queries the artifacts, either resolving a contract name (or, deprecated: a source filename) to the corresponding artifact file, and/or instantiating a contract abstraction from the artifact automatically.
Truffle Config¶
Provided by the truffle-config package.
Within the context of Truffle, config
objects are used as a singleton
object that serves all parts of Truffle with context about the user’s project.
Currently, a Truffle config
object contains a reference to an artifactor
and a resolver.