models

package
v2.14.14 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 4 Imported by: 27

Documentation

Index

Constants

View Source
const LockedLiquidityVolume = 1000
View Source
const RewardEvent = "minter/RewardEvent"
View Source
const SlashEvent = "minter/SlashEvent"
View Source
const ValidatorStatusNotReady = 1
View Source
const ValidatorStatusReady = 2

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	ID                  uint                  `json:"id"                   pg:",pk"`
	Address             string                `json:"address"              pg:"type:varchar(64)"`
	Balances            []*Balance            `json:"balances"             pg:"rel:has-many"`                    //relation has many to Balances
	Rewards             []*Reward             `json:"rewards"              pg:"rel:has-many"`                    //relation has many to Rewards
	Slashes             []*Slash              `json:"slashes"              pg:"rel:has-many"`                    //relation has many to Slashes
	Transactions        []*Transaction        `json:"transactions"         pg:"rel:has-many,fk:from_address_id"` //relation has many to Transactions
	InvalidTransactions []*InvalidTransaction `json:"invalid_transactions" pg:"rel:has-many,fk:from_address_id"` //relation has many to InvalidTransactions
}

func (*Address) GetAddress

func (a *Address) GetAddress() string

GetAddress Return address with prefix

type AddressLiquidityPool added in v2.12.0

type AddressLiquidityPool struct {
	LiquidityPoolId  uint64         `json:"liquidity_pool_id" pg:",pk"`
	AddressId        uint64         `json:"address_id"        pg:",pk"`
	FirstCoinVolume  string         `json:"first_coin_volume"`
	SecondCoinVolume string         `json:"second_coin_volume"`
	Liquidity        string         `json:"liquidity"`
	Address          *Address       `json:"first_coin"        pg:"rel:has-one,fk:address_id"`
	LiquidityPool    *LiquidityPool `json:"liquidity_pool"    pg:"rel:has-one,fk:liquidity_pool_id"`
}

type AggregatedReward

type AggregatedReward struct {
	FromBlockID uint64     `json:"from_block_id" pg:",pk"`
	ToBlockID   uint64     `json:"to_block_id"`
	AddressID   uint64     `json:"address_id"    pg:",pk"`
	ValidatorID uint64     `json:"validator_id"  pg:",pk"`
	Role        string     `json:"role"          pg:",pk"`
	Amount      string     `json:"amount"        pg:"type:numeric(70)"`
	TimeID      time.Time  `json:"time_id"`
	FromBlock   *Block     `pg:"rel:has-one,fk:from_block_id"` //Relation has one to Blocks
	ToBlock     *Block     `pg:"rel:has-one,fk:to_block_id"`   //Relation has one to Blocks
	Address     *Address   `pg:"rel:has-one"`                  //Relation has one to Addresses
	Validator   *Validator `pg:"rel:has-one"`                  //Relation has one to Validators
}

type Balance

type Balance struct {
	AddressID uint     `json:"address_id"  pg:",pk"`
	CoinID    uint     `json:"coin_id"     pg:",pk,use_zero"`
	Value     string   `json:"value"       pg:"type:numeric(70)"`
	Address   *Address `pg:"rel:has-one"`            //Relation has one to Address
	Coin      *Coin    `pg:"rel:has-one,fk:coin_id"` //Relation has one to Coin
}

type BalanceUpdateData added in v2.14.14

type BalanceUpdateData struct {
	Block *api_pb.BlockResponse
	Event *api_pb.EventsResponse
}

type Block

type Block struct {
	ID                  uint64                `json:"id"                   pg:",pk"`
	Size                uint64                `json:"size"`
	ProposerValidatorID uint64                `json:"proposer_validator_id"`
	NumTxs              uint32                `json:"num_txs"              pg:"default:0"`
	BlockTime           uint64                `json:"block_time"`
	CreatedAt           time.Time             `json:"created_at"`
	UpdatedAt           time.Time             `json:"updated_at"`
	BlockReward         string                `json:"block_reward"         pg:"type:numeric(70)"`
	Hash                string                `json:"hash"`
	Proposer            *Validator            `json:"proposer"             pg:"rel:has-one,fk:proposer_validator_id"` //relation has one to Validators
	Validators          []*Validator          `json:"validators"           pg:"many2many:block_validator"`            //relation has many to Validators
	Transactions        []*Transaction        `json:"transactions"         pg:"rel:has-many"`                         //relation has many to Transactions
	InvalidTransactions []*InvalidTransaction `json:"invalid_transactions" pg:"rel:has-many"`                         //relation has many to InvalidTransactions
	Rewards             []*Reward             `json:"rewards"              pg:"rel:has-many"`                         //relation has many to Rewards
	Slashes             []*Slash              `json:"slashes"              pg:"rel:has-many"`                         //relation has many to Slashes
	BlockValidators     []BlockValidator      `json:"block_validators"     pg:"rel:has-many"`
}

func (*Block) GetHash

func (t *Block) GetHash() string

Return block hash with prefix

type BlockAddresses

type BlockAddresses struct {
	Height    uint64
	Addresses []string
}

type BlockValidator

type BlockValidator struct {
	BlockID     uint64    `json:"block_id"`
	ValidatorID uint64    `json:"validator_id"`
	Signed      bool      `json:"signed"`
	Validator   Validator `json:"validator" pg:"rel:has-one"`
	// contains filtered or unexported fields
}

type BlockValidators

type BlockValidators struct {
	Height     uint64
	Validators []*Validator
}

type BuyCoinTxData

type BuyCoinTxData struct {
	CoinToBuy          string `json:"coin_to_buy"`
	ValueToBuy         string `json:"value_to_buy"`
	CoinToSell         string `json:"coin_to_sell"`
	MaximumValueToSell string `json:"maximum_value_to_sell"`
}

type Check added in v2.12.0

type Check struct {
	TransactionID uint64       `json:"transaction_id"`
	Data          string       `json:"data"`
	FromAddressId uint         `json:"from_address_id"`
	ToAddressId   uint         `json:"to_address_id"`
	FromAddress   Address      `json:"from_address" pg:"rel:has-one,fk:from_address_id"`
	ToAddress     Address      `json:"to_address"   pg:"rel:has-one,fk:to_address_id"`
	Transaction   *Transaction `json:"transaction"  pg:"rel:has-one,fk:transaction_id"`
}

type Coin

type Coin struct {
	ID               uint       `json:"id" pg:",use_zero"`
	Type             CoinType   `json:"type"`
	Name             string     `json:"name"`
	Symbol           string     `json:"symbol"`
	Volume           string     `json:"volume"     pg:"type:numeric(70)"`
	Crr              uint       `json:"crr"`
	Reserve          string     `json:"reserve"    pg:"type:numeric(70)"`
	MaxSupply        string     `json:"max_supply" pg:"type:numeric(70)"`
	Version          uint       `json:"version"    pg:",use_zero"`
	OwnerAddressId   uint       `json:"owner_address"`
	CreatedAtBlockId uint       `json:"created_at_block_id"`
	Burnable         bool       `json:"burnable"`
	Mintable         bool       `json:"mintable"`
	CreatedAt        time.Time  `json:"created_at"`
	UpdatedAt        *time.Time `json:"updated_at"`
	DeletedAt        *time.Time `pg:",soft_delete"`
	OwnerAddress     Address    `pg:"rel:has-one,rel:has-one"`
}

func (*Coin) GetSymbol

func (c *Coin) GetSymbol() string

Return coin with version

type CoinType added in v2.12.0

type CoinType byte
const (
	CoinTypeBase CoinType
	CoinTypeToken
	CoinTypePoolToken
)

type CreateCoinTxData

type CreateCoinTxData struct {
	Name                 string `json:"name"`
	Symbol               string `json:"symbol"`
	InitialAmount        string `json:"initial_amount"`
	InitialReserve       string `json:"initial_reserve"`
	ConstantReserveRatio string `json:"constant_reserve_ratio"`
	MaxSupply            string `json:"max_supply"`
}

type CreateMultisigTxData

type CreateMultisigTxData struct {
	Threshold string   `json:"threshold"`
	Weights   []string `json:"weights"`
	Addresses []string `json:"addresses"`
}

type DeclareCandidacyTxData

type DeclareCandidacyTxData struct {
	Address    string `json:"address"`
	PubKey     string `json:"pub_key"`
	Commission string `json:"commission"`
	Coin       string `json:"coin"`
	Stake      string `json:"stake"`
}

type DelegateTxData

type DelegateTxData struct {
	PubKey string `json:"pub_key"`
	Coin   string `json:"coin"`
	Value  string `json:"value"`
}

type EditCandidateTxData

type EditCandidateTxData struct {
	PubKey        string `json:"pub_key"`
	RewardAddress string `json:"reward_address"`
	OwnerAddress  string `json:"owner_address"`
}

type InvalidTransaction

type InvalidTransaction struct {
	ID            uint64    `json:"id" pg:",pk"`
	FromAddressID uint64    `json:"from_address_id"`
	BlockID       uint64    `json:"block_id"`
	CreatedAt     time.Time `json:"created_at"`
	Type          uint8     `json:"type"`
	Hash          string    `json:"hash"`
	TxData        string    `json:"tx_data"`
	Log           string    `json:"log"`
	Block         *Block    `pg:"rel:has-one"`                    //Relation has one to Blocks
	FromAddress   *Address  `pg:"rel:has-one,fk:from_address_id"` //Relation has one to Addresses
}

func (InvalidTransaction) GetHash

func (t InvalidTransaction) GetHash() string

GetHash Return transactions hash with prefix

type LiquidityPool added in v2.12.0

type LiquidityPool struct {
	Id               uint64 `json:"id"             pg:",pk"`
	TokenId          uint64 `json:"token_id"`
	FirstCoinId      uint64 `json:"first_coin_id"  pg:",use_zero"`
	SecondCoinId     uint64 `json:"second_coin_id" pg:",use_zero"`
	FirstCoinVolume  string `json:"first_coin_volume"`
	SecondCoinVolume string `json:"second_coin_volume"`
	Liquidity        string `json:"liquidity"`
	LiquidityBip     string `json:"liquidity_bip"`
	UpdatedAtBlockId uint64 `json:"updated_at_block_id"`
	FirstCoin        *Coin  `json:"first_coin"  pg:"rel:has-one,fk:first_coin_id"`
	SecondCoin       *Coin  `json:"second_coin" pg:"rel:has-one,fk:second_coin_id"`
	Token            *Coin  `json:"token"       pg:"rel:has-one,fk:token_id"`
}

func (*LiquidityPool) GetTokenSymbol added in v2.12.0

func (lp *LiquidityPool) GetTokenSymbol() string

type LiquidityPoolSnapshot added in v2.13.5

type LiquidityPoolSnapshot struct {
	BlockId          uint64    `json:"block_id"`
	LiquidityPoolId  uint64    `json:"liquidity_pool_id"`
	FirstCoinVolume  string    `json:"first_coin_volume"`
	SecondCoinVolume string    `json:"second_coin_volume"`
	Liquidity        string    `json:"liquidity"`
	LiquidityBip     string    `json:"liquidity_bip"`
	CreatedAt        time.Time `json:"created_at"`
}

type LiquidityPoolTrade added in v2.12.0

type LiquidityPoolTrade struct {
	BlockId          uint64         `json:"block_id"`
	LiquidityPoolId  uint64         `json:"liquidity_pool_id"`
	TransactionId    uint64         `json:"transaction_id"`
	FirstCoinVolume  string         `json:"first_coin_volume"`
	SecondCoinVolume string         `json:"second_coin_volume"`
	CreatedAt        time.Time      `json:"created_at"`
	Block            *Block         `json:"block"          pg:"rel:has-one,fk:block_id"`
	LiquidityPool    *LiquidityPool `json:"liquidity_pool" pg:"rel:has-one,fk:liquidity_pool_id"`
	Transaction      *Transaction   `json:"transaction"    pg:"rel:has-one,fk:transaction_id"`
}

type MultiSendTxData

type MultiSendTxData struct {
	List []SendTxData `json:"list"`
}

type RedeemCheckTxData

type RedeemCheckTxData struct {
	RawCheck string `json:"raw_check"`
	Proof    string `json:"proof"`
}

type Reward

type Reward struct {
	BlockID     uint64     `json:"block"        pg:",pk"`
	AddressID   uint       `json:"address_id"   pg:",pk"`
	ValidatorID uint64     `json:"validator_id" pg:",pk"`
	Role        string     `json:"role"         pg:",pk"`
	Amount      string     `json:"amount"       pg:"type:numeric(70)"`
	Block       *Block     `pg:"rel:has-one"` //Relation has one to Blocks
	Address     *Address   `pg:"rel:has-one"` //Relation has one to Addresses
	Validator   *Validator `pg:"rel:has-one"` //Relation has one to Validators
}

type SellAllCoinTxData

type SellAllCoinTxData struct {
	CoinToSell        string `json:"coin_to_sell"`
	CoinToBuy         string `json:"coin_to_buy"`
	MinimumValueToBuy string `json:"minimum_value_to_buy"`
}

type SellCoinTxData

type SellCoinTxData struct {
	CoinToSell        string `json:"coin_to_sell"`
	ValueToSell       string `json:"value_to_sell"`
	CoinToBuy         string `json:"coin_to_buy"`
	MinimumValueToBuy string `json:"minimum_value_to_buy"`
}

type SendTxData

type SendTxData struct {
	Coin  string `json:"coin"`
	To    string `json:"to"`
	Value string `json:"value"`
}

type SetCandidateTxData

type SetCandidateTxData struct {
	PubKey string `json:"pub_key"`
}

type Slash

type Slash struct {
	ID          uint64     `json:"id"            pg:",pk"`
	CoinID      uint       `json:"coin_id"       pg:",use_zero"`
	BlockID     uint64     `json:"block_id"`
	AddressID   uint       `json:"address_id"`
	ValidatorID uint64     `json:"validator_id"`
	Amount      string     `json:"amount"        pg:"type:numeric(70)"`
	Coin        *Coin      `pg:"rel:has-one"` //Relation has one to Coins
	Block       *Block     `pg:"rel:has-one"` //Relation has one to Blocks
	Address     *Address   `pg:"rel:has-one"` //Relation has one to Addresses
	Validator   *Validator `pg:"rel:has-one"` //Relation has one to Validators
}

type Stake

type Stake struct {
	ID             uint       `json:"id"               pg:",pk"`
	OwnerAddressID uint       `json:"owner_address_id"`
	ValidatorID    uint       `json:"validator_id"`
	CoinID         uint       `json:"coin_id"          pg:",use_zero"`
	Value          string     `json:"value"            pg:"type:numeric(70)"`
	BipValue       string     `json:"bip_value"        pg:"type:numeric(70)"`
	IsKicked       bool       `json:"is_kicked"`
	Coin           *Coin      `json:"coins"            pg:"rel:has-one"`                     //Relation has one to Coins
	OwnerAddress   *Address   `json:"owner_address"    pg:"rel:has-one,fk:owner_address_id"` //Relation has one to Addresses
	Validator      *Validator `json:"validator"        pg:"rel:has-one"`                     //Relation has one to Validators
}

type TagLiquidityPool added in v2.12.0

type TagLiquidityPool struct {
	PoolID   uint64 `json:"pool_id"`
	CoinIn   uint64 `json:"coin_in"`
	ValueIn  string `json:"value_in"`
	CoinOut  uint64 `json:"coin_out"`
	ValueOut string `json:"value_out"`
}

type Transaction

type Transaction struct {
	ID                  uint64               `json:"id" pg:",pk"`
	FromAddressID       uint64               `json:"from_address_id"`
	Nonce               uint64               `json:"nonce"`
	GasPrice            uint64               `json:"gas_price"`
	Gas                 uint64               `json:"gas"`
	Commission          string               `json:"commission"`
	BlockID             uint64               `json:"block_id"`
	GasCoinID           uint64               `json:"gas_coin_id" pg:",use_zero"`
	CreatedAt           time.Time            `json:"created_at"`
	Type                uint8                `json:"type"`
	Hash                string               `json:"hash"`
	ServiceData         string               `json:"service_data"`
	Data                json.RawMessage      `json:"data"`
	IData               interface{}          `json:"-" pg:"-"`
	Tags                map[string]string    `json:"tags"`
	Payload             []byte               `json:"payload"`
	RawTx               []byte               `json:"raw_tx"`
	CommissionPriceCoin interface{}          `json:"commission_price_coin" pg:"-"`
	Block               *Block               `json:"block"        pg:"rel:has-one"`                     //Relation has one to Blocks
	FromAddress         *Address             `json:"from_address" pg:"rel:has-one,fk:from_address_id"`  //Relation has one to Address
	GasCoin             *Coin                `json:"gas_coin"     pg:"rel:has-one,fk:gas_coin_id"`      //Relation has one to Coin
	Validators          []*Validator         `json:"validators"   pg:"many2many:transaction_validator"` //Relation has many to Validators
	TxOutputs           []*TransactionOutput `json:"tx_outputs"   pg:"rel:has-many,fk:id"`
	TxOutput            *TransactionOutput   `json:"tx_output"    pg:"rel:has-one,fk:id"`
}

func (*Transaction) GetFee

func (t *Transaction) GetFee() uint64

Return fee for transaction

func (*Transaction) GetHash

func (t *Transaction) GetHash() string

Return transactions hash with prefix

type TransactionLiquidityPool added in v2.12.0

type TransactionLiquidityPool struct {
	TransactionID   uint64
	LiquidityPoolID uint64
	// contains filtered or unexported fields
}

type TransactionOutput

type TransactionOutput struct {
	ID            uint64       `json:"id"`
	TransactionID uint64       `json:"transaction_id"`
	ToAddressID   uint64       `json:"to_address_id"`
	CoinID        uint         `json:"coin_id"     pg:",use_zero"`
	Value         string       `json:"value"       pg:"type:numeric(70)"`
	Coin          *Coin        `json:"coin"        pg:"rel:has-one"`                  //Relation has one to Coins
	ToAddress     *Address     `json:"to_address"  pg:"rel:has-one,fk:to_address_id"` //Relation has one to Addresses
	Transaction   *Transaction `json:"transaction" pg:"rel:has-one"`                  //Relation has one to Transactions
}

type TransactionValidator

type TransactionValidator struct {
	TransactionID uint64
	ValidatorID   uint64
	// contains filtered or unexported fields
}

type Unbond

type Unbond struct {
	BlockId     uint       `json:"block_id"`
	AddressId   uint       `json:"address_id"`
	CoinId      uint       `json:"coin_id" pg:",use_zero"`
	ValidatorId uint       `json:"validator_id"`
	Value       string     `json:"value"`
	Coin        *Coin      `json:"coin"      pg:"rel:has-one,fk:coin_id"`
	Address     *Address   `json:"address"   pg:"rel:has-one,fk:address_id"`
	Validator   *Validator `json:"validator" pg:"rel:has-one,fk:validator_id"`
}

type UnbondTxData

type UnbondTxData struct {
	PubKey string `json:"pub_key"`
	Coin   string `json:"coin"`
	Value  string `json:"value"`
}

type Validator

type Validator struct {
	ID                   uint                  `json:"id" pg:",pk"`
	RewardAddressID      *uint                 `json:"reward_address_id"`
	OwnerAddressID       *uint                 `json:"owner_address_id"`
	ControlAddressID     *uint                 `json:"control_address_id"`
	CreatedAtBlockID     *uint                 `json:"created_at_block_id"`
	PublicKey            string                `json:"public_key"  pg:"type:varchar(64)"`
	Status               *uint8                `json:"status"`
	Commission           *uint64               `json:"commission"`
	TotalStake           *string               `json:"total_stake"   pg:"type:numeric(70)"`
	Name                 *string               `json:"name"`
	SiteUrl              *string               `json:"site_url"`
	IconUrl              *string               `json:"icon_url"`
	Description          *string               `json:"description"`
	MetaUpdatedAtBlockID *uint64               `json:"meta_updated_at_block_id"`
	UpdateAt             *time.Time            `json:"update_at"`
	ControlAddress       *Address              `json:"control_address" pg:"rel:has-one,fk:control_address_id"`
	RewardAddress        *Address              `json:"reward_address"  pg:"rel:has-one,fk:reward_address_id"`
	OwnerAddress         *Address              `json:"owner_address"   pg:"rel:has-one,fk:owner_address_id"`
	Stakes               []*Stake              `json:"stakes"          pg:"rel:has-many"`
	PublicKeys           []ValidatorPublicKeys `json:"public_keys"     pg:"rel:has-many"`
	Bans                 []ValidatorBan        `json:"bans"            pg:"rel:has-many"`
}

func (Validator) GetPublicKey

func (v Validator) GetPublicKey() string

Return validators PK with prefix

type ValidatorBan added in v2.12.0

type ValidatorBan struct {
	ValidatorId uint       `json:"validator_id" pg:",pk"`
	BlockId     uint64     `json:"block_id"     pg:",pk"`
	Validator   *Validator `json:"validator"    pg:"rel:has-one"`
	Block       *Block     `json:"block"        pg:"rel:has-one"`
}

type ValidatorPublicKeys

type ValidatorPublicKeys struct {
	ID          uint       `json:"id"  pg:",pk"`
	ValidatorId uint       `json:"validator_id"`
	Key         string     `json:"key" pg:"type:varchar(64)"`
	CreatedAt   *time.Time `json:"created_at"`
	UpdateAt    *time.Time `json:"update_at"`
}

Jump to

Keyboard shortcuts

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