23 lines
1.1 KiB
Go
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" }
|