Documentation
¶
Index ¶
- Variables
- func GetFullyQualifiedName(sourceName, contractName string) string
- func IsFullyQualifiedName(name string) bool
- type Artifact
- type BuildInfo
- type DebugFile
- type DeployedBytecodeObject
- type Deployment
- type Hardhat
- type LinkReference
- type LinkReferenceOffset
- type LinkReferences
- type Log
- type QualifiedName
- type Receipt
Constants ¶
This section is empty.
Variables ¶
var ( ErrCannotFindDeployment = errors.New("cannot find deployment") ErrCannotFindArtifact = errors.New("cannot find artifact") )
Functions ¶
func GetFullyQualifiedName ¶
func IsFullyQualifiedName ¶
Types ¶
type Artifact ¶
type Artifact struct { Format string `json:"_format"` ContractName string `json:"contractName"` SourceName string `json:"sourceName"` Abi abi.ABI `json:"abi"` Bytecode hexutil.Bytes `json:"bytecode"` DeployedBytecode interface{} `json:"deployedBytecode"` // Changed to interface{} to handle both string and object LinkReferences LinkReferences `json:"linkReferences"` DeployedLinkReferences LinkReferences `json:"deployedLinkReferences"` }
Artifact represents a hardhat compilation artifact The Bytecode and DeployedBytecode are not guaranteed to be hexutil.Bytes when there are link references. In the future, custom json marshalling can be used to place the link reference values in the correct location.
func (*Artifact) UnmarshalJSON ¶
UnmarshalJSON is a custom unmarshaler for Artifact, handling the DeployedBytecode field.
type BuildInfo ¶
type BuildInfo struct { Format string `json:"_format"` Id string `json:"id"` SolcVersion string `json:"solcVersion"` SolcLongVersion string `json:"solcLongVersion"` Input solc.CompilerInput `json:"input"` Output solc.CompilerOutput `json:"output"` }
BuildInfo represents a hardhat build info artifact that is created after compilation
type DeployedBytecodeObject ¶
type DeployedBytecodeObject struct { Object hexutil.Bytes `json:"object"` SourceMap string `json:"sourceMap"` ImmutableReferences string `json:"immutableReferences"` }
DeployedBytecodeObject represents the deployed bytecode and its associated metadata
type Deployment ¶
type Deployment struct { Name string Abi abi.ABI `json:"abi"` Address common.Address `json:"address"` Args []interface{} `json:"-"` Bytecode hexutil.Bytes `json:"bytecode"` DeployedBytecode interface{} `json:"deployedBytecode"` Devdoc json.RawMessage `json:"devdoc"` Metadata string `json:"metadata"` Receipt json.RawMessage `json:"receipt"` SolcInputHash string `json:"solcInputHash"` StorageLayout solc.StorageLayout `json:"storageLayout"` TransactionHash common.Hash `json:"transactionHash"` Userdoc json.RawMessage `json:"userdoc"` }
Deployment represents a hardhat-deploy artifact file
func (*Deployment) UnmarshalJSON ¶
func (d *Deployment) UnmarshalJSON(data []byte) error
UnmarshalJSON is a custom unmarshaler for Deployment, handling the Args field. This changed recently when `foundry` migrated to `alloy` types, and now the Args field within the contract artifact has a different serialization format.
This custom unmarshaller should be removed when this is fixed upstream.
Old Example: ``` "args": [
"0xCE9FeE676767A25feb9722986148Fcd87085a14e", "OVM_L1CrossDomainMessenger"
], ```
New Example: ``` "args": "[\"0x45ce2021212883d655348778aC99707d63D49aBc\",\"\\OVM_L1CrossDomainMessenger\\\"]" ```
type Hardhat ¶
type Hardhat struct { ArtifactPaths []string DeploymentPaths []string // contains filtered or unexported fields }
`Hardhat` encapsulates all of the functionality required to interact with hardhat style artifacts.
func New ¶
New creates a new `Hardhat` struct and reads all of the files from disk so that they are cached for the end user. A network is passed that corresponds to the network that they deployments are associated with. A slice of artifact paths and deployment paths are passed so that a single `Hardhat` instance can operate on multiple sets of artifacts and deployments. The deployments paths should be the root of the deployments directory that contains additional directories for each particular network.
func (*Hardhat) GetArtifact ¶
GetArtifact returns the artifact that corresponds to the contract. This method supports just the contract name and the fully qualified contract name.
func (*Hardhat) GetBuildInfo ¶
GetBuildInfo returns the build info that corresponds to the contract. It does not support fully qualified contract names.
func (*Hardhat) GetDeployment ¶
func (h *Hardhat) GetDeployment(name string) (*Deployment, error)
GetDeployment returns the deployment that corresponds to the contract. It does not support fully qualified contract names.
func (*Hardhat) GetStorageLayout ¶
func (h *Hardhat) GetStorageLayout(name string) (*solc.StorageLayout, error)
TODO(tynes): handle fully qualified names properly
type LinkReference ¶
type LinkReference map[string][]LinkReferenceOffset
LinkReference represents a single linked contract
type LinkReferenceOffset ¶
LinkReferenceOffset represents the offsets in a link reference
type LinkReferences ¶
type LinkReferences map[string]LinkReference
LinkReferences represents the linked contracts
type Log ¶
type Log struct { TransactionIndex uint `json:"transactionIndex"` BlockNumber uint `json:"blockNumber"` TransactionHash common.Hash `json:"transactionHash"` Address common.Address `json:"address"` Topics []common.Hash `json:"topics"` Data hexutil.Bytes `json:"data"` LogIndex uint `json:"logIndex"` Blockhash common.Hash `json:"blockHash"` }
Log represents the logs in the hardhat deploy artifact receipt
type QualifiedName ¶
func ParseFullyQualifiedName ¶
func ParseFullyQualifiedName(name string) QualifiedName
type Receipt ¶
type Receipt struct { To *common.Address `json:"to"` From common.Address `json:"from"` ContractAddress *common.Address `json:"contractAddress"` TransactionIndex uint `json:"transactionIndex"` GasUsed uint `json:"gasUsed,string"` LogsBloom hexutil.Bytes `json:"logsBloom"` BlockHash common.Hash `json:"blockHash"` TransactionHash common.Hash `json:"transactionHash"` Logs []Log `json:"logs"` BlockNumber uint `json:"blockNumber"` CumulativeGasUsed uint `json:"cumulativeGasUsed,string"` Status uint `json:"status"` Byzantium bool `json:"byzantium"` }
Receipt represents the receipt held in a hardhat-deploy artifact file