model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package model holds all the models for the database.

Index

Constants

This section is empty.

Variables

View Source
var (
	// TransactionIDFieldName is the field name of the transactionID.
	TransactionIDFieldName string
	// ContractAddressFieldName is the field name of the contract address.
	ContractAddressFieldName string
	// ChainIDFieldName is the field name of the chain id.
	ChainIDFieldName string
	// AddressFieldName is the field name of the address.
	AddressFieldName string
	// BlockNumberFieldName is the field name of the block number.
	BlockNumberFieldName string
	// TokenIDFieldName is the field name of the token id, used in the token and balance tables.
	TokenIDFieldName string
	// SymbolFieldName is the field name of the symbol for the token table.
	SymbolFieldName string
	// NameFieldName is the field name of the name for the token table.
	NameFieldName string
	// DecimalsFieldName is the field name of the decimals for the token table.
	DecimalsFieldName string
)

Functions

func GetAllModels

func GetAllModels() (allModels []interface{})

GetAllModels gets all models to migrate.

Types

type DeadlineQueue

type DeadlineQueue struct {
	Timestamp     int64
	TransactionID string `gorm:"column:transaction_id;primaryKey"`
}

DeadlineQueue is the underlying table in the deadline queue.

type DestinationBridgeEvent

type DestinationBridgeEvent struct {
	TransactionID string `gorm:"column:transaction_id;primaryKey"`
	Request       string
	OriginChainID uint32
	DestChainID   uint32
	BlockNumber   uint64
	TxHash        string
	TxIndex       uint
	BlockHash     string
	LogIndex      uint
	Removed       bool
}

DestinationBridgeEvent is the table that holds every destination fast bridge transaction (relay).

type LastIndexed

type LastIndexed struct {
	gorm.Model
	// ContractAddress is the contract address
	ContractAddress string `gorm:"column:contract_address;index:idx_last_indexed,priority:1;uniqueIndex:idx_contract_chain"`
	// BlockNumber is the last block number indexed.
	// NOTE: SQLite's max int is below the max uint64 in golang. However, we can assume that no chain will have over 9 quintillion blocks.
	BlockNumber uint64 `gorm:"column:block_number;index:idx_last_indexed,priority:2"`
	// ChainID is the chain id of the contract
	ChainID uint32 `gorm:"column:chain_id;index:idx_last_indexed;uniqueIndex:idx_contract_chain"`
}

LastIndexed contains information on when a contract was last indexed.

type OriginBridgeEvent

type OriginBridgeEvent struct {
	TransactionID string `gorm:"column:transaction_id;primaryKey"`
	Request       string
	OriginChainID uint32
	DestChainID   uint32
	OriginSender  string
	DestRecipient string
	OriginToken   string
	DestToken     string
	OriginAmount  string
	DestAmount    string
	Deadline      string
	Nonce         string
	BlockNumber   uint64
	TxHash        string
	TxIndex       uint
	BlockHash     string
	LogIndex      uint
	Removed       bool
}

OriginBridgeEvent is the table that holds every origin fast bridge transaction (bridge).

type Token

type Token struct {
	TokenID  string `gorm:"column:token_id;primaryKey"` // Hash of ChainID and TokenAddress
	ChainID  uint32
	Address  string
	Symbol   string
	Name     string
	Decimals int
}

Token holds token metadata.

Jump to

Keyboard shortcuts

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