common

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ETH = 0
	ETH  = 0
	WETH = 1
	// ERC20 = 1
	ERC20 = 20
	// ERC721 = 2
	ERC721 = 721
	// ERC1155 = 3
	ERC1155 = 1155
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetType

type AssetType int

AssetType can be ETH/ERC20/ERC1155/ERC721

func (AssetType) String

func (a AssetType) String() string

type BlockHeader

type BlockHeader struct {
	GUID       uuid.UUID   `gorm:"primaryKey;DEFAULT replace(uuid_generate_v4()::text,'-','');serializer:uuid"`
	Hash       common.Hash `gorm:"primaryKey;serializer:bytes"`
	ParentHash common.Hash `gorm:"serializer:bytes"`
	Number     *big.Int    `gorm:"serializer:u256"`
	Timestamp  uint64
	RLPHeader  *common2.RLPHeader `gorm:"serializer:rlp;column:rlp_bytes"`
}

func BlockHeaderFromHeader

func BlockHeaderFromHeader(header *types.Header) BlockHeader

type BlocksDB

type BlocksDB interface {
	BlocksView
	StoreBlockHeaders(string, []ChainBlockHeader) error
}

func NewBlocksDB

func NewBlocksDB(db *gorm.DB) BlocksDB

type BlocksView

type BlocksView interface {
	ChainBlockHeader(string, common.Hash) (*BlockHeader, error)
	ChainBlockHeaderWithFilter(string, BlockHeader) (*BlockHeader, error)
	ChainBlockHeaderWithScope(func(db *gorm.DB) *gorm.DB, string) (*BlockHeader, error)
	ChainLatestBlockHeader(string) (*BlockHeader, error)

	LatestObservedEpochForChain(string, *big.Int, uint64) (*BlockHeader, error)

	BlockTimeStampByNum(string, uint64) (int64, error)

	CleanBlockHerders(chainId string) error
}

type ChainBlockHeader

type ChainBlockHeader struct {
	BlockHeader `gorm:"embedded"`
}

type MsgType

type MsgType int

MsgType can be layer1/layer2 msg

const (
	// UnknownMsg = 0
	UnknownMsg MsgType = iota
	// Layer1Msg = 1
	Layer1Msg
	// Layer2Msg = 2
	Layer2Msg
)

Jump to

Keyboard shortcuts

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