chain

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Common errors
	ErrInsufficientBalance   = errors.New("InsufficientBalance")
	ErrGasLimitExceeded      = errors.New("GasLimitExceeded")
	ErrBlockGasLimitExceeded = errors.New("BlockGasLimitExceeded")

	// BMC errors
	ErrBMCRevertLastOwner                 = errors.New("LastOwner")
	ErrBMCRevertUnauthroized              = errors.New("Unauthorized")
	ErrBMCRevertInvalidAddress            = errors.New("InvalidAddress")
	ErrBMCRevertNotExistsPermission       = errors.New("NotExistsPermission")
	ErrBMCRevertAlreadyExistsBSH          = errors.New("AlreadyExistsBSH")
	ErrBMCRevertNotExistsBSH              = errors.New("NotExistsBSH")
	ErrBMCRevertAlreadyExistsLink         = errors.New("AlreadyExistsLink")
	ErrBMCRevertNotExistsLink             = errors.New("NotExistsLink")
	ErrBMCRevertInvalidParam              = errors.New("InvalidParam")
	ErrBMCRevertAlreadyExistRoute         = errors.New("AlreadyExistRoute")
	ErrBMCRevertNotExistRoute             = errors.New("NotExistRoute")
	ErrBMCRevertInvalidSn                 = errors.New("InvalidSn")
	ErrBMCRevertParseFailure              = errors.New("ParseFailure")
	ErrBMCRevertInvalidRxHeight           = errors.New("InvalidRxHeight")
	ErrBMCRevertInvalidSeqNumber          = errors.New("InvalidSeqNumber")
	ErrBMCRevertNotExistsInternalHandler  = errors.New("NotExistsInternalHandler")
	ErrBMCRevertAlreadyExistsBMCPeriphery = errors.New("AlreadyExistsBMCPeriphery")
	ErrBMCRevertUnknownHandleBTPError     = errors.New("UnknownHandleBTPError")
	ErrBMCRevertUnknownHandleBTPMessage   = errors.New("UnknownHandleBTPMessage")
	ErrBMCRevertUnreachable               = errors.New("Unreachable:")
)

Functions

func RevertError

func RevertError(msg string) error

func ValidateBtpAddress

func ValidateBtpAddress(ba BTPAddress) error

Types

type BMCLinkStatus

type BMCLinkStatus struct {
	TxSeq            uint64
	RxSeq            uint64
	BMRIndex         uint
	RotateHeight     uint64
	RotateTerm       uint
	DelayLimit       uint
	MaxAggregation   uint
	CurrentHeight    uint64
	RxHeight         uint64
	RxHeightSrc      uint64
	BlockIntervalSrc uint
	BlockIntervalDst uint
}

type BTPAddress

type BTPAddress string

func (BTPAddress) BlockChain

func (a BTPAddress) BlockChain() string

func (BTPAddress) ContractAddress

func (a BTPAddress) ContractAddress() string

func (BTPAddress) NetworkAddress

func (a BTPAddress) NetworkAddress() string

func (BTPAddress) NetworkID

func (a BTPAddress) NetworkID() string

func (BTPAddress) Protocol

func (a BTPAddress) Protocol() string

func (*BTPAddress) Set

func (a *BTPAddress) Set(v string) error

func (BTPAddress) String

func (a BTPAddress) String() string

func (BTPAddress) Type

func (a BTPAddress) Type() string

type Event

type Event struct {
	Next     BTPAddress
	Sequence uint64
	Message  []byte
}

type Message

type Message struct {
	From     BTPAddress
	Receipts []*Receipt
}

type Receipt

type Receipt struct {
	Index  uint64
	Events []*Event
	Height uint64
}

type Receiver

type Receiver interface {
	// Subscribe ...
	// subscribes to BTP messages and block headers on `msgCh` of the src chain
	// and returns an `errCh` that sends any error during subscription and terminates
	// the subscription by closing `errCh`
	Subscribe(ctx context.Context, msgCh chan<- *Message, opts SubscribeOptions) (errCh <-chan error, err error)
}

type RelayMessage

type RelayMessage struct {
	Receipts [][]byte
}

RelayMessage is encoded

type RelayReceipt

type RelayReceipt struct {
	Index  uint64
	Events []byte
	Height uint64
}

type RelayTx

type RelayTx interface {
	ID() interface{}
	Send(ctx context.Context) (err error)
	Receipt(ctx context.Context) (blockHeight uint64, err error)
}

RelayTx ...

type Relayer

type Relayer interface {
	Sender
	Receiver
}

type Sender

type Sender interface {
	// Status ...
	// returns current BMCLinkStatus of the dst chain
	Status(ctx context.Context) (link *BMCLinkStatus, err error)

	// Segment ...
	// returns a "tx" Tx object including events upto "txSizeLimit" bytes and
	// returns rest of the "msg" Message as "newMsg"
	Segment(ctx context.Context, msg *Message) (tx RelayTx, newMsg *Message, err error)

	// Returns the current relayer balance
	Balance(ctx context.Context) (balance, threshold *big.Int, err error)
}

type SubscribeOptions

type SubscribeOptions struct {
	Seq    uint64
	Height uint64
}

Directories

Path Synopsis
bsc
abi

Jump to

Keyboard shortcuts

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