common

package
v0.0.0-...-5d11d67 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceUpdateKind

type BalanceUpdateKind string
const (
	KindBalanceUpdateFrozenDeposits   BalanceUpdateKind = "frozen_deposits"
	KindBalanceUpdateUnfrozenDeposits BalanceUpdateKind = "unfrozen_deposits"

	OVERSTAKE_PRECISION = 1_000_000
)

type CreationInfoKind

type CreationInfoKind string

TODO: find better name for this

const (
	CreatedAtBlockBeginning            CreationInfoKind = "block-beginning"
	CreatedAtBlockMetadata             CreationInfoKind = "block-metadata"
	CreatedAtTransactionMetadata       CreationInfoKind = "transaction-metadata"
	CreatedAtTransactionResult         CreationInfoKind = "transaction-result"
	CreatedAtTransactionInternalResult CreationInfoKind = "transaction-internal-result"

	// special case for delegation
	CreatedOnDelegation CreationInfoKind = "delegation"
)

type CycleStatistics

type CycleStatistics struct {
	Cycle     int64                                     `json:"cycle"`
	Delegates map[tezos.Address]DelegateCycleStatistics `json:"delegates"`
}

type DelegateCycleStatistics

type DelegateCycleStatistics struct {
	ExternalStaked    int64 `json:"external_staked"`
	OwnStaked         int64 `json:"own_staked"`
	ExternalDelegated int64 `json:"external_delegated"`
	OwnDelegated      int64 `json:"own_delegated"`
}

type DelegatedBalances

type DelegatedBalances map[tezos.Address]DelegatorBalances

type DelegationState

type DelegationState struct {
	Baker          tezos.Address      `json:"baker"`
	Cycle          int64              `json:"cycle"`
	LastBlockLevel rpc.BlockID        `json:"last_block_level"`
	Parameters     *StakingParameters `json:"staking_parameters"`

	CreatedAt DelegationStateCreationInfo `json:"created_at"`
	// contains filtered or unexported fields
}

func NewDelegationState

func NewDelegationState(delegate *rpc.Delegate, cycle int64, lastBlockLevel rpc.BlockID) *DelegationState

func (*DelegationState) AddBalance

func (d *DelegationState) AddBalance(address tezos.Address, balanceInfo DelegationStateBalanceInfo)

func (*DelegationState) Delegate

func (d *DelegationState) Delegate(delegator tezos.Address, delegate tezos.Address) error

func (*DelegationState) GetBakerStakedBalance

func (d *DelegationState) GetBakerStakedBalance() int64

func (*DelegationState) GetBakingPower

func (d *DelegationState) GetBakingPower() int64

func (*DelegationState) GetDelegatedBalance

func (d *DelegationState) GetDelegatedBalance() int64

func (*DelegationState) GetDelegatorAndBakerBalances

func (d *DelegationState) GetDelegatorAndBakerBalances() DelegatedBalances

includes baker own balance contributing to the total delegated balance

func (*DelegationState) GetDelegatorBalanceInfos

func (d *DelegationState) GetDelegatorBalanceInfos() DelegationStateBalances

func (*DelegationState) GetStakersStakedBalance

func (d *DelegationState) GetStakersStakedBalance() int64

func (*DelegationState) HasContractBalanceInfo

func (d *DelegationState) HasContractBalanceInfo(address tezos.Address) bool

func (*DelegationState) UpdateBalance

func (d *DelegationState) UpdateBalance(address tezos.Address, kind string, change int64) error

type DelegationStateBalanceInfo

type DelegationStateBalanceInfo struct {
	Balance         int64         `json:"balance"`
	StakedBalance   int64         `json:"frozen_deposits"`
	UnstakedBalance int64         `json:"unfrozen_deposits"`
	Baker           tezos.Address `json:"delegate"`
	// baker we stake with, can differ in case of delegation change
	StakeBaker tezos.Address `json:"stake_baker"`
}

type DelegationStateBalances

type DelegationStateBalances map[tezos.Address]DelegationStateBalanceInfo

type DelegationStateCreationInfo

type DelegationStateCreationInfo struct {
	Level         int64            `json:"level"`
	Operation     tezos.OpHash     `json:"operation"`
	Index         int              `json:"transaction_index"`
	InternalIndex int              `json:"internal_result_index"`
	Kind          CreationInfoKind `json:"kind"`
}

type DelegatorBalances

type DelegatorBalances struct {
	DelegatedBalance int64 `json:"delegated_balance"`
	// protion of staked balance included in delegated balance
	OverstakedBalance int64 `json:"overstaked_balance"`
	StakedBalance     int64 `json:"staked_balance"`
}

type FinalizableUnstakeRequest

type FinalizableUnstakeRequest struct {
	Delegate tezos.Address `json:"delegate"`
	Amount   tezos.Z       `json:"amount"`
	Cycle    int64         `json:"cycle"`
}

type StakingParameters

type StakingParameters struct {
	LimitOfStakingOverBakingMillionth int64 `json:"limit_of_staking_over_baking_millionth"`
	EdgeOfBakingOverStakingBillionth  int64 `json:"edge_of_baking_over_staking_billionth"`
}

type UnfinalizableUnstakeRequests

type UnfinalizableUnstakeRequests struct {
	Delegate tezos.Address `json:"delegate"`
	Requests []struct {
		Amount tezos.Z `json:"amount"`
		Cycle  int64   `json:"cycle"`
	} `json:"requests"`
}

type UnstakeRequests

type UnstakeRequests struct {
	Finalizable   []FinalizableUnstakeRequest  `json:"finalizable"`
	Unfinalizable UnfinalizableUnstakeRequests `json:"unfinalizable"`
}

func (*UnstakeRequests) GetUnstakedTotal

func (u *UnstakeRequests) GetUnstakedTotal() int64

func (*UnstakeRequests) GetUnstakedTotalForBaker

func (u *UnstakeRequests) GetUnstakedTotalForBaker(baker tezos.Address) int64

Jump to

Keyboard shortcuts

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