Documentation
¶
Index ¶
- Constants
- Variables
- func DetectLedger(s micheline.Script) (schema LedgerSchema, typ TokenType, lid, mid int64)
- func DisableLog()
- func GetKeyId(bigmapid int64, kh tezos.ExprHash) uint64
- func Int16Correct(i int) int
- func IsFA1(s micheline.Script) bool
- func IsFA12(s micheline.Script) bool
- func IsFA2(s micheline.Script) bool
- func IsLedgerOwner(ctx context.Context, t *pack.Table, ownerId, ledgerId AccountID) (bool, error)
- func PrimMatches(prim micheline.Prim, template [][]int) bool
- func ReadConfigOpts(keys ...string) pack.Options
- func StoreTicketEvents(ctx context.Context, t *pack.Table, events []*TicketEvent) error
- func StoreTokenEvents(ctx context.Context, t *pack.Table, events []*TokenEvent) error
- func TicketHash(a tezos.Address, typ, content micheline.Prim) uint64
- func UnpackTnsString(v string) (string, error)
- func UseLogger(logger logpkg.Logger)
- type Account
- func (a Account) Balance() int64
- func (a *Account) Equal(b *Account) bool
- func (a *Account) Free()
- func (a Account) ID() uint64
- func (m Account) IndexOpts(key string) pack.Options
- func (a Account) IsDust() bool
- func (a Account) MarshalBinary() ([]byte, error)
- func (a *Account) Reset()
- func (a *Account) RollbackBalance(f *Flow) error
- func (a *Account) RollbackBalanceN(flows []*Flow) error
- func (a *Account) SetID(id uint64)
- func (a Account) String() string
- func (m Account) TableKey() string
- func (m Account) TableOpts() pack.Options
- func (a *Account) UnmarshalBinary(data []byte) error
- func (a *Account) UpdateBalance(f *Flow) error
- func (a *Account) UpdateBalanceN(flows []*Flow) error
- type AccountID
- type AccountRank
- type Baker
- func (b Baker) BakingPower(p *rpc.Params, adjust int64) int64
- func (b Baker) BakingPowerEmmy(p *rpc.Params, adjust int64) int64
- func (b Baker) BakingPowerOxford(p *rpc.Params, adjust int64) int64
- func (b Baker) BakingPowerTenderbake(p *rpc.Params, adjust int64) int64
- func (b Baker) Balance() int64
- func (b *Baker) BurnStake(stake int64) int64
- func (b Baker) DelegationCapOxford(p *rpc.Params, adjust int64) int64
- func (b Baker) DelegationCapacity(p *rpc.Params, netRolls, adjust int64) int64
- func (b Baker) DelegationCapacityEmmy(p *rpc.Params, netRolls, adjust int64) int64
- func (b Baker) DelegationCapacityOxford(p *rpc.Params, adjust int64) int64
- func (b Baker) DelegationCapacityTenderbake(p *rpc.Params, adjust int64) int64
- func (b Baker) FrozenStake() int64
- func (b *Baker) GetVersionBytes() []byte
- func (b Baker) ID() uint64
- func (b Baker) IndexOpts(key string) pack.Options
- func (b *Baker) InitGracePeriod(cycle int64, params *rpc.Params)
- func (b Baker) IsOverDelegated(p *rpc.Params) bool
- func (b Baker) IsOverStaked(p *rpc.Params) bool
- func (b *Baker) MintStake(stake int64) int64
- func (b *Baker) Reset()
- func (b *Baker) RollbackBalance(f *Flow) error
- func (b *Baker) RollbackBalanceN(flows []*Flow) error
- func (b *Baker) SetID(id uint64)
- func (b *Baker) SetVersion(nonce uint64)
- func (b Baker) StakeAdjust(block *Block) int64
- func (b Baker) StakeAdjustEmmy(block *Block) (adjust int64)
- func (b Baker) StakeAdjustTenderbake(block *Block) (adjust int64)
- func (b Baker) StakeAmount(shares int64) int64
- func (b Baker) StakingBalance() int64
- func (b Baker) StakingCap(p *rpc.Params) int64
- func (b Baker) StakingCapacity(p *rpc.Params) int64
- func (b Baker) String() string
- func (b Baker) TableKey() string
- func (b Baker) TableOpts() pack.Options
- func (b Baker) TotalBalance() int64
- func (b *Baker) UpdateBalance(f *Flow) error
- func (b *Baker) UpdateBalanceN(flows []*Flow) error
- func (b *Baker) UpdateGracePeriod(cycle int64, params *rpc.Params)
- type BakerID
- type Balance
- type Ballot
- type BaseRight
- type BigmapAlloc
- func (b *BigmapAlloc) GetKeyType() micheline.Type
- func (b *BigmapAlloc) GetKeyTypeBytes() []byte
- func (b *BigmapAlloc) GetValueType() micheline.Type
- func (b *BigmapAlloc) GetValueTypeBytes() []byte
- func (m *BigmapAlloc) ID() uint64
- func (m BigmapAlloc) IndexOpts(key string) pack.Options
- func (m *BigmapAlloc) Reset()
- func (m *BigmapAlloc) SetID(id uint64)
- func (m BigmapAlloc) TableKey() string
- func (m BigmapAlloc) TableOpts() pack.Options
- func (b *BigmapAlloc) ToRemove(op *Op) *BigmapUpdate
- func (b *BigmapAlloc) ToUpdate(op *Op) *BigmapUpdate
- func (b *BigmapAlloc) ToUpdateCopy(op *Op, srcid int64) *BigmapUpdate
- type BigmapUpdate
- func (b *BigmapUpdate) GetKey(typ micheline.Type) (micheline.Key, error)
- func (b *BigmapUpdate) GetKeyHash() tezos.ExprHash
- func (b *BigmapUpdate) GetKeyType() micheline.Type
- func (b *BigmapUpdate) GetValue(typ micheline.Type) micheline.Value
- func (b *BigmapUpdate) GetValueType() micheline.Type
- func (m *BigmapUpdate) ID() uint64
- func (m BigmapUpdate) IndexOpts(key string) pack.Options
- func (m *BigmapUpdate) Reset()
- func (m *BigmapUpdate) SetID(id uint64)
- func (m BigmapUpdate) TableKey() string
- func (m BigmapUpdate) TableOpts() pack.Options
- func (b *BigmapUpdate) ToAlloc() *BigmapAlloc
- func (b *BigmapUpdate) ToEvent() micheline.BigmapEvent
- func (b *BigmapUpdate) ToKV() *BigmapValue
- type BigmapValue
- func (b *BigmapValue) GetKey(typ micheline.Type) (micheline.Key, error)
- func (b *BigmapValue) GetKeyHash() tezos.ExprHash
- func (b *BigmapValue) GetValue(typ micheline.Type) micheline.Value
- func (m *BigmapValue) ID() uint64
- func (m BigmapValue) IndexOpts(key string) pack.Options
- func (m *BigmapValue) Reset()
- func (m *BigmapValue) SetID(id uint64)
- func (m BigmapValue) TableKey() string
- func (m BigmapValue) TableOpts() pack.Options
- func (b *BigmapValue) ToUpdateCopy(op *Op) *BigmapUpdate
- func (b *BigmapValue) ToUpdateRemove(op *Op) *BigmapUpdate
- type Block
- func (b *Block) Age(height int64) int64
- func (b *Block) Clean()
- func (b Block) Clone() *Block
- func (b *Block) FetchRPC(ctx context.Context, c *rpc.Client) error
- func (b *Block) Free()
- func (b *Block) GetOpId(opn, opc, opi int) (OpID, bool)
- func (b Block) ID() uint64
- func (m Block) IndexOpts(key string) pack.Options
- func (b *Block) IsProtocolUpgrade() bool
- func (b *Block) NextN() int
- func (b *Block) Reset()
- func (b *Block) Rollback(accounts map[AccountID]*Account, bakers map[AccountID]*Baker)
- func (b *Block) SetID(id uint64)
- func (m Block) TableKey() string
- func (m Block) TableOpts() pack.Options
- func (b Block) Time() time.Time
- func (b *Block) Update(accounts map[AccountID]*Account, bakers map[AccountID]*Baker)
- type BlockBuilder
- type BlockCrawler
- type BlockIndexer
- type Chain
- func (c *Chain) ID() uint64
- func (m Chain) IndexOpts(key string) pack.Options
- func (c *Chain) Rollback(b *Block)
- func (c *Chain) SetID(id uint64)
- func (m Chain) TableKey() string
- func (m Chain) TableOpts() pack.Options
- func (c Chain) Time() time.Time
- func (c *Chain) Update(b *Block, accounts map[AccountID]*Account, bakers map[AccountID]*Baker)
- type ChainTip
- type Constant
- type ConstantID
- type Contract
- func AllocContract() *Contract
- func NewContract(acc *Account, oop *rpc.Origination, op *Op, dict micheline.ConstantDict, ...) *Contract
- func NewImplicitContract(acc *Account, res rpc.ImplicitResult, op *Op, p *rpc.Params) *Contract
- func NewInternalContract(acc *Account, iop rpc.InternalResult, op *Op, dict micheline.ConstantDict, ...) *Contract
- func NewManagerTzContract(a *Account, height int64) (*Contract, error)
- func NewRollupContract(acc *Account, op *Op, res rpc.OperationResult, p *rpc.Params) *Contract
- func (c *Contract) ConvertParams(in micheline.Parameters) (out micheline.Parameters)
- func (c *Contract) DecCallStats(entrypoint int)
- func (c *Contract) Free()
- func (c *Contract) HeapSize() int
- func (c Contract) ID() uint64
- func (c *Contract) IncCallStats(entrypoint int)
- func (m Contract) IndexOpts(key string) pack.Options
- func (c Contract) IsRollup() bool
- func (c *Contract) ListCallStats() map[string]int
- func (c *Contract) ListSmartRollupCallStats() map[string]int
- func (c *Contract) ListTxRollupCallStats() map[string]int
- func (c *Contract) LoadScript() (*micheline.Script, error)
- func (c *Contract) LoadType() (ptyp micheline.Type, styp micheline.Type, err error)
- func (c *Contract) NamedBigmaps(m []*BigmapAlloc) map[string]int64
- func (c *Contract) Reset()
- func (c *Contract) Rollback(drop, last *Op, p *rpc.Params)
- func (c *Contract) SetID(id uint64)
- func (c Contract) String() string
- func (m Contract) TableKey() string
- func (m Contract) TableOpts() pack.Options
- func (c *Contract) Update(op *Op, p *rpc.Params) bool
- type ContractID
- type Cycle
- type Deployment
- type Election
- type ElectionID
- type Endorsement
- type Event
- type EventID
- type FA1Transfer
- type FA2Transfer
- type Flow
- type FlowKind
- type FlowType
- type Income
- func (s *Income) Free()
- func (s Income) ID() uint64
- func (m Income) IndexOpts(key string) pack.Options
- func (s *Income) Reset()
- func (s *Income) SetID(id uint64)
- func (m Income) TableKey() string
- func (m Income) TableOpts() pack.Options
- func (s *Income) UpdateLuck(totalStake int64, p *rpc.Params)
- func (v *Income) UpdatePerformance(reliability int64)
- type LedgerBalance
- type LedgerDomain
- type LedgerFAa
- type LedgerFAb
- type LedgerFAc
- type LedgerFAd
- type LedgerFAe
- type LedgerFAf
- type LedgerFAg
- type LedgerFAh
- type LedgerFAi
- type LedgerFAj
- type LedgerNFT1
- type LedgerNFT2
- type LedgerNFT3
- type LedgerSchema
- type LedgerTezFin
- type LedgerTzBTC
- type MetaID
- type Metadata
- type Model
- type Op
- func (o *Op) Free()
- func (o Op) ID() uint64
- func (o Op) Id() uint64
- func (m Op) IndexOpts(key string) pack.Options
- func (o *Op) Reset()
- func (o *Op) SetID(id uint64)
- func (m Op) TableKey() string
- func (m Op) TableOpts() pack.Options
- func (o Op) Time() time.Time
- func (o Op) ToEndorsement() *Endorsement
- type OpID
- type OpRef
- type OpType
- type OpTypeList
- type Proposal
- type ProposalID
- type Right
- func (r *Right) Free()
- func (r *Right) ID() uint64
- func (m Right) IndexOpts(key string) pack.Options
- func (r Right) IsLost(pos int) bool
- func (r Right) IsMissed(pos int) bool
- func (r Right) IsSeedRequired(pos int) bool
- func (r Right) IsSeedRevealed(pos int) bool
- func (r Right) IsStolen(pos int) bool
- func (r Right) IsUsed(pos int) bool
- func (r Right) Reliability(pos int) int64
- func (r *Right) Reset()
- func (r *Right) SetID(id uint64)
- func (m Right) TableKey() string
- func (m Right) TableOpts() pack.Options
- func (r Right) ToBase(pos int, typ tezos.RightType) (BaseRight, bool)
- type Snapshot
- type Stake
- type Status
- type Storage
- type StorageID
- type Supply
- func (s *Supply) ID() uint64
- func (m Supply) IndexOpts(key string) pack.Options
- func (s *Supply) Reset()
- func (s *Supply) Rollback(b *Block)
- func (s *Supply) SetID(id uint64)
- func (m Supply) TableKey() string
- func (m Supply) TableOpts() pack.Options
- func (s Supply) Time() time.Time
- func (s *Supply) Update(b *Block, bakers map[AccountID]*Baker)
- type Ticket
- func (t *Ticket) Free()
- func (t Ticket) ID() uint64
- func (_ Ticket) IndexOpts(_ string) pack.Options
- func (t *Ticket) Reset()
- func (t *Ticket) SetID(id uint64)
- func (t Ticket) Size() int
- func (t *Ticket) Store(ctx context.Context, s *pack.Table) error
- func (_ Ticket) TableKey() string
- func (_ Ticket) TableOpts() pack.Options
- type TicketEvent
- func (e *TicketEvent) Free()
- func (t TicketEvent) ID() uint64
- func (_ TicketEvent) IndexOpts(_ string) pack.Options
- func (e *TicketEvent) Reset()
- func (t *TicketEvent) SetID(id uint64)
- func (e *TicketEvent) Store(ctx context.Context, t *pack.Table) error
- func (_ TicketEvent) TableKey() string
- func (_ TicketEvent) TableOpts() pack.Options
- type TicketEventID
- type TicketEventType
- type TicketID
- type TicketOwner
- func GetOrCreateTicketOwner(ctx context.Context, t *pack.Table, accountId, issuerId AccountID, id TicketID, ...) (*TicketOwner, error)
- func GetTicketOwner(ctx context.Context, t *pack.Table, accountId AccountID, id TicketID) (*TicketOwner, error)
- func GetTicketOwnerId(ctx context.Context, t *pack.Table, id TicketOwnerID) (*TicketOwner, error)
- func ListTicketOwners(ctx context.Context, t *pack.Table, q pack.Query) ([]*TicketOwner, error)
- func NewTicketOwner() *TicketOwner
- func (o *TicketOwner) Free()
- func (t TicketOwner) ID() uint64
- func (_ TicketOwner) IndexOpts(_ string) pack.Options
- func (o *TicketOwner) Reset()
- func (t *TicketOwner) SetID(id uint64)
- func (o *TicketOwner) Store(ctx context.Context, t *pack.Table) error
- func (_ TicketOwner) TableKey() string
- func (_ TicketOwner) TableOpts() pack.Options
- type TicketOwnerID
- type TicketUpdate
- func (m *TicketUpdate) Free()
- func (t TicketUpdate) ID() uint64
- func (_ TicketUpdate) IndexOpts(_ string) pack.Options
- func (_ TicketUpdate) Indexes() []string
- func (m *TicketUpdate) Reset()
- func (t *TicketUpdate) SetID(id uint64)
- func (t *TicketUpdate) Store(ctx context.Context, table *pack.Table) error
- func (_ TicketUpdate) TableKey() string
- func (_ TicketUpdate) TableOpts() pack.Options
- type TicketUpdateID
- type Token
- func FindTokenId(ctx context.Context, t *pack.Table, id TokenID) (*Token, error)
- func GetOrCreateToken(ctx context.Context, t *pack.Table, ledger *Contract, signer *Account, ...) (*Token, error)
- func GetToken(ctx context.Context, t *pack.Table, ledger *Contract, id tezos.Z) (*Token, error)
- func NewToken() *Token
- func NewTokenMeta() *Token
- type TokenEvent
- type TokenEventID
- type TokenEventType
- type TokenID
- type TokenMeta
- type TokenMetaID
- type TokenOwner
- func GetCurrentTokenOwner(ctx context.Context, t *pack.Table, tokenId TokenID) (*TokenOwner, error)
- func GetOrCreateOwner(ctx context.Context, t *pack.Table, accountId AccountID, tokenId TokenID, ...) (*TokenOwner, error)
- func GetOwnerId(ctx context.Context, t *pack.Table, id TokenOwnerID) (*TokenOwner, error)
- func GetTokenOwner(ctx context.Context, t *pack.Table, accountId AccountID, tokenId TokenID) (*TokenOwner, error)
- func ListOwners(ctx context.Context, t *pack.Table, q pack.Query) ([]*TokenOwner, error)
- func NewTokenOwner() *TokenOwner
- type TokenOwnerID
- type TokenTransfer
- type TokenType
- func (t TokenType) DecodeTransfers(prim micheline.Prim) ([]TokenTransfer, error)
- func (t TokenType) IsValid() bool
- func (t TokenType) MarshalText() ([]byte, error)
- func (t TokenType) Matches(prim micheline.Prim) bool
- func (t TokenType) String() string
- func (t *TokenType) UnmarshalText(data []byte) error
- type TransferList
- type Vote
- type Voter
Constants ¶
const ( DustLimit int64 = 10_000 // 0.01 tez AccountTableKey = "account" )
const ( BigmapAllocTableKey = "bigmap_types" BigmapUpdateTableKey = "bigmap_updates" BigmapValueTableKey = "bigmap_values" )
const ( ElectionTableKey = "gov_election" ProposalTableKey = "gov_proposal" VoteTableKey = "gov_vote" BallotTableKey = "gov_ballot" StakeTableKey = "gov_stake" )
const ( OpTableKey = "op" EndorseOpTableKey = "endorsement" )
const ( OPL_PROTOCOL_UPGRADE = -1 // migration OPL_BLOCK_EVENTS = -1 // block-level events like auto (un)freeze, rewards OPL_BLOCK_HEADER = -1 // implicit operations like liquidity baking )
implicit operation list ids
const ( SnapshotTableKey = "snapshot" SnapshotStagingTableKey = "snapstage" )
const BakerTableKey = "baker"
const BalanceTableKey = "balance"
const BlockTableKey = "block"
const ChainTableKey = "chain"
const ConstantTableKey = "constant"
const ContractTableKey = "contract"
const CycleTableKey = "cycle"
const EventTableKey = "event"
const FlowTableKey = "flow"
const IncomeTableKey = "income"
const MetadataTableKey = "metadata"
const RightsTableKey = "rights"
const StorageTableKey = "storage"
const SupplyTableKey = "supply"
const (
TicketEventTableKey = "ticket_events"
)
const (
TicketOwnerTableKey = "ticket_owners"
)
const (
TicketTableKey = "ticket"
)
const (
TicketUpdateTableKey = "ticket_updates"
)
const (
TokenEventTableKey = "token_events"
)
const (
TokenMetaTableKey = "token_metadata"
)
const (
TokenOwnerTableKey = "token_owners"
)
const (
TokenTableKey = "token"
)
Variables ¶
var ( ErrNoAccount = errors.New("account not indexed") ErrInvalidAddress = errors.New("invalid address") )
var ( ErrNoBigmap = errors.New("bigmap not indexed") ErrInvalidExprHash = errors.New("invalid expr hash") )
var ( // ErrNoBlock is an error that indicates a requested entry does // not exist in the block bucket. ErrNoBlock = errors.New("block not indexed") // ErrInvalidBlockHeight ErrInvalidBlockHeight = errors.New("invalid block height") // ErrInvalidBlockHash ErrInvalidBlockHash = errors.New("invalid block hash") )
var ( // ErrNoElection is an error that indicates a requested entry does // not exist in the election table. ErrNoElection = errors.New("election not indexed") // ErrNoProposal is an error that indicates a requested entry does // not exist in the proposal table. ErrNoProposal = errors.New("proposal not indexed") // ErrNoVote is an error that indicates a requested entry does // not exist in the vote table. ErrNoVote = errors.New("vote not indexed") // ErrNoBallot is an error that indicates a requested entry does // not exist in the ballot table. ErrNoBallot = errors.New("ballot not indexed") ErrInvalidProtocolHash = errors.New("invalid protocol hash") )
var ( ErrNoOp = errors.New("op not indexed") ErrNoEndorsement = errors.New("endorsement not indexed") ErrInvalidOpID = errors.New("invalid op id") ErrInvalidOpHash = errors.New("invalid op hash") )
var (
ErrLedgerSkip = errors.New("skip")
)
var ErrNoBaker = errors.New("baker not indexed")
var ErrNoBalance = errors.New("balance not indexed")
var ( // ErrNoChain is an error that indicates a requested entry does // not exist in the chain table. ErrNoChain = errors.New("chain state not indexed") )
var (
ErrNoConstant = errors.New("constant not indexed")
)
var (
ErrNoContract = errors.New("contract not indexed")
)
var ErrNoCycle = errors.New("cycle not indexed")
var (
ErrNoEvent = errors.New("event not indexed")
)
var (
ErrNoFlow = errors.New("flow not indexed")
)
var (
ErrNoIncome = errors.New("income not indexed")
)
var ErrNoMetadata = errors.New("metadata not indexed")
var (
ErrNoRights = errors.New("rights not indexed")
)
var (
ErrNoSnapshot = errors.New("snapshot not indexed")
)
var ErrNoStorage = errors.New("storage not indexed")
var ErrNoSupply = errors.New("supply not indexed")
var (
ErrNoTicket = errors.New("ticket type not indexed")
)
var (
ErrNoTicketEvent = errors.New("ticket event not indexed")
)
var (
ErrNoTicketOwner = errors.New("ticket owner not indexed")
)
var (
ErrNoTicketUpdate = errors.New("ticket update not indexed")
)
var (
ErrNoToken = errors.New("token not indexed")
)
var (
ErrNoTokenEvent = errors.New("token event not indexed")
)
var (
ErrNoTokenMeta = errors.New("token metadata not indexed")
)
var (
ErrNoTokenOwner = errors.New("token owner not indexed")
)
Functions ¶
func DetectLedger ¶
func DetectLedger(s micheline.Script) (schema LedgerSchema, typ TokenType, lid, mid int64)
Detect legder type from interface and schema from bigmap type.
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
func Int16Correct ¶
Correct overflow from negative numbers caused by DB storage/type
func IsLedgerOwner ¶
func ReadConfigOpts ¶
func StoreTicketEvents ¶
func StoreTokenEvents ¶
func UnpackTnsString ¶
Types ¶
type Account ¶
type Account struct {
RowId AccountID `pack:"I,pk" json:"row_id"`
Address tezos.Address `pack:"H,bloom=3" json:"address"`
Type tezos.AddressType `pack:"t,u8" json:"address_type"`
Pubkey tezos.Key `pack:"k" json:"pubkey"`
Counter int64 `pack:"j,i32" json:"counter"`
BakerId AccountID `pack:"D" json:"baker_id"`
CreatorId AccountID `pack:"C" json:"creator_id"`
FirstIn int64 `pack:"i,i32" json:"first_in"`
FirstOut int64 `pack:"o,i32" json:"first_out"`
LastIn int64 `pack:"J,i32" json:"last_in"`
LastOut int64 `pack:"O,i32" json:"last_out"`
FirstSeen int64 `pack:"0,i32" json:"first_seen"`
LastSeen int64 `pack:"l,i32" json:"last_seen"`
DelegatedSince int64 `pack:"+,i32" json:"delegated_since"`
TotalReceived int64 `pack:"R" json:"total_received"`
TotalSent int64 `pack:"S" json:"total_sent"`
TotalBurned int64 `pack:"B" json:"total_burned"`
TotalFeesPaid int64 `pack:"F" json:"total_fees_paid"`
TotalFeesUsed int64 `pack:"u" json:"total_fees_used"`
UnclaimedBalance int64 `pack:"U" json:"unclaimed_balance"`
SpendableBalance int64 `pack:"s" json:"spendable_balance"`
FrozenRollupBond int64 `pack:"L" json:"frozen_rollup_bond"` // rollup
LostRollupBond int64 `pack:"X" json:"lost_rollup_bond"` // rollup
StakedBalance int64 `pack:"Y" json:"staked_balance"` // stake
UnstakedBalance int64 `pack:"Z" json:"unstaked_balance"` // stake
LostStake int64 `pack:"V" json:"lost_stake"` // stake
IsFunded bool `pack:"f,snappy" json:"is_funded"`
IsActivated bool `pack:"A,snappy" json:"is_activated"`
IsDelegated bool `pack:"=,snappy" json:"is_delegated"`
IsStaked bool `pack:"?,snappy" json:"is_staked"`
IsRevealed bool `pack:"r,snappy" json:"is_revealed"`
IsBaker bool `pack:"d,snappy" json:"is_baker"`
IsContract bool `pack:"c,snappy" json:"is_contract"`
NTxSuccess int `pack:"1,i32" json:"n_tx_success"`
NTxFailed int `pack:"2,i32" json:"n_tx_failed"`
NTxIn int `pack:"3,i32" json:"n_tx_in"`
NTxOut int `pack:"4,i32" json:"n_tx_out"`
// used during block processing, not stored in DB
IsNew bool `pack:"-" json:"-"` // first seen this block
WasFunded bool `pack:"-" json:"-"` // true if account was funded before processing this block
WasDust bool `pack:"-" json:"-"` // true if account had 0 < balance < 1tez at start of block
IsDirty bool `pack:"-" json:"-"` // indicates an update happened
MustDelete bool `pack:"-" json:"-"` // indicates the account should be deleted (during rollback)
PrevBalance int64 `pack:"-" json:"-"` // previous balance before update
Baker *Baker `pack:"-" json:"-"` // used for stake updates
AuxBaker *Baker `pack:"-" json:"-"` // used for unstake during delegation
}
Account is an up-to-date snapshot of the current status of all known accounts. For history look at Op and Flow (balance updates) for baker info look at Baker, for smart contract info at Contract.
func AllocAccount ¶
func AllocAccount() *Account
func NewAccount ¶
func (Account) MarshalBinary ¶
func (*Account) RollbackBalance ¶
func (*Account) RollbackBalanceN ¶
func (*Account) UnmarshalBinary ¶
func (*Account) UpdateBalance ¶
func (*Account) UpdateBalanceN ¶
type AccountID ¶
type AccountID uint64
type AccountRank ¶
type AccountRank struct {
AccountId AccountID
Balance int64 // total balance
TxVolume24h int64 // tx volume in+out
TxTraffic24h int64 // number of tx in+out
RichRank int // assigned rank based on balance
VolumeRank int // assigned rank based on volume
TrafficRank int // assigned rank based on traffic
}
type Baker ¶
type Baker struct {
RowId BakerID `pack:"I,pk" json:"row_id"`
AccountId AccountID `pack:"A,u32" json:"account_id"`
Address tezos.Address `pack:"H,bloom=3" json:"address"`
ConsensusKey tezos.Key `pack:"K" json:"consensus_key"`
IsActive bool `pack:"v,snappy" json:"is_active"`
BakerSince int64 `pack:"*,i32" json:"baker_since"`
BakerUntil int64 `pack:"/,i32" json:"baker_until"`
TotalRewardsEarned int64 `pack:"W" json:"total_rewards_earned"`
TotalFeesEarned int64 `pack:"E" json:"total_fees_earned"`
TotalLost int64 `pack:"L" json:"total_lost"`
FrozenDeposits int64 `pack:"z" json:"frozen_deposits"`
FrozenRewards int64 `pack:"Z" json:"frozen_rewards"`
FrozenFees int64 `pack:"Y" json:"frozen_fees"`
DelegatedBalance int64 `pack:"~" json:"delegated_balance"`
TotalStake int64 `pack:"g" json:"total_stake"`
ActiveStakers int64 `pack:"j" json:"active_stakers"`
StakingEdge int64 `pack:"k" json:"staking_edge"`
StakingLimit int64 `pack:"l" json:"staking_limit"`
DepositsLimit int64 `pack:"T" json:"deposit_limit"`
ActiveDelegations int64 `pack:"a,i32" json:"active_delegations"`
BlocksBaked int64 `pack:"b,i32" json:"blocks_baked"`
BlocksProposed int64 `pack:"P,i32" json:"blocks_proposed"`
BlocksNotBaked int64 `pack:"N,i32" json:"blocks_not_baked"`
BlocksEndorsed int64 `pack:"x,i32" json:"blocks_endorsed"`
BlocksNotEndorsed int64 `pack:"y,i32" json:"blocks_not_endorsed"`
SlotsEndorsed int64 `pack:"e" json:"slots_endorsed"`
NBakerOps int64 `pack:"1,i32" json:"n_baker_ops"`
NProposal int64 `pack:"2,i32" json:"n_proposals"`
NBallot int64 `pack:"3,i32" json:"n_ballots"`
NEndorsement int64 `pack:"4,i32" json:"n_endorsements"`
NPreendorsement int64 `pack:"5,i32" json:"n_preendorsements"`
NSeedNonce int64 `pack:"6,i32" json:"n_nonce_revelations"`
N2Baking int64 `pack:"7,i32" json:"n_double_bakings"`
N2Endorsement int64 `pack:"8,i32" json:"n_double_endorsements"`
NSetDepositsLimit int64 `pack:"9,i32" json:"n_set_limits"`
NAccusations int64 `pack:"0,i32" json:"n_accusations"`
NUpdateConsensusKey int64 `pack:"!,i32" json:"n_update_consensus_key"`
NDrainDelegate int64 `pack:"=,i32" json:"n_drain_delegate"`
GracePeriod int64 `pack:"G,i32" json:"grace_period"`
Version uint32 `pack:"V,snappy" json:"baker_version"`
Account *Account `pack:"-" json:"-"` // related account
Reliability int64 `pack:"-" json:"-"` // current cycle reliability from rights
IsNew bool `pack:"-" json:"-"` // first seen this block
IsDirty bool `pack:"-" json:"-"` // indicates an update happened
}
Baker is an up-to-date snapshot of the current status of active or inactive bakers. For history look at Op and Flow (balance updates), for generic info look at Account.
func (Baker) BakingPower ¶
BakingPower calculates how much of the baker's stake (deposits and delegated) is used to derive consensus rights. There are subtle differences between versions. Post Oxford this is influenced by global and local limits.
func (Baker) BakingPowerOxford ¶
Ofxord active stake depends on global 5x limit and baker's local limit anything above these limits is counted as delegation and delegations are further capped to 9x stake
func (Baker) BakingPowerTenderbake ¶
v12+ staking balance capped by locked deposits
func (Baker) DelegationCapOxford ¶
Max counted delegation for baking power
func (Baker) DelegationCapacity ¶
func (Baker) DelegationCapacityEmmy ¶
Emmy - capacity depends on ratio between on stake and network-wide stake - adjust for end of cycle snapshot difference
func (Baker) DelegationCapacityOxford ¶
Oxford staking same as in Tenderbake, but config option semantic has changed to - FrozenDepositsPercentage = 10 // means deposit must be >= 10% of eligible delegation - LimitOfDelegationOverBaking = 9 // means max delegation = 9x stake
func (Baker) DelegationCapacityTenderbake ¶
Tenderbake - 10% of staking balance must be locked - deposit = stake * frozen_deposits_percentage / 100 - max_stake = total_balance / frozen_deposits_percentage * 100 - adjust for end of cycle snapshot difference
func (Baker) FrozenStake ¶
func (*Baker) GetVersionBytes ¶
func (*Baker) InitGracePeriod ¶
init 11 cycles ahead of current cycle
func (*Baker) RollbackBalance ¶
func (*Baker) RollbackBalanceN ¶
func (*Baker) SetVersion ¶
func (Baker) StakeAdjust ¶
func (Baker) StakeAdjustEmmy ¶
func (Baker) StakeAdjustTenderbake ¶
func (Baker) StakeAmount ¶
func (Baker) StakingBalance ¶
own balance plus frozen deposits+fees (NOT REWARDS!) plus all delegated balances (this is self-delegation safe) post oxford this is equal to TotalStake + SpendableBalance + DelegatedBalance
func (Baker) StakingCap ¶
max counted stake for baking power calc
func (Baker) StakingCapacity ¶
Oxford staking baker setting limit_of_staking_over_baking = 5(.000.000) means 5x own stake global_limit_of_staking_over_baking = 5 means baker total stake capcacity == 5x own stake
func (Baker) TotalBalance ¶
func (*Baker) UpdateBalance ¶
func (*Baker) UpdateBalanceN ¶
type Balance ¶
type Ballot ¶
type Ballot struct {
RowId uint64 `pack:"I,pk" json:"row_id"` // unique id
ElectionId ElectionID `pack:"E" json:"election_id"` // related election id
ProposalId ProposalID `pack:"P" json:"proposal_id"` // related proposal id
VotingPeriod int64 `pack:"p,i16" json:"voting_period"` // on-chain sequence number
VotingPeriodKind tezos.VotingPeriodKind `pack:"k,u8" json:"voting_period_kind"` // on-chain period
Height int64 `pack:"h,i32" json:"height"` // proposal/ballot operation block height
Time time.Time `pack:"T" json:"time"` // proposal/ballot operation block time
SourceId AccountID `pack:"S" json:"source_id"` // voting account
OpId OpID `pack:"O" json:"op_id"` // proposal/ballot operation id
Stake int64 `pack:"s" json:"stake"` // voting power (at beginning of voting period)
Ballot tezos.BallotVote `pack:"b,u8" json:"ballot"` // yay, nay, pass; proposal period uses yay only
}
Ballot represent a single vote cast by a baker during a voting period. Only periods 1, 2 and 4 support casting votes, period 1 uses `proposals` operations to vote on up to 20 proposals, periods 2 and 4 use `ballot` operations to vote on progressing with a single winning proposal.
type BigmapAlloc ¶
type BigmapAlloc struct {
RowId uint64 `pack:"I,pk" json:"row_id"` // internal: id
BigmapId int64 `pack:"B,i32" json:"bigmap_id"` // unique bigmap id
AccountId AccountID `pack:"A,u32" json:"account_id"` // account table id for contract
Height int64 `pack:"h,i32" json:"alloc_height"` // allocation height
NUpdates int64 `pack:"n,i32" json:"n_updates"` // running update counter
NKeys int64 `pack:"k,i32" json:"n_keys"` // current number of active keys
Updated int64 `pack:"u,i32" json:"update_height"` // last update height
Deleted int64 `pack:"D,i32" json:"delete_height"` // block when bigmap was removed
Data []byte `pack:"d,snappy" json:"-"` // micheline encoded type tree (key/val pair)
// internal, not stored
KeyType micheline.Type `pack:"-" json:"-"`
ValueType micheline.Type `pack:"-" json:"-"`
}
/tables/bigmaps
func CopyBigmapAlloc ¶
func CopyBigmapAlloc(b *BigmapAlloc, op *Op, dst int64) *BigmapAlloc
func NewBigmapAlloc ¶
func NewBigmapAlloc(op *Op, b micheline.BigmapEvent) *BigmapAlloc
func (*BigmapAlloc) GetKeyType ¶
func (b *BigmapAlloc) GetKeyType() micheline.Type
func (*BigmapAlloc) GetKeyTypeBytes ¶
func (b *BigmapAlloc) GetKeyTypeBytes() []byte
func (*BigmapAlloc) GetValueType ¶
func (b *BigmapAlloc) GetValueType() micheline.Type
func (*BigmapAlloc) GetValueTypeBytes ¶
func (b *BigmapAlloc) GetValueTypeBytes() []byte
func (*BigmapAlloc) ID ¶
func (m *BigmapAlloc) ID() uint64
func (*BigmapAlloc) Reset ¶
func (m *BigmapAlloc) Reset()
func (*BigmapAlloc) SetID ¶
func (m *BigmapAlloc) SetID(id uint64)
func (BigmapAlloc) TableKey ¶
func (m BigmapAlloc) TableKey() string
func (BigmapAlloc) TableOpts ¶
func (m BigmapAlloc) TableOpts() pack.Options
func (*BigmapAlloc) ToRemove ¶
func (b *BigmapAlloc) ToRemove(op *Op) *BigmapUpdate
func (*BigmapAlloc) ToUpdate ¶
func (b *BigmapAlloc) ToUpdate(op *Op) *BigmapUpdate
func (*BigmapAlloc) ToUpdateCopy ¶
func (b *BigmapAlloc) ToUpdateCopy(op *Op, srcid int64) *BigmapUpdate
type BigmapUpdate ¶
type BigmapUpdate struct {
RowId uint64 `pack:"I,pk" json:"row_id"` // internal: id
BigmapId int64 `pack:"B,i32,bloom" json:"bigmap_id"` // unique bigmap id
KeyId uint64 `pack:"K,bloom=3,snappy" json:"key_id"` // xxhash(BigmapId, KeyHash)
Action micheline.DiffAction `pack:"a,u8" json:"action"` // action (alloc, copy, update, remove)
OpId OpID `pack:"o" json:"op_id"` // operation id
Height int64 `pack:"h,i32" json:"height"` // creation time
Timestamp time.Time `pack:"t" json:"time"` // creation height
Key []byte `pack:"k,snappy" json:"key"` // key/value bytes: binary encoded micheline.Prim
Value []byte `pack:"v,snappy" json:"value"` // key/value bytes: binary encoded micheline.Prim, (Pair(int,int) on copy)
}
/tables/bigmap_updates
func NewBigmapUpdate ¶
func NewBigmapUpdate(op *Op, b micheline.BigmapEvent) *BigmapUpdate
func (*BigmapUpdate) GetKeyHash ¶
func (b *BigmapUpdate) GetKeyHash() tezos.ExprHash
func (*BigmapUpdate) GetKeyType ¶
func (b *BigmapUpdate) GetKeyType() micheline.Type
func (*BigmapUpdate) GetValueType ¶
func (b *BigmapUpdate) GetValueType() micheline.Type
func (*BigmapUpdate) ID ¶
func (m *BigmapUpdate) ID() uint64
func (*BigmapUpdate) Reset ¶
func (m *BigmapUpdate) Reset()
func (*BigmapUpdate) SetID ¶
func (m *BigmapUpdate) SetID(id uint64)
func (BigmapUpdate) TableKey ¶
func (m BigmapUpdate) TableKey() string
func (BigmapUpdate) TableOpts ¶
func (m BigmapUpdate) TableOpts() pack.Options
func (*BigmapUpdate) ToAlloc ¶
func (b *BigmapUpdate) ToAlloc() *BigmapAlloc
func (*BigmapUpdate) ToEvent ¶
func (b *BigmapUpdate) ToEvent() micheline.BigmapEvent
func (*BigmapUpdate) ToKV ¶
func (b *BigmapUpdate) ToKV() *BigmapValue
type BigmapValue ¶
type BigmapValue struct {
RowId uint64 `pack:"I,pk" json:"row_id"` // internal: id
BigmapId int64 `pack:"B,i32,bloom" json:"bigmap_id"` // unique bigmap id
Height int64 `pack:"h,i32" json:"height"` // update height
KeyId uint64 `pack:"K,bloom=3,snappy" json:"key_id"` // xxhash(BigmapId, KeyHash)
Key []byte `pack:"k,snappy" json:"key"` // key/value bytes: binary encoded micheline.Prim Pair
Value []byte `pack:"v,snappy" json:"value"` // key/value bytes: binary encoded micheline.Prim Pair
}
/tables/bigmap_values
func CopyBigmapValue ¶
func CopyBigmapValue(b *BigmapValue, dst, height int64) *BigmapValue
func NewBigmapValue ¶
func NewBigmapValue(b micheline.BigmapEvent, height int64) *BigmapValue
func (*BigmapValue) GetKeyHash ¶
func (b *BigmapValue) GetKeyHash() tezos.ExprHash
func (*BigmapValue) ID ¶
func (m *BigmapValue) ID() uint64
func (*BigmapValue) Reset ¶
func (m *BigmapValue) Reset()
func (*BigmapValue) SetID ¶
func (m *BigmapValue) SetID(id uint64)
func (BigmapValue) TableKey ¶
func (m BigmapValue) TableKey() string
func (BigmapValue) TableOpts ¶
func (m BigmapValue) TableOpts() pack.Options
func (*BigmapValue) ToUpdateCopy ¶
func (b *BigmapValue) ToUpdateCopy(op *Op) *BigmapUpdate
func (*BigmapValue) ToUpdateRemove ¶
func (b *BigmapValue) ToUpdateRemove(op *Op) *BigmapUpdate
type Block ¶
type Block struct {
RowId uint64 `pack:"I,pk" json:"row_id"`
ParentId uint64 `pack:"P" json:"parent_id"`
Hash tezos.BlockHash `pack:"H,snappy,bloom=3" json:"hash"`
Height int64 `pack:"h,i32" json:"height"`
Cycle int64 `pack:"c,i16" json:"cycle"`
IsCycleSnapshot bool `pack:"o,snappy" json:"is_cycle_snapshot"`
Timestamp time.Time `pack:"T" json:"time"`
Solvetime int `pack:"d,i16" json:"solvetime"`
Version int `pack:"v,i8" json:"version"`
Round int `pack:"p,i8" json:"round"`
Nonce uint64 `pack:"n,snappy" json:"nonce"`
VotingPeriodKind tezos.VotingPeriodKind `pack:"k,u8" json:"voting_period_kind"`
BakerId AccountID `pack:"B,u32" json:"baker_id"`
ProposerId AccountID `pack:"X,u32" json:"proposer_id"`
NSlotsEndorsed int `pack:"e,i16" json:"n_endorsed_slots"`
NOpsApplied int `pack:"1,i16" json:"n_ops_applied"`
NOpsFailed int `pack:"2,i16" json:"n_ops_failed"`
NContractCalls int `pack:"3,i16" json:"n_calls"`
NRollupCalls int `pack:"6,i16" json:"n_rollup_calls"`
NEvents int `pack:"4,i16" json:"n_events"`
NTx int `pack:"5,i16" json:"n_tx"`
NTickets int `pack:"7,i16" json:"n_tickets"`
Volume int64 `pack:"V" json:"volume"`
Fee int64 `pack:"F" json:"fee"`
Reward int64 `pack:"R" json:"reward"`
Deposit int64 `pack:"D" json:"deposit"`
ActivatedSupply int64 `pack:"S" json:"activated_supply"`
BurnedSupply int64 `pack:"b" json:"burned_supply"`
MintedSupply int64 `pack:"m" json:"minted_supply"`
SeenAccounts int `pack:"a,i16" json:"n_accounts"`
NewAccounts int `pack:"A,i16" json:"n_new_accounts"`
NewContracts int `pack:"C,i16" json:"n_new_contracts"`
ClearedAccounts int `pack:"E,i16" json:"n_cleared_accounts"`
FundedAccounts int `pack:"J,i16" json:"n_funded_accounts"`
GasLimit int64 `pack:"L,i32" json:"gas_limit"`
GasUsed int64 `pack:"G,i32" json:"gas_used"`
StoragePaid int64 `pack:"Y,i32" json:"storage_paid"`
LbVote tezos.FeatureVote `pack:"O,snappy" json:"lb_vote"`
LbEma int64 `pack:"M,i32" json:"lb_ema"`
AiVote tezos.FeatureVote `pack:"z,snappy" json:"ai_vote"`
AiEma int64 `pack:"i,i32" json:"ai_ema"`
ProposerConsensusKeyId AccountID `pack:"x" json:"proposer_consensus_key_id"`
BakerConsensusKeyId AccountID `pack:"y" json:"baker_consensus_key_id"`
// other tz or extracted/translated data for processing
TZ *rpc.Bundle `pack:"-" json:"-"`
Params *rpc.Params `pack:"-" json:"-"`
Chain *Chain `pack:"-" json:"-"`
Supply *Supply `pack:"-" json:"-"`
Ops []*Op `pack:"-" json:"-"`
Flows []*Flow `pack:"-" json:"-"`
Baker *Baker `pack:"-" json:"-"`
Proposer *Baker `pack:"-" json:"-"`
Parent *Block `pack:"-" json:"-"`
HasProposals bool `pack:"-" json:"-"`
HasBallots bool `pack:"-" json:"-"`
HasSeeds bool `pack:"-" json:"-"`
OfflineBaker AccountID `pack:"-" json:"-"`
OfflineEndorsers []AccountID `pack:"-" json:"-"`
}
Block contains extracted and translated data describing a Tezos block. Block also contains raw data and translations for related types such as operations, chain totals rights, etc. that is used by indexers and reporters
func AllocBlock ¶
func AllocBlock() *Block
func (*Block) IsProtocolUpgrade ¶
type BlockBuilder ¶
type BlockBuilder interface {
// resolves account from builder cache, returns nil and false when not found
AccountByAddress(tezos.Address) (*Account, bool)
// resolves account from database, returns nil and error when not found
LoadAccountByAddress(context.Context, tezos.Address) (*Account, error)
// resolves account from id, returns nil and false when not found
AccountById(AccountID) (*Account, bool)
// resolves baker from address, returns nil and false when not found
BakerByAddress(tezos.Address) (*Baker, bool)
// resolves baker from id, returns nil and false when not found
BakerById(AccountID) (*Baker, bool)
// resolves contract from account id, returns nil and false when not found
ContractById(AccountID) (*Contract, bool)
// returns a map of all accounts referenced in the current block
Accounts() map[AccountID]*Account
// returns a map of all delegates referenced in the current block
Bakers() map[AccountID]*Baker
// returns a map of all contracts referenced in the current block
Contracts() map[AccountID]*Contract
// returns a map of all constants referenced in the current block
Constants() micheline.ConstantDict
// return params at specific height
Params(int64) *rpc.Params
// returns the requested database table if exists or error otherwise
Table(string) (*pack.Table, error)
// returns global task scheduler
Sched() *task.Scheduler
// returns true if indexer is run in light mode
IsLightMode() bool
}
BlockBuilder is an interface to access block builder caches and info.
type BlockCrawler ¶
type BlockCrawler interface {
// returns the requested database table if exists or error otherwise
Table(string) (*pack.Table, error)
// returns the blockchain params at specified block height
ParamsByHeight(height int64) *rpc.Params
// returns the blockchain params for the specified protocol
ParamsByProtocol(proto tezos.ProtocolHash) *rpc.Params
// returns the current crawler chain tip
Tip() *ChainTip
// returns the crawler's most recently seen block height
Height() int64
// returns stored (main chain) block at specified height
BlockByHeight(ctx context.Context, height int64) (*Block, error)
// returns stored chain data at specified height
ChainByHeight(ctx context.Context, height int64) (*Chain, error)
// returns stored supply table data at specified height
SupplyByHeight(ctx context.Context, height int64) (*Supply, error)
// returns height for timestamp
BlockHeightFromTime(ctx context.Context, tm time.Time) int64
}
BlockCrawler is an interface to access the block crawler state and execute DB queries.
type BlockIndexer ¶
type BlockIndexer interface {
// Name returns the human-readable name of the index.
Name() string
// Key returns the key of the index as a string.
Key() string
// Create is invoked when the indexer manager determines the index needs
// to be created for the first time.
Create(path, label string, opts interface{}) error
// Init is invoked when the table manager is first initializing the
// datastore. This differs from the Create method in that it is called on
// every load, including the case the datatable was just created.
Init(path, label string, opts interface{}) error
// ConnectBlock is invoked when the table manager is notified that a new
// block has been connected to the main chain.
ConnectBlock(ctx context.Context, block *Block, builder BlockBuilder) error
// DisconnectBlock is invoked when the table manager is notified that a
// block has been disconnected from the main chain.
DisconnectBlock(ctx context.Context, block *Block, builder BlockBuilder) error
// DeleteBlock is invoked when the table manager is notified that a
// block must be rolled back after an error occured.
DeleteBlock(ctx context.Context, height int64) error
// DeleteCycle is invoked when an index must delete all content from
// a particular cycle.
DeleteCycle(ctx context.Context, cycle int64) error
// FinalizeSync is invoked when an the initial sync has finished. It may
// be used to clean and defrag tables or (re)build indexes.
FinalizeSync(ctx context.Context) error
// OnTaskComplete is called when a scheduled task completes.
OnTaskComplete(context.Context, *task.TaskResult) error
// Flush flushes all indexer databases.
Flush(ctx context.Context) error
// Close closes the indexer and frees all associated resources, if any.
Close() error
// returns the database storing all indexer tables
DB() *pack.DB
// returns the list of database tables used by the indexer
Tables() []*pack.Table
}
BlockIndexer is the interface all indexers must implement.
type Chain ¶
type Chain struct {
RowId uint64 `pack:"I,pk,snappy" json:"row_id"` // unique id
Height int64 `pack:"a,i32,snappy" json:"height"` // bc: block height (also for orphans)
Cycle int64 `pack:"b,i16,snappy" json:"cycle"` // bc: block cycle (tezos specific)
Timestamp time.Time `pack:"c,snappy" json:"time"` // bc: block creation time
TotalAccounts int64 `pack:"d,i32,snappy" json:"total_accounts"` // default accounts
TotalContracts int64 `pack:"e,i32,snappy" json:"total_contracts"` // smart contracts (KT1 with code)
TotalRollups int64 `pack:"f,i32,snappy" json:"total_rollups"` // rollups (any kind)
TotalOps int64 `pack:"g,i32,snappy" json:"total_ops"` //
TotalOpsFailed int64 `pack:"h,i32,snappy" json:"total_ops_failed"` //
TotalContractOps int64 `pack:"i,i32,snappy" json:"total_contract_ops"` // ops on KT1 contracts
TotalContractCalls int64 `pack:"j,i32,snappy" json:"total_contract_calls"` // calls from EOA to KT1 contracts with params
TotalRollupCalls int64 `pack:"k,i32,snappy" json:"total_rollup_calls"` // calls from EOA or KT1 to rollups
TotalActivations int64 `pack:"l,i32,snappy" json:"total_activations"` // fundraiser accounts activated
TotalSeedNonces int64 `pack:"m,i32,snappy" json:"total_nonce_revelations"` //
TotalEndorsements int64 `pack:"n,i32,snappy" json:"total_endorsements"` //
TotalPreendorsements int64 `pack:"o,i32,snappy" json:"total_preendorsements"` //
TotalDoubleBake int64 `pack:"p,i32,snappy" json:"total_double_bakings"` //
TotalDoubleEndorse int64 `pack:"q,i32,snappy" json:"total_double_endorsements"` //
TotalDelegations int64 `pack:"r,i32,snappy" json:"total_delegations"` //
TotalReveals int64 `pack:"s,i32,snappy" json:"total_reveals"` //
TotalOriginations int64 `pack:"t,i32,snappy" json:"total_originations"` //
TotalTransactions int64 `pack:"u,i32,snappy" json:"total_transactions"` //
TotalProposals int64 `pack:"v,i32,snappy" json:"total_proposals"` //
TotalBallots int64 `pack:"w,i32,snappy" json:"total_ballots"` //
TotalConstants int64 `pack:"x,i32,snappy" json:"total_constants"` // registered global constants
TotalSetLimits int64 `pack:"y,i32,snappy" json:"total_set_limits"` // registered global constants
TotalStorageBytes int64 `pack:"z,snappy" json:"total_storage_bytes"` //
TotalTicketTransfers int64 `pack:"1,i32,snappy" json:"total_ticket_transfers"` // transfer ticket
FundedAccounts int64 `pack:"2,i32,snappy" json:"funded_accounts"` // total number of accounts qith non-zero balance
DustAccounts int64 `pack:"3,i32,snappy" json:"dust_accounts"` // accounts with a balance < 1 tez
GhostAccounts int64 `pack:"4,i32,snappy" json:"ghost_accounts"` // unfunded L2 accounts (who own tokens, but cannot move them)
UnclaimedAccounts int64 `pack:"5,i16,snappy" json:"unclaimed_accounts"` // fundraiser accounts unclaimed
TotalDelegators int64 `pack:"6,i32,snappy" json:"total_delegators"` // count of all non-zero balance delegators
ActiveDelegators int64 `pack:"7,i32,snappy" json:"active_delegators"` // KT1 delegating to active bakers
InactiveDelegators int64 `pack:"8,i32,snappy" json:"inactive_delegators"` // KT1 delegating to inactive bakers
DustDelegators int64 `pack:"9,i32,snappy" json:"dust_delegators"` // KT1 delegating to inactive bakers
TotalBakers int64 `pack:"0,i16,snappy" json:"total_bakers"` // count of all bakers (active and inactive)
EligibleBakers int64 `pack:"A,i16,snappy" json:"eligible_bakers"` // bakers above minimum
ActiveBakers int64 `pack:"B,i16,snappy" json:"active_bakers"` // tz* active bakers
InactiveBakers int64 `pack:"C,i16,snappy" json:"inactive_bakers"` // tz* inactive bakers
ZeroBakers int64 `pack:"D,i16,snappy" json:"zero_bakers"` // tz* delegate with zero staking balance
SelfBakers int64 `pack:"E,i16,snappy" json:"self_bakers"` // tz* delegate with no incoming delegation
SingleBakers int64 `pack:"F,i16,snappy" json:"single_bakers"` // tz* delegate with 1 incoming delegation
MultiBakers int64 `pack:"G,i16,snappy" json:"multi_bakers"` // tz* delegate with >1 incoming delegations (delegation services)
TotalStakers int64 `pack:"H,i32,snappy" json:"total_stakers"` // wallets staking
ActiveStakers int64 `pack:"J,i32,snappy" json:"active_stakers"` // wallets staking with active bakers
InactiveStakers int64 `pack:"K,i32,snappy" json:"inactive_stakers"` // wallets staking with inactive bakers
}
type ChainTip ¶
type ChainTip struct {
Name string `json:"name"` // chain name, e.g. Bitcoin
Symbol string `json:"symbol"` // chain symbol, e.g. BTC
ChainId tezos.ChainIdHash `json:"chain_id"` // chain identifier (same for all blocks)
BestHash tezos.BlockHash `json:"last_block"` // The hash of the chain tip block.
BestId uint64 `json:"last_id"` // The internal blockindex id of the tip block;
BestHeight int64 `json:"height"` // The height of the tip block.
BestTime time.Time `json:"timestamp"` // The timestamp of the tip block.
GenesisTime time.Time `json:"genesis_time"` // cache of first block generation time
NYEveBlocks []int64 `json:"nye_blocks"` // first block heights per year for annual statistics
Deployments []Deployment `json:"deployments"` // protocol deployments
}
ChainTip reflects the blockchain state at the currently indexed height.
func (*ChainTip) AddDeployment ¶
type Constant ¶
type Constant struct {
RowId ConstantID `pack:"I,pk" json:"row_id"`
Address tezos.ExprHash `pack:"H,bloom=3" json:"address"`
CreatorId AccountID `pack:"C,u32" json:"creator_id"`
Value []byte `pack:"v,snappy" json:"value"`
Height int64 `pack:"h,i32" json:"height"`
StorageSize int64 `pack:"z,i32" json:"storage_size"`
Features micheline.Features `pack:"F,snappy" json:"features"`
}
Constant holds code and info about registered global constants
func NewConstant ¶
func NewConstant(rop *rpc.ConstantRegistration, op *Op) *Constant
assuming the op was successful!
type Contract ¶
type Contract struct {
RowId ContractID `pack:"I,pk" json:"row_id"`
Address tezos.Address `pack:"H,bloom=3" json:"address"`
AccountId AccountID `pack:"A,u32" json:"account_id"`
CreatorId AccountID `pack:"C,u32" json:"creator_id"`
FirstSeen int64 `pack:"f,i32" json:"first_seen"`
LastSeen int64 `pack:"l,i32" json:"last_seen"`
StorageSize int64 `pack:"z,i32" json:"storage_size"`
StoragePaid int64 `pack:"y,i32" json:"storage_paid"`
StorageBurn int64 `pack:"Y" json:"storage_burn"`
Script []byte `pack:"s,snappy" json:"script"`
Storage []byte `pack:"g,snappy" json:"storage"`
InterfaceHash uint64 `pack:"i,snappy" json:"iface_hash"`
CodeHash uint64 `pack:"c,snappy" json:"code_hash"`
StorageHash uint64 `pack:"x,snappy" json:"storage_hash"`
CallStats []byte `pack:"S,snappy" json:"call_stats"`
Features micheline.Features `pack:"F,snappy" json:"features"`
Interfaces micheline.Interfaces `pack:"n,snappy" json:"interfaces"`
LedgerType TokenType `pack:"t" json:"ledger_type"`
LedgerSchema LedgerSchema `pack:"h" json:"ledger_schema"`
LedgerBigmap int64 `pack:"b,i32" json:"ledger_bigmap"`
LedgerMeta MetaID `pack:"M" json:"metadata_id"`
MetadataBigmap int64 `pack:"m,i32" json:"metadata_bigmap"`
IsDirty bool `pack:"-" json:"-"` // indicates an update happened
IsNew bool `pack:"-" json:"-"` // new contract, used during migration
// contains filtered or unexported fields
}
Contract holds code and info about smart contracts on the Tezos blockchain.
func AllocContract ¶
func AllocContract() *Contract
func NewContract ¶
func NewContract(acc *Account, oop *rpc.Origination, op *Op, dict micheline.ConstantDict, p *rpc.Params) *Contract
assuming the op was successful!
func NewImplicitContract ¶
func NewInternalContract ¶
func NewInternalContract(acc *Account, iop rpc.InternalResult, op *Op, dict micheline.ConstantDict, p *rpc.Params) *Contract
func NewManagerTzContract ¶
create manager.tz contract, used during migration only
func NewRollupContract ¶
func (*Contract) ConvertParams ¶
func (c *Contract) ConvertParams(in micheline.Parameters) (out micheline.Parameters)
func (*Contract) DecCallStats ¶
func (*Contract) IncCallStats ¶
stats are stored as uint32 in a byte slice limit entrypoint count to 255
func (*Contract) ListCallStats ¶
func (*Contract) ListSmartRollupCallStats ¶
func (*Contract) ListTxRollupCallStats ¶
func (*Contract) LoadScript ¶
loads script and upgrades to babylon on-the-fly if originated earlier
func (*Contract) LoadType ¶
Loads type data from already unmarshaled script or from optimized unmarshaler
func (*Contract) NamedBigmaps ¶
func (c *Contract) NamedBigmaps(m []*BigmapAlloc) map[string]int64
type Cycle ¶
type Cycle struct {
RowId uint64 `pack:"I,pk" json:"row_id"`
Cycle int64 `pack:"a" json:"cycle"`
StartHeight int64 `pack:"b" json:"start_height"`
EndHeight int64 `pack:"c" json:"end_height"`
SnapshotHeight int64 `pack:"d" json:"snapshot_height"`
SnapshotIndex int `pack:"e" json:"snapshot_index"`
MissedRounds int `pack:"f" json:"missed_rounds"`
MissedEndorsements int `pack:"g" json:"missed_endorsements"`
Num2Baking int `pack:"h" json:"n_double_baking"`
Num2Endorsement int `pack:"i" json:"n_double_endorsement"`
NumSeeds int `pack:"j" json:"n_seed_nonces"`
SolveTimeMin int `pack:"k" json:"solvetime_min"`
SolveTimeMax int `pack:"l" json:"solvetime_max"`
SolveTimeSum int `pack:"m" json:"solvetime_sum"`
RoundMin int `pack:"n" json:"round_min"`
RoundMax int `pack:"o" json:"round_max"`
EndorsementsMin int `pack:"q" json:"endorsements_min"`
EndorsementsMax int `pack:"r" json:"endorsements_max"`
WorstBakedBlock int64 `pack:"t" json:"worst_baked_block"`
WorstEndorsedBlock int64 `pack:"u" json:"worst_endorsed_block"`
UniqueBakers int `pack:"v" json:"unique_bakers"`
BlockReward int64 `pack:"w" json:"block_reward"`
BlockBonusPerSlot int64 `pack:"x" json:"block_bonus_per_slot"`
MaxBlockReward int64 `pack:"y" json:"max_block_reward"`
EndorsementRewardPerSlot int64 `pack:"z" json:"endorsement_reward_per_slot"`
NonceRevelationReward int64 `pack:"1" json:"nonce_revelation_reward"`
VdfRevelationReward int64 `pack:"2" json:"vdf_revelation_reward"`
LBSubsidy int64 `pack:"3" json:"lb_subsidy"`
}
Cycle is a per-cycle stats collector.
type Deployment ¶
type Deployment struct {
Protocol tezos.ProtocolHash `json:"protocol"`
Version int `json:"version"` // protocol version
Deployment int `json:"deployment"` // protocol sequence id on indexed chain
StartHeight int64 `json:"start_height"` // first block on indexed chain
EndHeight int64 `json:"end_height"` // last block on indexed chain or -1
}
type Election ¶
type Election struct {
RowId ElectionID `pack:"I,pk" json:"row_id"` // unique id
ProposalId ProposalID `pack:"P" json:"proposal_id"` // winning proposal id (after first vote)
NumPeriods int `pack:"n,i8" json:"num_periods"` // number of periods processed (so far)
NumProposals int `pack:"N,i8" json:"num_proposals"` // number of sumbitted proposals
VotingPeriod int64 `pack:"p,i16" json:"voting_period"` // protocol (proposal) voting period starting the election
StartTime time.Time `pack:"T" json:"start_time"` // proposal voting period start
EndTime time.Time `pack:"t" json:"end_time"` // last voting perid end, estimate when open
StartHeight int64 `pack:"H,i32" json:"start_height"` // proposal voting period start block
EndHeight int64 `pack:"h,i32" json:"end_height"` // last voting perid end block, estimate when open
IsEmpty bool `pack:"e,snappy" json:"is_empty"` // no proposal published during this period
IsOpen bool `pack:"o,snappy" json:"is_open"` // flag, election in progress
IsFailed bool `pack:"f,snappy" json:"is_failed"` // flag, election aborted du to missing proposal or missed quorum/supermajority
NoQuorum bool `pack:"!,snappy" json:"no_quorum"` // flag, quorum not reached
NoMajority bool `pack:"m,snappy" json:"no_majority"` // flag, supermajority not reached
}
type ElectionID ¶
type ElectionID uint64
An Election represents a unique voting cycle which may be between 1 and 4 voting periods in length. Elections finish with the activation of the winning proposal protocol after period 4 or abort at the end of period 1 when no proposal was published, at the end of periods 2 and 4 when no quorum or supermajority was reached. Period 3 always ends successfully.
func (ElectionID) U64 ¶
func (id ElectionID) U64() uint64
type Endorsement ¶
type Endorsement struct {
RowId OpID `pack:"I,pk,snappy" json:"row_id"` // internal: unique row id
Hash tezos.OpHash `pack:"H,snappy,bloom=3" json:"hash"` // op hash
Height int64 `pack:"h,i32,snappy" json:"height"` // block height
OpN int `pack:"n,i16,snappy" json:"op_n"` // unique in-block pos
OpP int `pack:"P,i16,snappy" json:"op_p"` // op list pos (list can be derived from type)
Reward int64 `pack:"r,snappy" json:"reward"` // baking/endorsement reward
Deposit int64 `pack:"d,snappy" json:"deposit"` // baker deposit
SenderId AccountID `pack:"S,u32,snappy,bloom" json:"sender_id"` // sender id, also on internal ops
Power int64 `pack:"p,i16,snappy" json:"power"` // power
IsPre bool `pack:"i,snappy" json:"is_preendorsement"` // Ithaca pre-endorsement
}
func (Endorsement) ID ¶
func (m Endorsement) ID() uint64
func (*Endorsement) SetID ¶
func (m *Endorsement) SetID(id uint64)
func (Endorsement) TableKey ¶
func (m Endorsement) TableKey() string
func (Endorsement) TableOpts ¶
func (m Endorsement) TableOpts() pack.Options
func (Endorsement) ToOp ¶
func (e Endorsement) ToOp() *Op
type Event ¶
type Event struct {
RowId EventID `pack:"I,pk" json:"row_id"`
Height int64 `pack:"h,i32" json:"height"`
OpId uint64 `pack:"o" json:"op_id"` // unique external operation id
AccountId AccountID `pack:"C,bloom=3" json:"account_id"`
Type []byte `pack:"t,snappy" json:"type"`
Payload []byte `pack:"p,snappy" json:"payload"`
Tag string `pack:"a,snappy" json:"tag"`
TypeHash uint64 `pack:"H,bloom" json:"type_hash"`
}
Event holds location, type and content of on-chain events
func NewEventWithData ¶
func NewEventWithData(ev rpc.InternalResult, src AccountID, op *Op) *Event
assuming the op was successful!
type FA1Transfer ¶
type FA1Transfer TransferList
func (*FA1Transfer) UnmarshalPrim ¶
func (t *FA1Transfer) UnmarshalPrim(prim micheline.Prim) error
type FA2Transfer ¶
type FA2Transfer TransferList
func (*FA2Transfer) UnmarshalPrim ¶
func (t *FA2Transfer) UnmarshalPrim(prim micheline.Prim) error
type Flow ¶
type Flow struct {
RowId uint64 `pack:"I,pk" json:"row_id"`
Height int64 `pack:"h,i32,snappy" json:"height"`
Cycle int64 `pack:"c,i16,snappy" json:"cycle"`
Timestamp time.Time `pack:"T,snappy" json:"time"`
OpN int `pack:"1,i16,snappy" json:"op_n"`
OpC int `pack:"2,i16,snappy" json:"op_c"`
OpI int `pack:"3,i16,snappy" json:"op_i"`
AccountId AccountID `pack:"A,u32,snappy,bloom" json:"account_id"`
CounterPartyId AccountID `pack:"R,u32,snappy" json:"counterparty_id"` // account that initiated the flow
Kind FlowKind `pack:"C,u8,snappy,bloom" json:"kind"` // sub-account that received the update
Type FlowType `pack:"O,u8,snappy,bloom" json:"type"` // op type that caused this update
AmountIn int64 `pack:"i,snappy" json:"amount_in"` // sum flowing in to the account
AmountOut int64 `pack:"o,snappy" json:"amount_out"` // sum flowing out of the account
IsFee bool `pack:"e,snappy" json:"is_fee"` // flag: out-flow paid a fee
IsBurned bool `pack:"b,snappy" json:"is_burned"` // flag: out-flow was burned
IsFrozen bool `pack:"f,snappy" json:"is_frozen"` // flag: in-flow is frozen
IsUnfrozen bool `pack:"u,snappy" json:"is_unfrozen"` // flag: out-flow was unfrozen (rewards -> balance)
IsShielded bool `pack:"y,snappy" json:"is_shielded"` // flag: in-flow was shielded (Sapling)
IsUnshielded bool `pack:"Y,snappy" json:"is_unshielded"` // flag: out-flow was unshielded (Sapling)
TokenAge int64 `pack:"a,i32,snappy" json:"token_age"` // time since last transfer in seconds
}
type FlowKind ¶
type FlowKind byte
const ( FlowKindRewards FlowKind = iota // 0 freezer category FlowKindDeposits // 1 freezer category FlowKindFees // 2 freezer category FlowKindBalance // 3 spendable balance FlowKindDelegation // 4 delegated balance from other accounts FlowKindBond // 5 rollup bond FlowKindStake // 6 staking FlowKindInvalid )
func ParseFlowKind ¶
type FlowType ¶
type FlowType byte
const ( FlowTypeEndorsement FlowType = iota // 0 FlowTypeTransaction // 1 FlowTypeOrigination // 2 FlowTypeDelegation // 3 FlowTypeReveal // 4 FlowTypeBaking // 5 FlowTypeNonceRevelation // 6 FlowTypeActivation // 7 FlowTypePenalty // 8 FlowTypeInternal // 9 - used for unfreeze FlowTypeInvoice // 10 - invoice feature FlowTypeAirdrop // 11 - Babylon Airdrop FlowTypeSubsidy // 12 - Granada liquidity baking FlowTypeRegisterConstant // 13 - Hangzhou+ FlowTypeBonus // 14 - Ithaca+ baking bonus FlowTypeReward // 15 - Ithaca+ endorsing reward (or slash) FlowTypeDeposit // 16 - Ithaca+ deposit transfer FlowTypeDepositsLimit // 17 - Ithaca+ FlowTypeRollupOrigination // 18 - Jakarta+ FlowTypeRollupTransaction // 19 - Jakarta+ FlowTypeRollupReward // 20 - Jakarta+ FlowTypeRollupPenalty // 21 - Jakarta+ FlowTypePayStorage // 22 - Kathmandu+ FlowTypeUpdateConsensusKey // 23 - Lima+ FlowTypeDrain // 24 - Lima+ FlowTypeTransferTicket // 25 - Jakarta+ FlowTypeStake // 26 - Oxford+ FlowTypeUnstake // 27 - Oxford+ FlowTypeFinalizeUnstake // 28 - Oxford+ FlowTypeSetDelegateParameters // 29 - Oxford+ FlowTypeInvalid = 255 )
func MapFlowType ¶
func ParseFlowType ¶
func (*FlowType) MarshalText ¶
func (*FlowType) UnmarshalText ¶
type Income ¶
type Income struct {
RowId uint64 `pack:"I,pk,snappy" json:"row_id"`
Cycle int64 `pack:"c,i16,snappy" json:"cycle"`
StartHeight int64 `pack:"h,i32" json:"start_height"`
EndHeight int64 `pack:"e,i32" json:"end_height"`
AccountId AccountID `pack:"A,u32,snappy" json:"account_id"`
Balance int64 `pack:"B,snappy" json:"balance"` // @snapshot
Delegated int64 `pack:"d,snappy" json:"delegated"` // @snapshot
OwnStake int64 `pack:"b,snappy" json:"own_stake"` // @snapshot
StakingBalance int64 `pack:"S,snappy" json:"staking_balance"` // @snapshot
NDelegations int64 `pack:"n,i32,snappy" json:"n_delegations"` // @snapshot
NStakers int64 `pack:"#,i32,snappy" json:"n_stakers"` // @snapshot
NBakingRights int64 `pack:"R,i16,snappy" json:"n_baking_rights"`
NEndorsingRights int64 `pack:"r,i32,snappy" json:"n_endorsing_rights"`
Luck int64 `pack:"L,snappy" json:"luck"` // coins by fair share of stake
LuckPct int64 `pack:"l,d32,scale=2,snappy" json:"luck_percent"` // 0.0 .. +N.00 by fair share of stake
ContributionPct int64 `pack:"t,d32,scale=2,snappy" json:"contribution_percent"` // 0.0 .. +N.00 by rights utilized
PerformancePct int64 `pack:"p,d32,scale=2,snappy" json:"performance_percent"` // -N.00 .. +N.00 by expected income
NBlocksBaked int64 `pack:"k,i16,snappy" json:"n_blocks_baked"`
NBlocksProposed int64 `pack:"K,i16,snappy" json:"n_blocks_proposed"`
NBlocksNotBaked int64 `pack:"N,i16,snappy" json:"n_blocks_not_baked"`
NBlocksEndorsed int64 `pack:"E,i16,snappy" json:"n_blocks_endorsed"`
NBlocksNotEndorsed int64 `pack:"X,i16,snappy" json:"n_blocks_not_endorsed"`
NSlotsEndorsed int64 `pack:"Z,i32,snappy" json:"n_slots_endorsed"`
NSeedsRevealed int64 `pack:"s,i16,snappy" json:"n_seeds_revealed"`
ExpectedIncome int64 `pack:"f,snappy" json:"expected_income"`
TotalIncome int64 `pack:"i,snappy" json:"total_income"`
BakingIncome int64 `pack:"1,snappy" json:"baking_income"`
EndorsingIncome int64 `pack:"2,snappy" json:"endorsing_income"`
AccusationIncome int64 `pack:"3,snappy" json:"accusation_income"`
SeedIncome int64 `pack:"4,snappy" json:"seed_income"`
FeesIncome int64 `pack:"5,snappy" json:"fees_income"`
TotalLoss int64 `pack:"6,snappy" json:"total_loss"`
AccusationLoss int64 `pack:"7,snappy" json:"accusation_loss"`
SeedLoss int64 `pack:"8,snappy" json:"seed_loss"`
EndorsingLoss int64 `pack:"9,snappy" json:"endorsing_loss"`
LostAccusationFees int64 `pack:"F,snappy" json:"lost_accusation_fees"` // from denunciations
LostAccusationRewards int64 `pack:"W,snappy" json:"lost_accusation_rewards"` // from denunciations
LostAccusationDeposits int64 `pack:"D,snappy" json:"lost_accusation_deposits"` // from denunciations
LostSeedFees int64 `pack:"V,snappy" json:"lost_seed_fees"` // from missed seed nonce revelations
LostSeedRewards int64 `pack:"Y,snappy" json:"lost_seed_rewards"` // from missed seed nonce revelations
}
Income is a per-cycle income sheet for baker accounts.
func (*Income) UpdatePerformance ¶
type LedgerBalance ¶
type LedgerBalance struct {
Owner tezos.Address
TokenId tezos.Z
Balance tezos.Z
Name string // use for domain names
// internal
OwnerRef *TokenOwner // hook
TokenRef *Token // hook
// contains filtered or unexported fields
}
func (LedgerBalance) IsValid ¶
func (b LedgerBalance) IsValid() bool
func (*LedgerBalance) UnmarshalPrim ¶
func (b *LedgerBalance) UnmarshalPrim(prim micheline.Prim) error
type LedgerDomain ¶
type LedgerDomain LedgerBalance
// 15 Tezos Domains // - records KT1GBZmSxmnKJXGMdMLbugPfLyUPmuLSMwKS // Note: records contain a tzip12_token_id, but key is bytes (domain name) // sale example: https://tzstats.com/onzVjWA6LeBSEYd4ZEpiyfiHo7z2kcuqmeM94YD2t7fmoxQ1Zyr LedgerSchemaDomain: micheline.NewPairType(
micheline.NewCode(micheline.T_BYTES), // domain name
micheline.NewPairType(
micheline.NewPairType(
micheline.NewPairType(
micheline.NewOptType(micheline.NewCode(micheline.T_ADDRESS)), // address
micheline.NewMapType( // data
micheline.NewCode(micheline.T_STRING), // key
micheline.NewCode(micheline.T_BYTES), // value
),
),
micheline.NewPairType(
micheline.NewOptType(micheline.NewCode(micheline.T_BYTES)), // expiry_key
micheline.NewMapType( // internal_data
micheline.NewCode(micheline.T_STRING), // key
micheline.NewCode(micheline.T_BYTES), // value
),
),
),
micheline.NewPairType(
micheline.NewPairType(
micheline.NewCode(micheline.T_NAT), // level
micheline.NewCode(micheline.T_ADDRESS), // owner
),
micheline.NewOptType(micheline.NewCode(micheline.T_NAT)), // tzip12_token_id
),
),
),
func (*LedgerDomain) UnmarshalPrim ¶
func (b *LedgerDomain) UnmarshalPrim(prim micheline.Prim) error
type LedgerFAa ¶
type LedgerFAa LedgerBalance
5 FA 1.2 with approvals USDtez ledger KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9 PAUL ledger KT19DUSZw7mfeEATrbWVPHRrWNVbNnmfFAE6 @key: address @value: {0: nat, 1: map { @key: address @val: nat }
type LedgerFAb ¶
type LedgerFAb LedgerBalance
6 FA 1.2 with approvals (flipped order) - HEH balances KT1G1cCRNBgQ48mVDjopHjEmTN5Sbtar8nn9 @key: address @value: {0: nat, 1: map { @key: address @val: nat }
type LedgerFAc ¶
type LedgerFAc LedgerBalance
7 FA1.2 without approvals - Ctez tokens KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4 - Kalamint ledger KT1A5P4ejnLix13jtadsfV9GCnXLMNnab8UT (FA2 !!) - liquidity-baking tokens KT1AafHA1C1vk959wvHWBispY9Y2f3fxBUUo - Staker Gov token.ledger KT1AEfeckNbdEYwaMKkytBwPJPycz7jdSGea @key: address @value: nat
type LedgerFAd ¶
type LedgerFAd LedgerBalance
8 FA2 without operators/approvals (== NFT1) - WRAP assets.ledger KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ - hDAO ledger KT1AFA2mwNUMNd4SsujE1YYp29vd8BZejyKW @key: {0:address, 1:nat} @value: nat
type LedgerFAe ¶
type LedgerFAe LedgerBalance
9 FA2 with balance map and allowance set - QuipuSwap Governance Token (name: account_info) KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb @key: address @value: {map: nat -> nat } // token_id -> balance
{set: address } // allowances
type LedgerFAf ¶
type LedgerFAf LedgerBalance
10 Quipuswap legacy FA2 with allowance set, balance and frozen - QuipuSwap dex legder KT1Qm3urGqkRsWsovGzNb2R81c3dSfxpteHG @key: address @value: {0: { 0:{set: address}, 1:nat } // allowances, balance
1: nat // frozen_balance }
type LedgerFAg ¶
type LedgerFAg LedgerBalance
11 FA2 with single balance and allowance set - fDAO Token ledger KT1KPoyzkj82Sbnafm6pfesZKEhyCpXwQfMc - Flame ledger KT1Wa8yqRBpFCusJWgcQyjhRz7hUQAmFxW7j @key: address @value: {set: address } // allowances
nat // balance
type LedgerFAh ¶
type LedgerFAh LedgerBalance
12 FA2 Lugh Stablecoin - ledger KT1JBNFcB5tiycHNdYGYCtR3kk6JaJysUCi8 @key: {0:address, 1:nat} // owner, token_id @value: {0:nat, 1:bool} // balance, lock
type LedgerFAi ¶
type LedgerFAi LedgerBalance
13 Flame Dex - shares KT1PRtrP7pKZ3PSLwgfTwt8hD39bxVojoKuX @key: {0:address, 1:nat} // owner, token_id @value: {nat, nat, nat} // balance, last_rewards_per_share, rewards
type LedgerFAj ¶
type LedgerFAj LedgerBalance
14 MAG - ledger KT1H5KJDxuM9DURSfttepebb6Cn7GbvAAT45 @key: address // owner @value: {map: address => nat} // approvals
nat // balance nat // frozenBalance nat // reward nat // rewardDebt nat // usedVotes
type LedgerNFT1 ¶
type LedgerNFT1 LedgerBalance
1 @key: {0: address, 1: nat} @value: nat
func (*LedgerNFT1) UnmarshalPrim ¶
func (b *LedgerNFT1) UnmarshalPrim(prim micheline.Prim) error
type LedgerNFT2 ¶
type LedgerNFT2 LedgerBalance
2 @key: nat @value: address
func (*LedgerNFT2) UnmarshalPrim ¶
func (b *LedgerNFT2) UnmarshalPrim(prim micheline.Prim) error
type LedgerNFT3 ¶
type LedgerNFT3 LedgerBalance
3 @key: {0: nat, 1: address} @value: nat
func (*LedgerNFT3) UnmarshalPrim ¶
func (b *LedgerNFT3) UnmarshalPrim(prim micheline.Prim) error
type LedgerSchema ¶
type LedgerSchema byte
LedgerSchema describes the internal data storage structure of a token ledger. It is used to decode and reconcile balance updates and can be detected from matching the ledger's storage spec (i.e. bigmap key and value types).
const ( LedgerSchemaInvalid LedgerSchema = iota LedgerSchemaNFT1 // 1 nft LedgerSchemaNFT2 // 2 nft LedgerSchemaNFT3 // 3 nft LedgerSchemaTzBTC // 4 LedgerSchemaFAa // 5 LedgerSchemaFAb // 6 LedgerSchemaFAc // 7 LedgerSchemaFAd // 8 == nft1 LedgerSchemaFAe // 9 LedgerSchemaFAf // 10 LedgerSchemaFAg // 11 LedgerSchemaFAh // 12 LedgerSchemaFAi // 13 LedgerSchemaFAj // 14 LedgerSchemaDomain // 15 LedgerSchemaTezFin // 16 )
func (LedgerSchema) DecodeBalance ¶
func (s LedgerSchema) DecodeBalance(prim micheline.Prim) (bal *LedgerBalance, err error)
func (LedgerSchema) DecodeBalanceUpdates ¶
func (s LedgerSchema) DecodeBalanceUpdates(upd micheline.BigmapEvents, id int64) ([]*LedgerBalance, error)
func (LedgerSchema) IsValid ¶
func (s LedgerSchema) IsValid() bool
type LedgerTezFin ¶
type LedgerTezFin LedgerBalance
// 16 TezFin LedgerSchemaTezFin: micheline.NewPairType(
micheline.NewCode(micheline.T_ADDRESS), // owner
micheline.NewPairType(
micheline.NewPairType( // accountBorrows
micheline.NewCode(micheline.T_NAT), // interestIndex
micheline.NewCode(micheline.T_NAT), // principal
),
micheline.NewPairType(
micheline.NewMapType( // approvals
micheline.NewCode(micheline.T_ADDRESS),
micheline.NewCode(micheline.T_NAT),
),
micheline.NewCode(micheline.T_NAT), // balance
),
),
),
func (*LedgerTezFin) UnmarshalPrim ¶
func (b *LedgerTezFin) UnmarshalPrim(prim micheline.Prim) error
type LedgerTzBTC ¶
type LedgerTzBTC LedgerBalance
4 tzBTC (packed bytes) @key:{0: string = ledger, 1: address} @value: {0: int, 1: map { @key: address @val: nat }
func (*LedgerTzBTC) UnmarshalPrim ¶
func (b *LedgerTzBTC) UnmarshalPrim(prim micheline.Prim) error
type Metadata ¶
type Op ¶
type Op struct {
RowId OpID `pack:"I,pk" json:"row_id"` // internal: unique row id
Type OpType `pack:"t,u8,bloom" json:"type"` // indexer op type
Hash tezos.OpHash `pack:"H,snappy,bloom=3" json:"hash"` // op hash
Height int64 `pack:"h,i32" json:"height"` // block height
Cycle int64 `pack:"c,i16" json:"cycle"` // block cycle
Timestamp time.Time `pack:"T" json:"time"` // block time
OpN int `pack:"n,i32" json:"op_n"` // unique in-block pos
OpP int `pack:"P,i16" json:"op_p"` // op list pos (list can be derived from type)
Status tezos.OpStatus `pack:"?,u8" json:"status"` // op status
IsSuccess bool `pack:"!,snappy" json:"is_success"` // success flag
IsContract bool `pack:"C,snappy" json:"is_contract"` // contract call flag (target is contract)
IsInternal bool `pack:"N,snappy" json:"is_internal"` // internal contract call or op
IsEvent bool `pack:"m,snappy" json:"is_event"` // this is an implicit event
IsRollup bool `pack:"u,snappy" json:"is_rollup"` // this is an rollup operation
Counter int64 `pack:"j,i32" json:"counter"` // signer counter
GasLimit int64 `pack:"l,i32" json:"gas_limit"` // gas limit
GasUsed int64 `pack:"G,i32" json:"gas_used"` // gas used
StorageLimit int64 `pack:"Z,i32" json:"storage_limit"` // storage size limit
StoragePaid int64 `pack:"$,i32" json:"storage_paid"` // storage allocated/paid
Volume int64 `pack:"v" json:"volume"` // transacted tez volume
Fee int64 `pack:"f" json:"fee"` // tx fees
Reward int64 `pack:"r" json:"reward"` // baking/endorsement reward
Deposit int64 `pack:"d" json:"deposit"` // baker deposit
Burned int64 `pack:"b" json:"burned"` // burned tez (for storage allocation)
SenderId AccountID `pack:"S,u32,bloom" json:"sender_id"` // sender id, also on internal ops
ReceiverId AccountID `pack:"R,u32,bloom" json:"receiver_id"` // receiver id
CreatorId AccountID `pack:"M,u32" json:"creator_id"` // creator id, direct source for internal ops
BakerId AccountID `pack:"D,u32,bloom" json:"baker_id"` // delegate id
Data string `pack:"a,snappy" json:"data"` // custom op data
Parameters []byte `pack:"p,snappy" json:"parameters"` // call params
CodeHash uint64 `pack:"x" json:"code_hash"` // code hash of target contract
StorageHash uint64 `pack:"s" json:"storage_hash"` // storage hash
Errors []byte `pack:"e,snappy" json:"errors"` // call errors
Entrypoint int `pack:"E,i8" json:"entrypoint_id"` // update contract counters, search by entrypoint
// internal
OpC int `pack:"-" json:"-"` // contents list pos
OpI int `pack:"-" json:"-"` // internal op result list pos
Raw rpc.TypedOperation `pack:"-" json:"-"` // cache
RawTicketUpdates []rpc.TicketUpdate `pack:"-" json:"-"` // rpc ticket updates
BigmapEvents micheline.BigmapEvents `pack:"-" json:"-"` // cache here for bigmap index
Storage []byte `pack:"-" json:"-"` // storage update
IsStorageUpdate bool `pack:"-" json:"-"` // true when contract storage changed
Contract *Contract `pack:"-" json:"-"` // cached contract
BigmapUpdates []BigmapUpdate `pack:"-" json:"-"` // cached query result
Events []*Event `pack:"-" json:"-"` // cached query result
TicketUpdates []*TicketUpdate `pack:"-" json:"-"` // cached query result
IsBurnAddress bool `pack:"-" json:"-"` // target is known burn address
}
func (Op) ToEndorsement ¶
func (o Op) ToEndorsement() *Endorsement
type OpRef ¶
type OpRef struct {
Hash tezos.OpHash
Kind OpType
N int
L int
P int
C int
I int
Raw rpc.TypedOperation
}
Helper to uniquely identify an operation while indexing
func (OpRef) InternalResult ¶
func (id OpRef) InternalResult(op *rpc.Operation) *rpc.InternalResult
type OpType ¶
type OpType byte
Indexer operation and event type
const ( OpTypeBake OpType = iota // 0 implicit event (bake reward pay) OpTypeEndorsement // 1 OpTypeTransaction // 2 OpTypeReveal // 3 OpTypeDelegation // 4 OpTypeOrigination // 5 OpTypeNonceRevelation // 6 OpTypeActivation // 7 OpTypeBallot // 8 OpTypeProposal // 9 OpTypeDoubleBaking // 10 OpTypeDoubleEndorsement // 11 OpTypeUnfreeze // 12 implicit event OpTypeInvoice // 13 implicit event OpTypeAirdrop // 14 implicit event OpTypeSeedSlash // 15 implicit event OpTypeMigration // 16 implicit event OpTypeSubsidy // 17 v010 liquidity baking OpTypeRegisterConstant // 18 v011 OpTypePreendorsement // 19 v012 OpTypeDoublePreendorsement // 20 v012 OpTypeDepositsLimit // 21 v012 OpTypeDeposit // 22 v012 implicit event (baker deposit) OpTypeBonus // 23 v012 implicit event (baker extra bonus) OpTypeReward // 24 v012 implicit event (endorsement reward pay/burn) OpTypeRollupOrigination // 25 v013 OpTypeRollupTransaction // 26 v013 OpTypeVdfRevelation // 27 v014 OpTypeIncreasePaidStorage // 28 v014 OpTypeDrainDelegate // 29 v015 OpTypeUpdateConsensusKey // 30 v015 OpTypeTransferTicket // 31 v013 OpTypeStake // 32 v018 OpTypeUnstake // 33 v018 OpTypeFinalizeUnstake // 34 v018 OpTypeSetDelegateParameters // 35 v018 OpTypeStakeSlash // 36 v018 implicit event (staker slash) OpTypeBatch = 254 // API output only OpTypeInvalid = 255 )
enums are allocated in chronological order with most often used ops first
func ParseOpType ¶
func (*OpType) MarshalText ¶
func (*OpType) UnmarshalText ¶
type OpTypeList ¶
type OpTypeList []OpType
func (OpTypeList) Contains ¶
func (l OpTypeList) Contains(typ OpType) bool
func (OpTypeList) IsEmpty ¶
func (l OpTypeList) IsEmpty() bool
type Proposal ¶
type Proposal struct {
RowId ProposalID `pack:"I,pk" json:"row_id"` // unique id
Hash tezos.ProtocolHash `pack:"H,snappy" json:"hash"` // unique proposal hash
Height int64 `pack:"h,i32" json:"height"` // proposal publishing block
Time time.Time `pack:"T" json:"time"` // proposal publishing time
SourceId AccountID `pack:"S" json:"source_id"` // proposal publisher
OpId OpID `pack:"O" json:"op_id"` // operation publishing this proposal
ElectionId ElectionID `pack:"E" json:"election_id"` // custom: election sequence number (same for all voting periods)
VotingPeriod int64 `pack:"p,i16" json:"voting_period"` // protocol: proposal period sequence number
Stake int64 `pack:"s" json:"stake"` // stake accumulated by this proposal
Voters int64 `pack:"v,i16" json:"voters"` // number of voters who voted for this proposal
}
type ProposalID ¶
type ProposalID uint64
Proposal implements unique individual proposals, a baker can choose to publish multiple proposals in one operation, which results in multiple rows been created.
func (ProposalID) U64 ¶
func (id ProposalID) U64() uint64
type Right ¶
type Right struct {
RowId uint64 `pack:"I,pk" json:"row_id"` // unique id
Cycle int64 `pack:"c,i16" json:"cycle"` // cycle
Height int64 `pack:"h,i32" json:"height"` // height
AccountId AccountID `pack:"A,u32" json:"account_id"` // rights holder
Bake vec.BitSet `pack:"B,snappy" json:"baking_rights"` // bits for every block
Endorse vec.BitSet `pack:"E,snappy" json:"endorsing_rights"` // bits for every block
Baked vec.BitSet `pack:"b,snappy" json:"blocks_baked"` // bits for every block
Endorsed vec.BitSet `pack:"e,snappy" json:"blocks_endorsed"` // bits for every block
Seed vec.BitSet `pack:"S,snappy" json:"seeds_required"` // only bits for every seed block
Seeded vec.BitSet `pack:"s,snappy" json:"seeds_revealed"` // only bits for every seed block
}
func AllocRight ¶
func AllocRight() *Right
func (Right) IsSeedRequired ¶
func (Right) IsSeedRevealed ¶
func (Right) Reliability ¶
type Snapshot ¶
type Snapshot struct {
RowId uint64 `pack:"I,pk" json:"row_id"`
Height int64 `pack:"h,i32" json:"height"`
Cycle int64 `pack:"c,i16" json:"cycle"`
Timestamp time.Time `pack:"T" json:"time"`
Index int `pack:"i,i8" json:"index"`
OwnStake int64 `pack:"O" json:"own_stake"`
StakingBalance int64 `pack:"K" json:"staking_balance"`
AccountId AccountID `pack:"a,u32,bloom" json:"account_id"`
BakerId AccountID `pack:"d,u32" json:"baker_id"`
IsBaker bool `pack:"?,snappy" json:"is_baker"`
IsActive bool `pack:"v,snappy" json:"is_active"`
Balance int64 `pack:"B" json:"balance"`
Delegated int64 `pack:"D" json:"delegated"`
NDelegations int64 `pack:"n,i32" json:"n_delegations"`
NStakers int64 `pack:"#,i32" json:"n_stakers"`
Since int64 `pack:"S,i32" json:"since"`
}
Snapshot is an account balance snapshot made at a snapshot block.
func NewSnapshot ¶
func NewSnapshot() *Snapshot
type Stake ¶
type Stake struct {
RowId uint64 `pack:"I,pk" json:"row_id"`
Height int64 `pack:"h,i32" json:"height"`
AccountId AccountID `pack:"A" json:"account_id"`
Stake int64 `pack:"s" json:"stake"`
}
Stake snapshots
type Storage ¶
type Storage struct {
RowId StorageID `pack:"I,pk" json:"row_id"`
AccountId AccountID `pack:"A,bloom=3,snappy" json:"account_id"`
Hash uint64 `pack:"H,bloom=3,snappy" json:"hash"`
Height int64 `pack:"h,i32" json:"height"`
Storage []byte `pack:"S,snappy" json:"storage"`
}
Storage holds a snapshot of smart contract storage content.
type Supply ¶
type Supply struct {
RowId uint64 `pack:"I,pk" json:"row_id"` // unique id
Height int64 `pack:"h,i32,snappy" json:"height"` // bc: block height (also for orphans)
Cycle int64 `pack:"c,i16,snappy" json:"cycle"` // bc: block cycle (tezos specific)
Timestamp time.Time `pack:"T,snappy" json:"time"` // bc: block creation time
Total int64 `pack:"t,snappy" json:"total"` // total available supply (including unclaimed)
Activated int64 `pack:"A,snappy" json:"activated"` // activated fundraiser supply
Unclaimed int64 `pack:"U,snappy" json:"unclaimed"` // all non-activated fundraiser supply
Circulating int64 `pack:"C,snappy" json:"circulating"` // (total - unclaimed)
Liquid int64 `pack:"L,snappy" json:"liquid"` // (total - frozen - unclaimed)
Delegated int64 `pack:"E,snappy" json:"delegated"` // all delegated balances (includes overdelegation)
Staking int64 `pack:"D,snappy" json:"staking"` // baker's own balances / v18+ total stake (includes overstaking)
Unstaking int64 `pack:"N,snappy" json:"unstaking"` // staking exit queue
Shielded int64 `pack:"S,snappy" json:"shielded"` // Sapling shielded supply
ActiveStake int64 `pack:"K,snappy" json:"active_stake"` // network wide stake used for consensus
ActiveDelegated int64 `pack:"G,snappy" json:"active_delegated"` // delegated balances to active bakers
ActiveStaking int64 `pack:"J,snappy" json:"active_staking"` // active baker's slashable / v18+ stake
InactiveDelegated int64 `pack:"g,snappy" json:"inactive_delegated"` // delegated balances to inactive bakers
InactiveStaking int64 `pack:"j,snappy" json:"inactive_staking"` // inactive baker's slashable / v18+ stake
Minted int64 `pack:"M,snappy" json:"minted"`
MintedBaking int64 `pack:"b,snappy" json:"minted_baking"`
MintedEndorsing int64 `pack:"e,snappy" json:"minted_endorsing"`
MintedSeeding int64 `pack:"s,snappy" json:"minted_seeding"`
MintedAirdrop int64 `pack:"a,snappy" json:"minted_airdrop"`
MintedSubsidy int64 `pack:"y,snappy" json:"minted_subsidy"`
Burned int64 `pack:"B,snappy" json:"burned"`
BurnedDoubleBaking int64 `pack:"1,snappy" json:"burned_double_baking"`
BurnedDoubleEndorse int64 `pack:"2,snappy" json:"burned_double_endorse"`
BurnedOrigination int64 `pack:"3,snappy" json:"burned_origination"`
BurnedAllocation int64 `pack:"4,snappy" json:"burned_allocation"`
BurnedSeedMiss int64 `pack:"5,snappy" json:"burned_seed_miss"`
BurnedStorage int64 `pack:"6,snappy" json:"burned_storage"`
BurnedExplicit int64 `pack:"7,snappy" json:"burned_explicit"`
BurnedOffline int64 `pack:"8,snappy" json:"burned_offline"`
BurnedRollup int64 `pack:"9,snappy" json:"burned_rollup"`
Frozen int64 `pack:"F,snappy" json:"frozen"`
FrozenDeposits int64 `pack:"d,snappy" json:"frozen_deposits"` // <v18
FrozenRewards int64 `pack:"r,snappy" json:"frozen_rewards"` // <v18
FrozenFees int64 `pack:"f,snappy" json:"frozen_fees"` // <v18
FrozenBonds int64 `pack:"o,snappy" json:"frozen_bonds"` // rollup
FrozenStake int64 `pack:"x,snappy" json:"frozen_stake"` // v18+ all
FrozenBakerStake int64 `pack:"i,snappy" json:"frozen_baker_stake"` // v18+ baker only
FrozenStakerStake int64 `pack:"k,snappy" json:"frozen_staker_stake"` // v18+ staker only
}
Note: removed vesting supply in v9.1, TF vesting time is over
type Ticket ¶
type Ticket struct {
Id TicketID `pack:"I,pk" json:"row_id"`
Address tezos.Address `pack:"A,bloom=3" json:"address"`
Ticketer AccountID `pack:"X,bloom=3" json:"ticketer"`
Type micheline.Prim `pack:"T,snappy" json:"type"`
Content micheline.Prim `pack:"C,snappy" json:"content"`
Hash uint64 `pack:"H,bloom" json:"hash"`
Creator AccountID `pack:"c" json:"creator"`
FirstBlock int64 `pack:"<,i32" json:"first_block"`
FirstTime time.Time `pack:"f" json:"first_time"`
LastBlock int64 `pack:">,i32" json:"last_block"`
LastTime time.Time `pack:"t" json:"last_time"`
Supply tezos.Z `pack:"S,snappy" json:"total_supply"`
TotalMint tezos.Z `pack:"m,snappy" json:"total_mint"`
TotalBurn tezos.Z `pack:"b,snappy" json:"total_burn"`
NumTransfers int `pack:"x,i32" json:"num_transfers"`
NumHolders int `pack:"y,i32" json:"num_holders"`
}
Ticket tracks all ticket instances. A Ticket is uniquely defined by a ticketer (the issuing contract), type and contents matching this type.
func GetTicketId ¶
func ListTickets ¶
func LookupTicket ¶
type TicketEvent ¶
type TicketEvent struct {
Id TicketEventID `pack:"I,pk" json:"row_id"`
Type TicketEventType `pack:"y" json:"type"`
Ticket TicketID `pack:"T,bloom=3" json:"ticket"`
Ticketer AccountID `pack:"E,bloom=3" json:"ticketer"`
Sender AccountID `pack:"S" json:"sender"`
Receiver AccountID `pack:"R" json:"receiver"`
Amount tezos.Z `pack:"A,snappy" json:"amount"`
Height int64 `pack:"h,i32" json:"height"`
Time time.Time `pack:"t" json:"time"`
OpId uint64 `pack:"d" json:"op_id"`
}
TicketEvent tracks all ticket events such as transfers, mints, burns.
func ListTicketEvents ¶
func NewTicketEvent ¶
func NewTicketEvent() *TicketEvent
func (*TicketEvent) Free ¶
func (e *TicketEvent) Free()
func (TicketEvent) ID ¶
func (t TicketEvent) ID() uint64
func (*TicketEvent) Reset ¶
func (e *TicketEvent) Reset()
func (*TicketEvent) SetID ¶
func (t *TicketEvent) SetID(id uint64)
func (TicketEvent) TableKey ¶
func (_ TicketEvent) TableKey() string
func (TicketEvent) TableOpts ¶
func (_ TicketEvent) TableOpts() pack.Options
type TicketEventID ¶
type TicketEventID uint64
func (TicketEventID) U64 ¶
func (i TicketEventID) U64() uint64
type TicketEventType ¶
type TicketEventType byte
const ( TicketEventTypeInvalid TicketEventType = iota TicketEventTypeTransfer TicketEventTypeMint TicketEventTypeBurn )
func ParseTicketEventType ¶
func ParseTicketEventType(s string) TicketEventType
func (TicketEventType) IsValid ¶
func (t TicketEventType) IsValid() bool
func (TicketEventType) MarshalText ¶
func (t TicketEventType) MarshalText() ([]byte, error)
func (TicketEventType) String ¶
func (t TicketEventType) String() string
func (*TicketEventType) UnmarshalText ¶
func (t *TicketEventType) UnmarshalText(data []byte) error
type TicketOwner ¶
type TicketOwner struct {
Id TicketOwnerID `pack:"I,pk" json:"row_id"`
Ticket TicketID `pack:"T,bloom=3" json:"ticket"`
Ticketer AccountID `pack:"E,bloom=3" json:"ticketer"`
Account AccountID `pack:"A,bloom=3" json:"account"`
Balance tezos.Z `pack:"B,snappy" json:"balance"` // current balance
FirstBlock int64 `pack:"<,i32" json:"first_block"` // block height
FirstTime time.Time `pack:"f" json:"first_time"` // block time
LastBlock int64 `pack:">,i32" json:"last_block"` // block height
LastTime time.Time `pack:"t" json:"last_time"` // block time
NumTransfers int `pack:"x,i32" json:"num_transfers"` // #xfers this owner/ticket combi sent or recv
NumMints int `pack:"y,i32" json:"num_mints"` // #mints this owner/ticket combi
NumBurns int `pack:"z,i32" json:"num_burns"` // #burns this owner/ticket combi
VolSent tezos.Z `pack:"s,snappy" json:"vol_sent"` // running total
VolRecv tezos.Z `pack:"r,snappy" json:"vol_recv"` // running total
VolMint tezos.Z `pack:"m,snappy" json:"vol_mint"` // running total
VolBurn tezos.Z `pack:"b,snappy" json:"vol_burn"` // running total
// internal, used for stats
WasZero bool `pack:"-" json:"-"`
}
TicketOwner tracks owner info.
func GetOrCreateTicketOwner ¶
func GetTicketOwner ¶
func GetTicketOwnerId ¶
func GetTicketOwnerId(ctx context.Context, t *pack.Table, id TicketOwnerID) (*TicketOwner, error)
func ListTicketOwners ¶
func NewTicketOwner ¶
func NewTicketOwner() *TicketOwner
func (*TicketOwner) Free ¶
func (o *TicketOwner) Free()
func (TicketOwner) ID ¶
func (t TicketOwner) ID() uint64
func (*TicketOwner) Reset ¶
func (o *TicketOwner) Reset()
func (*TicketOwner) SetID ¶
func (t *TicketOwner) SetID(id uint64)
func (TicketOwner) TableKey ¶
func (_ TicketOwner) TableKey() string
func (TicketOwner) TableOpts ¶
func (_ TicketOwner) TableOpts() pack.Options
type TicketOwnerID ¶
type TicketOwnerID uint64
func (TicketOwnerID) U64 ¶
func (i TicketOwnerID) U64() uint64
type TicketUpdate ¶
type TicketUpdate struct {
Id TicketUpdateID `pack:"I,pk" json:"row_id"`
TicketId TicketID `pack:"T" json:"ticket"`
AccountId AccountID `pack:"S" json:"account"`
Amount tezos.Z `pack:"A,snappy" json:"amount"`
Height int64 `pack:"h,i32" json:"height"`
Time time.Time `pack:"t" json:"time"`
OpId uint64 `pack:"d" json:"op_id"`
}
TicketUpdate tracks low-level updates issued in operation receipts.
func ListTicketUpdates ¶
func NewTicketUpdate ¶
func NewTicketUpdate() *TicketUpdate
func (*TicketUpdate) Free ¶
func (m *TicketUpdate) Free()
func (TicketUpdate) ID ¶
func (t TicketUpdate) ID() uint64
func (TicketUpdate) Indexes ¶
func (_ TicketUpdate) Indexes() []string
func (*TicketUpdate) Reset ¶
func (m *TicketUpdate) Reset()
func (*TicketUpdate) SetID ¶
func (t *TicketUpdate) SetID(id uint64)
func (TicketUpdate) TableKey ¶
func (_ TicketUpdate) TableKey() string
func (TicketUpdate) TableOpts ¶
func (_ TicketUpdate) TableOpts() pack.Options
type TicketUpdateID ¶
type TicketUpdateID uint64
type Token ¶
type Token struct {
Id TokenID `pack:"I,pk" json:"row_id"`
Ledger AccountID `pack:"l,bloom=3" json:"ledger"`
TokenId tezos.Z `pack:"i,snappy" json:"token_id"`
TokenId64 int64 `pack:"6" json:"token_id64"`
Creator AccountID `pack:"C" json:"creator"`
Type TokenType `pack:"Y" json:"type"`
FirstBlock int64 `pack:"<" json:"first_block"`
FirstTime time.Time `pack:"T" json:"first_time"`
LastBlock int64 `pack:">" json:"last_block"`
LastTime time.Time `pack:"t" json:"last_time"`
Supply tezos.Z `pack:"S,snappy" json:"total_supply"`
TotalMint tezos.Z `pack:"m,snappy" json:"total_mint"`
TotalBurn tezos.Z `pack:"b,snappy" json:"total_burn"`
NumTransfers int `pack:"x,i32" json:"num_transfers"`
NumHolders int `pack:"y,i32" json:"num_holders"`
}
Token tracks token state and stats
func GetOrCreateToken ¶
func NewTokenMeta ¶
func NewTokenMeta() *Token
type TokenEvent ¶
type TokenEvent struct {
Id TokenEventID `pack:"I,pk" json:"row_id"`
Ledger AccountID `pack:"l,bloom=3" json:"ledger"`
Token TokenID `pack:"T,bloom=3" json:"token"`
Type TokenEventType `pack:"y" json:"type"`
Signer AccountID `pack:"Z" json:"signer"`
Sender AccountID `pack:"S" json:"sender"`
Receiver AccountID `pack:"R" json:"receiver"`
Amount tezos.Z `pack:"A,snappy" json:"amount"`
Height int64 `pack:"h" json:"height"`
Time time.Time `pack:"t" json:"time"`
OpId OpID `pack:"d" json:"op_id"`
TokenRef *Token `pack:"-" json:"-"`
}
TokenEvent tracks all token events such as transfers, mints, burns.
func NewTokenEvent ¶
func NewTokenEvent() *TokenEvent
func (*TokenEvent) Free ¶
func (m *TokenEvent) Free()
func (*TokenEvent) ID ¶
func (m *TokenEvent) ID() uint64
func (*TokenEvent) Reset ¶
func (m *TokenEvent) Reset()
func (*TokenEvent) SetID ¶
func (m *TokenEvent) SetID(id uint64)
func (TokenEvent) TableKey ¶
func (m TokenEvent) TableKey() string
func (TokenEvent) TableOpts ¶
func (m TokenEvent) TableOpts() pack.Options
type TokenEventID ¶
type TokenEventID uint64
type TokenEventType ¶
type TokenEventType byte
const ( TokenEventTypeInvalid TokenEventType = iota TokenEventTypeTransfer TokenEventTypeMint TokenEventTypeBurn )
func ParseTokenEventType ¶
func ParseTokenEventType(s string) TokenEventType
func (TokenEventType) IsValid ¶
func (t TokenEventType) IsValid() bool
func (TokenEventType) MarshalText ¶
func (t TokenEventType) MarshalText() ([]byte, error)
func (TokenEventType) String ¶
func (t TokenEventType) String() string
func (*TokenEventType) UnmarshalText ¶
func (t *TokenEventType) UnmarshalText(data []byte) error
type TokenMeta ¶
type TokenMeta struct {
Id TokenMetaID `pack:"I,pk" json:"row_id"`
Token TokenID `pack:"T,snappy" json:"token"`
Data []byte `pack:"D,snappy" json:"data"`
}
TokenMeta tracks token metadata from off-chain resolution
type TokenMetaID ¶
type TokenMetaID uint64
type TokenOwner ¶
type TokenOwner struct {
Id TokenOwnerID `pack:"I,pk" json:"row_id"`
Account AccountID `pack:"A,bloom=3" json:"account"`
Ledger AccountID `pack:"L,bloom=3" json:"ledger"`
Token TokenID `pack:"T,bloom=3" json:"token"`
Balance tezos.Z `pack:"B,snappy" json:"balance"` // current balance
FirstBlock int64 `pack:"<,i32" json:"first_seen"` // height
LastBlock int64 `pack:">,i32" json:"last_seen"` // height
NumTransfers int `pack:"x,i32" json:"num_transfers"` // #xfers this owner/token combi sent or recv
NumMints int `pack:"y,i32" json:"num_mints"` // #mints this owner/token combi
NumBurns int `pack:"z,i32" json:"num_burns"` // #burns this owner/token combi
VolSent tezos.Z `pack:"s,snappy" json:"vol_sent"` // running total
VolRecv tezos.Z `pack:"r,snappy" json:"vol_recv"` // running total
VolMint tezos.Z `pack:"m,snappy" json:"vol_mint"` // running total
VolBurn tezos.Z `pack:"b,snappy" json:"vol_burn"` // running total
// internal, used for stats
WasZero bool `pack:"-" json:"-"`
}
TokenOwner tracks current token ownership balances for each account and lifetime running totals. First/last and counters are useful as app-level stats and to limit db query range scans.
func GetCurrentTokenOwner ¶
func GetOrCreateOwner ¶
func GetOwnerId ¶
func GetOwnerId(ctx context.Context, t *pack.Table, id TokenOwnerID) (*TokenOwner, error)
func GetTokenOwner ¶
func ListOwners ¶
func NewTokenOwner ¶
func NewTokenOwner() *TokenOwner
func (*TokenOwner) Free ¶
func (m *TokenOwner) Free()
func (*TokenOwner) ID ¶
func (m *TokenOwner) ID() uint64
func (*TokenOwner) Reset ¶
func (m *TokenOwner) Reset()
func (*TokenOwner) SetID ¶
func (m *TokenOwner) SetID(id uint64)
func (TokenOwner) TableKey ¶
func (m TokenOwner) TableKey() string
func (TokenOwner) TableOpts ¶
func (m TokenOwner) TableOpts() pack.Options
type TokenOwnerID ¶
type TokenOwnerID uint64
type TokenTransfer ¶
func (TokenTransfer) IsValid ¶
func (t TokenTransfer) IsValid() bool
type TokenType ¶
type TokenType byte
FA1, FA1.2, FA2
func DetectTokenType ¶
func ParseTokenType ¶
func (TokenType) DecodeTransfers ¶
func (t TokenType) DecodeTransfers(prim micheline.Prim) ([]TokenTransfer, error)
func (TokenType) MarshalText ¶
func (*TokenType) UnmarshalText ¶
type TransferList ¶
type TransferList struct {
Transfers []TokenTransfer
// contains filtered or unexported fields
}
func (*TransferList) UnmarshalPrim ¶
func (t *TransferList) UnmarshalPrim(prim micheline.Prim) error
type Vote ¶
type Vote struct {
RowId uint64 `pack:"I,pk" json:"row_id"` // unique id
ElectionId ElectionID `pack:"E" json:"election_id"` // related election id
ProposalId ProposalID `pack:"P" json:"proposal_id"` // related proposal id
VotingPeriod int64 `pack:"p,i16" json:"voting_period"` // on-chain sequence number
VotingPeriodKind tezos.VotingPeriodKind `pack:"k,u8" json:"voting_period_kind"` // on-chain period
StartTime time.Time `pack:"T" json:"period_start_time"` // start time (block time) of voting period
EndTime time.Time `pack:"t" json:"period_end_time"` // end time (block time), estimate when polls are open
StartHeight int64 `pack:"H,i32" json:"period_start_height"` // start block height of voting period
EndHeight int64 `pack:"h,i32" json:"period_end_height"` // end block height
EligibleStake int64 `pack:"s" json:"eligible_stake"` // stake at start of period
EligibleVoters int64 `pack:"v,i16" json:"eligible_voters"` // total number of eligible bakers at start of period
QuorumPct int64 `pack:"q,d32,scale=2" json:"quorum_pct"` // required quorum in percent (store as integer with 2 digits)
QuorumStake int64 `pack:"S" json:"quorum_stake"` // required quorum in stake (0 for proposal_period)
TurnoutStake int64 `pack:"R" json:"turnout_stake"` // actual participation in stake
TurnoutVoters int64 `pack:"U,i16" json:"turnout_voters"` // actual participation in voters
TurnoutPct int64 `pack:"c,d32,scale=2" json:"turnout_pct"` // actual participation in percent
TurnoutEma int64 `pack:"e,d32,scale=2" json:"turnout_ema"` // EMA (80/20) of participation in percent
YayStake int64 `pack:"V" json:"yay_stake"`
YayVoters int64 `pack:"Y,i16" json:"yay_voters"`
NayStake int64 `pack:"W" json:"nay_stake"`
NayVoters int64 `pack:"N,i16" json:"nay_voters"`
PassStake int64 `pack:"X" json:"pass_stake"`
PassVoters int64 `pack:"A,i16" json:"pass_voters"`
IsOpen bool `pack:"o,snappy" json:"is_open"` // flag, polls are open (only current period)
IsFailed bool `pack:"f,snappy" json:"is_failed"` // flag, failed reaching quorum or supermajority
IsDraw bool `pack:"d,snappy" json:"is_draw"` // flag, draw between at least two proposals
NoProposal bool `pack:"?,snappy" json:"no_proposal"` // flag, no proposal submitted
NoQuorum bool `pack:"!,snappy" json:"no_quorum"` // flag, quorum not reached
NoMajority bool `pack:"m,snappy" json:"no_majority"` // flag, supermajority not reached
}
Vote represent the most recent state of a voting period during elections or, when closed, the final result of a voting period. Votes contain the cummulative aggregate state at the current block.
type Voter ¶
type Voter struct {
RowId AccountID
Stake int64
Ballot tezos.BallotVote
HasVoted bool
Time time.Time
Proposals []ProposalID
}
Source Files
¶
- account.go
- baker.go
- balance.go
- bigmap.go
- block.go
- chain.go
- config.go
- constant.go
- contract.go
- cycle.go
- event.go
- flow.go
- flowtype.go
- gov.go
- income.go
- interface.go
- log.go
- metadata.go
- op.go
- optype.go
- right.go
- snapshot.go
- status.go
- storage.go
- supply.go
- ticket.go
- ticket_event.go
- ticket_owner.go
- ticket_update.go
- tip.go
- token.go
- token_event.go
- token_ledger.go
- token_meta.go
- token_owner.go
- util.go