txs

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: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GasLimit the gas limit in Gwei used for transactions sent with TransactOpts
	GasLimit = uint64(3000000)
)

Variables

This section is empty.

Functions

func Address

func Address(input interface{}) []byte

func AddressArray

func AddressArray(input interface{}) []byte

AddressArray address

func Bool

func Bool(input interface{}) []byte

Bool bool

func BoolArray

func BoolArray(input interface{}) []byte

BoolArray bool array

func EthGenerateClaimMessage

func EthGenerateClaimMessage(event types.EthLogNewUnlockClaimEvent) []byte

EthGenerateClaimMessage Generates a hashed message containing a UnlockClaim event's data

func EthGetAddressFromBridgeRegistry

func EthGetAddressFromBridgeRegistry(privateKey *ecdsa.PrivateKey, client *ethclient.Client, registry common.Address, target ContractRegistry,
) (common.Address, error)

EthGetAddressFromBridgeRegistry queries the requested contract address from the BridgeRegistry contract

func EthInitRelayConfig

func EthInitRelayConfig(provider string, registry common.Address, event types.Event, privateKey *ecdsa.PrivateKey,
) (*ethclient.Client, *bind.TransactOpts, common.Address)

EthInitRelayConfig set up Ethereum client, validator's transaction auth, and the target contract's address

func HmyGenerateClaimMessage

func HmyGenerateClaimMessage(event types.HmyLogNewUnlockClaimEvent) []byte

HmyGenerateClaimMessage Generates a hashed message containing a UnlockClaim event's data

func HmyGetAddressFromBridgeRegistry

func HmyGetAddressFromBridgeRegistry(privateKey *ecdsa.PrivateKey, client *hmyclient.Client, registry common.Address, target ContractRegistry,
) (common.Address, error)

HmyGetAddressFromBridgeRegistry queries the requested contract address from the BridgeRegistry contract

func HmyInitRelayConfig

func HmyInitRelayConfig(provider string, registry common.Address, event types.Event, privateKey *ecdsa.PrivateKey,
) (*hmyclient.Client, *bind.TransactOpts, common.Address)

HmyInitRelayConfig set up Ethereum client, validator's transaction auth, and the target contract's address

func Int128

func Int128(input interface{}) []byte

Int128 int128

func Int128Array

func Int128Array(input interface{}) []byte

Int128Array int128 array

func Int16

func Int16(input interface{}) []byte

Int16 int16

func Int16Array

func Int16Array(input interface{}) []byte

Int16Array int16 array

func Int256

func Int256(input interface{}) []byte

Int256 int256

func Int256Array

func Int256Array(input interface{}) []byte

Int256Array int256 array

func Int32

func Int32(input interface{}) []byte

Int32 int32

func Int32Array

func Int32Array(input interface{}) []byte

Int32Array int32

func Int64

func Int64(input interface{}) []byte

Int64 int64

func Int64Array

func Int64Array(input interface{}) []byte

Int64Array int64 array

func Int8

func Int8(input interface{}) []byte

Int8 int8

func Int8Array

func Int8Array(input interface{}) []byte

Int8Array int8 array

func LoadEthereumPrivateKey

func LoadEthereumPrivateKey() (key *ecdsa.PrivateKey, err error)

LoadEthereumPrivateKey loads the validator's private key from environment variables

func LoadHarmonyPrivateKey

func LoadHarmonyPrivateKey() (key *ecdsa.PrivateKey, err error)

LoadHarmonyPrivateKey loads the validator's private key from environment variables

func LoadSender

func LoadSender(privateKey *ecdsa.PrivateKey) (address common.Address, err error)

LoadSender uses the validator's private key to load the validator's address

func PrefixMsg

func PrefixMsg(msg []byte) []byte

PrefixMsg prefixes a message for verification, mimics behavior of web3.eth.sign

func RelayOracleClaimToEthereum

func RelayOracleClaimToEthereum(provider string, contractAddress common.Address, event types.Event,
	claim EthOracleClaim, privateKey *ecdsa.PrivateKey) error

RelayOracleClaimToEthereum relays the provided OracleClaim to Oracle contract on the Ethereum network

func RelayOracleClaimToHarmony

func RelayOracleClaimToHarmony(provider string, contractAddress common.Address, event types.Event,
	claim HmyOracleClaim, privateKey *ecdsa.PrivateKey) error

RelayOracleClaimToHarmony relays the provided OracleClaim to Oracle contract on the Ethereum network

func RelayUnlockClaimToEthereum

func RelayUnlockClaimToEthereum(ethereumProvider string, ethereumBridgeRegistry common.Address, event types.Event,
	claim EthUnlockClaim, privateKey *ecdsa.PrivateKey) error

RelayUnlockClaimToEthereum relays the provided UnlockClaim to HarmonyBridge contract on the Ethereum network

func RelayUnlockClaimToHarmony

func RelayUnlockClaimToHarmony(harmonyProvider string, ethereumBridgeRegistry common.Address, event types.Event,
	claim HmyUnlockClaim, privateKey *ecdsa.PrivateKey) error

RelayUnlockClaimToHarmony relays the provided UnlockClaim to EthereumBridge contract on the Ethereum network

func SignClaim

func SignClaim(msg []byte, key *ecdsa.PrivateKey) ([]byte, error)

SignClaim Signs the prepared message with validator's private key

func SoliditySHA3

func SoliditySHA3(data ...interface{}) []byte

SoliditySHA3 solidity sha3

func String

func String(input interface{}) []byte

String string

func StringArray

func StringArray(input interface{}) []byte

StringArray string

func Uint128

func Uint128(input interface{}) []byte

Uint128 uint128

func Uint128Array

func Uint128Array(input interface{}) []byte

Uint128Array uint128

func Uint16

func Uint16(input interface{}) []byte

Uint16 uint16

func Uint16Array

func Uint16Array(input interface{}) []byte

Uint16Array uint16 array

func Uint256

func Uint256(input interface{}) []byte

Uint256 uint256

func Uint256Array

func Uint256Array(input interface{}) []byte

Uint256Array uint256 array

func Uint32

func Uint32(input interface{}) []byte

Uint32 uint32

func Uint32Array

func Uint32Array(input interface{}) []byte

Uint32Array uint32 array

func Uint64

func Uint64(input interface{}) []byte

Uint64 uint64

func Uint64Array

func Uint64Array(input interface{}) []byte

Uint64Array uint64 array

func Uint8

func Uint8(input interface{}) []byte

Uint8 uint8

func Uint8Array

func Uint8Array(input interface{}) []byte

Uint8Array uint8 array

Types

type ContractRegistry

type ContractRegistry byte

ContractRegistry is an enum for the bridge contract types

const (
	// Valset valset contract
	Valset ContractRegistry = iota + 1
	// Oracle oracle contract
	Oracle
	// BridgeBank bridgeBank contract
	BridgeBank
	// HarmonyBridge  contract
	HarmonyBridge
	// EthereumBridge  contract
	EthereumBridge
	// BridgeRegistry contract
	BridgeRegistry
)

func (ContractRegistry) String

func (d ContractRegistry) String() string

String returns the event type as a string

type EthOracleClaim

type EthOracleClaim struct {
	UnlockID  *big.Int
	Message   [32]byte
	Signature []byte
}

EthOracleClaim contains data required to make an EthOracleClaim

func EthUnlockClaimToSignedOracleClaim

func EthUnlockClaimToSignedOracleClaim(event types.EthLogNewUnlockClaimEvent, key *ecdsa.PrivateKey) (EthOracleClaim, error)

EthUnlockClaimToSignedOracleClaim packages and signs a unlock claim's data, returning a new oracle claim

type EthUnlockClaim

type EthUnlockClaim struct {
	HarmonyChainID   *big.Int
	HarmonySender    common.Address
	EthereumReceiver common.Address
	Token            common.Address
	Amount           *big.Int
}

EthUnlockClaim contains data required to make an Ethereum UnlockClaim

func HarmonyEventToEthereumClaim

func HarmonyEventToEthereumClaim(event *types.HmyLogLockEvent) (EthUnlockClaim, error)

HarmonyEventToEthereumClaim parses and packages an Ethereum event struct with a validator address in an EthBridgeClaim msg

type HmyOracleClaim

type HmyOracleClaim struct {
	UnlockID  *big.Int
	Message   [32]byte
	Signature []byte
}

HmyOracleClaim contains data required to make an HmyOracleClaim

func HmyUnlockClaimToSignedOracleClaim

func HmyUnlockClaimToSignedOracleClaim(event types.HmyLogNewUnlockClaimEvent, key *ecdsa.PrivateKey) (HmyOracleClaim, error)

HmyUnlockClaimToSignedOracleClaim packages and signs a unlock claim's data, returning a new oracle claim

type HmyUnlockClaim

type HmyUnlockClaim struct {
	EthereumChainID *big.Int
	EthereumSender  common.Address
	HarmonyReceiver common.Address
	Token           common.Address
	Amount          *big.Int
}

HmyUnlockClaim contains data required to make an Harmony UnlockClaim

func EthereumEventToHarmonyClaim

func EthereumEventToHarmonyClaim(event *types.EthLogLockEvent) (HmyUnlockClaim, error)

EthereumEventToHarmonyClaim parses and packages an Ethereum event struct with a validator address in an EthBridgeClaim msg

Jump to

Keyboard shortcuts

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