Governance

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionVote

type ActionVote struct {
	ActionId  GovActionId
	Procedure VotingProcedure
}

ActionVote pairs an action with its voting procedure.

type AddedCommitteeMember

type AddedCommitteeMember struct {
	Credential Certificate.Credential
	Epoch      uint64
}

AddedCommitteeMember pairs a credential with an epoch.

type GovAction

type GovAction interface {
	GovActionType() int
	MarshalCBOR() ([]byte, error)
}

GovAction is the interface all governance action types satisfy.

func UnmarshalGovAction

func UnmarshalGovAction(data []byte) (GovAction, error)

UnmarshalGovAction decodes CBOR and dispatches to the correct concrete type based on the type tag (element 0).

type GovActionId

type GovActionId struct {
	TransactionHash []byte
	GovActionIndex  uint32
	// contains filtered or unexported fields
}

GovActionId references a specific governance action.

type HardForkInitiation

type HardForkInitiation struct {
	PrevActionId    *GovActionId
	ProtocolVersion ProtocolVersion
}

HardForkInitiation proposes a hard fork to a new protocol version.

func (HardForkInitiation) GovActionType

func (a HardForkInitiation) GovActionType() int

func (HardForkInitiation) MarshalCBOR

func (a HardForkInitiation) MarshalCBOR() ([]byte, error)

type InfoAction

type InfoAction struct{}

InfoAction is the simplest governance action with no fields.

func (InfoAction) GovActionType

func (a InfoAction) GovActionType() int

func (InfoAction) MarshalCBOR

func (a InfoAction) MarshalCBOR() ([]byte, error)

type NewConstitution

type NewConstitution struct {
	PrevActionId *GovActionId
	Anchor       Certificate.Anchor
	ScriptHash   []byte // nil means null
}

NewConstitution proposes a new constitution.

func (NewConstitution) GovActionType

func (a NewConstitution) GovActionType() int

func (NewConstitution) MarshalCBOR

func (a NewConstitution) MarshalCBOR() ([]byte, error)

type NoConfidence

type NoConfidence struct {
	PrevActionId *GovActionId
}

NoConfidence expresses lack of confidence in the current constitutional committee.

func (NoConfidence) GovActionType

func (a NoConfidence) GovActionType() int

func (NoConfidence) MarshalCBOR

func (a NoConfidence) MarshalCBOR() ([]byte, error)

type ParameterChange

type ParameterChange struct {
	PrevActionId *GovActionId
	ParamUpdate  map[int]any
}

ParameterChange proposes changes to protocol parameters.

func (ParameterChange) GovActionType

func (a ParameterChange) GovActionType() int

func (ParameterChange) MarshalCBOR

func (a ParameterChange) MarshalCBOR() ([]byte, error)

type ProposalProcedure

type ProposalProcedure struct {
	Deposit       int64
	RewardAccount []byte
	Action        GovAction
	Anchor        Certificate.Anchor
}

ProposalProcedure encodes a single governance proposal.

func UnmarshalProposalProcedure

func UnmarshalProposalProcedure(
	data []byte,
) (ProposalProcedure, error)

UnmarshalProposalProcedure decodes a single proposal.

func (ProposalProcedure) MarshalCBOR

func (pp ProposalProcedure) MarshalCBOR() ([]byte, error)

MarshalCBOR encodes as [deposit, reward_account, gov_action, anchor].

type ProposalProcedures

type ProposalProcedures []ProposalProcedure

ProposalProcedures is a collection of proposals.

func (ProposalProcedures) MarshalCBOR

func (ps ProposalProcedures) MarshalCBOR() (
	[]byte, error,
)

MarshalCBOR encodes as a CBOR array.

func (*ProposalProcedures) UnmarshalCBOR

func (ps *ProposalProcedures) UnmarshalCBOR(
	data []byte,
) error

UnmarshalCBOR decodes a CBOR array of proposal procedures.

type ProtocolVersion

type ProtocolVersion struct {
	Major uint64
	Minor uint64
	// contains filtered or unexported fields
}

ProtocolVersion pairs a major and minor version.

type TreasuryWithdrawals

type TreasuryWithdrawals struct {
	Withdrawals  []Withdrawal
	PrevActionId *GovActionId
}

TreasuryWithdrawals proposes withdrawals from the treasury.

func (TreasuryWithdrawals) GovActionType

func (a TreasuryWithdrawals) GovActionType() int

func (TreasuryWithdrawals) MarshalCBOR

func (a TreasuryWithdrawals) MarshalCBOR() (
	[]byte, error,
)

type UpdateCommittee

type UpdateCommittee struct {
	PrevActionId *GovActionId
	Removed      []Certificate.Credential
	Added        []AddedCommitteeMember
	Quorum       Certificate.UnitInterval
}

UpdateCommittee proposes changes to the constitutional committee.

func (UpdateCommittee) GovActionType

func (a UpdateCommittee) GovActionType() int

func (UpdateCommittee) MarshalCBOR

func (a UpdateCommittee) MarshalCBOR() ([]byte, error)

type Vote

type Vote int

Vote represents a governance vote value.

const (
	VoteNo      Vote = 0
	VoteYes     Vote = 1
	VoteAbstain Vote = 2
)

type Voter

type Voter struct {
	Role VoterRole
	Hash serialization.ConstrainedBytes
	// contains filtered or unexported fields
}

Voter identifies who is casting a vote.

type VoterRole

type VoterRole int

VoterRole identifies the role of a voter.

const (
	ConstitutionalCommitteeKeyHash VoterRole = 0
	ConstitutionalCommitteeScript  VoterRole = 1
	DRepKeyHash                    VoterRole = 2
	DRepScript                     VoterRole = 3
	StakePoolOperator              VoterRole = 4
)

type VoterVotes

type VoterVotes struct {
	Voter Voter
	Votes []ActionVote
}

VoterVotes groups all votes cast by a single voter.

type VotingProcedure

type VotingProcedure struct {
	Vote   Vote
	Anchor *Certificate.Anchor
	// contains filtered or unexported fields
}

VotingProcedure captures a single vote plus optional anchor.

type VotingProcedures

type VotingProcedures []VoterVotes

VotingProcedures is the top-level collection.

func (*VotingProcedures) Add

func (vp *VotingProcedures) Add(
	voter Voter,
	actionId GovActionId,
	procedure VotingProcedure,
)

Add appends a vote for the given voter and action. If the same voter already has a vote for the same action, the existing procedure is replaced.

func (VotingProcedures) MarshalCBOR

func (vp VotingProcedures) MarshalCBOR() ([]byte, error)

MarshalCBOR encodes as { voter => { action_id => proc } }.

func (*VotingProcedures) UnmarshalCBOR

func (vp *VotingProcedures) UnmarshalCBOR(
	data []byte,
) error

UnmarshalCBOR decodes { voter => { action_id => procedure } }.

type Withdrawal

type Withdrawal struct {
	RewardAccount []byte
	Coin          int64
}

Withdrawal pairs a reward account with an amount.

Jump to

Keyboard shortcuts

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