Files
assetx/webapp-back/models/collateral_buy.go
default 2ee4553b71 init: 初始化 AssetX 项目仓库
包含 webapp(Next.js 用户端)、webapp-back(Go 后端)、
antdesign(管理后台)、landingpage(营销落地页)、
数据库 SQL 和配置文件。
2026-03-27 11:26:43 +00:00

23 lines
1.1 KiB
Go

package models
import "time"
// CollateralBuyRecord records each collateral purchase made by the buyer bot
type CollateralBuyRecord struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
ChainID int `gorm:"index" json:"chain_id"`
TxHash string `gorm:"size:66;uniqueIndex" json:"tx_hash"`
BuyerAddr string `gorm:"size:42" json:"buyer_addr"`
AssetAddr string `gorm:"size:42;index" json:"asset_addr"`
AssetSymbol string `gorm:"size:50" json:"asset_symbol"`
PaidAmount string `gorm:"size:78" json:"paid_amount"` // USDC paid, base units
ReceivedAmount string `gorm:"size:78" json:"received_amount"` // collateral received, base units
GasUsed uint64 `json:"gas_used"`
BlockNumber uint64 `json:"block_number"`
Status string `gorm:"size:20;default:'success'" json:"status"` // success / failed
ErrorMessage string `gorm:"type:text" json:"error_message,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
func (CollateralBuyRecord) TableName() string { return "collateral_buy_records" }