contract

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BridgeBankABI   = "/generated/abi/BridgeBank/BridgeBank.abi"
	CosmosBridgeABI = "/generated/abi/CosmosBridge/CosmosBridge.abi"
)

File paths to Peggy smart contract ABIs

View Source
const (
	SolcCmdText   = "[SOLC_CMD]"
	DirectoryText = "[DIRECTORY]"
	ContractText  = "[CONTRACT]"
)

Variables

View Source
var (
	// BaseABIBINGenCmd is the base command for contract compilation to ABI and BIN
	BaseABIBINGenCmd = strings.Join([]string{"solc ",
		fmt.Sprintf("--%s ./contracts/%s%s.sol ", SolcCmdText, DirectoryText, ContractText),
		fmt.Sprintf("-o ../cmd/ebrelayer/contract/generated/%s/%s ", SolcCmdText, ContractText),
		"--overwrite ",
		"--allow-paths *,"},
		"")
	// BaseBindingGenCmd is the base command for contract binding generation
	BaseBindingGenCmd = strings.Join([]string{"abigen ",
		fmt.Sprintf("--bin ../cmd/ebrelayer/contract/generated/bin/%s/%s.bin ", ContractText, ContractText),
		fmt.Sprintf("--abi ../cmd/ebrelayer/contract/generated/abi/%s/%s.abi ", ContractText, ContractText),
		fmt.Sprintf("--pkg %s ", ContractText),
		fmt.Sprintf("--type %s ", ContractText),
		fmt.Sprintf("--out ../cmd/ebrelayer/contract/generated/bindings/%s/%s.go", ContractText, ContractText)},
		"")
)
View Source
var BridgeContractToString = [...]string{"BridgeRegistry", "Valset", "Oracle", "CosmosBridge", "BridgeBank"}

BridgeContractToString returns the string associated with a BridgeContract

Functions

func CompileContracts

func CompileContracts(contracts BridgeContracts) error

CompileContracts compiles contracts to BIN and ABI files

func GenerateBindings

func GenerateBindings(contracts BridgeContracts) error

GenerateBindings generates bindings for each contract

func LoadABI

func LoadABI(contractType txs.ContractRegistry) abi.ABI

LoadABI loads a smart contract as an abi.ABI

Types

type BridgeContract

type BridgeContract int

BridgeContract is an enum containing supported contract names

const (
	// BridgeRegistry registers deployed addresses of the other contracts
	BridgeRegistry BridgeContract = iota + 1
	// Valset manages the validator set and signature verification
	Valset
	// Oracle enables validators to make OracleClaims and processes ProphecyClaims
	Oracle
	// CosmosBridge enables validators to make ProphecyClaims
	CosmosBridge
	// BridgeBank manages protocol assets on both Ethereum and Cosmos
	BridgeBank
)

func (BridgeContract) String

func (d BridgeContract) String() string

String returns the BridgeContract as a string

type BridgeContracts

type BridgeContracts []BridgeContract

BridgeContracts is a slice of BridgeContract

func LoadBridgeContracts

func LoadBridgeContracts() BridgeContracts

LoadBridgeContracts loads populated slice of BridgeContract

Directories

Path Synopsis
generated

Jump to

Keyboard shortcuts

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