store

package
v0.0.0-...-0682c63 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	tezos.Address
}

func (*Address) Scan

func (a *Address) Scan(src interface{}) error

func (Address) Value

func (a Address) Value() (driver.Value, error)

type DelegationStateBalances

type DelegationStateBalances common.DelegatedBalances

func (*DelegationStateBalances) Scan

func (j *DelegationStateBalances) Scan(src interface{}) error

func (DelegationStateBalances) Value

type DelegationStateStatus

type DelegationStateStatus int
const (
	DelegationStateStatusOk                  DelegationStateStatus = iota
	DelegationStateStatusMinimumNotAvailable                       // 1
)

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(config *configuration.Runtime) (*Store, error)

func (*Store) GetDelegationState

func (s *Store) GetDelegationState(delegate tezos.Address, cycle int64) (*StoredDelegationState, error)

func (*Store) GetLastFetchedCycle

func (s *Store) GetLastFetchedCycle() (int64, error)

func (*Store) IsDelegationStateAvailable

func (s *Store) IsDelegationStateAvailable(delegate tezos.Address, cycle int64) (bool, error)

func (*Store) PruneDelegationState

func (s *Store) PruneDelegationState(cycle int64) error

func (*Store) Statistics

func (s *Store) Statistics(cycle int64) (*common.CycleStatistics, error)

func (*Store) StoreDelegationState

func (s *Store) StoreDelegationState(state *StoredDelegationState) error

type StoredDelegationState

type StoredDelegationState struct {
	Delegate Address                 `json:"delegate" gorm:"primaryKey"`
	Cycle    int64                   `json:"cycle" gorm:"primaryKey"`
	Status   DelegationStateStatus   `json:"status"`
	Balances DelegationStateBalances `json:"balances" gorm:"type:jsonb;default:'{}'"`
}

func CreateStoredDelegationStateFromDelegationState

func CreateStoredDelegationStateFromDelegationState(state *common.DelegationState) *StoredDelegationState

func (*StoredDelegationState) ExternalDelegatedBalance

func (s *StoredDelegationState) ExternalDelegatedBalance() common.DelegatorBalances

func (*StoredDelegationState) OwnDelegatedbalance

func (s *StoredDelegationState) OwnDelegatedbalance() common.DelegatorBalances

func (*StoredDelegationState) ToTzktState

type TzktDelegator

type TzktDelegator struct {
	Address          tezos.Address `json:"address"`
	DelegatedBalance int64         `json:"delegatedBalance"`
	StakedBalance    int64         `json:"stakedBalance"`
}

type TzktLikeDelegationState

type TzktLikeDelegationState struct {
	Cycle                    int64           `json:"cycle"`
	OwnDelegatedBalance      int64           `json:"ownDelegatedBalance"`
	OwnStakedBalance         int64           `json:"ownStakedBalance"`
	ExternalDelegatedBalance int64           `json:"externalDelegatedBalance"`
	ExternalStakedBalance    int64           `json:"externalStakedBalance"`
	DelegatorsCount          int             `json:"delegatorsCount"`
	Delegators               []TzktDelegator `json:"delegators"`
}

Jump to

Keyboard shortcuts

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