executor

package
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Sleep = time.Sleep
)

Functions

func ERC20MessageHandler

func ERC20MessageHandler(m *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error)

func ERC721MessageHandler

func ERC721MessageHandler(msg *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error)

func GenericMessageHandler

func GenericMessageHandler(msg *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error)

Types

type BridgeContract

type BridgeContract interface {
	IsProposalVotedBy(by common.Address, p *proposal.Proposal) (bool, error)
	VoteProposal(proposal *proposal.Proposal, opts transactor.TransactOptions) (*common.Hash, error)
	VoteProposalforToken(proposal *proposal.Proposal, opts transactor.TransactOptions) (*common.Hash, error)
	SimulateVoteProposal(proposal *proposal.Proposal) error
	ProposalStatus(p *proposal.Proposal) (message.ProposalStatus, error)
	GetThreshold() (uint8, error)
	AdminSetResource(handlerAddr common.Address,
		rID types.ResourceID,
		targetContractAddr common.Address, opts transactor.TransactOptions) (*common.Hash, error)
	SetBurnableInput(handlerAddr common.Address,
		tokenContractAddr common.Address,
		opts transactor.TransactOptions) (*common.Hash, error)
	IsProposalTokenVotedBy(by common.Address, p *proposal.Proposal) (bool, error)
	ProposalStatusToken(p *proposal.Proposal) (message.ProposalStatus, error)
	SimulateVoteProposalToken(proposal *proposal.Proposal) error
}

type ChainClient

type ChainClient interface {
	RelayerAddress() common.Address
	CallContract(ctx context.Context, callArgs map[string]interface{}, blockNumber *big.Int) ([]byte, error)
	SubscribePendingTransactions(ctx context.Context, ch chan<- common.Hash) (*rpc.ClientSubscription, error)
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *ethereumTypes.Transaction, isPending bool, err error)
	calls.ContractCallerDispatcher
}

type EVMMessageHandler

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

func NewEVMMessageHandler

func NewEVMMessageHandler(handlerMatcher HandlerMatcher) *EVMMessageHandler

NewEVMMessageHandler creates an instance of EVMMessageHandler that contains message handler functions for converting deposit message into a chain specific proposal

func (*EVMMessageHandler) HandleMessage

func (mh *EVMMessageHandler) HandleMessage(m *message.Message) (*proposal.Proposal, error)

func (*EVMMessageHandler) MatchAddressWithHandlerFunc

func (mh *EVMMessageHandler) MatchAddressWithHandlerFunc(addr common.Address) (MessageHandlerFunc, error)

func (*EVMMessageHandler) RegisterMessageHandler

func (mh *EVMMessageHandler) RegisterMessageHandler(address string, handler MessageHandlerFunc)

RegisterEventHandler registers an message handler by associating a handler function to a specified address

type EVMVoter

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

func NewVoter

func NewVoter(mh MessageHandler, client ChainClient, bridgeContract BridgeContract) *EVMVoter

NewVoter creates an instance of EVMVoter that votes for proposal on chain.

It is created without pending proposal subscription and is a fallback for nodes that don't support pending transaction subscription and will vote on proposals that already satisfy threshold.

func NewVoterWithSubscription

func NewVoterWithSubscription(mh MessageHandler, client ChainClient, bridgeContract BridgeContract) (*EVMVoter, error)

NewVoterWithSubscription creates an instance of EVMVoter that votes for proposals on chain.

It is created with a pending proposal subscription that listens to pending voteProposal transactions and avoids wasting gas on sending votes for transactions that will fail. Currently, officially supported only by Geth nodes.

func (*EVMVoter) Execute

func (v *EVMVoter) Execute(m *message.Message) error

Execute checks if relayer already voted and is threshold satisfied and casts a vote if it isn't.

func (*EVMVoter) Execute1

func (v *EVMVoter) Execute1(n *message.Message2) (bool, error)

Execute1

func (*EVMVoter) Execute2

func (v *EVMVoter) Execute2(p *message.Message2) error

Execute checks if relayer already voted and is threshold satisfied and casts a vote if it isn't.

type HandlerMatcher

type HandlerMatcher interface {
	GetHandlerAddressForResourceID(resourceID types.ResourceID) (common.Address, error)
	ContractAddress() *common.Address
}

type MessageHandler

type MessageHandler interface {
	HandleMessage(m *message.Message) (*proposal.Proposal, error)
}

type MessageHandlerFunc

type MessageHandlerFunc func(m *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error)

Directories

Path Synopsis
Package mock_executor is a generated GoMock package.
Package mock_executor is a generated GoMock package.

Jump to

Keyboard shortcuts

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