Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Cardano.Ledger.Api.Governance
to the Api
- Loading branch information
Showing
6 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Version history for `cardano-ledger-api` | ||
|
||
## 1.0.1.0 | ||
|
||
* Add `Cardano.Ledger.Api.Governance` that exposes all of the governance related types. | ||
|
||
## 1.0.0.0 | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
libs/cardano-ledger-api/src/Cardano/Ledger/Api/Governance.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | ||
{-# LANGUAGE MultiParamTypeClasses #-} | ||
|
||
module Cardano.Ledger.Api.Governance ( | ||
EraGovernance (GovernanceState), | ||
emptyGovernanceState, | ||
getProposedPPUpdates, | ||
|
||
-- * Shelley | ||
ShelleyPPUPState (..), | ||
ProposedPPUpdates (..), | ||
emptyPPPUpdates, | ||
|
||
-- * Conway | ||
|
||
-- ** Conway Governance | ||
ConwayGovernance (..), | ||
cgRatifyL, | ||
cgTallyL, | ||
cgVoterRolesL, | ||
ConwayTallyState (..), | ||
RatifyState (..), | ||
EnactState (..), | ||
VoterRole (..), | ||
|
||
-- ** Governance Action | ||
GovernanceAction (..), | ||
GovernanceActionId (..), | ||
GovernanceActionIx (..), | ||
GovernanceActionState (..), | ||
|
||
-- ** Vote | ||
Vote (..), | ||
VoteDecision (..), | ||
|
||
-- *** Anchor | ||
Anchor (..), | ||
AnchorData (..), | ||
AnchorDataHash, | ||
hashAnchorData, | ||
) where | ||
|
||
import Cardano.Ledger.Api.Era () | ||
import Cardano.Ledger.Conway.Governance ( | ||
Anchor (..), | ||
AnchorDataHash, | ||
ConwayGovernance (..), | ||
ConwayTallyState (..), | ||
EnactState (..), | ||
GovernanceAction (..), | ||
GovernanceActionId (..), | ||
GovernanceActionIx (..), | ||
GovernanceActionState (..), | ||
RatifyState (..), | ||
Vote (..), | ||
VoteDecision (..), | ||
VoterRole (..), | ||
-- Lenses | ||
|
||
cgRatifyL, | ||
cgTallyL, | ||
cgVoterRolesL, | ||
) | ||
import Cardano.Ledger.Crypto (Crypto) | ||
import Cardano.Ledger.SafeHash (HashAnnotated, SafeHash, SafeToHash, hashAnnotated) | ||
import Cardano.Ledger.Shelley.Governance ( | ||
EraGovernance (GovernanceState), | ||
ShelleyPPUPState (..), | ||
emptyGovernanceState, | ||
getProposedPPUpdates, | ||
) | ||
import Cardano.Ledger.Shelley.PParams (ProposedPPUpdates (..), emptyPPPUpdates) | ||
import Data.ByteString (ByteString) | ||
|
||
newtype AnchorData c = AnchorData ByteString | ||
deriving (Eq, SafeToHash) | ||
|
||
instance HashAnnotated (AnchorData c) AnchorDataHash c | ||
|
||
-- | Hash `AnchorData` | ||
hashAnchorData :: Crypto c => AnchorData c -> SafeHash c AnchorDataHash | ||
hashAnchorData = hashAnnotated |