Documentation
¶
Overview ¶
package gethwrappers provides infrastructure for generating and verifying go-ethereum wrapper packages for smart contracts. See go_generate.go for more information.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Example (BoxOutput) ¶
fmt.Println() fmt.Print(boxOutput("%s is %d", "foo", 17))
Output: ↘↓↓↓↓↓↓↓↓↓↓↓↓↓↙ → ← → README ← → ← → foo is 17 ← → ← → README ← → ← ↗↑↑↑↑↑↑↑↑↑↑↑↑↑↖
Index ¶
- func Abigen(a AbigenArgs)
- func Exit(msg string, err error)
- func GetProjectRoot() (rootPath string)
- func ImproveAbigenOutput(path string, abiPath string)
- func TempDir(dirPrefix string) (string, func())
- func WriteVersionsDB(db *IntegratedVersion) error
- type AbigenArgs
- type ContractDetails
- type ContractVersion
- type IntegratedVersion
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Abigen ¶ added in v0.8.7
func Abigen(a AbigenArgs)
Abigen calls Abigen with the given arguments
It might seem like a shame, to shell out to another golang program like this, but the abigen executable is the stable public interface to the geth contract-wrapper machinery.
Check whether native abigen is installed, and has correct version
func GetProjectRoot ¶ added in v0.8.7
func GetProjectRoot() (rootPath string)
GetProjectRoot returns the root of the chainlink project
func ImproveAbigenOutput ¶ added in v0.9.10
func WriteVersionsDB ¶
func WriteVersionsDB(db *IntegratedVersion) error
Types ¶
type AbigenArgs ¶ added in v0.8.7
type AbigenArgs struct {
Bin, ABI, Out, Type, Pkg string
}
AbigenArgs is the arguments to the abigen executable. E.g., Bin is the -bin arg.
type ContractDetails ¶
type ContractDetails struct { Binary string // Hex representation of the contract's raw bytes ABI string Sources map[string]string // contractName -> source code }
ContractDetails contains the contract data needed to make a geth contract wrapper for a solidity contract.
func ExtractContractDetails ¶
func ExtractContractDetails(beltArtifactPath string) (*ContractDetails, error)
ExtractContractDetails returns the data in the belt artifact needed to make a geth contract wrapper for the corresponding EVM contract
This should be run on artifacts compiled with no metadata hash (
--metadata-hash=none
in the solc command, or
"metadata": {"bytecodeHash": "none"}
in the sol-compiler config JSON [evm-contracts/app.config.json in the Chainlink source code.])
The main drawback to including the metadata hash is that it varies from build to build, which causes a lot of false positives in the TestCheckContractHashesFromLastGoGenerate and TestArtifactCompilerVersionMatchesConfig checks that the golang wrappers are up to date with the contract source codes. It also increases contract size, slightly, which increases deployment costs.
func (*ContractDetails) VersionHash ¶
func (c *ContractDetails) VersionHash() (hash string)
VersionHash is the hash used to detect changes in the underlying contract
type ContractVersion ¶
type ContractVersion struct { // path to compiler artifact used by generate.sh to create wrapper package CompilerArtifactPath string // Hash of the artifact at the timem the wrapper was last generated Hash string }
ContractVersion records information about the solidity compiler artifact a golang contract wrapper package depends on.
type IntegratedVersion ¶
type IntegratedVersion struct { // Version of geth last used to generate the wrappers GethVersion string // { golang-pkg-name: version_info } ContractVersions map[string]ContractVersion }
IntegratedVersion carries the full versioning information checked in this test
func ReadVersionsDB ¶
func ReadVersionsDB() (*IntegratedVersion, error)
readVersionsDB populates an IntegratedVersion with all the info in the versions DB