{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Test.Cardano.Ledger.Api.State.Query.Examples (
  queryAccountsDepositsExamples,
  queryChainAccountStateExamples,
  queryCommitteeMembersStateExamples,
  queryConstitutionExamples,
  queryConstitutionHashExamples,
  queryCurrentEpochNoExamples,
  queryCurrentPParamsExamples,
  queryDRepDelegateesExamples,
  queryDRepDelegationsExamples,
  queryDRepStakeDistrExamples,
  queryDRepStateExamples,
  queryFuturePParamsExamples,
  queryGovStateExamples,
  queryPoolParametersExamples,
  queryPoolStateExamples,
  queryProposalsExamples,
  queryRatifyStateExamples,
  queryRegisteredDRepStakeDistrExamples,
  querySPOStakeDistrExamples,
  querySetSnapshotStakePoolDistrExamples,
  queryStakePoolDefaultVoteExamples,
  queryStakePoolDelegsAndRewardsExamples,
  queryStakePoolRelaysExamples,
  queryStakeSnapshotsExamples,
) where

import Cardano.Base.IP (toIPv4, toIPv6)
import Cardano.Ledger.Api.Governance (
  Committee (..),
  Constitution (..),
  ConwayGovState (..),
  DRepPulsingState (..),
  EnactState (..),
  GovActionId (..),
  GovActionIx (..),
  GovActionState (..),
  RatifyState (..),
  Vote (..),
 )
import Cardano.Ledger.Api.PParams (PParams)
import Cardano.Ledger.Api.State.Query (
  CommitteeMemberState (..),
  CommitteeMembersState (..),
  DefaultVote (..),
  HotCredAuthStatus (..),
  MemberStatus (..),
  NextEpochChange (..),
  QueryPoolStateResult (..),
  QueryResultPoolDistr,
  StakeSnapshot (..),
  StakeSnapshots (..),
  toQueryResultPoolDistr,
 )
import Cardano.Ledger.BaseTypes (
  AnchorData,
  EpochNo (..),
  Port (..),
  StrictMaybe (..),
  UnitInterval,
  textToDns,
 )
import Cardano.Ledger.Binary (natVersion)
import Cardano.Ledger.Coin (Coin (..), CompactForm (..), knownNonZeroCoin)
import Cardano.Ledger.Conway.PParams (ConwayEraPParams)
import Cardano.Ledger.Core (Era, eraProtVerHigh)
import Cardano.Ledger.Credential (Credential (..))
import Cardano.Ledger.DRep (DRep (..), DRepState (..))
import Cardano.Ledger.Hashes (SafeHash)
import Cardano.Ledger.Keys (KeyHash, KeyRole (..))
import Cardano.Ledger.State (
  BlsKey,
  ChainAccountState (..),
  FuturePParams (..),
  IndividualPoolStake (..),
  PoolDistr (..),
  StakePoolParams (..),
  StakePoolRelay (..),
 )
import Cardano.Ledger.TxIn (TxId (..))
import Data.Default (def)
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Maybe (fromJust)
import Data.Ratio ((%))
import Data.Sequence (Seq)
import qualified Data.Sequence as Seq
import Data.Sequence.Strict (StrictSeq)
import qualified Data.Sequence.Strict as StrictSeq
import Data.Set (Set)
import qualified Data.Set as Set
import Test.Cardano.Ledger.Conway.Examples (
  exampleAnchor,
  exampleProposalProcedure,
  exampleProposalProcedureHardForkInitiation,
  exampleProposalProcedureNewConstitution,
  exampleProposalProcedureNoConfidence,
  exampleProposalProcedureParameterChange,
  exampleProposalProcedureTreasuryWithdrawals,
  exampleProposalProcedureUpdateCommittee,
 )
import Test.Cardano.Ledger.Core.Rational (unsafeBoundRational)
import Test.Cardano.Ledger.Core.Utils (mkDummySafeHash)
import Test.Cardano.Ledger.Dijkstra.Examples (exampleBlsKey)
import Test.Cardano.Ledger.Era (EraTest (..))
import Test.Cardano.Ledger.Shelley.Examples (
  examplePoolDistr,
  exampleStakePoolParams,
  exampleVrfVerKeyHash,
  mkKeyHash,
  mkScriptHash,
 )

queryConstitutionExamples :: [Constitution era]
queryConstitutionExamples :: forall era. [Constitution era]
queryConstitutionExamples =
  [ Constitution
      { constitutionAnchor :: Anchor
constitutionAnchor = Anchor
exampleAnchor
      , constitutionGuardrailsScriptHash :: StrictMaybe ScriptHash
constitutionGuardrailsScriptHash = ScriptHash -> StrictMaybe ScriptHash
forall a. a -> StrictMaybe a
SJust (Int -> ScriptHash
mkScriptHash Int
1)
      }
  , Constitution
      { constitutionAnchor :: Anchor
constitutionAnchor = Anchor
exampleAnchor
      , constitutionGuardrailsScriptHash :: StrictMaybe ScriptHash
constitutionGuardrailsScriptHash = StrictMaybe ScriptHash
forall a. StrictMaybe a
SNothing
      }
  ]

queryCurrentEpochNoExamples :: [EpochNo]
queryCurrentEpochNoExamples :: [EpochNo]
queryCurrentEpochNoExamples =
  [ Word64 -> EpochNo
EpochNo Word64
0
  , Word64 -> EpochNo
EpochNo Word64
500
  , Word64 -> EpochNo
EpochNo Word64
forall a. Bounded a => a
maxBound
  ]

queryCurrentPParamsExamples :: EraTest era => [PParams era]
queryCurrentPParamsExamples :: forall era. EraTest era => [PParams era]
queryCurrentPParamsExamples = [PParams era
forall a. Default a => a
def, PParams era
forall era. EraTest era => PParams era
examplePParams]

queryConstitutionHashExamples :: [SafeHash AnchorData]
queryConstitutionHashExamples :: [SafeHash AnchorData]
queryConstitutionHashExamples =
  [ Int -> SafeHash AnchorData
forall a. Int -> SafeHash a
mkDummySafeHash Int
0
  , Int -> SafeHash AnchorData
forall a. Int -> SafeHash a
mkDummySafeHash Int
1
  , Int -> SafeHash AnchorData
forall a. Int -> SafeHash a
mkDummySafeHash Int
42
  ]

queryAccountsDepositsExamples :: [Map (Credential Staking) Coin]
queryAccountsDepositsExamples :: [Map (Credential Staking) Coin]
queryAccountsDepositsExamples =
  [ Map (Credential Staking) Coin
forall k a. Map k a
Map.empty
  , [(Credential Staking, Coin)] -> Map (Credential Staking) Coin
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
      [ (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1), Integer -> Coin
Coin Integer
2_000_000)
      , (ScriptHash -> Credential Staking
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
2), Integer -> Coin
Coin Integer
0)
      ]
  ]

queryChainAccountStateExamples :: [ChainAccountState]
queryChainAccountStateExamples :: [ChainAccountState]
queryChainAccountStateExamples =
  [ ChainAccountState
      { casTreasury :: Coin
casTreasury = Integer -> Coin
Coin Integer
0
      , casReserves :: Coin
casReserves = Integer -> Coin
Coin Integer
0
      }
  , ChainAccountState
      { casTreasury :: Coin
casTreasury = Integer -> Coin
Coin Integer
1_500_000_000_000_000
      , casReserves :: Coin
casReserves = Integer -> Coin
Coin Integer
8_000_000_000_000_000
      }
  ]

queryCommitteeMembersStateExamples :: [CommitteeMembersState]
queryCommitteeMembersStateExamples :: [CommitteeMembersState]
queryCommitteeMembersStateExamples =
  [ CommitteeMembersState
      { csCommittee :: Map (Credential ColdCommitteeRole) CommitteeMemberState
csCommittee = Map (Credential ColdCommitteeRole) CommitteeMemberState
forall k a. Map k a
Map.empty
      , csThreshold :: Maybe UnitInterval
csThreshold = Maybe UnitInterval
forall a. Maybe a
Nothing
      , csEpochNo :: EpochNo
csEpochNo = Word64 -> EpochNo
EpochNo Word64
0
      }
  , CommitteeMembersState
      { csCommittee :: Map (Credential ColdCommitteeRole) CommitteeMemberState
csCommittee =
          [(Credential ColdCommitteeRole, CommitteeMemberState)]
-> Map (Credential ColdCommitteeRole) CommitteeMemberState
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
            [
              ( KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1)
              , CommitteeMemberState
                  { cmsHotCredAuthStatus :: HotCredAuthStatus
cmsHotCredAuthStatus = Credential HotCommitteeRole -> HotCredAuthStatus
MemberAuthorized (KeyHash HotCommitteeRole -> Credential HotCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash HotCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
11))
                  , cmsStatus :: MemberStatus
cmsStatus = MemberStatus
Active
                  , cmsExpiration :: Maybe EpochNo
cmsExpiration = EpochNo -> Maybe EpochNo
forall a. a -> Maybe a
Just (Word64 -> EpochNo
EpochNo Word64
200)
                  , cmsNextEpochChange :: NextEpochChange
cmsNextEpochChange = NextEpochChange
NoChangeExpected
                  }
              )
            ,
              ( KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2)
              , CommitteeMemberState
                  { cmsHotCredAuthStatus :: HotCredAuthStatus
cmsHotCredAuthStatus = HotCredAuthStatus
MemberNotAuthorized
                  , cmsStatus :: MemberStatus
cmsStatus = MemberStatus
Expired
                  , cmsExpiration :: Maybe EpochNo
cmsExpiration = EpochNo -> Maybe EpochNo
forall a. a -> Maybe a
Just (Word64 -> EpochNo
EpochNo Word64
100)
                  , cmsNextEpochChange :: NextEpochChange
cmsNextEpochChange = NextEpochChange
ToBeRemoved
                  }
              )
            ,
              ( ScriptHash -> Credential ColdCommitteeRole
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
3)
              , CommitteeMemberState
                  { cmsHotCredAuthStatus :: HotCredAuthStatus
cmsHotCredAuthStatus = Maybe Anchor -> HotCredAuthStatus
MemberResigned (Anchor -> Maybe Anchor
forall a. a -> Maybe a
Just Anchor
exampleAnchor)
                  , cmsStatus :: MemberStatus
cmsStatus = MemberStatus
Unrecognized
                  , cmsExpiration :: Maybe EpochNo
cmsExpiration = Maybe EpochNo
forall a. Maybe a
Nothing
                  , cmsNextEpochChange :: NextEpochChange
cmsNextEpochChange = NextEpochChange
ToBeEnacted
                  }
              )
            ,
              ( KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
4)
              , CommitteeMemberState
                  { cmsHotCredAuthStatus :: HotCredAuthStatus
cmsHotCredAuthStatus = Maybe Anchor -> HotCredAuthStatus
MemberResigned Maybe Anchor
forall a. Maybe a
Nothing
                  , cmsStatus :: MemberStatus
cmsStatus = MemberStatus
Active
                  , cmsExpiration :: Maybe EpochNo
cmsExpiration = EpochNo -> Maybe EpochNo
forall a. a -> Maybe a
Just (Word64 -> EpochNo
EpochNo Word64
300)
                  , cmsNextEpochChange :: NextEpochChange
cmsNextEpochChange = EpochNo -> NextEpochChange
TermAdjusted (Word64 -> EpochNo
EpochNo Word64
350)
                  }
              )
            ,
              ( KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
5)
              , CommitteeMemberState
                  { cmsHotCredAuthStatus :: HotCredAuthStatus
cmsHotCredAuthStatus = Credential HotCommitteeRole -> HotCredAuthStatus
MemberAuthorized (ScriptHash -> Credential HotCommitteeRole
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
50))
                  , cmsStatus :: MemberStatus
cmsStatus = MemberStatus
Active
                  , cmsExpiration :: Maybe EpochNo
cmsExpiration = EpochNo -> Maybe EpochNo
forall a. a -> Maybe a
Just (Word64 -> EpochNo
EpochNo Word64
250)
                  , cmsNextEpochChange :: NextEpochChange
cmsNextEpochChange = NextEpochChange
ToBeExpired
                  }
              )
            ]
      , csThreshold :: Maybe UnitInterval
csThreshold = UnitInterval -> Maybe UnitInterval
forall a. a -> Maybe a
Just (Rational -> UnitInterval
forall r.
(HasCallStack, Typeable r, BoundedRational r) =>
Rational -> r
unsafeBoundRational (Integer
2 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
3) :: UnitInterval)
      , csEpochNo :: EpochNo
csEpochNo = Word64 -> EpochNo
EpochNo Word64
150
      }
  ]

querySPOStakeDistrExamples :: [Map (KeyHash StakePool) Coin]
querySPOStakeDistrExamples :: [Map (KeyHash StakePool) Coin]
querySPOStakeDistrExamples =
  [ Map (KeyHash StakePool) Coin
forall k a. Map k a
Map.empty
  , [(KeyHash StakePool, Coin)] -> Map (KeyHash StakePool) Coin
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
      [ (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1, Integer -> Coin
Coin Integer
1_000_000_000)
      , (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2, Integer -> Coin
Coin Integer
0)
      , (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
3, Integer -> Coin
Coin Integer
50)
      ]
  ]

querySetSnapshotStakePoolDistrExamples :: forall era. Era era => [QueryResultPoolDistr]
querySetSnapshotStakePoolDistrExamples :: forall era. Era era => [QueryResultPoolDistr]
querySetSnapshotStakePoolDistrExamples =
  (PoolDistr -> QueryResultPoolDistr)
-> [PoolDistr] -> [QueryResultPoolDistr]
forall a b. (a -> b) -> [a] -> [b]
map
    PoolDistr -> QueryResultPoolDistr
toQueryResultPoolDistr
    [ PoolDistr
forall a. Default a => a
def
    , PoolDistr
examplePoolDistr
    , PoolDistr
        { unPoolDistr :: Map (KeyHash StakePool) IndividualPoolStake
unPoolDistr =
            [(KeyHash StakePool, IndividualPoolStake)]
-> Map (KeyHash StakePool) IndividualPoolStake
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
              [
                ( Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1
                , IndividualPoolStake
                    { individualPoolStake :: Rational
individualPoolStake = Integer
1 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
4
                    , individualTotalPoolStake :: CompactForm Coin
individualTotalPoolStake = Word64 -> CompactForm Coin
CompactCoin Word64
1_000_000_000
                    , individualPoolStakeVrf :: VRFVerKeyHash StakePoolVRF
individualPoolStakeVrf = VRFVerKeyHash StakePoolVRF
exampleVrfVerKeyHash
                    , individualPoolStakeBls :: StrictMaybe BlsKey
individualPoolStakeBls = StrictMaybe BlsKey
forall a. StrictMaybe a
SNothing
                    }
                )
              ,
                ( Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2
                , IndividualPoolStake
                    { individualPoolStake :: Rational
individualPoolStake = Integer
3 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
8
                    , individualTotalPoolStake :: CompactForm Coin
individualTotalPoolStake = Word64 -> CompactForm Coin
CompactCoin Word64
5_000_000_000
                    , individualPoolStakeVrf :: VRFVerKeyHash StakePoolVRF
individualPoolStakeVrf = VRFVerKeyHash StakePoolVRF
exampleVrfVerKeyHash
                    , individualPoolStakeBls :: StrictMaybe BlsKey
individualPoolStakeBls = forall era. Era era => StrictMaybe BlsKey
exampleIndividualPoolStakeBls @era
                    }
                )
              ]
        , pdTotalActiveStake :: NonZero Coin
pdTotalActiveStake = forall (n :: Natural). (KnownNat n, 1 <= n) => NonZero Coin
knownNonZeroCoin @6_000_000_000
        }
    ]

-- | 'SNothing' before Dijkstra, where the key is neither encoded nor decoded.
exampleIndividualPoolStakeBls :: forall era. Era era => StrictMaybe BlsKey
exampleIndividualPoolStakeBls :: forall era. Era era => StrictMaybe BlsKey
exampleIndividualPoolStakeBls
  | forall era. Era era => Version
eraProtVerHigh @era Version -> Version -> Bool
forall a. Ord a => a -> a -> Bool
>= forall (v :: Natural).
(KnownNat v, MinVersion <= v, v <= MaxVersion) =>
Version
natVersion @12 = BlsKey -> StrictMaybe BlsKey
forall a. a -> StrictMaybe a
SJust BlsKey
exampleBlsKey
  | Bool
otherwise = StrictMaybe BlsKey
forall a. StrictMaybe a
SNothing

queryStakePoolDefaultVoteExamples :: [DefaultVote]
queryStakePoolDefaultVoteExamples :: [DefaultVote]
queryStakePoolDefaultVoteExamples =
  [ DefaultVote
DefaultNo
  , DefaultVote
DefaultAbstain
  , DefaultVote
DefaultNoConfidence
  ]

queryStakePoolDelegsAndRewardsExamples ::
  [(Map (Credential Staking) (KeyHash StakePool), Map (Credential Staking) Coin)]
queryStakePoolDelegsAndRewardsExamples :: [(Map (Credential Staking) (KeyHash StakePool),
  Map (Credential Staking) Coin)]
queryStakePoolDelegsAndRewardsExamples =
  [ (Map (Credential Staking) (KeyHash StakePool)
forall k a. Map k a
Map.empty, Map (Credential Staking) Coin
forall k a. Map k a
Map.empty)
  ,
    ( [(Credential Staking, KeyHash StakePool)]
-> Map (Credential Staking) (KeyHash StakePool)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
        [ (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1), Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
10)
        , (ScriptHash -> Credential Staking
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
2), Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
20)
        ]
    , [(Credential Staking, Coin)] -> Map (Credential Staking) Coin
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
        [ (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1), Integer -> Coin
Coin Integer
1_000_000)
        , (ScriptHash -> Credential Staking
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
2), Integer -> Coin
Coin Integer
0)
        ]
    )
  ]

queryStakePoolRelaysExamples :: [Map (KeyHash StakePool) (Rational, StrictSeq StakePoolRelay)]
queryStakePoolRelaysExamples :: [Map (KeyHash StakePool) (Rational, StrictSeq StakePoolRelay)]
queryStakePoolRelaysExamples =
  [ Map (KeyHash StakePool) (Rational, StrictSeq StakePoolRelay)
forall k a. Map k a
Map.empty
  , [(KeyHash StakePool, (Rational, StrictSeq StakePoolRelay))]
-> Map (KeyHash StakePool) (Rational, StrictSeq StakePoolRelay)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
      [
        ( Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1
        ,
          ( Integer
1 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
4
          , [StakePoolRelay] -> StrictSeq StakePoolRelay
forall a. [a] -> StrictSeq a
StrictSeq.fromList
              [ StrictMaybe Port
-> StrictMaybe IPv4 -> StrictMaybe IPv6 -> StakePoolRelay
SingleHostAddr
                  (Port -> StrictMaybe Port
forall a. a -> StrictMaybe a
SJust (Word16 -> Port
Port Word16
3001))
                  (IPv4 -> StrictMaybe IPv4
forall a. a -> StrictMaybe a
SJust ([Int] -> IPv4
toIPv4 [Int
192, Int
168, Int
1, Int
1]))
                  (IPv6 -> StrictMaybe IPv6
forall a. a -> StrictMaybe a
SJust ([Int] -> IPv6
toIPv6 [Int
0x2001, Int
0xdb8, Int
0, Int
0, Int
0, Int
0, Int
0, Int
1]))
              , StrictMaybe Port -> DnsName -> StakePoolRelay
SingleHostName
                  (Port -> StrictMaybe Port
forall a. a -> StrictMaybe a
SJust (Word16 -> Port
Port Word16
3001))
                  (Maybe DnsName -> DnsName
forall a. HasCallStack => Maybe a -> a
fromJust (Int -> Text -> Maybe DnsName
forall (m :: * -> *). MonadFail m => Int -> Text -> m DnsName
textToDns Int
64 Text
"pool-1.relay.example"))
              ]
          )
        )
      ,
        ( Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2
        ,
          ( Integer
3 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
8
          , [StakePoolRelay] -> StrictSeq StakePoolRelay
forall a. [a] -> StrictSeq a
StrictSeq.fromList
              [ StrictMaybe Port
-> StrictMaybe IPv4 -> StrictMaybe IPv6 -> StakePoolRelay
SingleHostAddr StrictMaybe Port
forall a. StrictMaybe a
SNothing (IPv4 -> StrictMaybe IPv4
forall a. a -> StrictMaybe a
SJust ([Int] -> IPv4
toIPv4 [Int
10, Int
0, Int
0, Int
5])) StrictMaybe IPv6
forall a. StrictMaybe a
SNothing
              , DnsName -> StakePoolRelay
MultiHostName (Maybe DnsName -> DnsName
forall a. HasCallStack => Maybe a -> a
fromJust (Int -> Text -> Maybe DnsName
forall (m :: * -> *). MonadFail m => Int -> Text -> m DnsName
textToDns Int
64 Text
"_relay._tcp.pool-2.example"))
              ]
          )
        )
      ]
  ]

queryDRepDelegateesExamples :: [Map (Credential Staking) DRep]
queryDRepDelegateesExamples :: [Map (Credential Staking) DRep]
queryDRepDelegateesExamples =
  [ Map (Credential Staking) DRep
forall k a. Map k a
Map.empty
  , [(Credential Staking, DRep)] -> Map (Credential Staking) DRep
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
      [ (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1), KeyHash DRepRole -> DRep
DRepKeyHash (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
10))
      , (ScriptHash -> Credential Staking
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
2), ScriptHash -> DRep
DRepScriptHash (Int -> ScriptHash
mkScriptHash Int
20))
      , (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
3), DRep
DRepAlwaysAbstain)
      , (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
4), DRep
DRepAlwaysNoConfidence)
      ]
  ]

queryDRepDelegationsExamples :: [Map DRep (Set (Credential Staking))]
queryDRepDelegationsExamples :: [Map DRep (Set (Credential Staking))]
queryDRepDelegationsExamples =
  [ Map DRep (Set (Credential Staking))
forall k a. Map k a
Map.empty
  , [(DRep, Set (Credential Staking))]
-> Map DRep (Set (Credential Staking))
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
      [
        ( KeyHash DRepRole -> DRep
DRepKeyHash (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1)
        , [Credential Staking] -> Set (Credential Staking)
forall a. Ord a => [a] -> Set a
Set.fromList [KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
10), ScriptHash -> Credential Staking
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
11)]
        )
      , (ScriptHash -> DRep
DRepScriptHash (Int -> ScriptHash
mkScriptHash Int
2), Credential Staking -> Set (Credential Staking)
forall a. a -> Set a
Set.singleton (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
20)))
      , (DRep
DRepAlwaysAbstain, Credential Staking -> Set (Credential Staking)
forall a. a -> Set a
Set.singleton (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
30)))
      , (DRep
DRepAlwaysNoConfidence, Set (Credential Staking)
forall a. Set a
Set.empty)
      ]
  ]

queryDRepStakeDistrExamples :: [Map DRep Coin]
queryDRepStakeDistrExamples :: [Map DRep Coin]
queryDRepStakeDistrExamples =
  [ Map DRep Coin
forall k a. Map k a
Map.empty
  , [(DRep, Coin)] -> Map DRep Coin
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
      [ (KeyHash DRepRole -> DRep
DRepKeyHash (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1), Integer -> Coin
Coin Integer
1_000_000_000)
      , (ScriptHash -> DRep
DRepScriptHash (Int -> ScriptHash
mkScriptHash Int
2), Integer -> Coin
Coin Integer
0)
      , (DRep
DRepAlwaysAbstain, Integer -> Coin
Coin Integer
50)
      , (DRep
DRepAlwaysNoConfidence, Integer -> Coin
Coin Integer
100)
      ]
  ]

queryDRepStateExamples :: [Map (Credential DRepRole) DRepState]
queryDRepStateExamples :: [Map (Credential DRepRole) DRepState]
queryDRepStateExamples =
  [ Map (Credential DRepRole) DRepState
forall k a. Map k a
Map.empty
  , [(Credential DRepRole, DRepState)]
-> Map (Credential DRepRole) DRepState
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
      [
        ( KeyHash DRepRole -> Credential DRepRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1)
        , DRepState
            { drepExpiry :: EpochNo
drepExpiry = Word64 -> EpochNo
EpochNo Word64
100
            , drepAnchor :: StrictMaybe Anchor
drepAnchor = Anchor -> StrictMaybe Anchor
forall a. a -> StrictMaybe a
SJust Anchor
exampleAnchor
            , drepDeposit :: CompactForm Coin
drepDeposit = Word64 -> CompactForm Coin
CompactCoin Word64
500_000_000
            , drepDelegs :: Set (Credential Staking)
drepDelegs = Set (Credential Staking)
forall a. Monoid a => a
mempty
            }
        )
      ,
        ( ScriptHash -> Credential DRepRole
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
2)
        , DRepState
            { drepExpiry :: EpochNo
drepExpiry = Word64 -> EpochNo
EpochNo Word64
0
            , drepAnchor :: StrictMaybe Anchor
drepAnchor = StrictMaybe Anchor
forall a. StrictMaybe a
SNothing
            , drepDeposit :: CompactForm Coin
drepDeposit = Word64 -> CompactForm Coin
CompactCoin Word64
0
            , drepDelegs :: Set (Credential Staking)
drepDelegs = Set (Credential Staking)
forall a. Monoid a => a
mempty
            }
        )
      ]
  ]

queryRatifyStateExamples ::
  EraTest era =>
  [RatifyState era]
queryRatifyStateExamples :: forall era. EraTest era => [RatifyState era]
queryRatifyStateExamples =
  [ RatifyState era
forall a. Default a => a
def
  , RatifyState
      { rsEnactState :: EnactState era
rsEnactState =
          EnactState
            { ensCommittee :: StrictMaybe (Committee era)
ensCommittee =
                Committee era -> StrictMaybe (Committee era)
forall a. a -> StrictMaybe a
SJust (Committee era -> StrictMaybe (Committee era))
-> Committee era -> StrictMaybe (Committee era)
forall a b. (a -> b) -> a -> b
$
                  Committee
                    { committeeMembers :: Map (Credential ColdCommitteeRole) EpochNo
committeeMembers =
                        Credential ColdCommitteeRole
-> EpochNo -> Map (Credential ColdCommitteeRole) EpochNo
forall k a. k -> a -> Map k a
Map.singleton (KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1)) (Word64 -> EpochNo
EpochNo Word64
200)
                    , committeeThreshold :: UnitInterval
committeeThreshold = Rational -> UnitInterval
forall r.
(HasCallStack, Typeable r, BoundedRational r) =>
Rational -> r
unsafeBoundRational (Integer
1 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
2) :: UnitInterval
                    }
            , ensConstitution :: Constitution era
ensConstitution =
                Constitution
                  { constitutionAnchor :: Anchor
constitutionAnchor = Anchor
exampleAnchor
                  , constitutionGuardrailsScriptHash :: StrictMaybe ScriptHash
constitutionGuardrailsScriptHash = ScriptHash -> StrictMaybe ScriptHash
forall a. a -> StrictMaybe a
SJust (Int -> ScriptHash
mkScriptHash Int
1)
                  }
            , ensCurPParams :: PParams era
ensCurPParams = PParams era
forall era. EraTest era => PParams era
examplePParams
            , ensPrevPParams :: PParams era
ensPrevPParams = PParams era
forall a. Default a => a
def
            , ensTreasury :: Coin
ensTreasury = Integer -> Coin
Coin Integer
1_000_000_000
            , ensWithdrawals :: Map (Credential Staking) Coin
ensWithdrawals =
                [(Credential Staking, Coin)] -> Map (Credential Staking) Coin
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
                  [ (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1), Integer -> Coin
Coin Integer
500_000_000)
                  , (ScriptHash -> Credential Staking
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
2), Integer -> Coin
Coin Integer
250_000_000)
                  ]
            , ensPrevGovActionIds :: GovRelation StrictMaybe
ensPrevGovActionIds = GovRelation StrictMaybe
forall a. Default a => a
def
            }
      , rsEnacted :: Seq (GovActionState era)
rsEnacted =
          [GovActionState era] -> Seq (GovActionState era)
forall a. [a] -> Seq a
Seq.fromList
            [ GovActionState
                { gasId :: GovActionId
gasId = Int -> GovActionId
mkGid Int
1
                , gasCommitteeVotes :: Map (Credential HotCommitteeRole) Vote
gasCommitteeVotes = Map (Credential HotCommitteeRole) Vote
forall k a. Map k a
Map.empty
                , gasDRepVotes :: Map (Credential DRepRole) Vote
gasDRepVotes = Map (Credential DRepRole) Vote
forall k a. Map k a
Map.empty
                , gasStakePoolVotes :: Map (KeyHash StakePool) Vote
gasStakePoolVotes = Map (KeyHash StakePool) Vote
forall k a. Map k a
Map.empty
                , gasProposalProcedure :: ProposalProcedure era
gasProposalProcedure = ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedure
                , gasProposedIn :: EpochNo
gasProposedIn = Word64 -> EpochNo
EpochNo Word64
100
                , gasExpiresAfter :: EpochNo
gasExpiresAfter = Word64 -> EpochNo
EpochNo Word64
130
                }
            ]
      , rsExpired :: Set GovActionId
rsExpired = [GovActionId] -> Set GovActionId
forall a. Ord a => [a] -> Set a
Set.fromList [Int -> GovActionId
mkGid Int
99]
      , rsDelayed :: Bool
rsDelayed = Bool
True
      }
  ]
  where
    mkGid :: Int -> GovActionId
mkGid Int
n =
      GovActionId
        { gaidTxId :: TxId
gaidTxId = SafeHash EraIndependentTxBody -> TxId
TxId (Int -> SafeHash EraIndependentTxBody
forall a. Int -> SafeHash a
mkDummySafeHash Int
n)
        , gaidGovActionIx :: GovActionIx
gaidGovActionIx = Word16 -> GovActionIx
GovActionIx Word16
0
        }

queryRegisteredDRepStakeDistrExamples :: [Map (Credential DRepRole) Coin]
queryRegisteredDRepStakeDistrExamples :: [Map (Credential DRepRole) Coin]
queryRegisteredDRepStakeDistrExamples =
  [ Map (Credential DRepRole) Coin
forall k a. Map k a
Map.empty
  , [(Credential DRepRole, Coin)] -> Map (Credential DRepRole) Coin
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
      [ (KeyHash DRepRole -> Credential DRepRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1), Integer -> Coin
Coin Integer
1_000_000_000)
      , (ScriptHash -> Credential DRepRole
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
2), Integer -> Coin
Coin Integer
0)
      ]
  ]

queryPoolParametersExamples :: [Map (KeyHash StakePool) StakePoolParams]
queryPoolParametersExamples :: [Map (KeyHash StakePool) StakePoolParams]
queryPoolParametersExamples =
  [ Map (KeyHash StakePool) StakePoolParams
forall k a. Map k a
Map.empty
  , [(KeyHash StakePool, StakePoolParams)]
-> Map (KeyHash StakePool) StakePoolParams
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
      [ (StakePoolParams -> KeyHash StakePool
sppId StakePoolParams
exampleStakePoolParams, StakePoolParams
exampleStakePoolParams)
      ,
        ( Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
99
        , StakePoolParams
exampleStakePoolParams
            { sppId = mkKeyHash 99
            , sppPledge = Coin 100_000_000
            , sppCost = Coin 340_000_000
            , sppRelays =
                StrictSeq.fromList
                  [ SingleHostAddr (SJust (Port 3001)) (SJust (toIPv4 [10, 0, 0, 1])) SNothing
                  , MultiHostName (fromJust (textToDns 64 "_relay._tcp.pool-99.example"))
                  ]
            }
        )
      ,
        ( Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
100
        , StakePoolParams
exampleStakePoolParams
            { sppId = mkKeyHash 100
            , sppPledge = Coin 0
            , sppCost = Coin 170_000_000
            , sppMetadata = SNothing
            }
        )
      ]
  ]

queryPoolStateExamples :: [QueryPoolStateResult]
queryPoolStateExamples :: [QueryPoolStateResult]
queryPoolStateExamples =
  [ QueryPoolStateResult
      { qpsrStakePoolParams :: Map (KeyHash StakePool) StakePoolParams
qpsrStakePoolParams = Map (KeyHash StakePool) StakePoolParams
forall k a. Map k a
Map.empty
      , qpsrFutureStakePoolParams :: Map (KeyHash StakePool) StakePoolParams
qpsrFutureStakePoolParams = Map (KeyHash StakePool) StakePoolParams
forall k a. Map k a
Map.empty
      , qpsrRetiring :: Map (KeyHash StakePool) EpochNo
qpsrRetiring = Map (KeyHash StakePool) EpochNo
forall k a. Map k a
Map.empty
      , qpsrDeposits :: Map (KeyHash StakePool) Coin
qpsrDeposits = Map (KeyHash StakePool) Coin
forall k a. Map k a
Map.empty
      }
  , QueryPoolStateResult
      { qpsrStakePoolParams :: Map (KeyHash StakePool) StakePoolParams
qpsrStakePoolParams =
          [(KeyHash StakePool, StakePoolParams)]
-> Map (KeyHash StakePool) StakePoolParams
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
            [ (StakePoolParams -> KeyHash StakePool
sppId StakePoolParams
exampleStakePoolParams, StakePoolParams
exampleStakePoolParams)
            , (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
99, StakePoolParams
exampleStakePoolParams {sppId = mkKeyHash 99})
            ]
      , qpsrFutureStakePoolParams :: Map (KeyHash StakePool) StakePoolParams
qpsrFutureStakePoolParams =
          KeyHash StakePool
-> StakePoolParams -> Map (KeyHash StakePool) StakePoolParams
forall k a. k -> a -> Map k a
Map.singleton
            (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
100)
            (StakePoolParams
exampleStakePoolParams {sppId = mkKeyHash 100})
      , qpsrRetiring :: Map (KeyHash StakePool) EpochNo
qpsrRetiring = KeyHash StakePool -> EpochNo -> Map (KeyHash StakePool) EpochNo
forall k a. k -> a -> Map k a
Map.singleton (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
99) (Word64 -> EpochNo
EpochNo Word64
250)
      , qpsrDeposits :: Map (KeyHash StakePool) Coin
qpsrDeposits =
          [(KeyHash StakePool, Coin)] -> Map (KeyHash StakePool) Coin
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
            [ (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1, Integer -> Coin
Coin Integer
500_000_000)
            , (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
99, Integer -> Coin
Coin Integer
500_000_000)
            ]
      }
  ]

queryFuturePParamsExamples :: EraTest era => [Maybe (PParams era)]
queryFuturePParamsExamples :: forall era. EraTest era => [Maybe (PParams era)]
queryFuturePParamsExamples = [Maybe (PParams era)
forall a. Maybe a
Nothing, PParams era -> Maybe (PParams era)
forall a. a -> Maybe a
Just PParams era
forall a. Default a => a
def, PParams era -> Maybe (PParams era)
forall a. a -> Maybe a
Just PParams era
forall era. EraTest era => PParams era
examplePParams]

queryGovStateExamples ::
  EraTest era =>
  [ConwayGovState era]
queryGovStateExamples :: forall era. EraTest era => [ConwayGovState era]
queryGovStateExamples =
  [ ConwayGovState era
forall a. Default a => a
def
  , ConwayGovState
      { cgsProposals :: Proposals era
cgsProposals = Proposals era
forall a. Default a => a
def
      , cgsCommittee :: StrictMaybe (Committee era)
cgsCommittee =
          Committee era -> StrictMaybe (Committee era)
forall a. a -> StrictMaybe a
SJust (Committee era -> StrictMaybe (Committee era))
-> Committee era -> StrictMaybe (Committee era)
forall a b. (a -> b) -> a -> b
$
            Committee
              { committeeMembers :: Map (Credential ColdCommitteeRole) EpochNo
committeeMembers =
                  [(Credential ColdCommitteeRole, EpochNo)]
-> Map (Credential ColdCommitteeRole) EpochNo
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
                    [ (KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1), Word64 -> EpochNo
EpochNo Word64
200)
                    , (KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2), Word64 -> EpochNo
EpochNo Word64
300)
                    , (ScriptHash -> Credential ColdCommitteeRole
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
3), Word64 -> EpochNo
EpochNo Word64
250)
                    ]
              , committeeThreshold :: UnitInterval
committeeThreshold = Rational -> UnitInterval
forall r.
(HasCallStack, Typeable r, BoundedRational r) =>
Rational -> r
unsafeBoundRational (Integer
2 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
3) :: UnitInterval
              }
      , cgsConstitution :: Constitution era
cgsConstitution =
          Constitution
            { constitutionAnchor :: Anchor
constitutionAnchor = Anchor
exampleAnchor
            , constitutionGuardrailsScriptHash :: StrictMaybe ScriptHash
constitutionGuardrailsScriptHash = ScriptHash -> StrictMaybe ScriptHash
forall a. a -> StrictMaybe a
SJust (Int -> ScriptHash
mkScriptHash Int
1)
            }
      , cgsCurPParams :: PParams era
cgsCurPParams = PParams era
forall era. EraTest era => PParams era
examplePParams
      , cgsPrevPParams :: PParams era
cgsPrevPParams = PParams era
forall a. Default a => a
def
      , cgsFuturePParams :: FuturePParams era
cgsFuturePParams = PParams era -> FuturePParams era
forall era. PParams era -> FuturePParams era
DefinitePParamsUpdate PParams era
forall era. EraTest era => PParams era
examplePParams
      , cgsDRepPulsingState :: DRepPulsingState era
cgsDRepPulsingState = PulsingSnapshot era -> RatifyState era -> DRepPulsingState era
forall era.
PulsingSnapshot era -> RatifyState era -> DRepPulsingState era
DRComplete PulsingSnapshot era
forall a. Default a => a
def RatifyState era
forall a. Default a => a
def
      }
  ]

queryProposalsExamples :: ConwayEraPParams era => [Seq (GovActionState era)]
queryProposalsExamples :: forall era. ConwayEraPParams era => [Seq (GovActionState era)]
queryProposalsExamples =
  [ Seq (GovActionState era)
forall a. Seq a
Seq.empty
  , [GovActionState era] -> Seq (GovActionState era)
forall a. [a] -> Seq a
Seq.fromList
      [ GovActionState
          { gasId :: GovActionId
gasId = Int -> GovActionId
mkGid Int
1
          , gasCommitteeVotes :: Map (Credential HotCommitteeRole) Vote
gasCommitteeVotes = Map (Credential HotCommitteeRole) Vote
forall k a. Map k a
Map.empty
          , gasDRepVotes :: Map (Credential DRepRole) Vote
gasDRepVotes = Map (Credential DRepRole) Vote
forall k a. Map k a
Map.empty
          , gasStakePoolVotes :: Map (KeyHash StakePool) Vote
gasStakePoolVotes = Map (KeyHash StakePool) Vote
forall k a. Map k a
Map.empty
          , gasProposalProcedure :: ProposalProcedure era
gasProposalProcedure = ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedure
          , gasProposedIn :: EpochNo
gasProposedIn = Word64 -> EpochNo
EpochNo Word64
100
          , gasExpiresAfter :: EpochNo
gasExpiresAfter = Word64 -> EpochNo
EpochNo Word64
130
          }
      , GovActionState
          { gasId :: GovActionId
gasId = Int -> GovActionId
mkGid Int
2
          , gasCommitteeVotes :: Map (Credential HotCommitteeRole) Vote
gasCommitteeVotes = Credential HotCommitteeRole
-> Vote -> Map (Credential HotCommitteeRole) Vote
forall k a. k -> a -> Map k a
Map.singleton (KeyHash HotCommitteeRole -> Credential HotCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash HotCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1)) Vote
VoteYes
          , gasDRepVotes :: Map (Credential DRepRole) Vote
gasDRepVotes = Credential DRepRole -> Vote -> Map (Credential DRepRole) Vote
forall k a. k -> a -> Map k a
Map.singleton (KeyHash DRepRole -> Credential DRepRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2)) Vote
VoteNo
          , gasStakePoolVotes :: Map (KeyHash StakePool) Vote
gasStakePoolVotes = KeyHash StakePool -> Vote -> Map (KeyHash StakePool) Vote
forall k a. k -> a -> Map k a
Map.singleton (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
3) Vote
Abstain
          , gasProposalProcedure :: ProposalProcedure era
gasProposalProcedure = ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureHardForkInitiation
          , gasProposedIn :: EpochNo
gasProposedIn = Word64 -> EpochNo
EpochNo Word64
50
          , gasExpiresAfter :: EpochNo
gasExpiresAfter = Word64 -> EpochNo
EpochNo Word64
80
          }
      , GovActionState
          { gasId :: GovActionId
gasId = Int -> GovActionId
mkGid Int
3
          , gasCommitteeVotes :: Map (Credential HotCommitteeRole) Vote
gasCommitteeVotes = Map (Credential HotCommitteeRole) Vote
forall k a. Map k a
Map.empty
          , gasDRepVotes :: Map (Credential DRepRole) Vote
gasDRepVotes = Map (Credential DRepRole) Vote
forall k a. Map k a
Map.empty
          , gasStakePoolVotes :: Map (KeyHash StakePool) Vote
gasStakePoolVotes = Map (KeyHash StakePool) Vote
forall k a. Map k a
Map.empty
          , gasProposalProcedure :: ProposalProcedure era
gasProposalProcedure = ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureTreasuryWithdrawals
          , gasProposedIn :: EpochNo
gasProposedIn = Word64 -> EpochNo
EpochNo Word64
60
          , gasExpiresAfter :: EpochNo
gasExpiresAfter = Word64 -> EpochNo
EpochNo Word64
90
          }
      , GovActionState
          { gasId :: GovActionId
gasId = Int -> GovActionId
mkGid Int
4
          , gasCommitteeVotes :: Map (Credential HotCommitteeRole) Vote
gasCommitteeVotes = Map (Credential HotCommitteeRole) Vote
forall k a. Map k a
Map.empty
          , gasDRepVotes :: Map (Credential DRepRole) Vote
gasDRepVotes =
              [(Credential DRepRole, Vote)] -> Map (Credential DRepRole) Vote
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
                [ (KeyHash DRepRole -> Credential DRepRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
4), Vote
Abstain)
                , (ScriptHash -> Credential DRepRole
forall (kr :: KeyRole). ScriptHash -> Credential kr
ScriptHashObj (Int -> ScriptHash
mkScriptHash Int
5), Vote
VoteYes)
                ]
          , gasStakePoolVotes :: Map (KeyHash StakePool) Vote
gasStakePoolVotes = Map (KeyHash StakePool) Vote
forall k a. Map k a
Map.empty
          , gasProposalProcedure :: ProposalProcedure era
gasProposalProcedure = ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureNoConfidence
          , gasProposedIn :: EpochNo
gasProposedIn = Word64 -> EpochNo
EpochNo Word64
70
          , gasExpiresAfter :: EpochNo
gasExpiresAfter = Word64 -> EpochNo
EpochNo Word64
100
          }
      , GovActionState
          { gasId :: GovActionId
gasId = Int -> GovActionId
mkGid Int
5
          , gasCommitteeVotes :: Map (Credential HotCommitteeRole) Vote
gasCommitteeVotes = Map (Credential HotCommitteeRole) Vote
forall k a. Map k a
Map.empty
          , gasDRepVotes :: Map (Credential DRepRole) Vote
gasDRepVotes = Map (Credential DRepRole) Vote
forall k a. Map k a
Map.empty
          , gasStakePoolVotes :: Map (KeyHash StakePool) Vote
gasStakePoolVotes = Map (KeyHash StakePool) Vote
forall k a. Map k a
Map.empty
          , gasProposalProcedure :: ProposalProcedure era
gasProposalProcedure = ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureUpdateCommittee
          , gasProposedIn :: EpochNo
gasProposedIn = Word64 -> EpochNo
EpochNo Word64
80
          , gasExpiresAfter :: EpochNo
gasExpiresAfter = Word64 -> EpochNo
EpochNo Word64
110
          }
      , GovActionState
          { gasId :: GovActionId
gasId = Int -> GovActionId
mkGid Int
6
          , gasCommitteeVotes :: Map (Credential HotCommitteeRole) Vote
gasCommitteeVotes = Map (Credential HotCommitteeRole) Vote
forall k a. Map k a
Map.empty
          , gasDRepVotes :: Map (Credential DRepRole) Vote
gasDRepVotes = Map (Credential DRepRole) Vote
forall k a. Map k a
Map.empty
          , gasStakePoolVotes :: Map (KeyHash StakePool) Vote
gasStakePoolVotes = Map (KeyHash StakePool) Vote
forall k a. Map k a
Map.empty
          , gasProposalProcedure :: ProposalProcedure era
gasProposalProcedure = ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureNewConstitution
          , gasProposedIn :: EpochNo
gasProposedIn = Word64 -> EpochNo
EpochNo Word64
90
          , gasExpiresAfter :: EpochNo
gasExpiresAfter = Word64 -> EpochNo
EpochNo Word64
120
          }
      , GovActionState
          { gasId :: GovActionId
gasId = Int -> GovActionId
mkGid Int
7
          , gasCommitteeVotes :: Map (Credential HotCommitteeRole) Vote
gasCommitteeVotes = Credential HotCommitteeRole
-> Vote -> Map (Credential HotCommitteeRole) Vote
forall k a. k -> a -> Map k a
Map.singleton (KeyHash HotCommitteeRole -> Credential HotCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash HotCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
11)) Vote
VoteYes
          , gasDRepVotes :: Map (Credential DRepRole) Vote
gasDRepVotes = Credential DRepRole -> Vote -> Map (Credential DRepRole) Vote
forall k a. k -> a -> Map k a
Map.singleton (KeyHash DRepRole -> Credential DRepRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
22)) Vote
VoteYes
          , gasStakePoolVotes :: Map (KeyHash StakePool) Vote
gasStakePoolVotes = KeyHash StakePool -> Vote -> Map (KeyHash StakePool) Vote
forall k a. k -> a -> Map k a
Map.singleton (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
33) Vote
VoteYes
          , gasProposalProcedure :: ProposalProcedure era
gasProposalProcedure = ProposalProcedure era
forall era. ConwayEraPParams era => ProposalProcedure era
exampleProposalProcedureParameterChange
          , gasProposedIn :: EpochNo
gasProposedIn = Word64 -> EpochNo
EpochNo Word64
100
          , gasExpiresAfter :: EpochNo
gasExpiresAfter = Word64 -> EpochNo
EpochNo Word64
130
          }
      ]
  ]
  where
    mkGid :: Int -> GovActionId
mkGid Int
n =
      GovActionId
        { gaidTxId :: TxId
gaidTxId = SafeHash EraIndependentTxBody -> TxId
TxId (Int -> SafeHash EraIndependentTxBody
forall a. Int -> SafeHash a
mkDummySafeHash Int
n)
        , gaidGovActionIx :: GovActionIx
gaidGovActionIx = Word16 -> GovActionIx
GovActionIx Word16
0
        }

queryStakeSnapshotsExamples :: [StakeSnapshots]
queryStakeSnapshotsExamples :: [StakeSnapshots]
queryStakeSnapshotsExamples =
  [ StakeSnapshots
      { ssStakeSnapshots :: Map (KeyHash StakePool) StakeSnapshot
ssStakeSnapshots = Map (KeyHash StakePool) StakeSnapshot
forall k a. Map k a
Map.empty
      , ssMarkTotal :: NonZero Coin
ssMarkTotal = forall (n :: Natural). (KnownNat n, 1 <= n) => NonZero Coin
knownNonZeroCoin @1
      , ssSetTotal :: NonZero Coin
ssSetTotal = forall (n :: Natural). (KnownNat n, 1 <= n) => NonZero Coin
knownNonZeroCoin @1
      , ssGoTotal :: NonZero Coin
ssGoTotal = forall (n :: Natural). (KnownNat n, 1 <= n) => NonZero Coin
knownNonZeroCoin @1
      }
  , StakeSnapshots
      { ssStakeSnapshots :: Map (KeyHash StakePool) StakeSnapshot
ssStakeSnapshots =
          [(KeyHash StakePool, StakeSnapshot)]
-> Map (KeyHash StakePool) StakeSnapshot
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
            [
              ( Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1
              , StakeSnapshot
                  { ssMarkPool :: Coin
ssMarkPool = Integer -> Coin
Coin Integer
1_000_000_000
                  , ssSetPool :: Coin
ssSetPool = Integer -> Coin
Coin Integer
900_000_000
                  , ssGoPool :: Coin
ssGoPool = Integer -> Coin
Coin Integer
800_000_000
                  }
              )
            ,
              ( Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2
              , StakeSnapshot
                  { ssMarkPool :: Coin
ssMarkPool = Integer -> Coin
Coin Integer
0
                  , ssSetPool :: Coin
ssSetPool = Integer -> Coin
Coin Integer
500_000_000
                  , ssGoPool :: Coin
ssGoPool = Integer -> Coin
Coin Integer
250_000_000
                  }
              )
            ]
      , ssMarkTotal :: NonZero Coin
ssMarkTotal = forall (n :: Natural). (KnownNat n, 1 <= n) => NonZero Coin
knownNonZeroCoin @5_000_000_000
      , ssSetTotal :: NonZero Coin
ssSetTotal = forall (n :: Natural). (KnownNat n, 1 <= n) => NonZero Coin
knownNonZeroCoin @4_500_000_000
      , ssGoTotal :: NonZero Coin
ssGoTotal = forall (n :: Natural). (KnownNat n, 1 <= n) => NonZero Coin
knownNonZeroCoin @4_000_000_000
      }
  ]