contract

package
v0.0.0-...-3085ac3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EthereumBridgeBankABI     = "/generated/ethereum/abi/BridgeBank/BridgeBank.abi"
	EthereumHarmonyBridgeABI  = "/generated/ethereum/abi/HarmonyBridge/HarmonyBridge.abi"
	EthereumBridgeRegistryABI = "/generated/ethereum/abi/BridgeRegistry/BridgeRegistry.abi"

	HarmonyBridgeBankABI     = "/generated/harmony/abi/BridgeBank/BridgeBank.abi"
	HarmonyEthereumBridgeABI = "/generated/harmony/abi/EthereumBridge/EthereumBridge.abi"
	HarmonyBridgeRegistryABI = "/generated/harmony/abi/BridgeRegistry/BridgeRegistry.abi"
)

File paths to Ethereum smart contract ABIs

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

Variables

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

BridgeContractToString returns the string associated with a BridgeContract

Functions

func EthCompileContracts

func EthCompileContracts(contracts BridgeContracts) error

EthCompileContracts compiles contracts to BIN and ABI files

func EthGenerateBindings

func EthGenerateBindings(contracts BridgeContracts) error

EthGenerateBindings generates bindings for each ethereum contract

func EthLoadABI

func EthLoadABI(contractType txs.ContractRegistry) abi.ABI

EthoadABI loads a smart contract as an abi.ABI

func HmyCompileContracts

func HmyCompileContracts(contracts BridgeContracts) error

HmyCompileContracts compiles contracts to BIN and ABI files

func HmyGenerateBindings

func HmyGenerateBindings(contracts BridgeContracts) error

HmyGenerateBindings generates bindings for each ethereum contract

func HmyLoadABI

func HmyLoadABI(contractType txs.ContractRegistry) abi.ABI

LoadHarmonyABI 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 UnlockClaims
	Oracle
	// HarmonyBridge enables validators to make UnlockClaims
	HarmonyBridge
	// EthereumBridge enables validators to make UnlockClaims
	EthereumBridge
	// BridgeBank manages protocol assets on both Ethereum and Harmony
	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 EthLoadBridgeContracts

func EthLoadBridgeContracts() BridgeContracts

EthLoadBridgeContracts loads populated slice of BridgeContract

func HmyLoadBridgeContracts

func HmyLoadBridgeContracts() BridgeContracts

HmyLoadBridgeContracts loads populated slice of BridgeContract

Jump to

Keyboard shortcuts

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