exmodels

package module
v0.0.0-...-057538c Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

exchange-models

Documentation

Index

Constants

View Source
const (
	REASON_CODE_UNKNOWN          = 0
	REASON_CODE_FIX              = 1
	REASON_CODE_STRIKE_FEE       = 100
	REASON_CODE_STRIKE_ADD       = 110
	REASON_CODE_STRIKE_SUB       = 120
	REASON_CODE_STRIKE_UNLOCK    = 130
	REASON_CODE_ORDER_SUBMIT     = 600
	REASON_CODE_ORDER_CANCEL     = 610
	REASON_CODE_ORDER_FULLFILLED = 620
	REASON_CODE_WITHDRAW_LOCK    = 800
	REASON_CODE_WITHDRAW_UNLOCK  = 810
	REASON_CODE_DEPOSIT          = 1000
	REASON_CODE_WITHDRAW         = 2000
)
View Source
const (
	FUNS_UNLOCK_FUNDS //=1
	FUNS_LOCK_FUNDS
	FUNS_PLUS_FUNDS
	FUNS_SUB_FUNDS
	FUNS_UNLOCK_AND_SUB_FUNDS //=5
)
View Source
const (
	DEPOSIT_STATE_SUBMITTING = "submitting"
	DEPOSIT_STATE_CANCELLED  = "cancelled"
	DEPOSIT_STATE_SUBMITTED  = "submitted"
	DEPOSIT_STATE_REJECTED   = "rejected"
	DEPOSIT_STATE_ACCEPTED   = "accepted"
	DEPOSIT_STATE_CHECKED    = "checked"
	DEPOSIT_STATE_WARNING    = "warning"
)
View Source
const (
	PAYMENT_TX_STATE_UNCONFIRM  = "unconfirm"
	PAYMENT_TX_STATE_CONFIRMING = "confirming"
	PAYMENT_TX_STATE_CONFIRMED  = "confirmed"
)
View Source
const (
	WITH_REQ_STATE_CREATED    = "Created"
	WITH_REQ_STATE_APPROVED   = "Approved"
	WITH_REQ_STATE_SUSPECT    = "Suspect"
	WITH_REQ_STATE_PROCESSING = "Processing"
	WITH_REQ_STATE_DONE       = "Done"
)
View Source
const (
	WITH_TX_STATE_CREATED    = "Created"
	WITH_TX_STATE_PROCESSING = "Processing"
	WITH_TX_STATE_DONE       = "Done"
)
View Source
const (
	AUDITABLE_TYPE_DEPOSIT = "Deposit"
)
View Source
const (
	AUDITLOGS_TYPE_TRANSFER = "Audit::TransferAuditLog"
)
View Source
const PAYMENT_TX_TYPE_NORMAL = "PaymentTransaction::Normal"
View Source
const SN_LENGTH = 8
View Source
const SN_POSTFIX = "TIO"
View Source
const SN_PREFIX = "PEA"
View Source
const TOKEN_TYPE_ACTIVATION = "Token::Activation"
View Source
const TOKEN_TYPE_PASSWORD_RESET = "Token::PasswordReset"
View Source
const TOKEN_TYPE_PASSWORD_UPDATE = "Token::PasswordUpdate"
View Source
const TOKEN_TYPE_PHONE_2FA_CODE = "Token::Phone2FACode"
View Source
const TOKEN_TYPE_PHONE_CONFIRMATION = "Token::PhoneConfirmation"
View Source
const TOKEN_TYPE_REFRESH = "Token::Refresh"
View Source
const TOKEN_TYPE_WITHDRAW = "Token::Withdraw"
View Source
const TYPE_ACCOUNT = "Account"
View Source
const TYPE_DEPOSIT = "Deposit"
View Source
const TYPE_WITHDRAW = "Withdraw"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountVersions

type AccountVersions struct {
	Id             uint `gorm:"primary_key"`
	AccountId      uint
	MemberId       uint
	Reason         uint
	Balance        decimal.NullDecimal `sql:"type:decimal(32,16);"`
	Locked         decimal.NullDecimal `sql:"type:decimal(32,16);"`
	Fee            decimal.NullDecimal `sql:"type:decimal(32,16); default: null"`
	Amount         decimal.NullDecimal `sql:"type:decimal(32,16); default: null"`
	ModifiableId   uint
	ModifiableType string

	Currency uint
	Fun      uint8

	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`
}

func (*AccountVersions) BeforeCreate

func (this *AccountVersions) BeforeCreate() (err error)

func (*AccountVersions) BeforeUpdate

func (this *AccountVersions) BeforeUpdate() (err error)

type Accounts

type Accounts struct {
	Id       uint `gorm:"primary_key"`
	Currency uint
	Balance  decimal.NullDecimal `sql:"type:decimal(32,16);"`
	Locked   decimal.NullDecimal `sql:"type:decimal(32,16);"`
	In       decimal.NullDecimal `sql:"type:decimal(32,16); default: null"`
	Out      decimal.NullDecimal `sql:"type:decimal(32,16); default: null"`

	DefaultWithdrawFundSourceId uint `sql:"default: null"`

	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`

	//Member           Members            //belongs_to
	MemberId uint //belongs_to

}

func (*Accounts) BeforeCreate

func (this *Accounts) BeforeCreate() (err error)

func (*Accounts) BeforeUpdate

func (this *Accounts) BeforeUpdate() (err error)

type AuditLogs

type AuditLogs struct {
	Id            uint   `gorm:"primary_key"`
	Type          string `gorm:"size:255" sql:"default: null"`
	OperatorId    uint   `sql:"default: null"`
	AuditableId   uint   `sql:"default: null"`
	AuditableType string `gorm:"size:255" sql:"default: null"`
	SourceState   string `gorm:"size:255" sql:"default: null"`
	TargetState   string `gorm:"size:255" sql:"default: null"`

	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`
}

func (*AuditLogs) BeforeCreate

func (this *AuditLogs) BeforeCreate() (err error)

func (*AuditLogs) BeforeUpdate

func (this *AuditLogs) BeforeUpdate() (err error)

type BaseModel

type BaseModel struct {
	MySQLConnection *gorm.DB
}

type Currency

type Currency struct {
	Id            uint `gorm:"primary_key"`
	Title         string
	Code          string
	Unit          string
	UnitRatio     decimal.NullDecimal `sql:"type:decimal(32,16);"`
	IsCoin        bool
	IsToken       bool
	Confirmations uint8
}

type Deposits

type Deposits struct {
	Id                   uint `gorm:"primary_key"`
	Currency             uint
	Amount               decimal.NullDecimal `sql:"type:decimal(32,16);"`
	Fee                  decimal.NullDecimal `sql:"type:decimal(32,16);"`
	FundUid              string              `gorm:"size:255" sql:"default: null"`
	FundExtra            string              `gorm:"size:255" sql:"default: null"`
	Txid                 string              `gorm:"size:255" sql:"default: null"`
	State                uint                `sql:"default: 0"`
	AasmState            string              `gorm:"size:255" sql:"default: null"`
	Confirmations        uint                `sql:"default: null"`
	Type                 string              `gorm:"size:255" sql:"default: null"`
	PaymentTransactionId uint                `sql:"default: null"`
	Txout                uint                `sql:"default: 0"`

	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`
	DoneAt    *time.Time `sql:"default: null"`

	//Account   Accounts //belongs_to
	AccountId uint //belongs_to
	//Member    Members  //belongs_to
	MemberId uint //belongs_to
}

func (*Deposits) BeforeCreate

func (this *Deposits) BeforeCreate() (err error)

func (*Deposits) BeforeUpdate

func (this *Deposits) BeforeUpdate() (err error)

type Identities

type Identities struct {
	Id                uint   `gorm:"primary_key"`
	Email             string `gorm:"size:255"`
	PasswordDigest    string `gorm:"size:255"`
	IsActive          bool   `sql:"default: null"`
	RetryCount        int    `sql:"default: null"`
	IsLocked          bool   `sql:"default: null"`
	RetryCount2FA     int    `sql:"default: 0" gorm:"column:retry_count_2fa"`
	IsTotpEnabled     bool   `sql:"default: false"`
	IsPhone2FAEnabled bool   `gorm:"column:is_phone_2fa_enabled"`
	TotpSecret        string `gorm:"size:255"`

	LockedAt     *time.Time `sql:"default: null"`
	LastVerifyAt *time.Time `sql:"default: null"`
	CreatedAt    *time.Time `sql:"default: null"`
	UpdatedAt    *time.Time `sql:"default: null"`
}

func (*Identities) BeforeCreate

func (this *Identities) BeforeCreate() (err error)

func (*Identities) BeforeUpdate

func (this *Identities) BeforeUpdate() (err error)

func (*Identities) CheckPassword

func (this *Identities) CheckPassword(password string) error

func (*Identities) SetHashedPassword

func (this *Identities) SetHashedPassword(password string) error

type Market

type Market struct {
	Id        uint `gorm:"primary_key"`
	Code      string
	BaseUnit  uint
	QuoteUnit uint //ask_currency
	SortOrder uint //bid_currency

	BidFee decimal.NullDecimal `sql:"type:decimal(32,16);"`
	AskFee decimal.NullDecimal `sql:"type:decimal(32,16);"`

	BidFixed uint
	AskFixed uint
}

type Members

type Members struct {
	Id               uint   `gorm:"primary_key"`
	Sn               string `gorm:"size:255"`
	DisplayName      string `gorm:"size:255" sql:"default: null"`
	Email            string `gorm:"size:255"`
	IdentityId       uint   `sql:"default: null"`
	State            uint   `sql:"default: null"`
	Activated        bool   `sql:"default: null"`
	CountryCode      uint   `sql:"default: null"`
	PhoneNumber      string `gorm:"size:255" sql:"default: null"`
	IsPhoneConfirmed bool
	Disabled         bool
	ApiDisabled      bool
	Nickname         string `gorm:"size:255" sql:"default: null"`
	RefId            uint   `sql:"default: null"`
	Name             string `gorm:"size:255" sql:"default: null"`
	Surname          string `gorm:"size:255" sql:"default: null"`

	CreatedAt *time.Time
	UpdatedAt *time.Time
}

func (*Members) BeforeCreate

func (this *Members) BeforeCreate() (err error)

func (*Members) BeforeUpdate

func (this *Members) BeforeUpdate() (err error)

type PaymentAddresses

type PaymentAddresses struct {
	Id          uint   `gorm:"primary_key"`
	Address     string `gorm:"size:255" sql:"default: null"`
	Currency    uint
	Secret      string `gorm:"size:255" sql:"default: null"`
	ExpectedTag string `gorm:"size:255" sql:"default: null"`

	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`

	//Account      Accounts                                          //belongs_to
	AccountId uint //belongs_to

}

func (*PaymentAddresses) BeforeCreate

func (this *PaymentAddresses) BeforeCreate() (err error)

func (*PaymentAddresses) BeforeUpdate

func (this *PaymentAddresses) BeforeUpdate() (err error)

type PaymentTransactions

type PaymentTransactions struct {
	Id            uint                `gorm:"primary_key"`
	Txid          string              `gorm:"size:255" sql:"default: null"`
	Amount        decimal.NullDecimal `sql:"type:decimal(32,16);"`
	Confirmations uint                `sql:"default: null"`
	Address       string              `gorm:"size:255" sql:"default: null"`
	State         uint                `sql:"default: 0"`
	AasmState     string              `gorm:"size:255" sql:"default: null"`

	Currency uint
	Type     string `gorm:"size:255" sql:"default: null"`
	Txout    uint   `sql:"default: 0"`

	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`
	ReceiveAt *time.Time `sql:"default: null"`
	DontAt    *time.Time `sql:"default: null"`
}

func (*PaymentTransactions) BeforeCreate

func (this *PaymentTransactions) BeforeCreate() (err error)

func (*PaymentTransactions) BeforeUpdate

func (this *PaymentTransactions) BeforeUpdate() (err error)

type Tokens

type Tokens struct {
	Id       uint   `gorm:"primary_key"`
	Token    string `gorm:"size:255"`
	MemberId uint
	IsUsed   bool
	Type     string `gorm:"size:255"`
	ReqIp    string `gorm:"size:255"`
	ReqData  string `sql:"type: text"`

	ExpiresAt *time.Time `sql:"default: null"`
	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`
}

func (*Tokens) BeforeCreate

func (this *Tokens) BeforeCreate() (err error)

func (*Tokens) BeforeUpdate

func (this *Tokens) BeforeUpdate() (err error)

type WithdrawsComissions

type WithdrawsComissions struct {
	Id       uint `gorm:"primary_key"`
	Currency uint
	Fixed    decimal.NullDecimal `sql:"type:decimal(32,16);"`
	Dynamic  decimal.NullDecimal `sql:"type:decimal(5,4);"`

	MinWithdrawAmount decimal.NullDecimal `sql:"type:decimal(32,16);"`

	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`
}

func (*WithdrawsComissions) BeforeCreate

func (this *WithdrawsComissions) BeforeCreate() (err error)

func (*WithdrawsComissions) BeforeUpdate

func (this *WithdrawsComissions) BeforeUpdate() (err error)

type WithdrawsRequests

type WithdrawsRequests struct {
	Id           uint `gorm:"primary_key"`
	AccountId    uint
	MemberId     uint
	Currency     uint
	Address      string              `gorm:"size:255" sql:"default: null"`
	Amount       decimal.NullDecimal `sql:"type:decimal(32,16);"`
	Fee          decimal.NullDecimal `sql:"type:decimal(32,16);"`
	WithdrawTxId uint
	State        string `gorm:"size:255" sql:"default: null"`

	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`
	DoneAt    *time.Time `sql:"default: null"`
}

func (*WithdrawsRequests) BeforeCreate

func (this *WithdrawsRequests) BeforeCreate() (err error)

func (*WithdrawsRequests) BeforeUpdate

func (this *WithdrawsRequests) BeforeUpdate() (err error)

type WithdrawsTransactions

type WithdrawsTransactions struct {
	Id         uint                `gorm:"primary_key"`
	TxHash     string              `gorm:"size:255" sql:"default: null"`
	State      string              `gorm:"size:255" sql:"default: null"`
	Fee        decimal.NullDecimal `sql:"type:decimal(32,16);"`
	MaxFee     decimal.NullDecimal `sql:"type:decimal(32,16);"`
	Txbody     string              `sql:"type: text"`
	TxbodyHash string              `gorm:"size:255" sql:"default: null"`
	TxData     string              `gorm:"size:255" sql:"default: null"`

	CreatedAt *time.Time `sql:"default: null"`
	UpdatedAt *time.Time `sql:"default: null"`
}

func (*WithdrawsTransactions) BeforeCreate

func (this *WithdrawsTransactions) BeforeCreate() (err error)

func (*WithdrawsTransactions) BeforeUpdate

func (this *WithdrawsTransactions) BeforeUpdate() (err error)

Jump to

Keyboard shortcuts

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