init: 初始化 AssetX 项目仓库
包含 webapp(Next.js 用户端)、webapp-back(Go 后端)、 antdesign(管理后台)、landingpage(营销落地页)、 数据库 SQL 和配置文件。
This commit is contained in:
43
webapp-back/models/holder.go
Normal file
43
webapp-back/models/holder.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// HolderSnapshot represents token holders data from blockchain
|
||||
type HolderSnapshot struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
HolderAddress string `gorm:"size:42;not null;index:idx_holder_token" json:"holder_address"`
|
||||
TokenType string `gorm:"size:50;not null;index:idx_holder_token,idx_token_time" json:"token_type"`
|
||||
TokenAddress string `gorm:"size:42;not null" json:"token_address"`
|
||||
Balance string `gorm:"type:varchar(78);not null" json:"balance"`
|
||||
ChainID int `gorm:"not null" json:"chain_id"`
|
||||
FirstSeen int64 `gorm:"not null" json:"first_seen"`
|
||||
LastUpdated int64 `gorm:"not null;index:idx_token_time" json:"last_updated"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (HolderSnapshot) TableName() string {
|
||||
return "holder_snapshots"
|
||||
}
|
||||
|
||||
// HolderStats represents aggregated statistics for each token type
|
||||
type HolderStats struct {
|
||||
TokenType string `json:"token_type"`
|
||||
HolderCount int `json:"holder_count"`
|
||||
TotalBalance string `json:"total_balance,omitempty"`
|
||||
}
|
||||
|
||||
// ScannerState persists scanner progress so it can resume after restart
|
||||
type ScannerState struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement"`
|
||||
ScannerType string `gorm:"column:scanner_type;not null;default:'holder';uniqueIndex:idx_chain_scanner"`
|
||||
ChainID int `gorm:"column:chain_id;uniqueIndex:idx_chain_scanner;not null"`
|
||||
LastScannedBlock uint64 `gorm:"column:last_scanned_block;not null;default:0"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at"`
|
||||
}
|
||||
|
||||
func (ScannerState) TableName() string {
|
||||
return "scanner_state"
|
||||
}
|
||||
Reference in New Issue
Block a user