types

package
v0.0.0-...-00d0827 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptingDelegates

type AcceptingDelegates uint64

AcceptingDelegates indicates if a full staker is accepting delegates.

const AcceptingDelegatesNo AcceptingDelegates = 2

AcceptingDelegatesNo .

const AcceptingDelegatesUnknown AcceptingDelegates = 0

AcceptingDelegatesUnknown .

const AcceptingDelegatesYes AcceptingDelegates = 1

AcceptingDelegatesYes .

func AcceptingDelegatesByName

func AcceptingDelegatesByName(name string) (AcceptingDelegates, bool)

AcceptingDelegatesByName returns the named Accepting Delegates.

func (AcceptingDelegates) GetEnumValue

func (v AcceptingDelegates) GetEnumValue() uint64

GetEnumValue returns the value of the Accepting Delegates

func (AcceptingDelegates) MarshalJSON

func (v AcceptingDelegates) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Accepting Delegates to JSON as a string.

func (*AcceptingDelegates) SetEnumValue

func (v *AcceptingDelegates) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (AcceptingDelegates) String

func (v AcceptingDelegates) String() string

String returns the name of the Accepting Delegates.

func (*AcceptingDelegates) UnmarshalJSON

func (v *AcceptingDelegates) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Accepting Delegates from JSON as a string.

type Account

type Account struct {

	// Type is the type of staking account.
	Type AccountType `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	// Url is the URL of the staked token account.
	Url *url.URL `json:"url,omitempty" form:"url" query:"url" validate:"required"`
	// Payout is the URL of the payout token account.
	Payout *url.URL `json:"payout,omitempty" form:"payout" query:"payout" validate:"required"`
	// Delegate is the URL of an account this stake is delegated to.
	Delegate *url.URL `json:"delegate,omitempty" form:"delegate" query:"delegate"`
	// Lockup is the number of quarters the tokens will be locked for, beyond the post-activation 6 months.
	Lockup uint64 `json:"lockup,omitempty" form:"lockup" query:"lockup"`
	// HardLock determines if the tokens can be withdrawn for a penalty (soft lock) or cannot be withdrawn at all (hard lock).
	HardLock bool `json:"hardLock,omitempty" form:"hardLock" query:"hardLock"`
	// contains filtered or unexported fields
}

func (*Account) Copy

func (v *Account) Copy() *Account

func (*Account) CopyAsInterface

func (v *Account) CopyAsInterface() interface{}

func (*Account) Equal

func (v *Account) Equal(u *Account) bool

func (*Account) IsValid

func (v *Account) IsValid() error

func (*Account) MarshalBinary

func (v *Account) MarshalBinary() ([]byte, error)

func (*Account) UnmarshalBinary

func (v *Account) UnmarshalBinary(data []byte) error

func (*Account) UnmarshalBinaryFrom

func (v *Account) UnmarshalBinaryFrom(rd io.Reader) error

type AccountParameters

type AccountParameters struct {

	// Parameters is the account that holds the staking parameters.
	Parameters *url.URL `json:"parameters,omitempty" form:"parameters" query:"parameters" validate:"required"`
	// TokenIssuance is the account rewards are issued from.
	TokenIssuance *url.URL `json:"tokenIssuance,omitempty" form:"tokenIssuance" query:"tokenIssuance" validate:"required"`
	// Authority is the authority that staking accounts are owned by.
	Authority *url.URL `json:"authority,omitempty" form:"authority" query:"authority" validate:"required"`
	// Validators is the signer that lists the staking validators.
	Validators *url.URL `json:"validators,omitempty" form:"validators" query:"validators" validate:"required"`
	// Requests is the account that users submit requests to.
	Requests *url.URL `json:"requests,omitempty" form:"requests" query:"requests" validate:"required"`
	// Actions tracks actions executed by the staking network in response to requests.
	Actions *url.URL `json:"actions,omitempty" form:"actions" query:"actions" validate:"required"`
	// Epoch stores the metadata for the last successfully processed epoch.
	Epoch *url.URL `json:"epoch,omitempty" form:"epoch" query:"epoch" validate:"required"`
	// RegisteredADIs tracks registered staking accounts.
	RegisteredADIs *url.URL `json:"registeredADIs,omitempty" form:"registeredADIs" query:"registeredADIs" validate:"required"`
	// ApprovedADIs ApprovedADIs staking acc://staking.acme/Approved.
	ApprovedADIs *url.URL `json:"approvedADIs,omitempty" form:"approvedADIs" query:"approvedADIs" validate:"required"`
	// Disputes Disputes of staking acc://staking.acme/Disputes.
	Disputes *url.URL `json:"disputes,omitempty" form:"disputes" query:"disputes" validate:"required"`
}

func (*AccountParameters) Copy

func (*AccountParameters) CopyAsInterface

func (v *AccountParameters) CopyAsInterface() interface{}

func (*AccountParameters) Equal

type AccountType

type AccountType uint64

AccountType is the stake type of a staking account.

const AccountTypeCoreFollower AccountType = 4

AccountTypeCoreFollower .

const AccountTypeCoreValidator AccountType = 3

AccountTypeCoreValidator .

const AccountTypeDelegated AccountType = 2

AccountTypeDelegated .

const AccountTypeInactive AccountType = 0

AccountTypeInactive .

const AccountTypePure AccountType = 1

AccountTypePure .

const AccountTypeStakingValidator AccountType = 5

AccountTypeStakingValidator .

func AccountTypeByName

func AccountTypeByName(name string) (AccountType, bool)

AccountTypeByName returns the named Account Type.

func (AccountType) GetEnumValue

func (v AccountType) GetEnumValue() uint64

GetEnumValue returns the value of the Account Type

func (AccountType) MarshalJSON

func (v AccountType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Account Type to JSON as a string.

func (*AccountType) SetEnumValue

func (v *AccountType) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (AccountType) String

func (v AccountType) String() string

String returns the name of the Account Type.

func (*AccountType) UnmarshalJSON

func (v *AccountType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Account Type from JSON as a string.

type AdiParameters

type AdiParameters struct {

	// StakingService Staking Service ADI acc://staking.acme.
	StakingService *url.URL `json:"stakingService,omitempty" form:"stakingService" query:"stakingService" validate:"required"`
}

func (*AdiParameters) Copy

func (v *AdiParameters) Copy() *AdiParameters

func (*AdiParameters) CopyAsInterface

func (v *AdiParameters) CopyAsInterface() interface{}

func (*AdiParameters) Equal

func (v *AdiParameters) Equal(u *AdiParameters) bool

type Approved

type Approved struct {
	Identity *url.URL `json:"identity,omitempty" form:"identity" query:"identity" validate:"required"`
	// Pure indicates whether the staker has been approved to be a pure staker.
	Pure bool `json:"pure,omitempty" form:"pure" query:"pure" validate:"required"`
	// Operator indicates whether the staker has been approved to be an operator.
	Operator bool `json:"operator,omitempty" form:"operator" query:"operator" validate:"required"`
	// contains filtered or unexported fields
}

func (*Approved) Copy

func (v *Approved) Copy() *Approved

func (*Approved) CopyAsInterface

func (v *Approved) CopyAsInterface() interface{}

func (*Approved) Equal

func (v *Approved) Equal(u *Approved) bool

func (*Approved) IsValid

func (v *Approved) IsValid() error

func (*Approved) MarshalBinary

func (v *Approved) MarshalBinary() ([]byte, error)

func (*Approved) UnmarshalBinary

func (v *Approved) UnmarshalBinary(data []byte) error

func (*Approved) UnmarshalBinaryFrom

func (v *Approved) UnmarshalBinaryFrom(rd io.Reader) error

type CronSchedule

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

func MustParseCron

func MustParseCron(spec string) *CronSchedule

func ParseCron

func ParseCron(spec string) (*CronSchedule, error)

func (*CronSchedule) Copy

func (s *CronSchedule) Copy() *CronSchedule

func (*CronSchedule) Equal

func (s *CronSchedule) Equal(r *CronSchedule) bool

func (*CronSchedule) MarshalJSON

func (s *CronSchedule) MarshalJSON() ([]byte, error)

func (*CronSchedule) Next

func (s *CronSchedule) Next(t time.Time) time.Time

func (*CronSchedule) UnmarshalJSON

func (s *CronSchedule) UnmarshalJSON(data []byte) error

type Identity

type Identity struct {

	// Identity is the URL of the staker's ADI.
	Identity *url.URL   `json:"identity,omitempty" form:"identity" query:"identity" validate:"required"`
	Accounts []*Account `json:"accounts,omitempty" form:"accounts" query:"accounts" validate:"required"`
	// DelegatorPayout is the token account that rewards from delegators are sent to.
	DelegatorPayout *url.URL `json:"delegatorPayout,omitempty" form:"delegatorPayout" query:"delegatorPayout" validate:"required"`
	// RejectDelegates indicates this identity rejects delegates.
	RejectDelegates bool `json:"rejectDelegates,omitempty" form:"rejectDelegates" query:"rejectDelegates" validate:"required"`
	// Type is the type of staking account.
	Type AccountType `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	// Stake is the URL of the staked token account.
	Stake *url.URL `json:"stake,omitempty" form:"stake" query:"stake" validate:"required"`
	// Rewards is the URL of the rewards token account.
	Rewards *url.URL `json:"rewards,omitempty" form:"rewards" query:"rewards" validate:"required"`
	// Delegate is the URL of an account this stake is delegated to.
	Delegate *url.URL `json:"delegate,omitempty" form:"delegate" query:"delegate"`
	// Lockup is the number of quarters the tokens will be locked for, beyond the post-activation 6 months.
	Lockup uint64 `json:"lockup,omitempty" form:"lockup" query:"lockup"`
	// HardLock determines if the tokens can be withdrawn for a penalty (soft lock) or cannot be withdrawn at all (hard lock).
	HardLock bool `json:"hardLock,omitempty" form:"hardLock" query:"hardLock"`
	// Status is the status of staking account.
	Status Status `json:"status,omitempty" form:"status" query:"status" validate:"required"`
	// AcceptingDelegates indicates if a full staker is accepting delegates.
	AcceptingDelegates AcceptingDelegates `json:"acceptingDelegates,omitempty" form:"acceptingDelegates" query:"acceptingDelegates" validate:"required"`
	// contains filtered or unexported fields
}

func (*Identity) Copy

func (v *Identity) Copy() *Identity

func (*Identity) CopyAsInterface

func (v *Identity) CopyAsInterface() interface{}

func (*Identity) Equal

func (v *Identity) Equal(u *Identity) bool

func (*Identity) IsValid

func (v *Identity) IsValid() error

func (*Identity) MarshalBinary

func (v *Identity) MarshalBinary() ([]byte, error)

func (*Identity) MarshalJSON

func (v *Identity) MarshalJSON() ([]byte, error)

func (*Identity) Normalize

func (id *Identity) Normalize()

Normalize updates an identity to the new multi-account form

func (*Identity) UnmarshalBinary

func (v *Identity) UnmarshalBinary(data []byte) error

func (*Identity) UnmarshalBinaryFrom

func (v *Identity) UnmarshalBinaryFrom(rd io.Reader) error

func (*Identity) UnmarshalJSON

func (v *Identity) UnmarshalJSON(data []byte) error

type Parameters

type Parameters struct {
	ADI              AdiParameters     `json:"adi,omitempty" form:"adi" query:"adi" validate:"required"`
	Account          AccountParameters `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	PayoutSchedule   *CronSchedule     `json:"payoutSchedule,omitempty" form:"payoutSchedule" query:"payoutSchedule" validate:"required"`
	RequestsSchedule *CronSchedule     `json:"requestsSchedule,omitempty" form:"requestsSchedule" query:"requestsSchedule" validate:"required"`
	// TokenIssuanceRate APR of payout of unissued tokens.
	TokenIssuanceRate *WeightParameter   `json:"tokenIssuanceRate,omitempty" form:"tokenIssuanceRate" query:"tokenIssuanceRate" validate:"required"`
	StakingWeight     []*WeightParameter `json:"stakingWeight,omitempty" form:"stakingWeight" query:"stakingWeight" validate:"required"`
	DelegationFee     *WeightParameter   `json:"delegationFee,omitempty" form:"delegationFee" query:"delegationFee" validate:"required"`
	DelegatedMinimum  *big.Int           `json:"delegatedMinimum,omitempty" form:"delegatedMinimum" query:"delegatedMinimum" validate:"required"`
	FullStakeMinimum  *big.Int           `json:"fullStakeMinimum,omitempty" form:"fullStakeMinimum" query:"fullStakeMinimum" validate:"required"`
}

func (*Parameters) Copy

func (v *Parameters) Copy() *Parameters

func (*Parameters) CopyAsInterface

func (v *Parameters) CopyAsInterface() interface{}

func (*Parameters) Equal

func (v *Parameters) Equal(u *Parameters) bool

func (*Parameters) Init

func (p *Parameters) Init()

init() Initialize stuff in the package Initialize the starting values for Parameters

func (*Parameters) MarshalJSON

func (v *Parameters) MarshalJSON() ([]byte, error)

func (*Parameters) UnmarshalJSON

func (v *Parameters) UnmarshalJSON(data []byte) error

type Status

type Status uint64

Status is the status of a staking account.

const StatusPending Status = 1

StatusPending .

const StatusRegistered Status = 2

StatusRegistered .

const StatusUnknown Status = 0

StatusUnknown .

func StatusByName

func StatusByName(name string) (Status, bool)

StatusByName returns the named Status.

func (Status) GetEnumValue

func (v Status) GetEnumValue() uint64

GetEnumValue returns the value of the Status

func (Status) MarshalJSON

func (v Status) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Status to JSON as a string.

func (*Status) SetEnumValue

func (v *Status) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (Status) String

func (v Status) String() string

String returns the name of the Status.

func (*Status) UnmarshalJSON

func (v *Status) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Status from JSON as a string.

type WeightParameter

type WeightParameter struct {
	Type        AccountType `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	Numerator   uint64      `json:"numerator,omitempty" form:"numerator" query:"numerator" validate:"required"`
	Denominator uint64      `json:"denominator,omitempty" form:"denominator" query:"denominator" validate:"required"`
}

func (*WeightParameter) BigRat

func (w *WeightParameter) BigRat() *big.Rat

func (*WeightParameter) Copy

func (v *WeightParameter) Copy() *WeightParameter

func (*WeightParameter) CopyAsInterface

func (v *WeightParameter) CopyAsInterface() interface{}

func (*WeightParameter) Equal

func (v *WeightParameter) Equal(u *WeightParameter) bool

func (*WeightParameter) Float64

func (w *WeightParameter) Float64() float64

Jump to

Keyboard shortcuts

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