model

package
v0.0.0-...-50fcca9 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeenRequest    TxPhase = 0
	ConfirmRequest TxPhase = 1
	AckRequest     TxPhase = 2

	TxStatusInit      TxStatus = 0
	TxStatusConfirmed TxStatus = 1

	FillTxCreated FillTxStatus = 0
	FillTxSent    FillTxStatus = 1
	FillTxSuccess FillTxStatus = 2
	FillTxFailed  FillTxStatus = 3
	FillTxMissing FillTxStatus = 4

	FillRetryTxCreated FillRetryTxStatus = 0
	FillRetryTxSent    FillRetryTxStatus = 1
	FillRetryTxSuccess FillRetryTxStatus = 2
	FillRetryTxFailed  FillRetryTxStatus = 3
	FillRetryTxMissing FillRetryTxStatus = 4
)

Variables

This section is empty.

Functions

func InitTables

func InitTables(db *gorm.DB)

Types

type BlockLog

type BlockLog struct {
	Id         int64
	Chain      string `gorm:"not null;index:block_log_chain"`
	BlockHash  string `gorm:"not null;index:block_log_block_hash"`
	ParentHash string `gorm:"not null;index:block_log_parent_hash"`
	Height     int64  `gorm:"not null;index:block_log_height"`
	BlockTime  int64
	CreateTime int64
}

func (*BlockLog) BeforeCreate

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

func (BlockLog) TableName

func (BlockLog) TableName() string

type FillRetryTxStatus

type FillRetryTxStatus int

type FillTxStatus

type FillTxStatus int

type RetrySwap

type RetrySwap struct {
	gorm.Model

	Status      common.RetrySwapStatus `gorm:"not null"`
	SwapID      uint                   `gorm:"not null"`
	Direction   common.SwapDirection   `gorm:"not null"`
	StartTxHash string                 `gorm:"not null;index:retry_swap_start_tx_hash"`
	FillTxHash  string                 `gorm:"not null"`
	Sponsor     string                 `gorm:"not null;index:retry_swap_sponsor"`
	BEP20Addr   string                 `gorm:"not null;index:retry_swap_bep20_addr"`
	ERC20Addr   string                 `gorm:"not null;index:retry_swap_erc20_addr"`
	Symbol      string                 `gorm:"not null"`
	Amount      string                 `gorm:"not null"`
	Decimals    int                    `gorm:"not null"`

	RecordHash string `gorm:"not null"`
	ErrorMsg   string
}

func (RetrySwap) TableName

func (RetrySwap) TableName() string

type RetrySwapTx

type RetrySwapTx struct {
	gorm.Model

	RetrySwapID         uint                 `gorm:"not null;index:retry_swap_tx_retry_swap_id"`
	StartTxHash         string               `gorm:"not null;index:retry_swap_tx_start_tx_hash"`
	Direction           common.SwapDirection `gorm:"not null"`
	TrackRetryCounter   int64
	RetryFillSwapTxHash string            `gorm:"not null"`
	Status              FillRetryTxStatus `gorm:"not null"`
	ErrorMsg            string            `gorm:"not null"`
	GasPrice            string
	ConsumedFeeAmount   string
	Height              int64
}

func (RetrySwapTx) TableName

func (RetrySwapTx) TableName() string

type Swap

type Swap struct {
	gorm.Model

	Status common.SwapStatus `gorm:"not null;index:swap_status"`
	// the user addreess who start this swap
	Sponsor string `gorm:"not null;index:swap_sponsor"`

	BEP20Addr string `gorm:"not null;index:swap_bep20_addr"`
	ERC20Addr string `gorm:"not null;index:swap_erc20_addr"`
	Symbol    string
	Amount    string               `gorm:"not null;index:swap_amount"`
	Decimals  int                  `gorm:"not null"`
	Direction common.SwapDirection `gorm:"not null;index:swap_direction"`

	// The tx hash confirmed deposit
	StartTxHash string `gorm:"not null;index:swap_start_tx_hash"`
	// The tx hash confirmed withdraw
	FillTxHash string `gorm:"not null;index:swap_fill_tx_hash"`

	// used to log more message about how this swap failed or invalid
	Log string

	RecordHash string `gorm:"not null"`
}

func (Swap) TableName

func (Swap) TableName() string

type SwapFillTx

type SwapFillTx struct {
	gorm.Model

	Direction         common.SwapDirection `gorm:"not null"`
	StartSwapTxHash   string               `gorm:"not null;index:swap_fill_tx_start_swap_tx_hash"`
	FillSwapTxHash    string               `gorm:"not null;index:swap_fill_tx_fill_swap_tx_hash"`
	GasPrice          string               `gorm:"not null"`
	ConsumedFeeAmount string
	Height            int64
	Status            FillTxStatus `gorm:"not null"`
	TrackRetryCounter int64
}

func (SwapFillTx) TableName

func (SwapFillTx) TableName() string

type SwapPair

type SwapPair struct {
	gorm.Model
	Sponsor    string `gorm:"not null;index:sponsor"`
	Symbol     string `gorm:"not null;index:symbol"`
	Name       string `gorm:"not null"`
	Decimals   int    `gorm:"not null"`
	BEP20Addr  string `gorm:"not null"`
	ERC20Addr  string `gorm:"not null"`
	Available  bool   `gorm:"not null;index:available"`
	LowBound   string `gorm:"not null"`
	UpperBound string `gorm:"not null"`
	IconUrl    string

	RecordHash string `gorm:"not null"`
}

func (SwapPair) TableName

func (SwapPair) TableName() string

type SwapPairCreatTx

type SwapPairCreatTx struct {
	gorm.Model

	SwapPairRegisterTxHash string `gorm:"unique;not null"`
	SwapPairCreatTxHash    string `gorm:"unique;not null"`

	ERC20Addr string `gorm:"not null"`

	Symbol   string `gorm:"not null;index:swap_pair_creat_tx_symbol"`
	Name     string `gorm:"not null"`
	Decimals int    `gorm:"not null"`

	GasPrice          string `gorm:"not null"`
	ConsumedFeeAmount string
	Height            int64
	Status            FillTxStatus `gorm:"not null"`
	TrackRetryCounter int64
}

func (SwapPairCreatTx) TableName

func (SwapPairCreatTx) TableName() string

type SwapPairRegisterTxLog

type SwapPairRegisterTxLog struct {
	Id    int64
	Chain string `gorm:"not null;index:swappair_register_tx_log_chain"`

	Sponsor   string `gorm:"not null"`
	ERC20Addr string `gorm:"not null"`
	Symbol    string `gorm:"not null;index:swappair_register_tx_log_symbol"`
	Name      string `gorm:"not null"`
	Decimals  int    `gorm:"not null"`

	Status       TxStatus `gorm:"not null;index:swappair_register_tx_log_status"`
	TxHash       string   `gorm:"not null;index:swappair_register_tx_log_tx_hash"`
	BlockHash    string   `gorm:"not null"`
	Height       int64    `gorm:"not null"`
	ConfirmedNum int64    `gorm:"not null"`

	Phase TxPhase `gorm:"not null;index:swappair_register_tx_log_phase"`

	UpdateTime int64
	CreateTime int64
}

func (*SwapPairRegisterTxLog) BeforeCreate

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

func (SwapPairRegisterTxLog) TableName

func (SwapPairRegisterTxLog) TableName() string

type SwapPairStateMachine

type SwapPairStateMachine struct {
	gorm.Model

	Status common.SwapPairStatus `gorm:"not null;index:swap_pair_sm_status"`

	ERC20Addr string `gorm:"not null"`
	BEP20Addr string

	Sponsor  string `gorm:"not null"`
	Symbol   string `gorm:"not null;index:swap_pair_sm_symbol"`
	Name     string `gorm:"not null"`
	Decimals int    `gorm:"not null"`

	PairRegisterTxHash string `gorm:"not null"`
	PairCreatTxHash    string

	// used to log more message about how this swap_pair failed or invalid
	Log string

	RecordHash string `gorm:"not null"`
}

func (SwapPairStateMachine) TableName

func (SwapPairStateMachine) TableName() string

type SwapStartTxLog

type SwapStartTxLog struct {
	Id    int64
	Chain string `gorm:"not null;index:swap_start_tx_log_chain"`

	TokenAddr   string `gorm:"not null"`
	FromAddress string `gorm:"not null"`
	Amount      string `gorm:"not null"`
	FeeAmount   string `gorm:"not null"`

	Status       TxStatus `gorm:"not null;index:swap_start_tx_log_status"`
	TxHash       string   `gorm:"not null;index:swap_start_tx_log_tx_hash"`
	BlockHash    string   `gorm:"not null"`
	Height       int64    `gorm:"not null"`
	ConfirmedNum int64    `gorm:"not null"`

	Phase TxPhase `gorm:"not null;index:swap_start_tx_log_phase"`

	UpdateTime int64
	CreateTime int64
}

func (*SwapStartTxLog) BeforeCreate

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

func (SwapStartTxLog) TableName

func (SwapStartTxLog) TableName() string

type TxPhase

type TxPhase int

type TxStatus

type TxStatus int

Jump to

Keyboard shortcuts

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