Documentation
¶
Index ¶
- func NewEtherscanV2ContractVerifier(chain chainsel.Chain, apiKey string, apiBaseURL string, address string, ...) (verification.Verifiable, error)
- func NewVerifier(strategy VerificationStrategy, cfg VerifierConfig) (verification.Verifiable, error)
- type ContractInputsProvider
- type SolidityContractMetadata
- type VerificationStrategy
- type VerifierConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEtherscanV2ContractVerifier ¶
func NewEtherscanV2ContractVerifier( chain chainsel.Chain, apiKey string, apiBaseURL string, address string, metadata SolidityContractMetadata, contractType string, version string, pollInterval time.Duration, lggr logger.Logger, httpClient *http.Client, ) (verification.Verifiable, error)
NewEtherscanV2ContractVerifier creates a verifier that uses metadata from ContractInputsProvider. apiBaseURL is optional: when empty, the default Etherscan v2 multiplexer is used; otherwise it must be the explorer API base URL from domain network config (CLD).
func NewVerifier ¶
func NewVerifier(strategy VerificationStrategy, cfg VerifierConfig) (verification.Verifiable, error)
NewVerifier creates a Verifiable for the given strategy and config.
Types ¶
type ContractInputsProvider ¶
type ContractInputsProvider interface {
// GetInputs returns metadata for the given contract type and version.
// Returns an error if the domain does not support this contract type/version.
GetInputs(contractType datastore.ContractType, version *semver.Version) (SolidityContractMetadata, error)
}
ContractInputsProvider is implemented by domains to provide contract metadata for verification. Framework has no knowledge of domain-specific contract types; it only passes the metadata to explorers.
type SolidityContractMetadata ¶
type SolidityContractMetadata struct {
Version string `json:"version"`
Language string `json:"language"`
Settings map[string]any `json:"settings"`
Sources map[string]any `json:"sources"`
Bytecode string `json:"bytecode"`
Name string `json:"name"`
}
SolidityContractMetadata defines the metadata for a Solidity contract used for verification. Domains provide this via ContractInputsProvider.
func (SolidityContractMetadata) SourceCode ¶
func (s SolidityContractMetadata) SourceCode() (string, error)
SourceCode returns the source code portion for explorer API submission.
type VerificationStrategy ¶
type VerificationStrategy int
VerificationStrategy identifies which block explorer API to use for a chain.
const ( StrategyUnknown VerificationStrategy = iota StrategyEtherscan StrategyOkLink StrategyBlockscout StrategyRoutescan StrategySourcify StrategyBtrScan StrategyCoreDAO StrategyL2Scan StrategySocialScan )
func GetVerificationStrategyForNetwork ¶ added in v0.93.0
func GetVerificationStrategyForNetwork(n cfgnet.Network) VerificationStrategy
GetVerificationStrategyForNetwork returns the verifier strategy from domain network config only (block_explorer.type and related fields). There is no chain-ID allowlist in CLDF; CLD must set block_explorer appropriately for each network.
type VerifierConfig ¶
type VerifierConfig struct {
Chain chainsel.Chain
Network cfgnet.Network
Address string
Metadata SolidityContractMetadata
ContractType string
Version string
PollInterval time.Duration
Logger logger.Logger
// HTTPClient is optional; when nil, verifiers use http.DefaultClient. Set for testing.
HTTPClient *http.Client
}
VerifierConfig holds the parameters needed to create a verifier.