gethwrappers

package
v2.15.0-beta0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 22 Imported by: 0

README

To run these commands, you must either install docker, or the correct version of abigen.

The latter can be installed with these commands, at least on linux:

   git clone https://github.com/ethereum/go-ethereum
   cd go-ethereum/cmd/abigen
   git checkout v<version-needed>
   go install

Here, is the version of go-ethereum specified in chainlink's go.mod. This will install abigen in "$GOPATH/bin", which you should add to your $PATH.

To reduce explicit dependencies, and in case the system does not have the correct version of abigen installed , the above commands spin up docker containers. In my hands, total running time including compilation is about 13s. If you're modifying solidity code and testing against go code a lot, it might be worthwhile to generate the wrappers using a static container with abigen and solc, which will complete much faster. E.g.

   abigen -sol ../../contracts/src/v0.8/vrf/VRF.sol -pkg vrf -out solidity_interfaces.go

where VRF.sol simply contains import "contract_path"; instructions for all the contracts you wish to target. This runs in about 0.25 seconds in my hands.

If you're on linux, you can copy the correct version of solc out of the appropriate docker container. At least, the following works on ubuntu:

   $ docker run --name solc ethereum/solc:0.6.2
   $ sudo docker cp solc:/usr/bin/solc /usr/bin
   $ docker rm solc

If you need to point abigen at your solc executable, you can specify the path with the abigen --solc option.

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.

Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abigen

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 DeepCopyLog

func DeepCopyLog(l types.Log) types.Log

func Exit

func Exit(msg string, err error)

func GetProjectRoot

func GetProjectRoot() (rootPath string)

GetProjectRoot returns the root of the chainlink project

func ImproveAbigenOutput

func ImproveAbigenOutput(path string, abiPath string)

func TempDir

func TempDir(dirPrefix string) (string, func())

func VersionHash

func VersionHash(abiPath string, binPath string) (hash string)

VersionHash is the hash used to detect changes in the underlying contract

func WriteVersionsDB

func WriteVersionsDB(db *IntegratedVersion) (err error)

Types

type AbigenArgs

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 ContractVersion

type ContractVersion struct {
	// Hash of the artifact at the timem the wrapper was last generated
	Hash string
	// Path to compiled abi file
	AbiPath string
	// Path to compiled bin file (if exists, this can be empty)
	BinaryPath 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

Directories

Path Synopsis
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
generation
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.
Package gethwrappers provides tools for wrapping solidity contracts with golang packages, using abigen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL