ethereum

package
v0.0.0-...-760f33f Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "Ethereum"
View Source
const RawABI = `` /* 292-byte string literal not displayed */

Variables

This section is empty.

Functions

func MakeMessageFromEvent

func MakeMessageFromEvent(event etypes.Log, log *logrus.Entry) (*chain.Message, error)

Types

type Chain

type Chain struct {
	// contains filtered or unexported fields
}

Chain streams the Ethereum blockchain and routes tx data packets

func NewChain

func NewChain(config *Config, ethMessages chan chain.Message, subMessages chan chain.Message) (*Chain, error)

NewChain initializes a new instance of EthChain

func (*Chain) Name

func (ch *Chain) Name() string

func (*Chain) Start

func (ch *Chain) Start(ctx context.Context, eg *errgroup.Group) error

func (*Chain) Stop

func (ch *Chain) Stop()

type Config

type Config struct {
	Endpoint   string                  `mapstructure:"endpoint"`
	PrivateKey string                  `mapstructure:"private-key"`
	Bridge     ContractInfo            `mapstructure:"bridge"`
	Apps       map[string]ContractInfo `mapstructure:"apps"`
}

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(endpoint string, kp *secp256k1.Keypair, log *logrus.Entry) *Connection

func (*Connection) Close

func (co *Connection) Close()

func (*Connection) Connect

func (co *Connection) Connect(ctx context.Context) error

type Contract

type Contract struct {
	Name    string
	Address common.Address
	ABI     *abi.ABI
}

func LoadAppContracts

func LoadAppContracts(config *Config) ([]Contract, error)

func LoadBridgeContract

func LoadBridgeContract(config *Config) (*Contract, error)

type ContractInfo

type ContractInfo struct {
	Address string `mapstructure:"address"`
	AbiPath string `mapstructure:"abi"`
}

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener streams the Ethereum blockchain for application events

func NewListener

func NewListener(conn *Connection, messages chan<- chain.Message, contracts []Contract, log *logrus.Entry) (*Listener, error)

func (*Listener) Start

func (li *Listener) Start(cxt context.Context, eg *errgroup.Group) error

type Message

type Message struct {
	Data              []byte
	VerificationInput VerificationInput
}

type VerificationBasic

type VerificationBasic struct {
	BlockNumber uint64
	EventIndex  uint32
}

type VerificationInput

type VerificationInput struct {
	IsBasic bool
	AsBasic VerificationBasic
	IsNone  bool
}

func (*VerificationInput) Decode

func (v *VerificationInput) Decode(decoder scale.Decoder) error

func (VerificationInput) Encode

func (v VerificationInput) Encode(encoder scale.Encoder) error

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(conn *Connection, messages <-chan chain.Message, bridgeContract *Contract, log *logrus.Entry) (*Writer, error)

func (*Writer) Start

func (wr *Writer) Start(ctx context.Context, eg *errgroup.Group) error

func (*Writer) Write

func (wr *Writer) Write(ctx context.Context, msg *chain.Message) error

Submit sends a SCALE-encoded message to an application deployed on the Ethereum network

Jump to

Keyboard shortcuts

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