cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Governance.Action

Description

Seven governance action alternatives assembled from validated components. For example, NoConfidence Nothing starts a new committee confidence chain. These values describe proposals; they do not establish ledger eligibility.

Synopsis

Documentation

data Action Source #

A governance action. Optional predecessors reference the preceding action of the corresponding purpose; Nothing starts a chain. Optional script hashes identify guardrails policies. Amounts and expiry epochs use unsigned 64-bit units.

Constructors

ParameterChange !(Maybe ActionId) !Update !(Maybe ScriptHash)

Previous parameter action, sparse changes, optional guardrails policy.

HardForkInitiation !(Maybe ActionId) !ProtocolVersion

Previous hard-fork action and proposed protocol version.

TreasuryWithdrawals !Withdrawals !(Maybe ScriptHash)

Reward accounts receiving treasury lovelace and optional policy.

NoConfidence !(Maybe ActionId)

Previous committee-confidence action.

UpdateCommittee !(Maybe ActionId) !Removals !Members !UnitInterval

Previous committee action, removals, additions with expiry, and quorum.

NewConstitution !(Maybe ActionId) !Constitution

Previous constitution action and replacement constitution.

InfoAction

Informational action without additional fields.

Instances

Instances details
Show Action Source # 
Instance details

Defined in Cometa.Governance.Action

Eq Action Source # 
Instance details

Defined in Cometa.Governance.Action

Methods

(==) :: Action -> Action -> Bool #

(/=) :: Action -> Action -> Bool #

data Removals Source #

Cold credentials to remove, sorted by kind and hash. Repeated credentials are retained. Ledger acceptance is a separate check.

Instances

Instances details
Show Removals Source # 
Instance details

Defined in Cometa.Governance.Action

Eq Removals Source # 
Instance details

Defined in Cometa.Governance.Action

Ord Removals Source # 
Instance details

Defined in Cometa.Governance.Action

removalsFromList :: [Credential CommitteeCold] -> Removals Source #

Sort by credential kind then hash bytes, retaining duplicate credentials.

removalsToList :: Removals -> [Credential CommitteeCold] Source #

Sorted removal credentials, including duplicates.

data EncodedRemovals Source #

A standalone removal collection retaining its exact CBOR representation. Equality and ordering compare bytes; inspect credentials with toRemovals.

encodeRemovals :: Removals -> ByteString Source #

Fresh tagged definite array of sorted credentials, retaining duplicates.

encodeRemovalsWith :: SetEncoding -> Removals -> ByteString Source #

Fresh definite array with the requested outer set tag.

decodeRemovals :: ByteString -> Either Error EncodedRemovals Source #

Decode a standalone credential collection, retaining all imported bytes. Optional tag 258, definite and indefinite arrays, and duplicate credentials are accepted; invalid fields or trailing bytes return InvalidProposalCbor.

fromRemovals :: Removals -> EncodedRemovals Source #

Assign fresh tagged encoding to a removal collection.

toRemovals :: EncodedRemovals -> Removals Source #

Inspect sorted removal credentials without changing retained bytes.

removalsCbor :: EncodedRemovals -> ByteString Source #

Exact imported bytes or fresh bytes assigned by fromRemovals.

removalsSetEncoding :: EncodedRemovals -> SetEncoding Source #

Observe the exact standalone removal collection's outer set tag.

withRemovalsSetEncoding :: SetEncoding -> EncodedRemovals -> EncodedRemovals Source #

Change only the outer tag, retaining every array and credential byte. Requesting the current representation preserves the entire encoding exactly.

data Withdrawals Source #

Unique reward accounts and lovelace amounts, including zero amounts.

withdrawalsFromList :: [(RewardAddress, Word64)] -> Either Error Withdrawals Source #

Reject repeated reward accounts with DuplicateTreasuryWithdrawal, even when amounts agree. Values are lovelace; no minimum or positivity is imposed.

withdrawalsToList :: Withdrawals -> [(RewardAddress, Word64)] Source #

Entries ordered by exact reward-address bytes, matching fresh serialization.

data EncodedAction Source #

Exact original CBOR plus its semantic action. Equality and ordering compare bytes. Use toAction when comparing action meanings.

encodeCbor :: Action -> ByteString Source #

Fresh definite CBOR with shortest integers and sorted maps/removal credentials. Reconstructing semantic data can change transaction identity; toCbor preserves imported bytes instead.

decodeCbor :: ByteString -> Either Error EncodedAction Source #

Decode exactly one action and retain its original bytes. Definite and indefinite containers and nonminimal integers are accepted; unknown variants, wrong arity, invalid components, duplicate map keys and trailing data return InvalidProposalCbor.

fromAction :: Action -> EncodedAction Source #

Assign fresh encoding to semantic data.

toAction :: EncodedAction -> Action Source #

Inspect semantic data without changing retained bytes.

toCbor :: EncodedAction -> ByteString Source #

Exact imported encoding, or the encoding assigned by fromAction.