bindings

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: LGPL-3.0, MIT Imports: 17 Imported by: 1

README

License

This repository contains two separate license regimes:

  1. LGPL-3.0-or-later for all code in ./abigen (the forked go-ethereum abigen).
    See the full text in LICENSE under “GNU LESSER…”
  2. MIT for everything else in this repo.
    See the full text in LICENSE under “MIT License”.

CRE Generated Bindings (MVP)

This project utilizes a forked version of abigen (from go-ethereum) that lets you generate Go bindings for your smart contracts using a custom template.

Prerequisites

  1. Go Install Go 1.18 or later:
    brew install go          # macOS (Homebrew)
    sudo apt install golang  # Ubuntu/Debian
    
  2. Solidity compiler Install solc to compile or verify your contracts:
    npm install -g solc      # via npm
    brew install solidity    # macOS (Homebrew)
    

Usage

Programmatic API

import "github.com/smartcontractkit/chainlink-evm/pkg/bindings"

func main() {
  err := bindings.GenerateBindings(
    "./pkg/bindings/build/MyContract_combined.json", // or "" if using abiPath
    "./pkg/bindings/MyContract.abi",                 // or "" for combined-json mode
    "bindings",                                       // Go package name
    "MyContract",                                     // typeName (single-ABI only)
    "./pkg/bindings/build/bindings.go",               // output file
  )
  if err != nil {
    log.Fatalf("generate bindings: %v", err)
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractID

func ExtractID(report []byte) ([]byte, error)

func ExtractSigs

func ExtractSigs(attrSigs []*pb2.AttributedSignature) [][]byte

func GenerateBindings

func GenerateBindings(
	combinedJSONPath string,
	abiPath string,
	pkgName string,
	typeName string,
	outPath string,
) error

func PadTopics

func PadTopics(topics []*evm.TopicValues) []*evm.TopicValues

func PrepareTopicArg

func PrepareTopicArg(arg abi.Argument, value interface{}) (interface{}, error)

func ValidateLogTrackingOptions

func ValidateLogTrackingOptions[T any](opts *LogTrackingOptions[T])

Types

type ContractInitOptions

type ContractInitOptions struct {
	GasConfig *evm.GasConfig
}

type EVMClient

Minimal Chain Capabilities SDK client interface.

type FilterOptions

type FilterOptions struct {
	BlockHash []byte
	FromBlock *big.Int
	ToBlock   *big.Int
}

type LogTrackingOptions

type LogTrackingOptions[T any] struct {
	MaxLogsKept   uint64 `protobuf:"varint,1,opt,name=max_logs_kept,json=maxLogsKept,proto3" json:"max_logs_kept,omitempty"`     // maximum number of logs to retain ( 0 = unlimited )
	RetentionTime int64  `protobuf:"varint,2,opt,name=retention_time,json=retentionTime,proto3" json:"retention_time,omitempty"` // maximum amount of time to retain logs in seconds
	LogsPerBlock  uint64 `protobuf:"varint,3,opt,name=logs_per_block,json=logsPerBlock,proto3" json:"logs_per_block,omitempty"`  // rate limit ( maximum # of logs per block, 0 = unlimited )
	Filters       []T
}

Directories

Path Synopsis
abigen module

Jump to

Keyboard shortcuts

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