worker

package
v0.0.0-...-1a342eb Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTableDB

type CreateTableDB interface {
	CreateTable(tableName, realTableName string)
}

func NewCreateTableDB

func NewCreateTableDB(db *gorm.DB) CreateTableDB

type L1ToL2

type L1ToL2 struct {
	GUID                  uuid.UUID      `gorm:"primaryKey;DEFAULT replace(uuid_generate_v4()::text,'-','');serializer:uuid" json:"guid"`
	L1BlockNumber         *big.Int       `gorm:"serializer:u256;column:l1_block_number" db:"l1_block_number" json:"l1BlockNumber" form:"l1_block_number"`
	L2BlockNumber         *big.Int       `gorm:"serializer:u256;column:l2_block_number" db:"l2_block_number" json:"l2BlockNumber" form:"l2_block_number"`
	QueueIndex            *big.Int       `gorm:"serializer:u256;column:queue_index" json:"queueIndex"`
	L1TransactionHash     common.Hash    `` /* 128-byte string literal not displayed */
	L2TransactionHash     common.Hash    `` /* 127-byte string literal not displayed */
	TransactionSourceHash common.Hash    `` /* 143-byte string literal not displayed */
	MessageHash           common.Hash    `gorm:"serializer:bytes"`
	L1TxOrigin            common.Address `gorm:"column:l1_tx_origin;serializer:bytes" db:"l1_tx_origin" json:"l1TxOrigin" form:"l1_tx_origin"`
	Status                int64          `gorm:"column:status" db:"status" json:"status" form:"status"`
	FromAddress           common.Address `gorm:"column:from_address;serializer:bytes" db:"from_address" json:"fromAddress" form:"from_address"`
	ToAddress             common.Address `gorm:"column:to_address;serializer:bytes" db:"to_address" json:"toAddress" form:"to_address"`
	L1TokenAddress        common.Address `gorm:"column:l1_token_address;serializer:bytes" db:"l1_token_address" json:"l1TokenAddress" form:"l1_token_address"`
	L2TokenAddress        common.Address `gorm:"column:l2_token_address;serializer:bytes" db:"l2_token_address" json:"l2TokenAddress" form:"l2_token_address"`
	ETHAmount             *big.Int       `gorm:"serializer:u256;column:eth_amount" json:"ETHAmount"`
	GasLimit              *big.Int       `gorm:"serializer:u256;column:gas_limit" json:"gasLimit"`
	Timestamp             int64          `gorm:"column:timestamp" db:"timestamp" json:"timestamp" form:"timestamp"`
	TokenIds              string         `gorm:"column:token_ids" db:"token_ids" json:"tokenIds" form:"token_ids"`
	AssetType             int64          `gorm:"column:asset_type" db:"asset_type" json:"assetType" form:"asset_type"`
	TokenAmounts          string         `gorm:"column:token_amounts" db:"token_amounts" json:"tokenAmounts" form:"token_amounts"`
}

type L1ToL2DB

type L1ToL2DB interface {
	L1ToL2View
	StoreL1ToL2Transactions(string, []L1ToL2) error
	UpdateTokenPairAndAddress(chainId string, l1L2List []L1ToL2) error
	UpdateMessageHash(chainId string, l1L2List []L1ToL2) error
	MarkL1ToL2TransactionDepositFinalized(chainId string, l1l2List []L1ToL2) error
	RelayedL1ToL2Transaction(chainId string, l1L2List []L1ToL2) error
	FinalizedL1ToL2Transaction(chainId string, l1L2List []L1ToL2) error
	UpdateL1ToL2MsgHashByL1TxHash(chainId string, l1L2 L1ToL2) error
	UpdateL1ToL2L2TxHashByMsgHash(chainId string, l1L2 L1ToL2) error
}

func NewL1ToL2DB

func NewL1ToL2DB(db *gorm.DB) L1ToL2DB

type L1ToL2View

type L1ToL2View interface {
	GetBlockNumberFromHash(chainId string, blockHash common.Hash) (*big.Int, error)
	L1LatestBlockHeader(l2chainId, destChainId string) (*common2.BlockHeader, error)
	L2LatestBlockHeader(chainId string) (*common2.BlockHeader, error)
	L1LatestFinalizedBlockHeader(chainId, destChainId string) (*common2.BlockHeader, error)
	L2LatestFinalizedBlockHeader(chainId string) (*common2.BlockHeader, error)
	L1ToL2List(string, string, int, int, string) ([]L1ToL2, int64)
	L1ToL2TransactionDeposit(string, common.Hash) (*L1ToL2, error)
	L1ToL2Transaction(string, common.Hash) (*L1ToL2, error)
}

type L2ToL1

type L2ToL1 struct {
	GUID                    uuid.UUID      `gorm:"primaryKey;DEFAULT replace(uuid_generate_v4()::text,'-','';serializer:uuid" json:"guid"`
	L1BlockNumber           *big.Int       `gorm:"serializer:u256;column:l1_block_number" db:"l1_block_number" json:"l1BlockNumber" form:"l1_block_number"`
	L2BlockNumber           *big.Int       `gorm:"serializer:u256;column:l2_block_number;primaryKey" db:"l2_block_number" json:"l2BlockNumber" form:"l2_block_number"`
	MsgNonce                *big.Int       `gorm:"column:msg_nonce;serializer:u256" db:"msg_nonce" json:"msgNonce" form:"msg_nonce"`
	L2TransactionHash       common.Hash    `` /* 127-byte string literal not displayed */
	WithdrawTransactionHash common.Hash    `` /* 153-byte string literal not displayed */
	L1ProveTxHash           common.Hash    `gorm:"column:l1_prove_tx_hash;serializer:bytes" db:"l1_prove_tx_hash" json:"l1ProveTxHash" form:"l1_prove_tx_hash"`
	L1FinalizeTxHash        common.Hash    `` /* 126-byte string literal not displayed */
	MessageHash             common.Hash    `gorm:"column:message_hash;serializer:bytes" db:"message_hash" json:"messageHash" form:"message_hash"`
	Status                  int64          `gorm:"column:status" db:"status" json:"status" form:"status"`
	FromAddress             common.Address `gorm:"column:from_address;serializer:bytes" db:"from_address" json:"fromAddress" form:"from_address"`
	ETHAmount               *big.Int       `gorm:"serializer:u256;column:eth_amount" json:"ETHAmount"`
	GasLimit                *big.Int       `gorm:"serializer:u256;column:gas_limit" json:"gasLimit"`
	TimeLeft                *big.Int       `gorm:"serializer:u256;column:time_left" json:"timeLeft"`
	ToAddress               common.Address `gorm:"column:to_address;serializer:bytes" db:"to_address" json:"toAddress" form:"to_address"`
	L1TokenAddress          common.Address `gorm:"column:l1_token_address;serializer:bytes" db:"l1_token_address" json:"l1TokenAddress" form:"l1_token_address"`
	L2TokenAddress          common.Address `gorm:"column:l2_token_address;serializer:bytes" db:"l2_token_address" json:"l2TokenAddress" form:"l2_token_address"`
	Version                 int64          `gorm:"column:version" json:"version"`
	Timestamp               int64          `gorm:"column:timestamp" db:"timestamp" json:"timestamp" form:"timestamp"`
	TokenIds                string         `gorm:"column:token_ids" db:"token_ids" json:"tokenIds" form:"token_ids"`
	AssetType               int64          `gorm:"column:asset_type" db:"asset_type" json:"assetType" form:"asset_type"`
	TokenAmounts            string         `gorm:"column:token_amounts" db:"token_amounts" json:"tokenAmounts" form:"token_amounts"`
	ClaimedIndex            int64          `gorm:"column:claimed_index" db:"claimed_index" json:"claimed_index"`
}

type L2ToL1DB

type L2ToL1DB interface {
	L2ToL1View
	StoreL2ToL1Transactions(string, []L2ToL1) error
	UpdateTokenPairsAndAddress(chainId string, l2L1List []L2ToL1) error
	UpdateMessageHash(chainId string, l1L2List []L2ToL1) error
	UpdateReadyForProvedStatus(chainId string, blockTimestamp int64, fraudProofWindows time.Duration) error
	UpdateL1FinalizeStatus(chainId string, withdrawalHash common.Hash, finalizedL1EventGuid uuid.UUID) error
	UpdateTimeLeft(chainId string) error
	MarkL2ToL1TransactionWithdrawalProven(chainId string, l2L1List []L2ToL1) error
	MarkL2ToL1TransactionWithdrawalProvenV0(chainId string, l2L1List []L2ToL1) error
	MarkL2ToL1TransactionWithdrawalFinalized(chainId string, l2L1List []L2ToL1) error
	MarkL2ToL1TransactionWithdrawalFinalizedV0(chainId string, l2L1List []L2ToL1) error
	MarkL2ToL1TransactionMsgHashFinalized(chainId string, l2L1List []L2ToL1) error
	MarkL2ToL1TransactionMsgHashFinalizedV0(chainId string, l2L1List []L2ToL1) error
	UpdateL2ToL1ClaimedStatus(chainId string, l1L2 L2ToL1) error
}

func NewL21ToL1DB

func NewL21ToL1DB(db *gorm.DB) L2ToL1DB

type L2ToL1View

type L2ToL1View interface {
	L2ToL1List(string, string, int, int, string) ([]L2ToL1, int64)
	L1LatestBlockHeader(l2chainId, destChainId string) (*common2.BlockHeader, error)
	L2LatestBlockHeader(chainId string) (*common2.BlockHeader, error)
	L2ToL1TransactionWithdrawal(string, common.Hash) (*L2ToL1, error)
	L2ToL1TransactionMsgHash(string, common.Hash) (*L2ToL1, error)
	GetBlockNumberFromHash(chainId string, blockHash common.Hash) (*big.Int, error)
	L1LatestFinalizedBlockHeader(l2chainId, l1chainId string) (*common2.BlockHeader, error)
	L2LatestFinalizedBlockHeader(chainId string) (*common2.BlockHeader, error)
}

type StateRoot

type StateRoot struct {
	GUID              uuid.UUID   `gorm:"primaryKey;DEFAULT replace(uuid_generate_v4()::text,'-','';serializer:uuid" json:"guid"`
	BlockHash         common.Hash `gorm:"serializer:bytes;column:block_hash;primaryKey" json:"blockHash"`
	TransactionHash   common.Hash `gorm:"serializer:bytes;column:transaction_hash" json:"transactionHash"`
	L1BlockNumber     *big.Int    `gorm:"serializer:u256" json:"l1BlockNumber"`
	L2BlockNumber     *big.Int    `gorm:"serializer:u256" json:"l2BlockNumber"`
	OutputIndex       *big.Int    `gorm:"serializer:u256" json:"outputIndex"`
	PrevTotalElements *big.Int    `gorm:"serializer:u256" json:"prevTotalElements"`
	Status            int         `json:"status"`
	OutputRoot        string      `json:"outputRoot"`
	Canonical         bool        `json:"canonical"`
	BatchSize         *big.Int    `gorm:"serializer:u256" json:"batchSize"`
	Timestamp         uint64      `json:"timestamp"`
	BlockSize         uint64      `json:"blockSize"`
}

type StateRootDB

type StateRootDB interface {
	StateRootView
	StoreBatchStateRoots(string, []StateRoot) error
}

func NewStateRootDB

func NewStateRootDB(db *gorm.DB) StateRootDB

type StateRootView

type StateRootView interface {
	StateRootL1BlockHeader(chainId, l1ChainId string) (*common2.BlockHeader, error)
	StateRootList(string, int, int, string) ([]StateRoot, int64)
	GetLatestStateRootL2BlockNumber(chainId string) (uint64, error)
	UpdateSafeStatus(chainId string, safeBlockNumber *big.Int) error
	UpdateFinalizedStatus(chainId string, finalizedBlockNumber *big.Int) error
}

Jump to

Keyboard shortcuts

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