Documentation
¶
Index ¶
- func GetOkLinkShortName(chainID uint64) (string, bool)
- func IsChainSupportedOnBlockscout(chainID uint64) bool
- func IsChainSupportedOnBtrScan(chainID uint64) bool
- func IsChainSupportedOnCoreDAO(chainID uint64) bool
- func IsChainSupportedOnEtherscanV2(chainID uint64) bool
- func IsChainSupportedOnL2Scan(chainID uint64) bool
- func IsChainSupportedOnOkLink(chainID uint64) bool
- func IsChainSupportedOnRouteScan(chainID uint64) (networkType string, ok bool)
- func IsChainSupportedOnSocialScanV2(chainID uint64) bool
- func IsChainSupportedOnSourcify(chainID uint64) bool
- func NewEtherscanV2ContractVerifier(chain chainsel.Chain, apiKey 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 GetOkLinkShortName ¶
func NewEtherscanV2ContractVerifier ¶
func NewEtherscanV2ContractVerifier( chain chainsel.Chain, apiKey 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.
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 GetVerificationStrategy ¶
func GetVerificationStrategy(chainID uint64) VerificationStrategy
GetVerificationStrategy returns the verification strategy for the given chain ID.
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.