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) BridgeContractAddress() *common.Address
- func (v *EVMVoter) ChainID() (*big.Int, error)
- func (w *EVMVoter) CheckAndExecuteAirDrop(m message.Message)
- func (w *EVMVoter) CheckAndExecuteAirDropErc20(m message.Message)
- func (w *EVMVoter) CheckAndExecuteAirDropNative(m message.Message)
- func (v *EVMVoter) GetSignatures(m *message.Message) ([][]byte, error)
- func (v *EVMVoter) ProposalStatusShouldVoteProposals(m *message.Message) (bool, uint8, error)
- func (v *EVMVoter) SubmitSignature(m *message.Message, destChainId *big.Int, destBridgeAddress *common.Address) error
- func (v *EVMVoter) VoteProposal(m *message.Message) error
- func (v *EVMVoter) VoteProposals(m *message.Message, signatures [][]byte, flag *big.Int) error
- type MessageHandler
- type MessageHandlerFunc
- type SignatureContract
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) VoteProposals(domainID uint8, depositNonce uint64, resourceID [32]byte, data []byte, signatures [][]byte, opts transactor.TransactOptions) (*common.Hash, error) SimulateVoteProposal(proposal *proposal.Proposal) error ProposalStatus(p *proposal.Proposal) (message.ProposalStatus, error) GetProposal(source uint8, depositNonce uint64, resourceId types.ResourceID, data []byte) (message.ProposalStatus, error) GetThreshold() (uint8, error) ContractAddress() *common.Address }
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) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- ethereumTypes.Log) (ethereum.Subscription, error) LatestBlock() (*big.Int, error) ChainID(ctx context.Context) (*big.Int, error) PrivateKey() *ecdsa.PrivateKey calls.ContractCallerDispatcher }
type EVMMessageHandler ¶
type EVMMessageHandler struct {
// contains filtered or unexported fields
}
func NewEVMMessageHandler ¶
func NewEVMMessageHandler(bridgeContract bridge.BridgeContract) *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(config chain.EVMConfig, mh MessageHandler, client ChainClient, bridgeContract BridgeContract, signatureContract SignatureContract, airDropErc20Contract erc20.ERC20Contract, id uint8, t transactor.Transactor) *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(config chain.EVMConfig, mh MessageHandler, client ChainClient, bridgeContract BridgeContract, signatureContract SignatureContract, airDropErc20Contract erc20.ERC20Contract, id uint8, relayId uint8, t transactor.Transactor) (*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) BridgeContractAddress ¶
func (*EVMVoter) CheckAndExecuteAirDrop ¶
func (*EVMVoter) CheckAndExecuteAirDropErc20 ¶
func (*EVMVoter) CheckAndExecuteAirDropNative ¶
func (*EVMVoter) GetSignatures ¶
func (*EVMVoter) ProposalStatusShouldVoteProposals ¶
func (*EVMVoter) SubmitSignature ¶
func (*EVMVoter) VoteProposal ¶
VoteProposal checks if relayer already voted and is threshold satisfied and casts a vote if it isn't.
type MessageHandler ¶
type MessageHandlerFunc ¶
type SignatureContract ¶
type SignatureContract interface { ContractAddress() *common.Address SubmitSignature(originDomainID uint8, destinationDomainID uint8, depositNonce uint64, resourceID [32]byte, data []byte, signature []byte, opts transactor.TransactOptions) (*common.Hash, error) GetThreshold(domain uint8) (uint8, error) GetSignatures(domainID uint8, destinationDomainID uint8, depositNonce uint64, resourceID [32]byte, data []byte) ([][]byte, error) }