bridgesync

package
v0.8.0-beta5 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0, MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidPageSize indicates that the page size is invalid
	ErrInvalidPageSize = errors.New("page size must be greater than 0")

	// ErrInvalidPageNumber indicates that the page number is invalid
	ErrInvalidPageNumber = errors.New("page number must be greater than 0")
)
View Source
var (

	// bridgeAsset(uint32 destinationNetwork,address destinationAddress,uint256 amount,
	// 	address token,bool forceUpdateGlobalExitRoot,bytes permitData)
	BridgeAssetMethodID = common.Hex2Bytes("cd586579")
	// bridgeMessage(uint32 destinationNetwork,address destinationAddress,
	//  bool forceUpdateGlobalExitRoot,bytes metadata)
	BridgeMessageMethodID = common.Hex2Bytes("240ff378")
)

Functions

func DecodeGlobalIndex

func DecodeGlobalIndex(globalIndex *big.Int) (mainnetFlag bool,
	rollupIndex uint32, localExitRootIndex uint32, err error)

Decodes global index to its three parts: 1. mainnetFlag - first byte 2. rollupIndex - next 4 bytes 3. localExitRootIndex - last 4 bytes NOTE - mainnet flag is not in the global index bytes if it is false NOTE - rollup index is 0 if mainnet flag is true NOTE - rollup index is not in the global index bytes if mainnet flag is false and rollup index is 0

func ExtractFromAddrFromCalls

func ExtractFromAddrFromCalls(foundCalls []*Call,
	logEvent *agglayerbridge.AgglayerbridgeBridgeEvent) (common.Address, error)

func ExtractParamFromCallData

func ExtractParamFromCallData(callData []byte) (*bridgeCallParams, error)

func ExtractTxnAddresses

func ExtractTxnAddresses(ctx context.Context,
	client aggkittypes.EthClienter,
	bridgeAddr common.Address,
	txHash common.Hash,
	logEvent *agglayerbridge.AgglayerbridgeBridgeEvent,
	logger *logger.Logger) (txnSender common.Address, fromAddr common.Address, toAddr common.Address, err error)

ExtractTxnAddresses extracts the txn_sender, from address, and to address from the transaction trace.

func GenerateGlobalIndex

func GenerateGlobalIndex(mainnetFlag bool, rollupIndex uint32, depositCount uint32) *big.Int

GenerateGlobalIndex encodes a unique "global index" used for identifying bridges and claims. The index is constructed as a big integer from three components: - mainnetFlag: indicates if the origin network is mainnet (true) or a rollup (false).

  • If true, the first 4-byte segment is set to `0x01` and the next 4 bytes are zero.
  • If false, the first 4-byte segment is the rollupIndex (networkID - 1).

- rollupIndex: only used if mainnetFlag is false; represents (networkID - 1). - depositCount: always appended as the final 4-byte segment.

Encoding layout (big-endian concatenation of 4-byte chunks):

[ mainnetFlag ] [ rollupIndex ] [ depositCount ]

Examples:

mainnetFlag=true,  depositCount=3  → 0x0100000000000003
mainnetFlag=false, rollupIndex=1, depositCount=3 → 0x0000000100000003

The result is returned as a *big.Int that can be used consistently across mainnet and rollup networks.

func GenerateGlobalIndexForNetworkID added in v0.7.0

func GenerateGlobalIndexForNetworkID(networkID uint32, depositCount uint32) *big.Int

GenerateGlobalIndexForNetworkID builds the "global index" used to identify bridges and claims.

Types

type AgglayerBridgeL2Reader

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

AgglayerBridgeL2Reader provides functionality to read and interact with the AggLayer Bridge L2 contract. It encapsulates the contract instance and provides methods to query bridge-related data from the L2 chain.

func NewAgglayerBridgeL2Reader

func NewAgglayerBridgeL2Reader(
	bridgeAddr common.Address,
	l2Client aggkittypes.BaseEthereumClienter,
) (*AgglayerBridgeL2Reader, error)

NewAgglayerBridgeL2Reader creates a new instance of AgglayerBridgeL2Reader. It initializes the contract instance using the provided bridge address and L2 client.

Parameters:

  • bridgeAddr: The Ethereum address of the AggLayer Bridge L2 contract
  • l2Client: The Ethereum client for interacting with the L2 chain

Returns:

  • *AgglayerBridgeL2Reader: A new reader instance
  • error: Any error that occurred during contract initialization

func (*AgglayerBridgeL2Reader) GetUnsetClaimsForBlockRange

func (r *AgglayerBridgeL2Reader) GetUnsetClaimsForBlockRange(ctx context.Context,
	fromBlock, toBlock uint64) ([]types.Unclaim, error)

GetUnsetClaimsForBlockRange retrieves all unset claims (unclaims) within a specified block range. It filters the UpdatedUnsetGlobalIndexHashChain events from the bridge contract and converts them into Unclaim objects for further processing. If the block range is too large, it automatically splits the request into smaller chunks.

Parameters:

  • ctx: Context for cancellation and timeout control
  • fromBlock: The starting block number for the search range (inclusive)
  • toBlock: The ending block number for the search range (inclusive)

Returns:

  • []types.Unclaim: A slice of Unclaim objects containing global index, block number, and block index
  • error: Any error that occurred during the event filtering or iteration

type BackfillTxnSender added in v0.7.0

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

BackfillTxnSender handles the backfilling of txn_sender field for bridge records

func NewBackfillTxnSender added in v0.7.0

func NewBackfillTxnSender(
	dbPath string,
	client types.EthClienter,
	bridgeAddr common.Address,
	logger *log.Logger,
) (*BackfillTxnSender, error)

NewBackfillTxnSender creates a new instance of BackfillTxnSender

func (*BackfillTxnSender) BackfillAll added in v0.7.0

func (b *BackfillTxnSender) BackfillAll(ctx context.Context) error

BackfillAll processes bridge table to backfill txn_sender field

func (*BackfillTxnSender) Close added in v0.7.0

func (b *BackfillTxnSender) Close() error

Close closes the database connection

type Bridge

type Bridge struct {
	BlockNum           uint64         `meddler:"block_num"`
	BlockPos           uint64         `meddler:"block_pos"`
	FromAddress        common.Address `meddler:"from_address,address"`
	TxHash             common.Hash    `meddler:"tx_hash,hash"`
	BlockTimestamp     uint64         `meddler:"block_timestamp"`
	LeafType           uint8          `meddler:"leaf_type"`
	OriginNetwork      uint32         `meddler:"origin_network"`
	OriginAddress      common.Address `meddler:"origin_address"`
	DestinationNetwork uint32         `meddler:"destination_network"`
	DestinationAddress common.Address `meddler:"destination_address"`
	Amount             *big.Int       `meddler:"amount,bigint"`
	Metadata           []byte         `meddler:"metadata"`
	DepositCount       uint32         `meddler:"deposit_count"`
	TxnSender          common.Address `meddler:"txn_sender,address"`
	ToAddress          common.Address `meddler:"to_address,address"`
}

Bridge is the representation of a bridge event

func (*Bridge) Hash

func (b *Bridge) Hash() common.Hash

Hash returns the hash of the bridge event as expected by the exit tree Note: can't change the Hash() here after adding BlockTimestamp and TxHash. Might affect previous versions

func (*Bridge) String

func (b *Bridge) String() string

type BridgeDeployment

type BridgeDeployment byte

BridgeDeployment represents the type of bridge contract deployment (sovereign vs non-sovereign).

const (
	Unknown BridgeDeployment = iota
	NonSovereignChain
	SovereignChain
)

type BridgeQuerier

type BridgeQuerier interface {
	GetBoundaryBlockForClaimType(ctx context.Context, claimType ClaimType) (uint64, error)
}

type BridgeQuerierMock

type BridgeQuerierMock struct {
	mock.Mock
}

BridgeQuerierMock is an autogenerated mock type for the BridgeQuerier type

func NewBridgeQuerierMock

func NewBridgeQuerierMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *BridgeQuerierMock

NewBridgeQuerierMock creates a new instance of BridgeQuerierMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*BridgeQuerierMock) EXPECT

func (*BridgeQuerierMock) GetBoundaryBlockForClaimType

func (_m *BridgeQuerierMock) GetBoundaryBlockForClaimType(ctx context.Context, claimType ClaimType) (uint64, error)

GetBoundaryBlockForClaimType provides a mock function with given fields: ctx, claimType

type BridgeQuerierMock_Expecter

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

func (*BridgeQuerierMock_Expecter) GetBoundaryBlockForClaimType

func (_e *BridgeQuerierMock_Expecter) GetBoundaryBlockForClaimType(ctx interface{}, claimType interface{}) *BridgeQuerierMock_GetBoundaryBlockForClaimType_Call

GetBoundaryBlockForClaimType is a helper method to define mock.On call

  • ctx context.Context
  • claimType ClaimType

type BridgeQuerierMock_GetBoundaryBlockForClaimType_Call

type BridgeQuerierMock_GetBoundaryBlockForClaimType_Call struct {
	*mock.Call
}

BridgeQuerierMock_GetBoundaryBlockForClaimType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBoundaryBlockForClaimType'

func (*BridgeQuerierMock_GetBoundaryBlockForClaimType_Call) Return

func (*BridgeQuerierMock_GetBoundaryBlockForClaimType_Call) Run

func (*BridgeQuerierMock_GetBoundaryBlockForClaimType_Call) RunAndReturn

type BridgeSync

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

BridgeSync manages the state of the exit tree for the bridge contract by processing Ethereum blockchain events.

func NewL1

func NewL1(
	ctx context.Context,
	cfg Config,
	rd ReorgDetector,
	ethClient aggkittypes.EthClienter,
	originNetwork uint32,
) (*BridgeSync, error)

NewL1 creates a bridge syncer that synchronizes the mainnet exit tree

func NewL2

func NewL2(
	ctx context.Context,
	cfg Config,
	rd ReorgDetector,
	ethClient aggkittypes.EthClienter,
	originNetwork uint32,
	syncFullClaims bool,
) (*BridgeSync, error)

NewL2 creates a bridge syncer that synchronizes the local exit tree

func (*BridgeSync) GetBlockByLER

func (s *BridgeSync) GetBlockByLER(ctx context.Context, ler common.Hash) (uint64, error)

func (*BridgeSync) GetBridges

func (s *BridgeSync) GetBridges(ctx context.Context, fromBlock, toBlock uint64) ([]Bridge, error)

func (*BridgeSync) GetBridgesPaged added in v0.5.0

func (s *BridgeSync) GetBridgesPaged(
	ctx context.Context,
	page, pageSize uint32,
	depositCount *uint64, networkIDs []uint32, fromAddress string) ([]*Bridge, int, error)

func (*BridgeSync) GetClaims

func (s *BridgeSync) GetClaims(ctx context.Context, fromBlock, toBlock uint64) ([]Claim, error)

func (*BridgeSync) GetClaimsByGlobalIndex added in v0.7.0

func (s *BridgeSync) GetClaimsByGlobalIndex(ctx context.Context, globalIndex *big.Int) ([]Claim, error)

func (*BridgeSync) GetClaimsPaged added in v0.5.0

func (s *BridgeSync) GetClaimsPaged(
	ctx context.Context,
	page, pageSize uint32, networkIDs []uint32, globalIndex *big.Int) ([]*Claim, int, error)

func (*BridgeSync) GetContractDepositCount added in v0.5.0

func (s *BridgeSync) GetContractDepositCount(ctx context.Context) (uint32, error)

GetContractDepositCount returns the last deposit count from the bridge contract

func (*BridgeSync) GetExitRootByHash added in v0.7.0

func (s *BridgeSync) GetExitRootByHash(ctx context.Context, root common.Hash) (*tree.Root, error)

func (*BridgeSync) GetExitRootByIndex

func (s *BridgeSync) GetExitRootByIndex(ctx context.Context, index uint32) (tree.Root, error)

GetExitRootByIndex returns the root of the exit tree at the moment the leaf with the given index was added

func (*BridgeSync) GetLastProcessedBlock

func (s *BridgeSync) GetLastProcessedBlock(ctx context.Context) (uint64, error)

func (*BridgeSync) GetLastReorgEvent added in v0.5.0

func (s *BridgeSync) GetLastReorgEvent(ctx context.Context) (*LastReorg, error)

func (*BridgeSync) GetLastRoot added in v0.5.0

func (s *BridgeSync) GetLastRoot(ctx context.Context) (*tree.Root, error)

func (*BridgeSync) GetLatestNetworkBlock added in v0.7.0

func (s *BridgeSync) GetLatestNetworkBlock(ctx context.Context) (uint64, error)

GetLatestNetworkBlock returns the latest block number from the network

func (*BridgeSync) GetLegacyTokenMigrations added in v0.5.0

func (s *BridgeSync) GetLegacyTokenMigrations(
	ctx context.Context, pageNumber, pageSize uint32) ([]*LegacyTokenMigration, int, error)

func (*BridgeSync) GetProof

func (s *BridgeSync) GetProof(ctx context.Context, depositCount uint32, localExitRoot common.Hash) (tree.Proof, error)

func (*BridgeSync) GetRootByLER

func (s *BridgeSync) GetRootByLER(ctx context.Context, ler common.Hash) (*tree.Root, error)

func (*BridgeSync) GetTokenMappings added in v0.5.0

func (s *BridgeSync) GetTokenMappings(ctx context.Context, pageNumber, pageSize uint32, originTokenAddress string,
) ([]*TokenMapping, int, error)

func (*BridgeSync) GetUnsetClaimsPaged

func (s *BridgeSync) GetUnsetClaimsPaged(
	ctx context.Context,
	page, pageSize uint32, globalIndex *big.Int) ([]*UnsetClaim, int, error)

func (*BridgeSync) IsActive added in v0.7.0

func (s *BridgeSync) IsActive(ctx context.Context) bool

IsActive returns true if the syncer is active (not halted)

func (*BridgeSync) OriginNetwork

func (s *BridgeSync) OriginNetwork() uint32

OriginNetwork returns the network ID of the origin chain

func (*BridgeSync) Start

func (s *BridgeSync) Start(ctx context.Context)

Start starts the synchronization process

func (*BridgeSync) SubscribeToSync

func (s *BridgeSync) SubscribeToSync(subscriberID string) <-chan sync.Block

SubscribeToSync allows a subscriber to receive block notifications

type BridgeSyncRuntimeData added in v0.5.0

type BridgeSyncRuntimeData struct {
	// This fields are coming from legacy sync.RuntimeData
	ChainID   uint64
	Addresses []common.Address
	// DBVersion tracks the database schema version for compatibility validation
	DBVersion *int
}

BridgeSyncRuntimeData contains runtime environment data used for database compatibility checks. It includes chain ID, contract addresses, and database version information.

func (BridgeSyncRuntimeData) IsCompatible added in v0.5.0

func (b BridgeSyncRuntimeData) IsCompatible(storage BridgeSyncRuntimeData) error

func (BridgeSyncRuntimeData) String added in v0.5.0

func (b BridgeSyncRuntimeData) String() string

type BridgeSyncerID

type BridgeSyncerID int

BridgeSyncerID represents the type of bridge syncer

const (
	L1BridgeSyncer BridgeSyncerID = iota
	L2BridgeSyncer

	// CurrentDBVersion represents the current version of the bridge syncer's database schema.
	// It is used to ensure the database is reset if an upgrade requires a full resync.
	// Increment this value whenever the database schema changes in a way that is not backward-compatible.
	CurrentDBVersion = 1
)

func (BridgeSyncerID) String

func (b BridgeSyncerID) String() string

type Call

type Call struct {
	From  common.Address    `json:"from"`
	To    common.Address    `json:"to"`
	Value *rpctypes.ArgBig  `json:"value"`
	Err   *string           `json:"error"`
	Input rpctypes.ArgBytes `json:"input"`
	Calls []Call            `json:"calls"`
}

type Claim

type Claim struct {
	BlockNum            uint64         `meddler:"block_num"`
	BlockPos            uint64         `meddler:"block_pos"`
	TxHash              common.Hash    `meddler:"tx_hash,hash"`
	GlobalIndex         *big.Int       `meddler:"global_index,bigint"`
	OriginNetwork       uint32         `meddler:"origin_network"`
	OriginAddress       common.Address `meddler:"origin_address"`
	DestinationAddress  common.Address `meddler:"destination_address"`
	Amount              *big.Int       `meddler:"amount,bigint"`
	ProofLocalExitRoot  types.Proof    `meddler:"proof_local_exit_root,merkleproof"`
	ProofRollupExitRoot types.Proof    `meddler:"proof_rollup_exit_root,merkleproof"`
	MainnetExitRoot     common.Hash    `meddler:"mainnet_exit_root,hash"`
	RollupExitRoot      common.Hash    `meddler:"rollup_exit_root,hash"`
	GlobalExitRoot      common.Hash    `meddler:"global_exit_root,hash"`
	DestinationNetwork  uint32         `meddler:"destination_network"`
	Metadata            []byte         `meddler:"metadata"`
	IsMessage           bool           `meddler:"is_message"`
	BlockTimestamp      uint64         `meddler:"block_timestamp"`
	Type                ClaimType      `meddler:"type"`
}

Claim representation of a claim event

func (*Claim) String

func (c *Claim) String() string

type ClaimType

type ClaimType string
const (
	ClaimEvent         ClaimType = "ClaimEvent"
	DetailedClaimEvent ClaimType = "DetailedClaimEvent"
)

type Config

type Config struct {
	// DBPath path of the DB
	DBPath string `mapstructure:"DBPath"`
	// BlockFinality indicates the status of the blocks that will be queried in order to sync
	BlockFinality aggkittypes.BlockNumberFinality `` //nolint:lll
	/* 134-byte string literal not displayed */
	// InitialBlockNum is the first block that will be queried when starting the synchronization from scratch.
	// It should be a number equal or bellow the creation of the bridge contract
	InitialBlockNum uint64 `mapstructure:"InitialBlockNum"`
	// BridgeAddr is the address of the bridge smart contract
	BridgeAddr common.Address `mapstructure:"BridgeAddr"`
	// SyncBlockChunkSize is the amount of blocks that will be queried to the client on each request
	SyncBlockChunkSize uint64 `mapstructure:"SyncBlockChunkSize"`
	// RetryAfterErrorPeriod is the time that will be waited when an unexpected error happens before retry
	RetryAfterErrorPeriod types.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"`
	// WaitForNewBlocksPeriod time that will be waited when the synchronizer has reached the latest block
	WaitForNewBlocksPeriod types.Duration `mapstructure:"WaitForNewBlocksPeriod"`
	// RequireStorageContentCompatibility is true it's mandatory that data stored in the database
	// is compatible with the running environment
	RequireStorageContentCompatibility bool `mapstructure:"RequireStorageContentCompatibility"`
	// DBQueryTimeout is the timeout for database operations (queries, transactions)
	// This is separate from HTTP timeouts to allow database operations more time when needed
	DBQueryTimeout types.Duration `mapstructure:"DBQueryTimeout"`
}

func (Config) Validate

func (c Config) Validate() error

Validate checks if the configuration is valid

type Event

type Event struct {
	Bridge               *Bridge
	Claim                *Claim
	TokenMapping         *TokenMapping
	LegacyTokenMigration *LegacyTokenMigration
	RemoveLegacyToken    *RemoveLegacyToken
	UnsetClaim           *UnsetClaim
	SetClaim             *SetClaim
}

Event combination of bridge, claim, token mapping and legacy token migration events

func (Event) String

func (e Event) String() string

type InvalidClaim

type InvalidClaim struct {
	// claim struct fields
	BlockNum            uint64         `meddler:"block_num"`
	BlockPos            uint64         `meddler:"block_pos"`
	TxHash              common.Hash    `meddler:"tx_hash,hash"`
	GlobalIndex         *big.Int       `meddler:"global_index,bigint"`
	OriginNetwork       uint32         `meddler:"origin_network"`
	OriginAddress       common.Address `meddler:"origin_address"`
	DestinationAddress  common.Address `meddler:"destination_address"`
	Amount              *big.Int       `meddler:"amount,bigint"`
	ProofLocalExitRoot  types.Proof    `meddler:"proof_local_exit_root,merkleproof"`
	ProofRollupExitRoot types.Proof    `meddler:"proof_rollup_exit_root,merkleproof"`
	MainnetExitRoot     common.Hash    `meddler:"mainnet_exit_root,hash"`
	RollupExitRoot      common.Hash    `meddler:"rollup_exit_root,hash"`
	GlobalExitRoot      common.Hash    `meddler:"global_exit_root,hash"`
	DestinationNetwork  uint32         `meddler:"destination_network"`
	Metadata            []byte         `meddler:"metadata"`
	IsMessage           bool           `meddler:"is_message"`
	BlockTimestamp      uint64         `meddler:"block_timestamp"`
	// additional fields
	Reason    string `meddler:"reason"`
	CreatedAt uint64 `meddler:"created_at"`
}

func NewInvalidClaim

func NewInvalidClaim(c *Claim, reason string) *InvalidClaim

NewInvalidClaim creates a new InvalidClaim from a Claim and a reason

type LastReorg added in v0.5.0

type LastReorg struct {
	DetectedAt int64  `json:"detected_at"`
	FromBlock  uint64 `json:"from_block"`
	ToBlock    uint64 `json:"to_block"`
}

type LegacyTokenMigration added in v0.5.0

type LegacyTokenMigration struct {
	BlockNum            uint64         `meddler:"block_num"`
	BlockPos            uint64         `meddler:"block_pos"`
	BlockTimestamp      uint64         `meddler:"block_timestamp"`
	TxHash              common.Hash    `meddler:"tx_hash,hash"`
	Sender              common.Address `meddler:"sender,address"`
	LegacyTokenAddress  common.Address `meddler:"legacy_token_address,address"`
	UpdatedTokenAddress common.Address `meddler:"updated_token_address,address"`
	Amount              *big.Int       `meddler:"amount,bigint"`
}

LegacyTokenMigration representation of a MigrateLegacyToken event, that is emitted by the sovereign chain bridge contract.

func (*LegacyTokenMigration) String

func (l *LegacyTokenMigration) String() string

type RecordToBackfill added in v0.7.0

type RecordToBackfill struct {
	BlockNum           uint64         `meddler:"block_num"`
	BlockPos           uint64         `meddler:"block_pos"`
	FromAddress        *string        `meddler:"from_address"`
	TxHash             common.Hash    `meddler:"tx_hash,hash"`
	BlockTimestamp     uint64         `meddler:"block_timestamp"`
	LeafType           uint8          `meddler:"leaf_type"`
	OriginNetwork      uint32         `meddler:"origin_network"`
	OriginAddress      common.Address `meddler:"origin_address,address"`
	DestinationNetwork uint32         `meddler:"destination_network"`
	DestinationAddress common.Address `meddler:"destination_address,address"`
	Amount             *big.Int       `meddler:"amount,bigint"`
	Metadata           []byte         `meddler:"metadata"`
	DepositCount       uint32         `meddler:"deposit_count"`
	TxnSender          *string        `meddler:"txn_sender"`
}

RecordToBackfill represents a record that needs txn_sender backfilling

type RecordUpdate added in v0.7.0

type RecordUpdate struct {
	BlockNum  uint64
	BlockPos  uint64
	TxnSender common.Address
	FromAddr  common.Address
}

RecordUpdate represents a record update with txn_sender data

func (*RecordUpdate) String

func (r *RecordUpdate) String() string

type RemoveLegacyToken added in v0.5.0

type RemoveLegacyToken struct {
	BlockNum           uint64         `meddler:"block_num"`
	BlockPos           uint64         `meddler:"block_pos"`
	BlockTimestamp     uint64         `meddler:"block_timestamp"`
	TxHash             common.Hash    `meddler:"tx_hash,hash"`
	LegacyTokenAddress common.Address `meddler:"legacy_token_address,address"`
}

RemoveLegacyToken representation of a RemoveLegacySovereignTokenAddress event, that is emitted by the sovereign chain bridge contract.

func (*RemoveLegacyToken) String

func (r *RemoveLegacyToken) String() string

type ReorgDetector

type ReorgDetector interface {
	sync.ReorgDetector
	GetLastReorgEvent(ctx context.Context) (reorgdetector.ReorgEvent, error)
}

type SetClaim

type SetClaim struct {
	BlockNum    uint64      `meddler:"block_num"`
	BlockPos    uint64      `meddler:"block_pos"`
	TxHash      common.Hash `meddler:"tx_hash,hash"`
	GlobalIndex *big.Int    `meddler:"global_index,bigint"`
	CreatedAt   uint64      `meddler:"created_at"`
}

SetClaim representation of a SetClaim event, that is emitted by the bridge contract when a claim is set.

func (*SetClaim) String

func (s *SetClaim) String() string

type TokenMapping added in v0.5.0

type TokenMapping struct {
	BlockNum            uint64                       `meddler:"block_num"`
	BlockPos            uint64                       `meddler:"block_pos"`
	BlockTimestamp      uint64                       `meddler:"block_timestamp"`
	TxHash              common.Hash                  `meddler:"tx_hash,hash"`
	OriginNetwork       uint32                       `meddler:"origin_network"`
	OriginTokenAddress  common.Address               `meddler:"origin_token_address,address"`
	WrappedTokenAddress common.Address               `meddler:"wrapped_token_address,address"`
	Metadata            []byte                       `meddler:"metadata"`
	IsNotMintable       bool                         `meddler:"is_not_mintable"`
	Type                bridgetypes.TokenMappingType `meddler:"token_type"`
}

TokenMapping representation of a NewWrappedToken event, that is emitted by the bridge contract

func (*TokenMapping) String

func (t *TokenMapping) String() string

type Transaction added in v0.7.0

type Transaction struct {
	FromRaw          string `json:"from"`
	To               string `json:"to"`
	Hash             string `json:"hash"`
	Value            string `json:"value"`
	Gas              string `json:"gas"`
	GasPrice         string `json:"gasPrice"`
	Nonce            string `json:"nonce"`
	Input            string `json:"input"`
	BlockHash        string `json:"blockHash"`
	BlockNumber      string `json:"blockNumber"`
	TransactionIndex string `json:"transactionIndex"`
}

Transaction represents the structure of a transaction returned by eth_getTransactionByHash

func RPCTransactionByHash

func RPCTransactionByHash(client aggkittypes.EthClienter,
	txHash common.Hash) (*Transaction, error)

func (*Transaction) From added in v0.7.0

func (t *Transaction) From() common.Address

func (*Transaction) ToAddress

func (t *Transaction) ToAddress() common.Address

type TxnSenderJob added in v0.7.0

type TxnSenderJob struct {
	Record RecordToBackfill
}

TxnSenderJob represents a job for extracting transaction sender

type TxnSenderResult added in v0.7.0

type TxnSenderResult struct {
	Update RecordUpdate
	Error  error
}

TxnSenderResult represents the result of extracting transaction sender

type UnsetClaim

type UnsetClaim struct {
	BlockNum                  uint64      `meddler:"block_num"`
	BlockPos                  uint64      `meddler:"block_pos"`
	TxHash                    common.Hash `meddler:"tx_hash,hash"`
	GlobalIndex               *big.Int    `meddler:"global_index,bigint"`
	UnsetGlobalIndexHashChain common.Hash `meddler:"unset_global_index_hash_chain,hash"`
	CreatedAt                 uint64      `meddler:"created_at"`
}

UnsetClaim representation of an UpdatedUnsetGlobalIndexHashChain event, that is emitted by the bridge contract when a claim is unset.

func (*UnsetClaim) String

func (u *UnsetClaim) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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