Documentation
¶
Index ¶
Constants ¶
View Source
const ( // LeafTypeAsset represents a bridge asset LeafTypeAsset uint8 = 0 // LeafTypeMessage represents a bridge message LeafTypeMessage uint8 = 1 )
Variables ¶
View Source
var ( ErrInvalidClaim = errors.New("invalid claim") ErrClaimDoesntExist = errors.New("the claim requested to be updated does not exist") )
Functions ¶
This section is empty.
Types ¶
type Claim ¶
type Claim struct {
LeafType uint8 `meddler:"leaf_type"`
ProofLocalExitRoot tree.Proof `meddler:"proof_local_exit_root,merkleproof"`
ProofRollupExitRoot tree.Proof `meddler:"proof_rollup_exit_root,merkleproof"`
GlobalIndex *big.Int `meddler:"global_index,bigint"`
MainnetExitRoot common.Hash `meddler:"mainnet_exit_root,hash"`
RollupExitRoot common.Hash `meddler:"rollup_exit_root,hash"`
OriginNetwork uint32 `meddler:"origin_network"`
OriginTokenAddress common.Address `meddler:"origin_token_address,address"`
DestinationNetwork uint32 `meddler:"destination_network"`
DestinationAddress common.Address `meddler:"destination_address,address"`
Amount *big.Int `meddler:"amount,bigint"`
Metadata []byte `meddler:"metadata"`
Status ClaimStatus `meddler:"status"`
TxID string `meddler:"tx_id"`
}
Claim representation of a claim event
type ClaimSender ¶
type ClaimSender interface {
// contains filtered or unexported methods
}
type ClaimSponsor ¶
type ClaimSponsor struct {
// contains filtered or unexported fields
}
func NewEVMClaimSponsor ¶
func NewEVMClaimSponsor( logger *log.Logger, dbPath string, l2Client EthClienter, bridgeAddr common.Address, sender common.Address, maxGas, gasOffset uint64, ethTxManager EthTxManager, retryAfterErrorPeriod time.Duration, maxRetryAttemptsAfterError int, waitTxToBeMinedPeriod time.Duration, waitOnEmptyQueue time.Duration, ) (*ClaimSponsor, error)
func (*ClaimSponsor) AddClaimToQueue ¶
func (c *ClaimSponsor) AddClaimToQueue(claim *Claim) error
func (*ClaimSponsor) GetClaim ¶
func (c *ClaimSponsor) GetClaim(globalIndex *big.Int) (*Claim, error)
func (*ClaimSponsor) Start ¶
func (c *ClaimSponsor) Start(ctx context.Context)
type ClaimStatus ¶
type ClaimStatus string
const ( PendingClaimStatus ClaimStatus = "pending" WIPClaimStatus ClaimStatus = "work in progress" SuccessClaimStatus ClaimStatus = "success" FailedClaimStatus ClaimStatus = "failed" )
type EVMClaimSponsor ¶
type EVMClaimSponsor struct {
// contains filtered or unexported fields
}
type EVMClaimSponsorConfig ¶
type EVMClaimSponsorConfig struct {
// DBPath path of the DB
DBPath string `mapstructure:"DBPath"`
// Enabled indicates if the sponsor should be run or not
Enabled bool `mapstructure:"Enabled"`
// SenderAddr is the address that will be used to send the claim txs
SenderAddr common.Address `mapstructure:"SenderAddr"`
// BridgeAddrL2 is the address of the bridge smart contract on L2
BridgeAddrL2 common.Address `mapstructure:"BridgeAddrL2"`
// MaxGas is the max gas (limit) allowed for a claim to be sponsored
MaxGas uint64 `mapstructure:"MaxGas"`
// RetryAfterErrorPeriod is the time that will be waited when an unexpected error happens before retry
RetryAfterErrorPeriod configTypes.Duration `mapstructure:"RetryAfterErrorPeriod"`
// MaxRetryAttemptsAfterError is the maximum number of consecutive attempts that will happen before panicing.
// Any number smaller than zero will be considered as unlimited retries
MaxRetryAttemptsAfterError int `mapstructure:"MaxRetryAttemptsAfterError"`
// WaitTxToBeMinedPeriod is the period that will be used to ask if a given tx has been mined (or failed)
WaitTxToBeMinedPeriod configTypes.Duration `mapstructure:"WaitTxToBeMinedPeriod"`
// WaitOnEmptyQueue is the time that will be waited before trying to send the next claim of the queue
// if the queue is empty
WaitOnEmptyQueue configTypes.Duration `mapstructure:"WaitOnEmptyQueue"`
// EthTxManager is the configuration of the EthTxManager to be used by the claim sponsor
EthTxManager ethtxmanager.Config `mapstructure:"EthTxManager"`
// GasOffset is the gas to add on top of the estimated gas when sending the claim txs
GasOffset uint64 `mapstructure:"GasOffset"`
}
type EthClienter ¶
type EthClienter interface {
ethereum.GasEstimator
bind.ContractBackend
}
type EthTxManager ¶
type EthTxManager interface {
Remove(ctx context.Context, id common.Hash) error
ResultsByStatus(ctx context.Context, statuses []ethtxtypes.MonitoredTxStatus) ([]ethtxtypes.MonitoredTxResult, error)
Result(ctx context.Context, id common.Hash) (ethtxtypes.MonitoredTxResult, error)
Add(ctx context.Context, to *common.Address, value *big.Int, data []byte,
gasOffset uint64, sidecar *types.BlobTxSidecar) (common.Hash, error)
}
Click to show internal directories.
Click to hide internal directories.