store

package
v0.0.0-...-11a4fed Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTables

func InitTables(db *gorm.DB)

Types

type BlockLog

type BlockLog struct {
	Id         int64
	Chain      string
	BlockHash  string
	ParentHash string
	Height     int64
	BlockTime  int64
	CreateTime int64
}

func (*BlockLog) BeforeCreate

func (l *BlockLog) BeforeCreate() (err error)

func (BlockLog) TableName

func (BlockLog) TableName() string

type Swap

type Swap struct {
	Id   int64
	Type SwapType
	// bnb chain swap id should be hex encoded bytes without '0x' prefix
	BnbChainSwapId string
	// other chain swap id should be hex encoded bytes without '0x' prefix
	OtherChainSwapId string
	SenderAddr       string
	ReceiverAddr     string
	OtherChainAddr   string
	InAmount         string
	OutAmount        string
	DeputyOutAmount  string
	RandomNumberHash string `gorm:"not null"`
	ExpireHeight     int64
	Height           int64
	Timestamp        int64
	RandomNumber     string
	Status           SwapStatus
	CreateTime       int64
	UpdateTime       int64
}

func (*Swap) BeforeCreate

func (t *Swap) BeforeCreate() (err error)

func (Swap) TableName

func (Swap) TableName() string

type SwapStatus

type SwapStatus string
const (
	SwapStatusOtherHTLTConfirmed    SwapStatus = "OTHER_HTLT_CONFIRMED"
	SwapStatusOtherHTLTSent         SwapStatus = "OTHER_HTLT_SENT"
	SwapStatusOtherHTLTExpired      SwapStatus = "OTHER_HTLT_EXPIRED"
	SwapStatusOtherHTLTSentFailed   SwapStatus = "OTHER_HTLT_SENT_FAILED"
	SwapStatusOtherClaimSent        SwapStatus = "OTHER_CLAIM_SENT"
	SwapStatusOtherClaimConfirmed   SwapStatus = "OTHER_CLAIM_CONFIRMED"
	SwapStatusOtherClaimSentFailed  SwapStatus = "OTHER_CLAIM_SENT_FAILED"
	SwapStatusOtherRefundSent       SwapStatus = "OTHER_REFUND_SENT"
	SwapStatusOtherRefundConfirmed  SwapStatus = "OTHER_REFUND_CONFIRMED"
	SwapStatusOtherRefundSentFailed SwapStatus = "OTHER_REFUND_SENT_FAILED"

	SwapStatusBEP2HTLTSent         SwapStatus = "BEP2_HTLT_SENT"
	SwapStatusBEP2HTLTConfirmed    SwapStatus = "BEP2_HTLT_CONFIRMED"
	SwapStatusBEP2HTLTExpired      SwapStatus = "BEP2_HTLT_EXPIRED"
	SwapStatusBEP2HTLTSentFailed   SwapStatus = "BEP2_HTLT_SENT_FAILED"
	SwapStatusBEP2ClaimConfirmed   SwapStatus = "BEP2_CLAIM_CONFIRMED"
	SwapStatusBEP2ClaimSent        SwapStatus = "BEP2_CLAIM_SENT"
	SwapStatusBEP2ClaimSentFailed  SwapStatus = "BEP2_CLAIM_SENT_FAILED"
	SwapStatusBEP2RefundSent       SwapStatus = "BEP2_REFUND_SENT"
	SwapStatusBEP2RefundConfirmed  SwapStatus = "BEP2_REFUND_CONFIRMED"
	SwapStatusBEP2RefundSentFailed SwapStatus = "BEP2_REFUND_SENT_FAILED"

	SwapStatusRejected SwapStatus = "REJECTED"
)

type SwapType

type SwapType string
const (
	SwapTypeOtherToBEP2 SwapType = "OTHER_TO_BEP2"
	SwapTypeBEP2ToOther SwapType = "BEP2_TO_OTHER"
)

type TxLog

type TxLog struct {
	Id    int64
	Chain string
	// swap id should be hex encoded bytes without '0x' prefix
	SwapId       string
	TxType       TxType
	TxHash       string
	ContractAddr string
	// sender address should be encoded by each executor
	SenderAddr string
	// receiver address should be encoded by each executor
	ReceiverAddr     string
	SenderOtherChain string
	OtherChainAddr   string
	InAmount         string
	OutAmount        string
	OutCoin          string
	// random number hash should be hex encoded bytes without '0x' prefix
	RandomNumberHash string
	ExpireHeight     int64
	Timestamp        int64
	RandomNumber     string
	BlockHash        string
	Height           int64
	Status           TxLogStatus
	ConfirmedNum     int64
	CreateTime       int64
	UpdateTime       int64
}

func (*TxLog) BeforeCreate

func (t *TxLog) BeforeCreate() (err error)

func (TxLog) TableName

func (TxLog) TableName() string

type TxLogStatus

type TxLogStatus string
const (
	TxStatusInit      TxLogStatus = "INIT"
	TxStatusConfirmed TxLogStatus = "CONFIRMED"
)

type TxSent

type TxSent struct {
	Id               int64    `json:"id"`
	Chain            string   `json:"chain"`
	SwapId           string   `json:"swap_id"`
	Type             TxType   `json:"type"`
	TxHash           string   `json:"tx_hash"`
	RandomNumberHash string   `json:"random_number_hash"`
	ErrMsg           string   `json:"err_msg"`
	Status           TxStatus `json:"status"`
	CreateTime       int64    `json:"create_time"`
	UpdateTime       int64    `json:"update_time"`
}

func (*TxSent) BeforeCreate

func (t *TxSent) BeforeCreate() (err error)

func (TxSent) TableName

func (TxSent) TableName() string

type TxStatus

type TxStatus string
const (
	TxSentStatusInit     TxStatus = "INIT"
	TxSentStatusNotFound TxStatus = "NOT_FOUND"
	TxSentStatusPending  TxStatus = "PENDING"
	TxSentStatusFailed   TxStatus = "FAILED"
	TxSentStatusSuccess  TxStatus = "SUCCESS"
	TxSentStatusLost     TxStatus = "LOST"
)

type TxType

type TxType string
const (
	TxTypeOtherHTLT   TxType = "OTHER_HTLT"
	TxTypeOtherClaim  TxType = "OTHER_CLAIM"
	TxTypeOtherRefund TxType = "OTHER_REFUND"
	TxTypeBEP2HTLT    TxType = "BEP2_HTLT"
	TxTypeBEP2Claim   TxType = "BEP2_CLAIM"
	TxTypeBEP2Refund  TxType = "BEP2_REFUND"
)

Jump to

Keyboard shortcuts

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