Documentation
¶
Index ¶
- type AddressType
- type Addresses
- type AddressesDB
- type AddressesView
- type Balances
- type BalancesDB
- type BalancesView
- type Blocks
- type BlocksDB
- type BlocksView
- type Business
- type BusinessDB
- type BusinessView
- type CreateTableDB
- type DB
- type Deposits
- type DepositsDB
- type DepositsView
- type GasInfo
- type Internals
- type InternalsDB
- type InternalsView
- type ReorgBlocks
- type ReorgBlocksDB
- type ReorgBlocksView
- type TokenBalance
- type TokenType
- type Tokens
- type TokensDB
- type TokensView
- type TransactionType
- type Transactions
- type TransactionsDB
- type TransactionsView
- type TxStatus
- type Withdraws
- type WithdrawsDB
- type WithdrawsView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressType ¶
type AddressType string
const ( AddressTypeUser AddressType = "user" AddressTypeHot AddressType = "hot" AddressTypeCold AddressType = "cold" )
func ParseAddressType ¶
func ParseAddressType(s string) (AddressType, error)
func (AddressType) String ¶
func (at AddressType) String() string
type Addresses ¶
type Addresses struct {
GUID uuid.UUID `gorm:"primary_key" json:"guid"`
Address string `gorm:"type:varchar;unique;not null;" json:"address"`
AddressType AddressType `gorm:"type:varchar(10);not null;default:'user'" json:"address_type"`
PublicKey string `gorm:"type:varchar;not null" json:"public_key"`
Timestamp uint64 `gorm:"type:bigint;not null;check:timestamp > 0" json:"timestamp"`
}
type AddressesDB ¶
type AddressesDB interface {
AddressesView
StoreAddresses(string, []*Addresses) error
}
func NewAddressesDB ¶
func NewAddressesDB(db *gorm.DB) AddressesDB
type AddressesView ¶
type AddressesView interface {
AddressExist(requestId string, address string) (bool, AddressType)
QueryAddressesByToAddress(string, string) (*Addresses, error)
QueryHotWalletInfo(string) (*Addresses, error)
QueryColdWalletInfo(string) (*Addresses, error)
GetAllAddresses(string) ([]*Addresses, error)
}
type Balances ¶
type Balances struct {
GUID uuid.UUID `gorm:"primary_key" json:"guid"`
Address string `gorm:"type:varchar;not null" json:"address"`
TokenAddress string `gorm:"type:varchar;not null" json:"token_address"`
AddressType AddressType `gorm:"type:varchar(10);not null;default:'eoa'" json:"address_type"`
Balance *big.Int `gorm:"type:numeric;not null;default:0;check:balance >= 0;serializer:u256" json:"balance"`
LockBalance *big.Int `gorm:"type:numeric;not null;default:0;serializer:u256" json:"lock_balance"`
Timestamp uint64 `gorm:"type:bigint;not null;check:timestamp > 0" json:"timestamp"`
}
type BalancesDB ¶
type BalancesDB interface {
BalancesView
UpdateOrCreate(string, []*TokenBalance) error
StoreBalances(string, []*Balances) error
UpdateBalanceListByTwoAddress(string, []*Balances) error
UpdateBalance(string, *Balances) error
}
func NewBalancesDB ¶
func NewBalancesDB(db *gorm.DB) BalancesDB
type BalancesView ¶
type BalancesView interface {
QueryWalletBalanceByTokenAndAddress(
requestId string,
addressType AddressType,
address,
tokenAddress string,
) (*Balances, error)
}
type BlocksDB ¶
type BlocksDB interface {
BlocksView
StoreBlockss([]Blocks) error
DeleteBlocksByNumber(blockHeader []Blocks) error
}
func NewBlocksDB ¶
type BlocksView ¶
type BusinessDB ¶
type BusinessDB interface {
BusinessView
StoreBusiness(*Business) error
}
func NewBusinessDB ¶
func NewBusinessDB(db *gorm.DB) BusinessDB
type BusinessView ¶
type CreateTableDB ¶
type CreateTableDB interface {
CreateTable(tableName, realTableName string)
}
func NewCreateTableDB ¶
func NewCreateTableDB(db *gorm.DB) CreateTableDB
type DB ¶
type DB struct {
CreateTable CreateTableDB
Blocks BlocksDB
ReorgBlocks ReorgBlocksDB
Addresses AddressesDB
Balances BalancesDB
Deposits DepositsDB
Withdraws WithdrawsDB
Transactions TransactionsDB
Tokens TokensDB
Business BusinessDB
Internals InternalsDB
// contains filtered or unexported fields
}
func (*DB) ExecuteSQLMigration ¶
type Deposits ¶
type Deposits struct {
GUID uuid.UUID `gorm:"primaryKey;type:varchar(36)" json:"guid"`
Timestamp uint64 `gorm:"not null;check:timestamp > 0" json:"timestamp"`
Status TxStatus `gorm:"type:varchar(10);not null" json:"status"`
Confirms uint8 `gorm:"not null;default:0" json:"confirms"`
BlockHash string `gorm:"type:varchar;not null" json:"block_hash"`
BlockNumber *big.Int `gorm:"not null;check:block_number > 0;serializer:u256" json:"block_number"`
TxHash string `gorm:"column:hash;type:varchar;not null" json:"hash"`
TxType TransactionType `gorm:"type:varchar;not null" json:"tx_type"`
FromAddress string `gorm:"type:varchar;not null" json:"from_address"`
ToAddress string `gorm:"type:varchar;not null" json:"to_address"`
Amount *big.Int `gorm:"not null;serializer:u256" json:"amount"`
GasLimit uint64 `gorm:"not null" json:"gas_limit"`
MaxFeePerGas string `gorm:"type:varchar;not null" json:"max_fee_per_gas"`
MaxPriorityFeePerGas string `gorm:"type:varchar;not null" json:"max_priority_fee_per_gas"`
TokenType TokenType `gorm:"type:varchar;not null" json:"token_type"`
TokenAddress string `gorm:"type:varchar;not null" json:"token_address"`
TokenId string `gorm:"type:varchar;not null" json:"token_id"`
TokenMeta string `gorm:"type:varchar;not null" json:"token_meta"`
TxSignHex string `gorm:"type:varchar;not null" json:"tx_sign_hex"`
}
type DepositsDB ¶
type DepositsDB interface {
DepositsView
StoreDeposits(string, []*Deposits) error
UpdateDepositsComfirms(requestId string, blockNumber uint64, confirms uint64) error
UpdateDepositById(requestId string, guid string, signedTx string, status TxStatus) error
UpdateDepositsStatusById(requestId string, status TxStatus, depositList []*Deposits) error
UpdateDepositsStatusByTxHash(requestId string, status TxStatus, depositList []*Deposits) error
UpdateDepositListByTxHash(requestId string, depositList []*Deposits) error
UpdateDepositListById(requestId string, depositList []*Deposits) error
HandleFallBackDeposits(requestId string, startBlock, EndBlock *big.Int) error
}
func NewDepositsDB ¶
func NewDepositsDB(db *gorm.DB) DepositsDB
type DepositsView ¶
type Internals ¶
type Internals struct {
GUID uuid.UUID `gorm:"primaryKey" json:"guid"`
Timestamp uint64 `json:"timestamp"`
Status TxStatus `json:"status" gorm:"column:status"`
BlockHash string `gorm:"column:block_hash" json:"block_hash"`
BlockNumber *big.Int `gorm:"serializer:u256;column:block_number" json:"block_number"`
TxHash string `gorm:"column:hash" json:"hash"`
TxType TransactionType `json:"tx_type" gorm:"column:tx_type"`
FromAddress string `json:"from_address"`
ToAddress string `json:"to_address"`
Amount *big.Int `gorm:"serializer:u256;column:amount" json:"amount"`
GasLimit uint64 `json:"gas_limit"`
MaxFeePerGas string `json:"max_fee_per_gas"`
MaxPriorityFeePerGas string `json:"max_priority_fee_per_gas"`
TokenType TokenType `json:"token_type" gorm:"column:token_type"` // ETH, ERC20, ERC721, ERC1155
TokenAddress string `json:"token_address"`
TokenId string `json:"token_id" gorm:"column:token_id"` // ERC721/ERC1155 的 token ID
TokenMeta string `json:"token_meta" gorm:"column:token_meta"` // Token 元数据
TxSignHex string `json:"tx_sign_hex" gorm:"column:tx_sign_hex"`
}
type InternalsDB ¶
type InternalsDB interface {
InternalsView
StoreInternal(string, *Internals) error
UpdateInternalByTxHash(requestId string, txHash string, signedTx string, status TxStatus) error
UpdateInternalById(requestId string, id string, signedTx string, status TxStatus) error
UpdateInternalStatusByTxHash(requestId string, status TxStatus, internalsList []*Internals) error
UpdateInternalListByHash(requestId string, internalsList []*Internals) error
UpdateInternalListById(requestId string, internalsList []*Internals) error
HandleFallBackInternals(requestId string, startBlock, EndBlock *big.Int) error
}
func NewInternalsDB ¶
func NewInternalsDB(db *gorm.DB) InternalsDB
type InternalsView ¶
type ReorgBlocks ¶
type ReorgBlocksDB ¶
type ReorgBlocksDB interface {
ReorgBlocksView
StoreReorgBlocks([]ReorgBlocks) error
}
func NewReorgBlocksDB ¶
func NewReorgBlocksDB(db *gorm.DB) ReorgBlocksDB
type ReorgBlocksView ¶
type ReorgBlocksView interface {
LatestReorgBlocks() (*rpcclient.BlockHeader, error)
}
type TokenBalance ¶
type Tokens ¶
type Tokens struct {
GUID uuid.UUID `gorm:"primaryKey" json:"guid"`
TokenAddress string `json:"token_address"`
Decimals uint8 `json:"uint"`
TokenName string `json:"tokens_name"`
CollectAmount *big.Int `gorm:"serializer:u256" json:"collect_amount"`
ColdAmount *big.Int `gorm:"serializer:u256" json:"cold_amount"`
Timestamp uint64 `json:"timestamp"`
}
type TokensDB ¶
type TokensDB interface {
TokensView
StoreTokens(string, []Tokens) error
}
func NewTokensDB ¶
type TokensView ¶
type TransactionType ¶
type TransactionType string
const ( TxTypeUnKnow TransactionType = "unknow" TxTypeDeposit TransactionType = "deposit" TxTypeWithdraw TransactionType = "withdraw" TxTypeCollection TransactionType = "collection" TxTypeHot2Cold TransactionType = "hot2cold" TxTypeCold2Hot TransactionType = "cold2hot" )
func ParseTransactionType ¶
func ParseTransactionType(s string) (TransactionType, error)
type Transactions ¶
type Transactions struct {
GUID uuid.UUID `gorm:"primaryKey" json:"guid"`
BlockHash string `gorm:"column:block_hash" db:"block_hash" json:"block_hash"`
BlockNumber *big.Int `gorm:"serializer:u256;column:block_number" db:"block_number" json:"BlockNumber" form:"block_number"`
Hash string `gorm:"column:hash" db:"hash" json:"hash"`
FromAddress string `json:"from_address"`
ToAddress string `json:"to_address"`
TokenAddress string `json:"token_address"`
TokenId string `json:"token_id" gorm:"column:token_id"`
TokenMeta string `json:"token_meta" gorm:"column:token_meta"`
Fee *big.Int `gorm:"serializer:u256;column:fee" db:"fee" json:"Fee" form:"fee"`
Amount *big.Int `gorm:"serializer:u256;column:amount" db:"amount" json:"Amount" form:"amount"`
Status account.TxStatus `json:"status"`
TxType TransactionType `json:"tx_type" gorm:"column:tx_type"`
Timestamp uint64
}
type TransactionsDB ¶
type TransactionsDB interface {
TransactionsView
StoreTransactions(string, []*Transactions, uint64) error
UpdateTransactionsStatus(requestId string, blockNumber *big.Int) error
UpdateTransactionStatus(requestId string, txList []*Transactions) error
HandleFallBackTransactions(requestId string, startBlock, EndBlock *big.Int) error
}
func NewTransactionsDB ¶
func NewTransactionsDB(db *gorm.DB) TransactionsDB
type TransactionsView ¶
type TransactionsView interface {
QueryTransactionByHash(requestId string, hash string) (*Transactions, error)
QueryFallBackTransactions(requestId string, startBlock, EndBlock *big.Int) ([]*Transactions, error)
}
type Withdraws ¶
type Withdraws struct {
GUID uuid.UUID `gorm:"primaryKey" json:"guid"`
Timestamp uint64 `json:"timestamp"`
Status TxStatus `json:"status" gorm:"column:status"`
BlockHash string `gorm:"column:block_hash" json:"block_hash"`
BlockNumber *big.Int `gorm:"serializer:u256;column:block_number" json:"block_number"`
TxHash string `gorm:"column:hash" json:"hash"`
TxType TransactionType `gorm:"column:tx_type" json:"tx_type"`
FromAddress string `gorm:"column:from_address" json:"from_address"`
ToAddress string `gorm:"column:to_address" json:"to_address"`
Amount *big.Int `gorm:"serializer:u256;column:amount" json:"amount"`
GasLimit uint64 `json:"gas_limit"`
MaxFeePerGas string `json:"max_fee_per_gas"`
MaxPriorityFeePerGas string `json:"max_priority_fee_per_gas"`
TokenType TokenType `json:"token_type" gorm:"column:token_type"` // ETH, ERC20, ERC721, ERC1155
TokenAddress string `json:"token_address" gorm:"column:token_address"`
TokenId string `json:"token_id" gorm:"column:token_id"` // ERC721/ERC1155 的 token ID
TokenMeta string `json:"token_meta" gorm:"column:token_meta"` // Token 元数据
// 交易签名
TxSignHex string `json:"tx_sign_hex" gorm:"column:tx_sign_hex"`
}
type WithdrawsDB ¶
type WithdrawsDB interface {
WithdrawsView
StoreWithdraw(requestId string, withdraw *Withdraws) error
UpdateWithdrawByTxHash(requestId string, txHash string, signedTx string, status TxStatus) error
UpdateWithdrawById(requestId string, guid string, signedTx string, status TxStatus) error
UpdateWithdrawStatusById(requestId string, status TxStatus, withdrawsList []*Withdraws) error
UpdateWithdrawStatusByTxHash(requestId string, status TxStatus, withdrawsList []*Withdraws) error
UpdateWithdrawListByTxHash(requestId string, withdrawsList []*Withdraws) error
UpdateWithdrawListById(requestId string, withdrawsList []*Withdraws) error
HandleFallBackWithdraw(requestId string, startBlock, EndBlock *big.Int) error
}
func NewWithdrawsDB ¶
func NewWithdrawsDB(db *gorm.DB) WithdrawsDB
type WithdrawsView ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.