state

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StakeTypeValidator = "v"
	StakeTypeHost      = "s"
)

Various names for staking categories

View Source
const (
	ProposalVoteNo         = 0
	ProposalVoteYes        = 1
	ProposalVoteNoWithVeto = 2
	ProposalVoteAbstain    = 3
)

Proposal vote choices

Variables

View Source
var (
	// DefaultRepoConfig is a sane default for repository configurations
	DefaultRepoConfig = MakeDefaultRepoConfig()
)

Functions

func IsValidPropFeeRefundTypeType added in v0.0.30

func IsValidPropFeeRefundTypeType(v *int) bool

IsValidPropFeeRefundTypeType checks if v is a valid PropFeeRefundTypeType

func IsValidProposalCreatorType added in v0.0.30

func IsValidProposalCreatorType(v *int) bool

IsValidProposalCreatorType checks if v is a valid ProposalCreatorType

func IsValidProposalTallyMethod added in v0.0.30

func IsValidProposalTallyMethod(v *int) bool

IsValidProposalTallyMethod checks if v is a valid ProposalTallyMethod

func IsValidVoterType added in v0.0.30

func IsValidVoterType(v *int) bool

IsValidVoterType checks if v is a valid VoterType

Types

type Account

type Account struct {
	util.CodecUtil      `json:"-" msgpack:"-"`
	Balance             util.String   `json:"balance" msgpack:"balance"`
	Nonce               util.UInt64   `json:"nonce" msgpack:"nonce"`
	Stakes              AccountStakes `json:"stakes,omitempty" msgpack:"stakes"`
	DelegatorCommission float64       `json:"delegatorCommission" msgpack:"delegatorCommission"`
}

Account represents a user's identity and includes balance and other information.

func NewAccountFromBytes

func NewAccountFromBytes(bz []byte) (*Account, error)

NewAccountFromBytes decodes bz to Account

func NewBareAccount added in v0.0.29

func NewBareAccount() *Account

NewBareAccount returns an empty account

func (*Account) Bytes

func (a *Account) Bytes() []byte

Bytes return the serialized equivalent of the account

func (*Account) Clean

func (a *Account) Clean(curHeight uint64)

Clean implements types.BalanceAccount; it removes old, unused data stored in the account such as unbonded stakes. Ignores stakes with unbond height set to 0. curHeight: The current blockchain height

func (*Account) DecodeMsgpack

func (a *Account) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder

func (*Account) EncodeMsgpack

func (a *Account) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder

func (*Account) FromMap

func (a *Account) FromMap(m map[string]interface{}) error

FromMap populates the object from a map

func (*Account) GetAvailableBalance

func (a *Account) GetAvailableBalance(curHeight uint64) util.String

GetAvailableBalance returns the spendable balance of the account. Formula: balance - total staked. curHeight: The current blockchain height; Used to determine which stakes are unbonded.

func (*Account) GetBalance

func (a *Account) GetBalance() util.String

GetBalance implements types.BalanceAccount

func (*Account) IsNil

func (a *Account) IsNil() bool

IsNil checks whether an account is empty/unset

func (*Account) SetBalance

func (a *Account) SetBalance(bal string)

SetBalance implements types.BalanceAccount

type AccountStakes

type AccountStakes map[string]*StakeInfo

AccountStakes holds staked balances

func BareAccountStakes

func BareAccountStakes() AccountStakes

BareAccountStakes returns an empty AccountStakes

func (*AccountStakes) Add

func (s *AccountStakes) Add(stakeType string, value util.String, unbondHeight uint64) string

Add Register adds a staked balance

  • stakeType: The unique stake identifier
  • value: The value staked
  • unbondHeight: The height where the stake is unbonded

Returns the full stake name

func (*AccountStakes) Get

func (s *AccountStakes) Get(name string) *StakeInfo

Get information about of a stake category. Returns zero if not found name: The name of the staking category

func (*AccountStakes) Has

func (s *AccountStakes) Has(name string) bool

Has checks whether a staked balance with the given name exist

func (*AccountStakes) Remove

func (s *AccountStakes) Remove(stakeType string, value util.String, unbondHeight uint64) string

Remove removes a stake entry that matches the given stake type, value and unbond height. Returns the key of the stake entry removed

func (*AccountStakes) TotalStaked

func (s *AccountStakes) TotalStaked(curHeight uint64) util.String

TotalStaked returns the sum of all staked balances curHeight: The current blockchain height; Used to determine which stakes are unbonded.

func (*AccountStakes) UpdateUnbondHeight

func (s *AccountStakes) UpdateUnbondHeight(
	stakeType string,
	value util.String,
	unbondHeight,
	newUnbondHeight uint64) string

UpdateUnbondHeight update the unbond height that matches the given stake type, value and unbond height. Returns the key of the stake entry that was updated.

type BaseContributor

type BaseContributor struct {
	FeeCap   util.String          `json:"feeCap" mapstructure:"feeCap" msgpack:"feeCap"`
	FeeUsed  util.String          `json:"feeUsed" mapstructure:"feeUsed" msgpack:"feeUsed"`
	Policies []*ContributorPolicy `json:"policies" mapstructure:"policies" msgpack:"policies"`
}

BaseContributor represents the basic information of a contributor

type BaseContributors

type BaseContributors map[string]*BaseContributor

BaseContributors is a collection of repo contributors

func (*BaseContributors) Has

func (rc *BaseContributors) Has(pushKeyID string) bool

Has checks whether a gpg id exists

type BlockInfo

type BlockInfo struct {
	AppHash         util.Bytes     `json:"appHash"`
	LastAppHash     util.Bytes     `json:"lastAppHash"`
	Hash            util.Bytes     `json:"hash"`
	Height          util.Int64     `json:"height"`
	ProposerAddress util.TMAddress `json:"proposerAddress"`
	Time            util.Int64     `json:"time"`
}

BlockInfo describes information about a block

type ContributorPolicy

type ContributorPolicy struct {
	Object string `json:"obj,omitempty" mapstructure:"obj,omitempty" msgpack:"obj,omitempty"`
	Action string `json:"act,omitempty" mapstructure:"act,omitempty" msgpack:"act,omitempty"`
}

ContributorPolicy describes a contributors policy. Similar to Policy except the one has no subject field.

type FeeMode

type FeeMode int
const (
	FeeModePusherPays FeeMode = iota
	FeeModeRepoPays
	FeeModeRepoPaysCapped
)

type Namespace

type Namespace struct {
	util.CodecUtil `json:"-" msgpack:"-"`
	Owner          string           `json:"owner" mapstructure:"owner" msgpack:"owner"`
	GraceEndAt     util.UInt64      `json:"graceEndAt" mapstructure:"graceEndAt" msgpack:"graceEndAt"`
	ExpiresAt      util.UInt64      `json:"expiresAt" mapstructure:"expiresAt" msgpack:"expiresAt"`
	Domains        NamespaceDomains `json:"domains" mapstructure:"domains" msgpack:"domains"`
	Contributors   BaseContributors `json:"contributors" msgpack:"contributors" mapstructure:"contributors"`
}

Namespace describes an object for storing human-readable names mapping to various network resources

func BareNamespace

func BareNamespace() *Namespace

BareNamespace returns an empty namespace object

func NewNamespaceFromBytes

func NewNamespaceFromBytes(bz []byte) (*Namespace, error)

NewNamespaceFromBytes decodes bz to Namespace

func (*Namespace) Bytes

func (ns *Namespace) Bytes() []byte

Bytes return the bytes equivalent of the account

func (*Namespace) DecodeMsgpack

func (ns *Namespace) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder

func (*Namespace) EncodeMsgpack

func (ns *Namespace) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder

func (*Namespace) IsNil

func (ns *Namespace) IsNil() bool

IsNil returns true if the repo fields are set to their nil value

type NamespaceDomains

type NamespaceDomains map[string]string

NamespaceDomains represents a map of human-readable names to their original, usually unreadable name

func (*NamespaceDomains) Get

func (nd *NamespaceDomains) Get(domain string) string

Get the target of a domain

type Policy

type Policy struct {
	Object  string `json:"obj,omitempty" mapstructure:"obj,omitempty" msgpack:"obj,omitempty"`
	Subject string `json:"sub,omitempty" mapstructure:"sub,omitempty" msgpack:"sub,omitempty"`
	Action  string `json:"act,omitempty" mapstructure:"act,omitempty" msgpack:"act,omitempty"`
}

Policy describes a repository access policy

type PropFeeRefundType

type PropFeeRefundType int

PropFeeRefundType describes the typeof refund scheme supported

const (
	ProposalFeeRefundNo PropFeeRefundType = iota
	ProposalFeeRefundOnAccept
	ProposalFeeRefundOnAcceptReject
	ProposalFeeRefundOnAcceptAllReject
	ProposalFeeRefundOnBelowThreshold
	ProposalFeeRefundOnBelowThresholdAccept
	ProposalFeeRefundOnBelowThresholdAcceptReject
	ProposalFeeRefundOnBelowThresholdAcceptAllReject
)

func (PropFeeRefundType) Ptr added in v0.0.30

func (p PropFeeRefundType) Ptr() *int

type Proposal

type Proposal interface {
	GetCreator() string
	GetVoterType() VoterType
	GetPowerAge() uint64
	GetEndAt() uint64
	GetQuorum() float64
	GetTallyMethod() ProposalTallyMethod
	GetAction() types.TxCode
	GetActionData() map[string]util.Bytes
	GetThreshold() float64
	GetVetoQuorum() float64
	GetVetoOwnersQuorum() float64
	GetAccepted() float64
	GetRejected() float64
	GetRejectedWithVeto() float64
	GetRejectedWithVetoByOwners() float64
	GetFees() ProposalFees
	GetRefundType() PropFeeRefundType
	IsFinalized() bool
	SetOutcome(v ProposalOutcome)
	IncrAccept()
	IsFeeDepositEnabled() bool
	IsDepositedFeeOK() bool
	IsDepositPeriod(curChainHeight uint64) bool
}

Proposal describes a repository proposal

type ProposalActionData

type ProposalActionData map[string]interface{}

ProposalActionData represents action data of a proposal

func (*ProposalActionData) Get

func (d *ProposalActionData) Get(actionName string) map[string]interface{}

Get returns the data corresponding to the given action name

type ProposalCreatorType

type ProposalCreatorType int

ProposalCreatorType describes types of proposal creators

const (
	ProposalCreatorAny ProposalCreatorType = iota
	ProposalCreatorOwner
)

func (ProposalCreatorType) Ptr added in v0.0.30

func (p ProposalCreatorType) Ptr() *int

type ProposalFees

type ProposalFees map[string]string

ProposalFees contains address and fees paid by proposal creators

func (ProposalFees) Add

func (pf ProposalFees) Add(address string, fee string)

Add adds a new fee entry

func (ProposalFees) Get

func (pf ProposalFees) Get(address string) util.String

Get return the fee associated with an address

func (ProposalFees) Has

func (pf ProposalFees) Has(address string) bool

Has checks if an address exists

func (ProposalFees) Total

func (pf ProposalFees) Total() decimal.Decimal

Total returns the total fees

type ProposalOutcome

type ProposalOutcome int

ProposalOutcome describes a proposal outcome

const (
	ProposalOutcomeAccepted ProposalOutcome = iota + 1
	ProposalOutcomeRejected
	ProposalOutcomeRejectedWithVeto
	ProposalOutcomeRejectedWithVetoByOwners
	ProposalOutcomeQuorumNotMet
	ProposalOutcomeBelowThreshold
	ProposalOutcomeInsufficientDeposit
)

Proposal outcomes

func (ProposalOutcome) Ptr added in v0.0.30

func (p ProposalOutcome) Ptr() *int

type ProposalTallyMethod

type ProposalTallyMethod int

ProposalTallyMethod represents a type for repo proposal counting method

const (
	ProposalTallyMethodIdentity ProposalTallyMethod = iota
	ProposalTallyMethodCoinWeighted
	ProposalTallyMethodNetStake
	ProposalTallyMethodNetStakeNonDelegated
	ProposalTallyMethodNetStakeOfDelegators
)

func (ProposalTallyMethod) Ptr added in v0.0.30

func (p ProposalTallyMethod) Ptr() *int

type PushKey

type PushKey struct {
	util.CodecUtil `json:"-" msgpack:"-"`
	PubKey         ed25519.PublicKey  `json:"pubKey,omitempty" mapstructure:"pubKey,omitempty" msgpack:"pubKey,omitempty"`
	Address        identifier.Address `json:"address,omitempty" mapstructure:"address,omitempty" msgpack:"address,omitempty"`
	Scopes         []string           `json:"scopes,omitempty" mapstructure:"scopes,omitempty" msgpack:"scopes,omitempty"`
	FeeCap         util.String        `json:"feeCap,omitempty" mapstructure:"feeCap,omitempty" msgpack:"feeCap,omitempty"`
	FeeUsed        util.String        `json:"feeUsed,omitempty" mapstructure:"feeUsed,omitempty" msgpack:"feeUsed,omitempty"`
}

PushKey represents a push key

func BarePushKey

func BarePushKey() *PushKey

BarePushKey returns a PushKey object with zero values

func NewPushKeyFromBytes

func NewPushKeyFromBytes(bz []byte) (*PushKey, error)

NewPushKeyFromBytes deserialize bz to PushKey

func (*PushKey) Bytes

func (pk *PushKey) Bytes() []byte

Bytes return the serialized equivalent

func (*PushKey) DecodeMsgpack

func (pk *PushKey) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder

func (*PushKey) EncodeMsgpack

func (pk *PushKey) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder

func (*PushKey) IsNil

func (pk *PushKey) IsNil() bool

IsNil returns true if g fields have zero values

type Reference

type Reference struct {
	util.CodecUtil `json:"-" mapstructure:"-" msgpack:"-"`

	// Creator is the raw push key ID of the reference creator
	Creator ed25519.PushKey `json:"creator" mapstructure:"creator" msgpack:"creator,omitempty"`

	// Nonce is the current count of commits on the reference.
	// It is used to enforce order of operation to the reference.
	Nonce util.UInt64 `json:"nonce" mapstructure:"nonce" msgpack:"nonce,omitempty"`

	// ReferenceData contains extra data
	Data *ReferenceData `json:"data" mapstructure:"data" msgpack:"data,omitempty"`

	// Hash is the current hash of the reference
	Hash util.Bytes `json:"hash" mapstructure:"hash" msgpack:"hash,omitempty"`
}

Reference represents a git reference

func BareReference

func BareReference() *Reference

BareReference returns an empty reference object

func (*Reference) DecodeMsgpack

func (r *Reference) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Reference) EncodeMsgpack

func (r *Reference) EncodeMsgpack(enc *msgpack.Encoder) error

func (*Reference) IsNil

func (r *Reference) IsNil() bool

IsNil checks whether the reference fields are all empty

type ReferenceData

type ReferenceData struct {

	// Labels are keywords that describe the reference
	Labels []string `json:"labels" mapstructure:"labels" msgpack:"labels,omitempty"`

	// Assignees contains pushers assigned to the reference
	Assignees []string `json:"assignees" mapstructure:"assignees" msgpack:"assignees,omitempty"`

	// Closed indicates that the reference is closed
	Closed bool `json:"closed" mapstructure:"closed" msgpack:"closed,omitempty"`
}

ReferenceData contain data specific to a reference

func (*ReferenceData) IsNil

func (i *ReferenceData) IsNil() bool

IsNil checks whether the object's fields are have zero values

type References

type References map[string]*Reference

References represents a collection of references

func (*References) Get

func (r *References) Get(name string) *Reference

Get a reference by name, returns empty reference if not found.

func (*References) Has

func (r *References) Has(name string) bool

Has checks whether a reference exist

type RepoConfig

type RepoConfig struct {
	util.CodecUtil `json:"-" mapstructure:"-" msgpack:"-"`
	Gov            *RepoConfigGovernance `json:"governance,omitempty" mapstructure:"governance,omitempty" msgpack:"governance,omitempty"`
	Policies       RepoPolicies          `json:"policies,omitempty" mapstructure:"policies,omitempty" msgpack:"policies,omitempty"`
}

RepoConfig contains repo-specific configuration settings

func BareRepoConfig

func BareRepoConfig() *RepoConfig

BareRepoConfig returns empty repository configurations

func MakeDefaultRepoConfig

func MakeDefaultRepoConfig() *RepoConfig

MakeDefaultRepoConfig returns sane defaults for repository configurations

func MakeZeroValueRepoConfig added in v0.0.30

func MakeZeroValueRepoConfig() *RepoConfig

MakeZeroValueRepoConfig returns a RepoConfig with all fields set to their zero value

func (*RepoConfig) Clone

func (c *RepoConfig) Clone() *RepoConfig

Clone clones c

func (*RepoConfig) DecodeMsgpack

func (c *RepoConfig) DecodeMsgpack(dec *msgpack.Decoder) error

func (*RepoConfig) EncodeMsgpack

func (c *RepoConfig) EncodeMsgpack(enc *msgpack.Encoder) error

func (*RepoConfig) IsEmpty added in v0.0.30

func (c *RepoConfig) IsEmpty() bool

IsEmpty checks if c considered empty

func (*RepoConfig) Merge added in v0.0.30

func (c *RepoConfig) Merge(upd map[string]interface{}) error

Merge merges the upd into c. Slice from upd will replace slice in c.

func (*RepoConfig) ToJSONToMap added in v0.0.30

func (c *RepoConfig) ToJSONToMap() map[string]interface{}

ToJSONToMap converts c to a JSON map and the map to go map.

This allows us to control how c is marshalled to go map via custom marshal types.

func (*RepoConfig) ToMap

func (c *RepoConfig) ToMap() map[string]interface{}

ToMap converts the object to a map

type RepoConfigGovernance

type RepoConfigGovernance struct {
	Voter                *int    `json:"propVoter,omitempty" mapstructure:"propVoter,omitempty" msgpack:"propVoter,omitempty"`
	PropCreator          *int    `json:"propCreator,omitempty" mapstructure:"propCreator,omitempty" msgpack:"propCreator,omitempty"`
	PropDuration         *string `json:"propDur,omitempty" mapstructure:"propDur,omitempty" msgpack:"propDur,omitempty"`
	PropFee              *string `json:"propFee,omitempty" mapstructure:"propFee,omitempty" msgpack:"propFee,omitempty"`
	PropFeeDepositDur    *string `json:"propFeeDepDur,omitempty" mapstructure:"propFeeDepDur,omitempty" msgpack:"propFeeDepDur,omitempty"`
	PropQuorum           *string `json:"propQuorum,omitempty" mapstructure:"propQuorum,omitempty" msgpack:"propQuorum,omitempty"`
	PropVetoQuorum       *string `json:"propVetoQuorum,omitempty" mapstructure:"propVetoQuorum,omitempty" msgpack:"propVetoQuorum,omitempty"`
	PropVetoOwnersQuorum *string `json:"propVetoOwnersQuorum,omitempty" mapstructure:"propVetoOwnersQuorum,omitempty" msgpack:"propVetoOwnersQuorum,omitempty"`
	PropThreshold        *string `json:"propThreshold,omitempty" mapstructure:"propThreshold,omitempty" msgpack:"propThreshold,omitempty"`
	PropFeeRefundType    *int    `json:"propFeeRefundType,omitempty" mapstructure:"propFeeRefundType,omitempty" msgpack:"propFeeRefundType,omitempty"`
	PropTallyMethod      *int    `json:"propTallyMethod,omitempty" mapstructure:"propTallyMethod,omitempty" msgpack:"propTallyMethod,omitempty"`
	UsePowerAge          *bool   `json:"usePowerAge,omitempty" mapstructure:"usePowerAge,omitempty" msgpack:"usePowerAge,omitempty"`
	CreatorAsContributor *bool   `json:"creatorAsContrib,omitempty" mapstructure:"creatorAsContrib,omitempty" msgpack:"creatorAsContrib,omitempty"`
	NoPropFeeForMergeReq *bool   `json:"noPropFeeForMergeReq,omitempty" mapstructure:"noPropFeeForMergeReq,omitempty" msgpack:"noPropFeeForMergeReq,omitempty"`
}

RepoConfigGovernance contains governance settings for a repository

func (RepoConfigGovernance) MarshalJSON added in v0.0.30

func (b RepoConfigGovernance) MarshalJSON() ([]byte, error)

type RepoContributor

type RepoContributor struct {
	FeeMode  FeeMode              `json:"feeMode" mapstructure:"feeMode" msgpack:"feeMode"`
	FeeCap   util.String          `json:"feeCap" mapstructure:"feeCap" msgpack:"feeCap"`
	FeeUsed  util.String          `json:"feeUsed" mapstructure:"feeUsed" msgpack:"feeUsed"`
	Policies []*ContributorPolicy `json:"policies" mapstructure:"policies" msgpack:"policies"`
}

RepoContributor represents a repository contributor

type RepoContributors

type RepoContributors map[string]*RepoContributor

RepoContributors is a collection of repo contributors

func (*RepoContributors) Has

func (rc *RepoContributors) Has(pushKeyID string) bool

Has checks whether a push key id exists

type RepoOwner

type RepoOwner struct {
	Creator  bool        `json:"creator" mapstructure:"creator" msgpack:"creator,omitempty"`
	JoinedAt util.UInt64 `json:"joinedAt" mapstructure:"joinedAt" msgpack:"joinedAt,omitempty"`
	Veto     bool        `json:"veto" mapstructure:"veto" msgpack:"veto,omitempty"`
}

RepoOwner describes an owner of a repository

type RepoOwners

type RepoOwners map[string]*RepoOwner

RepoOwners represents an index of owners of a repository.

func (RepoOwners) ForEach

func (r RepoOwners) ForEach(iter func(o *RepoOwner, addr string))

ForEach iterates through the collection passing each item to the iter callback

func (RepoOwners) Get

func (r RepoOwners) Get(address string) *RepoOwner

Get return a repo owner associated with the given address

func (RepoOwners) Has

func (r RepoOwners) Has(address string) bool

Has returns true of address exist

type RepoPolicies

type RepoPolicies []*Policy

RepoPolicies represents an index of repo Policies policies key is policy id

type RepoProposal

type RepoProposal struct {
	util.CodecUtil     `json:"-" msgpack:"-"`
	ID                 string                `json:"-" mapstructure:"-" msgpack:"-"`
	Action             types.TxCode          `json:"action" mapstructure:"action" msgpack:"action"`                                     // The action type.
	ActionData         map[string]util.Bytes `json:"actionData" mapstructure:"actionData" msgpack:"actionData"`                         // The data to use to perform the action.
	Creator            string                `json:"creator" mapstructure:"creator" msgpack:"creator"`                                  // The creator is the address of the proposal creator.
	Height             util.UInt64           `json:"height" mapstructure:"height" msgpack:"height"`                                     // The height of the block the proposal was added
	Config             *RepoConfigGovernance `json:"config" mapstructure:"config" msgpack:"-"`                                          // The repo config to used to evaluate the proposal
	EndAt              util.UInt64           `json:"endAt" mapstructure:"endAt" msgpack:"endAt"`                                        // Used to close the proposal after the given height.
	FeeDepositEndAt    util.UInt64           `json:"feeDepEndAt" mapstructure:"feeDepEndAt" msgpack:"feeDepEndAt"`                      // Used to close the proposal after the given height.
	PowerAge           util.UInt64           `json:"powerAge" mapstructure:"powerAge" msgpack:"powerAge"`                               // Used to set the age of a voter's power source.
	Yes                float64               `json:"yes" mapstructure:"yes" msgpack:"yes"`                                              // Count of "Yes" votes
	No                 float64               `json:"no" mapstructure:"no" msgpack:"no"`                                                 // Count of "No" votes
	NoWithVeto         float64               `json:"noWithVeto" mapstructure:"noWithVeto" msgpack:"noWithVeto"`                         // Count of "No" votes from owners/stakeholders veto power
	NoWithVetoByOwners float64               `json:"noWithVetoByOwners" mapstructure:"noWithVetoByOwners" msgpack:"noWithVetoByOwners"` // Count of "No" votes specifically from owners veto power
	Abstain            float64               `json:"abstain" mapstructure:"abstain" msgpack:"abstain"`                                  // Count of explicit "abstain" votes
	Fees               ProposalFees          `json:"fees" mapstructure:"fees" msgpack:"fees"`                                           // Count of explicit "abstain" votes
	Outcome            ProposalOutcome       `json:"outcome" mapstructure:"outcome" msgpack:"outcome"`                                  // The outcome of the proposal vote.
}

RepoProposal represents a repository proposal

func BareRepoProposal

func BareRepoProposal() *RepoProposal

BareRepoProposal returns RepoProposal object with empty values

func (*RepoProposal) DecodeMsgpack

func (p *RepoProposal) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder

func (*RepoProposal) EncodeMsgpack

func (p *RepoProposal) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder

func (*RepoProposal) GetAccepted

func (p *RepoProposal) GetAccepted() float64

GetAccepted implements Proposal

func (*RepoProposal) GetAction

func (p *RepoProposal) GetAction() types.TxCode

GetAction implements Proposal

func (*RepoProposal) GetActionData

func (p *RepoProposal) GetActionData() map[string]util.Bytes

GetActionData implements Proposal

func (*RepoProposal) GetCreator

func (p *RepoProposal) GetCreator() string

GetCreator implements Proposal

func (*RepoProposal) GetEndAt

func (p *RepoProposal) GetEndAt() uint64

GetEndAt implements Proposal

func (*RepoProposal) GetFees

func (p *RepoProposal) GetFees() ProposalFees

GetFees implements Proposal

func (*RepoProposal) GetPowerAge

func (p *RepoProposal) GetPowerAge() uint64

GetPowerAge implements Proposal

func (*RepoProposal) GetQuorum

func (p *RepoProposal) GetQuorum() float64

GetQuorum implements Proposal

func (*RepoProposal) GetRefundType

func (p *RepoProposal) GetRefundType() PropFeeRefundType

GetRefundType implements Proposal

func (*RepoProposal) GetRejected

func (p *RepoProposal) GetRejected() float64

GetRejected implements Proposal

func (*RepoProposal) GetRejectedWithVeto

func (p *RepoProposal) GetRejectedWithVeto() float64

GetRejectedWithVeto implements Proposal

func (*RepoProposal) GetRejectedWithVetoByOwners

func (p *RepoProposal) GetRejectedWithVetoByOwners() float64

GetRejectedWithVetoByOwners implements Proposal

func (*RepoProposal) GetTallyMethod

func (p *RepoProposal) GetTallyMethod() ProposalTallyMethod

GetTallyMethod implements Proposal

func (*RepoProposal) GetThreshold

func (p *RepoProposal) GetThreshold() float64

GetThreshold implements Proposal

func (*RepoProposal) GetVetoOwnersQuorum

func (p *RepoProposal) GetVetoOwnersQuorum() float64

GetVetoOwnersQuorum implements Proposal

func (*RepoProposal) GetVetoQuorum

func (p *RepoProposal) GetVetoQuorum() float64

GetVetoQuorum implements Proposal

func (*RepoProposal) GetVoterType

func (p *RepoProposal) GetVoterType() VoterType

GetVoterType implements Proposal

func (*RepoProposal) IncrAccept

func (p *RepoProposal) IncrAccept()

IncrAccept increments 'Yes' by 1

func (*RepoProposal) IsAccepted

func (p *RepoProposal) IsAccepted() bool

IsAccepted implements Proposal

func (*RepoProposal) IsDepositPeriod

func (p *RepoProposal) IsDepositPeriod(chainHeight uint64) bool

IsDepositPeriod checks whether the proposal is in the deposit period

func (*RepoProposal) IsDepositedFeeOK

func (p *RepoProposal) IsDepositedFeeOK() bool

IsDepositedFeeOK checks whether the fees deposited to the proposal meets the minimum required deposit

func (*RepoProposal) IsFeeDepositEnabled

func (p *RepoProposal) IsFeeDepositEnabled() bool

IsFeeDepositEnabled checks whether fee deposit is enabled on the proposal

func (*RepoProposal) IsFinalized

func (p *RepoProposal) IsFinalized() bool

IsFinalized implements Proposal

func (*RepoProposal) SetOutcome

func (p *RepoProposal) SetOutcome(v ProposalOutcome)

SetOutcome implements Proposal

type RepoProposals

type RepoProposals map[string]*RepoProposal

RepoProposals represents an index of proposals for a repo.

func (*RepoProposals) Add

func (p *RepoProposals) Add(id string, rp *RepoProposal)

Add adds a proposal map to the give id

func (*RepoProposals) ForEach

func (p *RepoProposals) ForEach(itr func(prop *RepoProposal, id string) error) error

ForEach iterates through items, passing each to the callback function

func (*RepoProposals) Get

func (p *RepoProposals) Get(id string) *RepoProposal

Get returns the proposal corresponding to the given id

func (*RepoProposals) Has

func (p *RepoProposals) Has(id string) bool

Has checks whether a repo with the given id exists

type Repository

type Repository struct {
	util.CodecUtil `json:"-" msgpack:"-" mapstructure:"-"`

	// Balance is the native coin balance
	Balance util.String `json:"balance" msgpack:"balance" mapstructure:"balance"`

	// Description describes the repository
	Description string `json:"desc" msgpack:"desc" mapstructure:"desc"`

	// References contains the repository reference information
	References References `json:"references" msgpack:"references" mapstructure:"references"`

	// Owners contains the address of the repository owners
	Owners RepoOwners `json:"owners" msgpack:"owners" mapstructure:"owners"`

	// Proposals contains the repository governance proposals
	Proposals RepoProposals `json:"proposals" msgpack:"proposals" mapstructure:"proposals"`

	// Contributors contains push keys that can push
	Contributors RepoContributors `json:"contributors" msgpack:"contributors" mapstructure:"contributors"`

	// Config is the repository configuration
	Config *RepoConfig `json:"config" msgpack:"config" mapstructure:"config"`

	// CreatedAt is the block height the reference was created
	CreatedAt util.UInt64 `json:"createdAt" mapstructure:"createdAt" msgpack:"createdAt,omitempty"`

	// UpdatedAt is the block height the reference was last updated
	UpdatedAt util.UInt64 `json:"updatedAt" mapstructure:"updatedAt" msgpack:"updatedAt,omitempty"`
}

Repository represents a git repository.

func BareRepository

func BareRepository() *Repository

BareRepository returns an empty repository object

func NewRepositoryFromBytes

func NewRepositoryFromBytes(bz []byte) (*Repository, error)

NewRepositoryFromBytes decodes bz to Repository

func (*Repository) AddOwner

func (r *Repository) AddOwner(ownerAddress string, owner *RepoOwner)

AddOwner adds an owner

func (*Repository) Bytes

func (r *Repository) Bytes() []byte

Bytes return the bytes equivalent of the account

func (*Repository) Clean

func (r *Repository) Clean(_ uint64)

Clean implements types.BalanceAccount

func (*Repository) DecodeMsgpack

func (r *Repository) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder

func (*Repository) EncodeMsgpack

func (r *Repository) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder

func (*Repository) GetBalance

func (r *Repository) GetBalance() util.String

GetBalance implements types.BalanceAccount

func (*Repository) IsEmpty added in v0.0.30

func (r *Repository) IsEmpty() bool

IsEmpty returns true if the repo is considered empty

func (*Repository) SetBalance

func (r *Repository) SetBalance(bal string)

SetBalance implements types.BalanceAccount

type StakeInfo

type StakeInfo struct {
	// Value is the amount staked
	Value util.String `json:"value" mapstructure:"value"`

	// UnbondHeight is the height at which the stake is unbonded.
	// A value of 0 means the stake is bonded forever
	UnbondHeight util.UInt64 `json:"unbondHeight" mapstructure:"unbondHeight"`
}

StakeInfo represents properties about a stake.

func BareStakeInfo

func BareStakeInfo() *StakeInfo

BareStakeInfo returns an empty StakeInfo

type VoterType

type VoterType int

VoterType represents a type of repository voter type

const (
	VoterOwner                  VoterType = iota // Only owners can vote
	VoterNetStakers                              // Only network stakeholders can vote.
	VoterNetStakersAndVetoOwner                  // Only network stakeholders and veto owners can vote.
)

func (VoterType) Ptr added in v0.0.30

func (p VoterType) Ptr() *int

Jump to

Keyboard shortcuts

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