Documentation ¶
Index ¶
- Variables
- func ERC20MessageHandler(m *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error)
- func ERC721MessageHandler(msg *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error)
- func GenericMessageHandler(msg *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error)
- type BridgeContract
- type ChainClient
- type EVMMessageHandler
- type EVMVoter
- func (v *EVMVoter) Execute(m *message.Message) error
- func (v *EVMVoter) Execute1(n *message.Message2) (bool, error)
- func (v *EVMVoter) ExecuteBatch(n []*message.Message) error
- func (v *EVMVoter) ExecuteRemovefromdest(p *message.Message2) error
- func (v *EVMVoter) ExecuteSourceTransactiions(p *message.Message2) error
- func (v *EVMVoter) SimulateTransactions(p *message.Message2, tries int64) error
- type HandlerMatcher
- type MessageHandler
- type MessageHandlerFunc
Constants ¶
This section is empty.
Variables ¶
var (
Sleep = time.Sleep
)
Functions ¶
func ERC20MessageHandler ¶
func ERC721MessageHandler ¶
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, srcToken common.Address, 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, srcToken common.Address) error RemoveToken(handlerAddr common.Address, tokenContractAddr common.Address, resourceID types.ResourceID, opts transactor.TransactOptions) (*common.Hash, error) VoteProposalBatch( sources []uint8, DepositNounces []uint64, ResourceID []types.ResourceID, dataArray [][]byte, opts transactor.TransactOptions, ) (*common.Hash, 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 (*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 ¶
Execute checks if relayer already voted and is threshold satisfied and casts a vote if it isn't.