| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cometa.Governance.DRep
Description
Delegation targets distinguish a DRep credential from the predefined always-abstain and always-no-confidence targets. Special targets cannot be used as voting authorities.
import qualified Cometa.Governance.DRep as DRep abstainingTarget :: DRep.DRep abstainingTarget = DRep.AlwaysAbstain
Synopsis
- data DRep
- encodeCbor :: DRep -> ByteString
- decodeCbor :: ByteString -> Either Error DRep
- toText :: DRep -> Either Error Text
- fromText :: Text -> Either Error DRep
Documentation
A delegation target. The two special targets are not voting authorities; only a credential can identify a DRep voter.
Constructors
| DRepCredential !(Credential DRep) | A key or script DRep credential. |
| AlwaysAbstain | Delegate to the predefined always-abstain target. |
| AlwaysNoConfidence | Delegate to the predefined always-no-confidence target. |
encodeCbor :: DRep -> ByteString Source #
Encode fresh definite CBOR: [0, key hash], [1, script hash], [2]
(always abstain), or [3] (always no confidence).
decodeCbor :: ByteString -> Either Error DRep Source #
Decode one complete DRep. Definite or indefinite arrays and nonminimal
unsigned codes are accepted. Codes, arity and 28-byte credential lengths are
checked; invalid input or trailing bytes returns
InvalidGovernanceCbor. Original encoding is not retained.
toText :: DRep -> Either Error Text Source #
Encode a credential DRep as CIP-129 drep Bech32 text, using header
0x22 for a key or 0x23 for a script and its 28-byte hash. The special
abstain and no-confidence delegation targets have no credential identifier;
they return UnsupportedOperation.
fromText :: Text -> Either Error DRep Source #
Import either CIP-105 (28-byte drep key or drep_script script) or
CIP-129 (29-byte drep header and hash) text. Uniform upper or lower case is
accepted. Mixed case, invalid checksum/padding, other prefixes or headers and
wrong lengths return InvalidDRepText. Re-encoding always produces CIP-129.