Version: v0.0.0-...-80b2b3e Latest Latest

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 13 Imported by: 0




View Source
const (
	ImplicitAccountPrefix = "tz"
	ContractAccountPrefix = "KT1"
View Source
const (
	DayPeriod   = "day"
	WeekPeriod  = "week"
	MonthPeriod = "month"
View Source
const (
	LowBalanceAccountsStatKey = "low_balance_accounts"
	InactiveAccountsStatKey   = "inactive_accounts"
View Source
const (
	SortAsc  = "asc"
	SortDesc = "desc"
View Source
const (
	BakersChangesStorageKey = "bakers_changes"


View Source
var AccountNotFoundErr = errors.New("account not found")
View Source
var UserLimitReachedErr = errors.New("limit reached")


func GetChartPeriods

func GetChartPeriods() map[string]time.Duration

func ValidatePeriod

func ValidatePeriod(period string) error


type Account

type Account struct {
	AccountID          null.String           `gorm:"primary_key;AUTO_INCREMENT" json:"account_id"`
	BlockID            null.String           `json:"block_id"`
	Block              *Block                `json:"block"` // This line is infered from column name "block_id".
	Manager            null.String           `json:"manager"`
	Spendable          null.Bool             `json:"spendable"`
	DelegateSetable    null.Bool             `json:"delegate_setable"`
	DelegateValue      string                `json:"delegate_value"`
	Counter            null.Int              `json:"counter"`
	Script             string                `json:"script"`
	Storage            string                `json:"storage"`
	Balance            null.Int              `json:"balance"`
	BlockLevel         null.Int              `json:"block_level" sql:"DEFAULT:'-1'::integer"`
	AccountsCheckpoint []*AccountsCheckpoint `json:"accounts_checkpoint"` // This line is infered from other tables.
	DelegatedContracts []*DelegatedContract  `json:"delegated_contracts"` // This line is infered from other tables.
	BakerInfo          *Baker                `json:"baker_info"`
	IsBaker            bool                  `json:"is_baker"`
	IsRevealed         bool                  `json:"is_revealed"`
	Transactions       int64                 `json:"transactions"`
	Operations         int64                 `json:"operations"`
	Index              int64                 `json:"index"`

type AccountAssetBalance

type AccountAssetBalance struct {

type AccountBaking

type AccountBaking struct {
	Status       RewardStatus
	Count        int64
	Missed       int64
	Reward       int64
	AvgPriority  float32
	Stolen       int64
	TotalDeposit int64

type AccountBalance

type AccountBalance struct {
	Time    time.Time
	Balance int64

type AccountDelegator

type AccountDelegator struct {
	AccountId string
	Cycle     int64
	Balance   int64
	Share     float64

type AccountEndorsing

type AccountEndorsing struct {
	Status       RewardStatus
	Count        int64
	Missed       int64
	Reward       int64
	TotalDeposit int64

type AccountFilter

type AccountFilter struct {
	Type      AccountType
	OrderBy   AccountOrderField
	Delegate  string
	After     string
	Favorites []string

type AccountListView

type AccountListView struct {
	AccountName  string    `json:"account_name"`
	DelegateName string    `json:"delegate_name"`
	CreatedAt    time.Time `json:"created_at"`
	LastActive   time.Time `json:"last_active"`

type AccountOrderField

type AccountOrderField int
const (
	AccountOrderFieldBalance AccountOrderField = iota

type AccountPrefix

type AccountPrefix string

type AccountReward

type AccountReward struct {
	Status                 RewardStatus
	Delegators             int64
	StakingBalance         int64
	BakingRewards          int64
	FutureBakingCount      int64
	EndorsementRewards     int64
	FutureEndorsementCount int64
	Fees                   int64
	MissedBaking           int64
	MissedEndorsements     int64
	Losses                 int64

TODO refactor Account rewards models

type AccountRewardsCount

type AccountRewardsCount struct {
	Status                 RewardStatus
	StakingBalance         int64
	BakingCount            int64
	BakingReward           int64
	StolenBaking           int64
	FutureBakingCount      int64
	FutureEndorsementCount int64
	EndorsementsCount      int64
	EndorsementsReward     int64
	ActualBakingSecurityDeposit        int64
	ExpectedBakingSecurityDeposit      int64
	ActualEndorsementSecurityDeposit   int64
	ExpectedEndorsementSecurityDeposit int64
	ActualTotalSecirityDeposit         int64
	ExpectedTotalSecurityDeposit       int64
	AvailableBond                      int64

type AccountType

type AccountType int
const (
	AccountTypeBoth AccountType = iota

type AccountsCheckpoint

type AccountsCheckpoint struct {
	AccountID  string    `json:"account_id"`
	Account    *Account  `json:"account"` // This line is infered from column name "account_id".
	BlockID    string    `json:"block_id"`
	Block      *Block    `json:"block"` // This line is infered from column name "block_id".
	BlockLevel uint      `json:"block_level" sql:"DEFAULT:'-1'::integer"`
	AsOf       time.Time `json:"asof" gorm:"column:asof"`
	IsBaker    bool      `json:"is_baker"`

type AggTimeFilter

type AggTimeFilter struct {
	From   time.Time
	To     time.Time
	Period string

func (*AggTimeFilter) Validate

func (agg *AggTimeFilter) Validate() error

type AggTimeInt

type AggTimeInt struct {
	Date  time.Time `json:"date"`
	Value int64     `json:"value"`

type AssetHolder

type AssetHolder struct {
	Address HolderAddress
	Balance HolderBalance

type AssetInfo

type AssetInfo struct {
	ID           uint64
	Name         string
	Balance      int64
	Ticker       string
	Source       string
	ContractType string
	AccountId    string
	Timestamp    time.Time
	Scale        int64

type AssetOperation

type AssetOperation struct {
	BlockLevel         int64     `json:"block_level"`
	TokenId            uint64    `json:"token_id"`
	OperationId        int64     `json:"operation_id"`
	OperationGroupHash string    `json:"operation_group_hash"`
	Sender             string    `json:"sender"`
	Receiver           string    `json:"receiver"`
	Amount             int64     `json:"amount"`
	Type               string    `json:"type"`
	Timestamp          time.Time `json:"timestamp"`

type AssetOperationReport

type AssetOperationReport struct {
	Fee          int64
	GasLimit     int64
	StorageLimit int64

type AssetReport

type AssetReport struct {

	Amount      float64 `csv:"amount"`
	Source      string  `csv:"source"`
	Destination string  `csv:"destination"`

type Baker

type Baker struct {
	AccountID string `json:"pkh"`

type BakerBalance

type BakerBalance struct {
	Pkh              string
	Balance          int64
	FrozenBalance    uint64
	StakingBalance   uint64
	DelegatedBalance uint64

type BakerChanges

type BakerChanges struct {
	Baker      string
	Balance    int64
	Delegators int64

type BakerChartData

type BakerChartData struct {
	Baker     string
	BakerName string
	Rolls     int64
	Percent   float64

type BakerDelegators

type BakerDelegators struct {
	Baker   string
	Address string
	Value   int64

type BakerRegistry

type BakerRegistry struct {
	Delegate                               string         `gorm:"primary_key" json:"delegate"`
	BakerName                              string         `json:"bakerName"`
	BakerOffchainRegistryUrl               string         `json:"bakerOffchainRegistryUrl"`
	BakerPaysFromAccounts                  pq.StringArray `gorm:"type:varchar[]" json:"bakerPaysFromAccounts"`
	BakerChargesTransactionFee             bool           `json:"bakerChargesTransactionFee"`
	MinDelegation                          int64          `json:"minDelegation,string"`
	MinPayout                              int64          `json:"minPayout,string"`
	OverDelegationThreshold                int64          `json:"overDelegationThreshold,string"`
	PayoutDelay                            int64          `json:"payoutDelay,string"`
	PaymentConfigMask                      string         `json:"paymentConfigMask"`
	PayoutFrequency                        int64          `json:"payoutFrequency,string"`
	ReporterAccount                        pq.StringArray `gorm:"type:varchar[]" json:"reporterAccount"`
	Split                                  int64          `json:"split,string""`
	OpenForDelegation                      bool           `json:"openForDelegation"`
	SubtractPayoutsLessThanMin             bool           `json:"subtractPayoutsLessThanMin"`
	SubtractRewardsFromUninvitedDelegation bool           `json:"subtractRewardsFromUninvitedDelegation"`
	LastUpdateId                           int64          `json:"-"`
	IsHidden                               bool           `json:"is_hidden"`

func (*BakerRegistry) Unmarshal

func (pb *BakerRegistry) Unmarshal(data []byte) (err error)

type BakerStats

type BakerStats struct {
	Name                     string    `json:"name"`
	Fee                      int64     `json:"fee"`
	BakingSince              time.Time `json:"baking_since"` //first baking or endorsement
	Balance                  int64     `json:"balance"`
	StakingBalance           int64     `json:"staking_balance"`
	FrozenBalance            int64     `json:"frozen_balance"`
	Rolls                    int64     `json:"rolls"`
	Blocks                   int64     `json:"blocks"`
	Endorsements             int64     `json:"endorsements"`
	TotalPaidFees            int64     `json:"fees"`
	ActiveDelegations        int64     `json:"active_delegations"`
	StakingCapacity          int64     `json:"staking_capacity"`
	FrozenEndorsementRewards int64     `json:"frozen_endorsement_rewards"`
	FrozenBakingRewards      int64     `json:"frozen_baking_rewards"`
	EndorsementCount         int64     `json:"endorsement_count"`
	BakingCount              int64     `json:"baking_count"`
	Media                    string    `json:"media"`

	//	From old resp
	BakingDeposits      int64
	EndorsementDeposits int64
	BakingRewards       int64
	EndorsementRewards  int64

type BakersVoting

type BakersVoting struct {
	ProposalsCount int64
	Bakers         []BakerDelegators

type BakingCycle

type BakingCycle struct {
	Cycle      int64
	CycleStart null.Time
	CycleEnd   null.Time

type BakingRight

type BakingRight struct {
	BlockHash     string    `json:"block_hash"`
	Level         int64     `json:"level"`
	Delegate      string    `json:"delegate"`
	Priority      int       `json:"priority"`
	EstimatedTime time.Time `json:"estimated_time"`

type BalanceUpdate

type BalanceUpdate struct {
	ID                 uint    `gorm:"primary_key;AUTO_INCREMENT" json:"id"`
	Source             string  `json:"source"`
	SourceID           uint    `json:"source_id"`
	SourceHash         string  `json:"source_hash"`
	Kind               string  `json:"kind"`
	Contract           string  `json:"contract"`
	Change             float64 `json:"change"`
	Level              float64 `json:"level"`
	Delegate           string  `json:"delegate"`
	Category           string  `json:"category"`
	OperationGroupHash string  `json:"operation_group_hash" gorm:"column:operation_group_hash"`

type Ballot

type Ballot struct {
	Pkh        string `json:"pkh"`
	Ballot     string `json:"ballot"`
	BlockID    string `json:"block_id"`
	Block      *Block `json:"block"` // This line is infered from column name "block_id".
	BlockLevel uint   `json:"block_level"`

type BallotsStat

type BallotsStat struct {
	Yay           int64
	Nay           int64
	Pass          int64
	Quorum        float64
	Supermajority float64

type BigMapContent

type BigMapContent struct {
	BigMapId           uint64 //big_map_id
	Key                string //key
	KeyHash            string //key_hash
	OperationGroupHash string //operation_group_id
	Value              string //value

DB model

type Block

type Block struct {
	Level       null.Int    `json:"level"`
	Proto       null.Int    `json:"proto"`
	Predecessor null.String `json:"predecessor"`
	//Temp not unmarshal timestamp from json db because time.Time not support ISO without timezone
	Timestamp                time.Time              `json:"-"`
	BlockTime                int64                  `json:"block_time"`
	ValidationPass           null.Int               `json:"validation_pass"`
	Fitness                  null.String            `json:"fitness"`
	Context                  string                 `json:"context"`
	Signature                string                 `json:"signature"`
	Protocol                 null.String            `json:"protocol"`
	ChainID                  string                 `json:"chain_id"`
	Hash                     null.String            `json:"hash"`
	OperationsHash           string                 `json:"operations_hash"`
	PeriodKind               string                 `json:"period_kind"`
	CurrentExpectedQuorum    int64                  `json:"current_expected_quorum"`
	ActiveProposal           string                 `json:"active_proposal"`
	Baker                    string                 `json:"baker"`
	BakerName                string                 `json:"baker_name"`
	Reward                   int64                  `json:"reward"`
	Deposit                  int64                  `json:"deposit"`
	NonceHash                string                 `json:"nonce_hash"`
	ConsumedGas              int64                  `json:"consumed_gas"`
	MetaLevel                int64                  `json:"meta_level"`
	MetaLevelPosition        int64                  `json:"meta_level_position"`
	MetaCycle                int64                  `json:"meta_cycle"`
	MetaCyclePosition        int64                  `json:"meta_cycle_position"`
	MetaVotingPeriod         int64                  `json:"meta_voting_period"`
	MetaVotingPeriodPosition int64                  `json:"meta_voting_period_position"`
	ExpectedCommitment       bool                   `json:"expected_commitment"`
	Priority                 null.Int               `json:"priority" gorm:"column:priority"`
	BlockAggregation         *BlockAggregationView  `json:"-"`
	Delegates                []*Delegate            `json:"delegates"`            // This line is infered from other tables.
	Proposals                []*Proposal            `json:"proposals"`            // This line is infered from other tables.
	Rolls                    []*Roll                `json:"rolls"`                // This line is infered from other tables.
	Ballots                  []*Ballot              `json:"ballots"`              // This line is infered from other tables.
	AccountsCheckpoint       []*AccountsCheckpoint  `json:"accounts_checkpoint"`  // This line is infered from other tables.
	OperationGroups          []*OperationGroup      `json:"operation_groups"`     // This line is infered from other tables.
	DelegatesCheckpoint      []*DelegatesCheckpoint `json:"delegates_checkpoint"` // This line is infered from other tables.
	Accounts                 []*Account             `json:"accounts"`             // This line is infered from other tables.
	BakingRights             []FutureBakingRight    `json:"baking_rights,omitempty"`

type BlockAggregationView

type BlockAggregationView struct {
	Level                      int64 `json:"level"`
	Volume                     int64 `json:"volume"`
	Fees                       int64 `json:"fees"`
	GasUsed                    int64 `json:"gas_used"`
	Endorsements               int64 `json:"endorsements"`
	Proposals                  int64 `json:"proposals"`
	SeedNonceRevelations       int64 `json:"seed_nonce_revelations"`
	Delegations                int64 `json:"delegations"`
	Transactions               int64 `json:"transactions"`
	ActivateAccounts           int64 `json:"activate_accounts"`
	Ballots                    int64 `json:"ballots"`
	Originations               int64 `json:"originations"`
	Reveals                    int64 `json:"reveals"`
	DoubleBakingEvidences      int64 `json:"double_baking_evidences"`
	DoubleEndorsementEvidences int64 `json:"double_baking_evidences"`
	NumberOfOperations         int64 `json:"number_of_operations"`

func (*BlockAggregationView) TableName

func (*BlockAggregationView) TableName() string

type BlockFilter

type BlockFilter struct {
	FromID      null.Int
	ToID        null.Int
	BlockLevels []int64
	BlockHashes []string

type BlockPriority

type BlockPriority struct {
	Blocks         int64
	ZeroPriority   int64
	FirstPriority  int64
	SecondPriority int64
	ThirdPriority  int64

type ChartData

type ChartData struct {
	Timestamp         time.Time
	Activations       int64
	AverageDelay      float64
	Blocks            int64
	DelegationVolume  int64
	Fees              int64
	Operations        int64
	TransactionVolume int64
	Bakers            int64
	WhaleAccounts     int64

type CommonReport

type CommonReport struct {
	BlockLevel uint64    `csv:"block level"`
	Kind       string    `csv:"operation type"`
	Timestamp  time.Time `csv:"timestamp"`
	Coin       string    `csv:"coin"`
	Fee        float64   `csv:"fee"`
	Status     string    `csv:"status"`
	//DB field
	OperationGroupHash null.String `csv:"-"`

	//CSV field
	Link string `csv:"link"`

type DailyStat

type DailyStat struct {
	Key   string          `gorm:"column:key"`
	Date  time.Time       `gorm:"column:date"`
	Value decimal.Decimal `gorm:"column:value"`

type Delegate

type Delegate struct {
	Pkh              string `gorm:"primary_key;AUTO_INCREMENT" json:"pkh"`
	BlockID          string `json:"block_id"`
	Block            *Block `json:"block"` // This line is infered from column name "block_id".
	Balance          int64  `json:"balance"`
	FrozenBalance    int64  `json:"frozen_balance"`
	StakingBalance   int64  `json:"staking_balance"`
	DelegatedBalance int64  `json:"delegated_balance"`
	Deactivated      bool   `json:"deactivated"`
	GracePeriod      uint   `json:"grace_period"`
	BlockLevel       uint   `json:"block_level" sql:"DEFAULT:'-1'::integer"`

type DelegatedContract

type DelegatedContract struct {
	AccountID     string   `json:"account_id"`
	Account       *Account `json:"account"` // This line is infered from column name "account_id".
	DelegateValue string   `json:"delegate_value"`

type DelegatesCheckpoint

type DelegatesCheckpoint struct {
	DelegatePkh string `json:"delegate_pkh"`
	BlockID     string `json:"block_id"`
	Block       *Block `json:"block"` // This line is infered from column name "block_id".
	BlockLevel  uint   `json:"block_level" sql:"DEFAULT:'-1'::integer"`

type DoubleOperationEvidence

type DoubleOperationEvidence struct {
	OperationID    int64               `json:"operation_id" gorm:"column:operation_id"`
	Operation      Operation           `gorm:"save_associations:false;association_foreignkey:OperationID;foreignkey:OperationID"`
	Type           DoubleOperationType `json:"type" gorm:"column:doe_type"`
	BlockHash      string              `json:"block_hash" gorm:"column:doe_block_hash"`
	BlockLevel     int64               `json:"block_level" gorm:"column:doe_block_level"`
	DenouncedLevel int64               `json:"denounced_level" gorm:"column:doe_denounced_level"`
	Offender       string              `json:"offender" gorm:"column:doe_offender"`
	Priority       int                 `json:"priority" gorm:"column:doe_priority"`
	EvidenceBaker  string              `json:"evidence_baker" gorm:"column:doe_evidence_baker"`
	BakerReward    int64               `json:"baker_reward" gorm:"column:doe_baker_reward"`
	LostDeposits   int64               `json:"lost_deposits" gorm:"column:doe_lost_deposits"`
	LostRewards    int64               `json:"lost_rewards" gorm:"column:doe_lost_rewards"`
	LostFees       int64               `json:"lost_fees" gorm:"column:doe_lost_fees"`

type DoubleOperationEvidenceExtended

type DoubleOperationEvidenceExtended struct {
	OffenderName      string `json:"offender_name" gorm:"column:baker_name"`
	EvidenceBakerName string `json:"evidence_baker_name" gorm:"column:baker_name"`

type DoubleOperationEvidenceQueryOptions

type DoubleOperationEvidenceQueryOptions struct {
	BlockIDs        []string
	OperationHashes []string
	OperationIDs    []int64
	Type            DoubleOperationType
	LoadOperation   bool
	Limit           uint
	Offset          uint

type DoubleOperationType

type DoubleOperationType string
const (
	DoubleOperationTypeBaking      DoubleOperationType = "double_baking_evidence"
	DoubleOperationTypeEndorsement DoubleOperationType = "double_endorsement_evidence"

type EmailVerification

type EmailVerification struct {
	AccountID string
	Email     string
	Token     string
	Verified  bool
	Sent      bool
	CreatedAt time.Time

type EndorsementRight

type EndorsementRight struct {
	BlockLevel    int64          `json:"block_level"`
	BlockHash     sql.NullString `json:"block_hash"`
	Cycle         sql.NullInt64  `json:"cycle"`
	Delegate      string         `json:"delegate"`
	ForkId        string         `json:"fork_id"`
	Slot          int64          `json:"slot"`
	EstimatedTime time.Time      `json:"estimated_time"`

type ExtendReport

type ExtendReport struct {
	//Baker operations
	Reward float64 `csv:"reward"`
	Loss   float64 `csv:"loss"`

type Fee

type Fee struct {
	Low       uint      `json:"low"`
	Medium    uint      `json:"medium"`
	High      uint      `json:"high"`
	Timestamp time.Time `json:"timestamp"`
	Kind      string    `json:"kind"`
	Level     int64     `json:"level"`
	Cycle     int64     `json:"cycle"`

type FutureBakingRight

type FutureBakingRight struct {
	BlockLevel    int64         `json:"block_level"`
	Delegate      string        `json:"delegate"`
	DelegateName  string        `json:"delegate_name" gorm:"-"`
	Cycle         sql.NullInt64 `json:"cycle"`
	Priority      int           `json:"priority"`
	EstimatedTime time.Time     `json:"estimated_time"`
	Deposit       int64         `json:"deposit" gorm:"-"`
	Reward        int64         `json:"reward"  gorm:"-"`
	ForkId        string        `json:"fork_id"`

type FutureBlockBakingRight

type FutureBlockBakingRight struct {
	Level  int64               `json:"level"`
	Rights []FutureBakingRight `json:"rights"`

type FutureBlockEndorsementRight

type FutureBlockEndorsementRight struct {
	Level  int64                    `json:"level"`
	Rights []FutureEndorsementRight `json:"rights"`

type FutureEndorsementRight

type FutureEndorsementRight struct {
	BlockLevel    int64         `json:"block_level"`
	BlockHash     string        `json:"block_hash"`
	Delegate      string        `json:"delegate"`
	DelegateName  string        `json:"delegate_name" gorm:"-"`
	Cycle         sql.NullInt64 `json:"cycle"`
	Slots         pq.Int64Array `json:"slots" gorm: "type:integer[]"`
	EstimatedTime time.Time     `json:"estimated_time"`

	ForkId  string `json:"fork_id"`
	Reward  int64  `json:"reward"  gorm:"-"`
	Deposit int64  `json:"deposit"  gorm:"-"`

type GenericAccount

type GenericAccount struct {
	Pkh  string `json:"pkh"`
	Name string `json:"name"`

type HolderAddress

type HolderAddress string

func (*HolderAddress) Scan

func (v *HolderAddress) Scan(value interface{}) (err error)

type HolderBalance

type HolderBalance uint64

func (*HolderBalance) Scan

func (v *HolderBalance) Scan(value interface{}) (err error)

type HoldingPoint

type HoldingPoint struct {
	Percent float64 `json:"percent"`
	Amount  int64   `json:"amount"`
	Count   int64   `json:"count"`

type MarketDataProvider

type MarketDataProvider interface {
	GetTezosMarketData(curr string) (md MarketInfo, err error)

MarketDataProvider is an interface for getting actual price and price changes.

type MarketInfo

type MarketInfo interface {
	GetPrice() float64
	GetPriceChange() float64
	GetMarketCap() float64
	GetVolume() float64
	GetSupply() float64

MarketInfo is the interface getting prices and price changes.

type NFTContract

type NFTContract struct {
	ID               int64  `gorm:"column:id"`
	Name             string `gorm:"column:name"`
	ContractType     string `gorm:"column:contract_type"`
	AccountId        string `gorm:"column:account_id"`
	SwapContract     string `gorm:"column:swap_contract"`
	Description      string `gorm:"column:description"`
	LedgerBigMap     int64  `gorm:"column:ledger_big_map"`
	TokensBigMap     int64  `gorm:"column:tokens_big_map"`
	OperationsNum    int64  `gorm:"column:operations_num"`
	LastHeight       int64  `gorm:"column:last_height"`
	LastUpdateHeight int64  `gorm:"column:last_update_height"`
	NFTsNumber       int64  `gorm:"column:nfts_number"`

type NFTContractOwnership

type NFTContractOwnership struct {
	UniqueHoldersNum   int64
	SingleTokenHolders int64
	MultiTokenHolders  int64
	WhaleTokenHolders  int64

type NFTDistribution

type NFTDistribution struct {
	Holders          []AssetHolder
	TokenNum         int64
	UniqueHoldersNum int64

type NFTOperations

type NFTOperations struct {
	BlockLevel         int64
	TokenID            int64
	OperationId        int64
	OperationGroupHash string
	Sender             string
	Receiver           string
	Amount             int64

type NFTToken

type NFTToken struct {
	ContractID   int64     `gorm:"column:contract_id"`
	ID           uint64    `gorm:"column:token_id"`
	Name         string    `gorm:"column:name"`
	Category     string    `gorm:"column:category"`
	Description  string    `gorm:"column:description"`
	Decimals     int64     `gorm:"column:decimals"`
	Amount       int64     `gorm:"column:amount"`
	LastPrice    int64     `gorm:"column:last_price"`
	IssuedBy     string    `gorm:"column:issued_by"`
	IsForSale    bool      `gorm:"column:is_for_sale"`
	IpfsSource   string    `gorm:"column:ipfs_source"`
	CreatedAt    time.Time `gorm:"column:created_at"`
	LastActiveAt time.Time `gorm:"column:last_active_at"`

type Network

type Network string
const (
	NetworkMain     Network = "main"
	NetworkFlorence Network = "florence"

type Operation

type Operation struct {
	OperationID           null.Int    `gorm:"primary_key;AUTO_INCREMENT" json:"operation_id"`
	OperationGroupHash    null.String `json:"operation_group_hash"`
	Kind                  null.String `json:"kind"`
	Level                 int64       `json:"level"`
	Delegate              string      `json:"delegate"`
	Slots                 string      `json:"slots"`
	Nonce                 string      `json:"nonce"`
	Pkh                   string      `json:"pkh"`
	Secret                string      `json:"secret"`
	Source                string      `json:"source"`
	Fee                   int64       `json:"fee"`
	Counter               int64       `json:"counter"`
	GasLimit              int64       `json:"gas_limit"`
	StorageLimit          int64       `json:"storage_limit"`
	PublicKey             string      `json:"public_key"`
	Amount                int64       `json:"amount"`
	Destination           string      `json:"destination"`
	Parameters            string      `json:"parameters"`
	ParametersEntrypoints string      `json:"parameters_entrypoints"`
	ParametersMicheline   string      `json:"parameters_micheline"`
	ManagerPubkey         string      `json:"manager_pubkey"`
	Balance               int64       `json:"balance"`
	Spendable             bool        `json:"spendable"`
	Delegatable           bool        `json:"delegatable"`
	DelegationAmount      int64       `json:"delegation_amount" gorm:"column:balance"`
	Script                string      `json:"script"`
	Storage               string      `json:"storage"`
	Status                string      `json:"status"`
	Errors                string      `json:"errors"`
	ConsumedGas           int64       `json:"consumed_gas"`
	StorageSize           int64       `json:"storage_size"`
	PaidStorageSizeDiff   int64       `json:"paid_storage_size_diff"`
	OriginatedContracts   string      `json:"originated_contracts"`
	BlockHash             null.String `json:"block_hash"`
	BlockLevel            null.Int    `json:"block_level"`
	//Temp not unmarshal timestamp from json db because time.Time not support ISO without timezone
	Timestamp          time.Time `json:"-"`
	Branch             string    `json:"branch" gorm:"column:branch"`
	NumberOfSlots      int64     `json:"number_of_slots" gorm:"column:number_of_slots"`
	Cycle              int64     `json:"cycle" gorm:"column:cycle"`
	Proposal           string    `json:"proposal" gorm:"column:proposal"`
	Ballot             string    `json:"ballot" gorm:"column:ballot"`
	Internal           bool      `json:"internal" gorm:"column:internal"`
	Period             int64     `json:"period" gorm:"column:period"`
	Reward             int64     `json:"reward" gorm:"column:change"`
	DelegateName       string    `json:"delegate_name" gorm:"column:delegate_name"`
	SourceName         string    `json:"source_name" gorm:"column:source_name"`
	DestinationName    string    `json:"destination_name" gorm:"column:destination_name"`
	Confirmations      int64     `json:"confirmations"`
	EndorsementReward  int64     `json:"endorsement_reward" gorm:"column:endorsement_reward"`
	EndorsementDeposit int64     `json:"endorsement_reward" gorm:"column:endorsement_deposit"`
	ClaimedAmount      int64     `json:"claimed_amount" gorm:"column:claimed_amount"`
	Deposit            int64     `json:"deposit"`

type OperationCount

type OperationCount struct {
	Kind  string `json:"kind"`
	Count int64  `json:"count"`

type OperationCounter

type OperationCounter struct {
	ID              int64     `gorm:"column:cnt_id;primary_key;AUTO_INCREMENT"`
	LastOperationID int64     `gorm:"column:cnt_last_op_id"`
	OperationType   string    `gorm:"column:cnt_operation_type"`
	Count           int64     `gorm:"column:cnt_count"`
	CreatedAt       time.Time `gorm:"column:cnt_created_at"`

type OperationGroup

type OperationGroup struct {
	Protocol   null.String `json:"protocol"`
	ChainID    string      `json:"chain_id"`
	Hash       null.String `gorm:"primary_key;AUTO_INCREMENT" json:"hash"`
	Branch     null.String `json:"branch"`
	Signature  string      `json:"signature"`
	BlockID    null.String `json:"block_id"`
	Block      *Block      `json:"block"` // This line is infered from column name "block_id".
	BlockLevel int64       `json:"block_level" gorm:"column:block_level"`

type OperationReport

type OperationReport struct {

	//DB field
	Amount      float64 `csv:"-"`
	Source      string  `csv:"-"`
	Destination string  `csv:"-"`

	//CSV field
	In  float64 `csv:"in"`
	Out float64 `csv:"out"`

type PeriodBallot

type PeriodBallot struct {
	Rolls    int64
	Ballot   string
	Proposal string

type PeriodInfo

type PeriodInfo struct {
	ID         int64
	Type       string
	StartBlock int64
	EndBlock   int64
	StartTime  time.Time
	EndTime    time.Time

type PeriodStats

type PeriodStats struct {
	Rolls       int64
	Bakers      int64
	BlockLevel  int64
	Period      int64
	Kind        string
	TotalBakers int64
	TotalRolls  int64
	BallotsStat *BallotsStat
	Proposal    *ProposalInfo

type PeriodType

type PeriodType string

type Proposal

type Proposal struct {
	ProtocolHash string `json:"protocol_hash"`
	BlockID      string `json:"block_id"`
	Block        *Block `json:"block"` // This line is infered from column name "block_id".
	BlockLevel   uint   `json:"block_level"`
	Supporters   uint   `json:"supporters"`


type ProposalInfo

type ProposalInfo struct {
	Hash             string
	Title            string
	ShortDescription string
	ProposalFile     string

type ProposalVoter

type ProposalVoter struct {
	Proposal   string
	BlockLevel int64
	Operation  string
	Timestamp  time.Time
	Ballot     string

type Proposer

type Proposer struct {

type Protocol

type Protocol struct {
	Hash       string
	StartBlock int64
	EndBlock   int64

type PublicBaker

type PublicBaker struct {
	DelegatorsChange int64 `json:"delegators"`
	StakeChange      int64 `json:"stake_change"`

type PublicBakerSearch

type PublicBakerSearch struct {
	Delegate  string
	BakerName string

type RegisteredToken

type RegisteredToken struct {
	ID           uint64
	Name         string
	ContractType string
	AccountId    string
	Scale        uint64
	Ticker       string

type ReportFilter

type ReportFilter struct {
	From         int64
	To           int64
	Limit        int64
	Operations   []string
	EndorsingReq bool
	AssetsReq    bool

type RewardStatus

type RewardStatus string
const (
	StatusPending  RewardStatus = "pending"
	StatusActive   RewardStatus = "active"
	StatusFrozen   RewardStatus = "frozen"
	StatusUnfrozen RewardStatus = "unfrozen"

type RightFilter

type RightFilter struct {
	Delegates    []string
	PriorityFrom int
	PriorityTo   int
	Limit        null.Int
	Offset       null.Int
	IsFuture     bool

type Roll

type Roll struct {
	Pkh          string `json:"pkh"`
	Rolls        int64  `json:"rolls"`
	BlockLevel   int64  `json:"block_level"`
	VotingPeriod int64  `json:"voting_period"`
	Cycle        int64  `json:"cycle"`

type Snapshot

type Snapshot struct {
	Cycle      int64 `gorm:"column:snp_cycle" json:"cycle"`
	BlockLevel int64 `gorm:"column:snp_block_level" json:"block_level"`
	Block      Block `gorm:"column:snp_block_level save_associations:false" json:"block"`
	Rolls      int64 `gorm:"column:snp_rolls" json:"rolls"`

type SnapshotsView

type SnapshotsView struct {

type Storage

type Storage struct {
	Key   string `gorm:"column:key"`
	Value string `gorm:"column:value"`

type ThirdPartyBaker

type ThirdPartyBaker struct {
	Provider          string  `json:"provider"`
	Number            int     `json:"number"`
	Name              string  `json:"name"`
	Address           string  `json:"address"`
	Yield             float64 `json:"yield"`
	StakingBalance    int64   `json:"staking_balance,omitempty"`
	Fee               float64 `json:"fee"`
	AvailableCapacity int64   `json:"available_capacity,omitempty"`
	Efficiency        float64 `json:"efficiency,omitempty"`
	PayoutAccuracy    string  `json:"payout_accuracy,omitempty"`

type ThirdPartyBakerAgg

type ThirdPartyBakerAgg struct {
	Address        string
	Alias          string
	StakingBalance int64
	Providers      ThirdPartyProviders

type ThirdPartyProviders

type ThirdPartyProviders []ThirdPartyBaker

func (*ThirdPartyProviders) Scan

func (v *ThirdPartyProviders) Scan(value interface{}) (err error)

type User

type User struct {
	AccountID string
	Username  string
	Email     string
	Verified  bool
	CreatedAt time.Time

type UserAddress

type UserAddress struct {
	AccountID           string
	Address             string
	DelegationsEnabled  bool
	InTransfersEnabled  bool
	OutTransfersEnabled bool

type UserAddressWithBalance

type UserAddressWithBalance struct {
	Balance null.Int

type UserAddressWithEmail

type UserAddressWithEmail struct {
	Email string

type UserNote

type UserNote struct {
	ID          uint64
	AccountID   string
	Address     string
	Alias       string
	Tag         string
	Description string

type UserNoteWithBalance

type UserNoteWithBalance struct {
	Balance null.Int

type Voter

type Voter struct {
	Rolls int64

type VotingProposal

type VotingProposal struct {
	Bakers     int64
	BlockLevel int64
	Period     int64
	Kind       string

Jump to

Keyboard shortcuts

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