-- | Responses for Cardano epoch quries

module Blockfrost.Types.Cardano.Epochs
  ( EpochInfo (..)
  , PoolStakeDistribution (..)
  , ProtocolParams (..)
  , CostModels (..)
  , CostModelsRaw (..)
  , StakeDistribution (..)
  ) where

import Blockfrost.Types.Shared
import Data.Aeson (object, FromJSON (..), ToJSON (..), withObject)
import Data.Map (Map)
import Data.Text (Text)
import Deriving.Aeson
import Servant.Docs (ToSample (..), singleSample)

import qualified Data.Aeson.Key
import qualified Data.Aeson.KeyMap
import qualified Data.Char
import qualified Data.Map

import Blockfrost.Types.Cardano.Scripts (ScriptType (..))

-- | Information about an epoch
data EpochInfo = EpochInfo
  { EpochInfo -> Epoch
_epochInfoEpoch          :: Epoch -- ^ Epoch number
  , EpochInfo -> POSIXTime
_epochInfoStartTime      :: POSIXTime -- ^ Unix time of the start of the epoch
  , EpochInfo -> POSIXTime
_epochInfoEndTime        :: POSIXTime -- ^ Unix time of the end of the epoch
  , EpochInfo -> POSIXTime
_epochInfoFirstBlockTime :: POSIXTime -- ^ Unix time of the first block of the epoch
  , EpochInfo -> POSIXTime
_epochInfoLastBlockTime  :: POSIXTime -- ^ Unix time of the last block of the epoch
  , EpochInfo -> Integer
_epochInfoBlockCount     :: Integer -- ^ Number of blocks within the epoch
  , EpochInfo -> Integer
_epochInfoTxCount        :: Integer -- ^ Number of transactions within the epoch
  , EpochInfo -> Lovelaces
_epochInfoOutput         :: Lovelaces -- ^ Sum of all the transactions within the epoch in Lovelaces
  , EpochInfo -> Lovelaces
_epochInfoFees           :: Lovelaces -- ^ Sum of all the fees within the epoch in Lovelaces
  , EpochInfo -> Maybe Lovelaces
_epochInfoActiveStake    :: Maybe Lovelaces -- ^ Sum of all the active stakes within the epoch in Lovelaces
  }
  deriving stock (Int -> EpochInfo -> ShowS
[EpochInfo] -> ShowS
EpochInfo -> String
(Int -> EpochInfo -> ShowS)
-> (EpochInfo -> String)
-> ([EpochInfo] -> ShowS)
-> Show EpochInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EpochInfo -> ShowS
showsPrec :: Int -> EpochInfo -> ShowS
$cshow :: EpochInfo -> String
show :: EpochInfo -> String
$cshowList :: [EpochInfo] -> ShowS
showList :: [EpochInfo] -> ShowS
Show, EpochInfo -> EpochInfo -> Bool
(EpochInfo -> EpochInfo -> Bool)
-> (EpochInfo -> EpochInfo -> Bool) -> Eq EpochInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EpochInfo -> EpochInfo -> Bool
== :: EpochInfo -> EpochInfo -> Bool
$c/= :: EpochInfo -> EpochInfo -> Bool
/= :: EpochInfo -> EpochInfo -> Bool
Eq, (forall x. EpochInfo -> Rep EpochInfo x)
-> (forall x. Rep EpochInfo x -> EpochInfo) -> Generic EpochInfo
forall x. Rep EpochInfo x -> EpochInfo
forall x. EpochInfo -> Rep EpochInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. EpochInfo -> Rep EpochInfo x
from :: forall x. EpochInfo -> Rep EpochInfo x
$cto :: forall x. Rep EpochInfo x -> EpochInfo
to :: forall x. Rep EpochInfo x -> EpochInfo
Generic)
  deriving (Maybe EpochInfo
Value -> Parser [EpochInfo]
Value -> Parser EpochInfo
(Value -> Parser EpochInfo)
-> (Value -> Parser [EpochInfo])
-> Maybe EpochInfo
-> FromJSON EpochInfo
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser EpochInfo
parseJSON :: Value -> Parser EpochInfo
$cparseJSONList :: Value -> Parser [EpochInfo]
parseJSONList :: Value -> Parser [EpochInfo]
$comittedField :: Maybe EpochInfo
omittedField :: Maybe EpochInfo
FromJSON, [EpochInfo] -> Value
[EpochInfo] -> Encoding
EpochInfo -> Bool
EpochInfo -> Value
EpochInfo -> Encoding
(EpochInfo -> Value)
-> (EpochInfo -> Encoding)
-> ([EpochInfo] -> Value)
-> ([EpochInfo] -> Encoding)
-> (EpochInfo -> Bool)
-> ToJSON EpochInfo
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: EpochInfo -> Value
toJSON :: EpochInfo -> Value
$ctoEncoding :: EpochInfo -> Encoding
toEncoding :: EpochInfo -> Encoding
$ctoJSONList :: [EpochInfo] -> Value
toJSONList :: [EpochInfo] -> Value
$ctoEncodingList :: [EpochInfo] -> Encoding
toEncodingList :: [EpochInfo] -> Encoding
$comitField :: EpochInfo -> Bool
omitField :: EpochInfo -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_epochInfo", CamelToSnake]] EpochInfo

instance ToSample EpochInfo where
  toSamples :: Proxy EpochInfo -> [(Text, EpochInfo)]
toSamples = [(Text, EpochInfo)] -> Proxy EpochInfo -> [(Text, EpochInfo)]
forall a. a -> Proxy EpochInfo -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, EpochInfo)] -> Proxy EpochInfo -> [(Text, EpochInfo)])
-> [(Text, EpochInfo)] -> Proxy EpochInfo -> [(Text, EpochInfo)]
forall a b. (a -> b) -> a -> b
$ EpochInfo -> [(Text, EpochInfo)]
forall a. a -> [(Text, a)]
singleSample
    EpochInfo
      { $sel:_epochInfoEpoch:EpochInfo :: Epoch
_epochInfoEpoch = Epoch
225
      , $sel:_epochInfoStartTime:EpochInfo :: POSIXTime
_epochInfoStartTime = POSIXTime
1603403091
      , $sel:_epochInfoEndTime:EpochInfo :: POSIXTime
_epochInfoEndTime = POSIXTime
1603835086
      , $sel:_epochInfoFirstBlockTime:EpochInfo :: POSIXTime
_epochInfoFirstBlockTime = POSIXTime
1603403092
      , $sel:_epochInfoLastBlockTime:EpochInfo :: POSIXTime
_epochInfoLastBlockTime = POSIXTime
1603835084
      , $sel:_epochInfoBlockCount:EpochInfo :: Integer
_epochInfoBlockCount = Integer
21298
      , $sel:_epochInfoTxCount:EpochInfo :: Integer
_epochInfoTxCount = Integer
17856
      , $sel:_epochInfoOutput:EpochInfo :: Lovelaces
_epochInfoOutput = Discrete' "ADA" '(1000000, 1)
Lovelaces
7849943934049314
      , $sel:_epochInfoFees:EpochInfo :: Lovelaces
_epochInfoFees = Discrete' "ADA" '(1000000, 1)
Lovelaces
4203312194
      , $sel:_epochInfoActiveStake:EpochInfo :: Maybe Lovelaces
_epochInfoActiveStake = Discrete' "ADA" '(1000000, 1)
-> Maybe (Discrete' "ADA" '(1000000, 1))
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Discrete' "ADA" '(1000000, 1)
784953934049314
      }

-- | Protocol parameters
data ProtocolParams = ProtocolParams
  { ProtocolParams -> Epoch
_protocolParamsEpoch                 :: Epoch -- ^ Epoch number
  , ProtocolParams -> Integer
_protocolParamsMinFeeA               :: Integer -- ^ The linear factor for the minimum fee calculation for given epoch
  , ProtocolParams -> Integer
_protocolParamsMinFeeB               :: Integer -- ^ The constant factor for the minimum fee calculation
  , ProtocolParams -> Integer
_protocolParamsMaxBlockSize          :: Integer -- ^ Maximum block body size in Bytes
  , ProtocolParams -> Integer
_protocolParamsMaxTxSize             :: Integer -- ^ Maximum transaction size
  , ProtocolParams -> Integer
_protocolParamsMaxBlockHeaderSize    :: Integer -- ^ Maximum block header size
  , ProtocolParams -> Lovelaces
_protocolParamsKeyDeposit            :: Lovelaces -- ^ The amount of a key registration deposit in Lovelaces
  , ProtocolParams -> Lovelaces
_protocolParamsPoolDeposit           :: Lovelaces -- ^ The amount of a pool registration deposit in Lovelaces
  , ProtocolParams -> Integer
_protocolParamsEMax                  :: Integer -- ^ Epoch bound on pool retirement
  , ProtocolParams -> Integer
_protocolParamsNOpt                  :: Integer -- ^ Desired number of pools
  , ProtocolParams -> Rational
_protocolParamsA0                    :: Rational -- ^ Pool pledge influence
  , ProtocolParams -> Rational
_protocolParamsRho                   :: Rational -- ^ Monetary expansion
  , ProtocolParams -> Rational
_protocolParamsTau                   :: Rational -- ^ Treasury expansion
  , ProtocolParams -> Rational
_protocolParamsDecentralisationParam :: Rational -- ^ Percentage of blocks produced by federated nodes
  , ProtocolParams -> Maybe Text
_protocolParamsExtraEntropy          :: Maybe Text -- ^ Seed for extra entropy
  , ProtocolParams -> Integer
_protocolParamsProtocolMajorVer      :: Integer -- ^ Accepted protocol major version
  , ProtocolParams -> Integer
_protocolParamsProtocolMinorVer      :: Integer -- ^ Accepted protocol minor version
  , ProtocolParams -> Lovelaces
_protocolParamsMinUtxo               :: Lovelaces -- ^ Minimum UTXO value
  , ProtocolParams -> Lovelaces
_protocolParamsMinPoolCost           :: Lovelaces  -- ^ Minimum stake cost forced on the pool
  , ProtocolParams -> Text
_protocolParamsNonce                 :: Text -- ^ Epoch number only used once
  , ProtocolParams -> CostModels
_protocolParamsCostModels            :: CostModels -- ^ Cost models parameters for Plutus Core scripts
  , ProtocolParams -> CostModelsRaw
_protocolParamsCostModelsRaw         :: CostModelsRaw
  , ProtocolParams -> Rational
_protocolParamsPriceMem               :: Rational -- ^ The per word cost of script memory usage
  , ProtocolParams -> Rational
_protocolParamsPriceStep              :: Rational -- ^ The cost of script execution step usage
  , ProtocolParams -> Quantity
_protocolParamsMaxTxExMem             :: Quantity -- ^ The maximum number of execution memory allowed to be used in a single transaction
  , ProtocolParams -> Quantity
_protocolParamsMaxTxExSteps           :: Quantity -- ^ The maximum number of execution steps allowed to be used in a single transaction
  , ProtocolParams -> Quantity
_protocolParamsMaxBlockExMem          :: Quantity -- ^ The maximum number of execution memory allowed to be used in a single block
  , ProtocolParams -> Quantity
_protocolParamsMaxBlockExSteps        :: Quantity -- ^ The maximum number of execution steps allowed to be used in a single block
  , ProtocolParams -> Quantity
_protocolParamsMaxValSize             :: Quantity -- ^ The maximum Val size
  , ProtocolParams -> Integer
_protocolParamsCollateralPercent      :: Integer -- ^ The percentage of the transactions fee which must be provided as collateral when including non-native scripts
  , ProtocolParams -> Integer
_protocolParamsMaxCollateralInputs    :: Integer -- ^ The maximum number of collateral inputs allowed in a transaction
  , ProtocolParams -> Lovelaces
_protocolParamsCoinsPerUtxoSize       :: Lovelaces -- ^ The cost per UTxO size. Cost per UTxO *word* for Alozno. Cost per UTxO *byte* for Babbage and later
  , ProtocolParams -> Lovelaces
_protocolParamsCoinsPerUtxoWord       :: Lovelaces -- ^ The cost per UTxO word (DEPRECATED)
  , ProtocolParams -> Maybe Rational
_protocolParamsPvtMotionNoConfidence :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsPvtCommitteeNormal :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsPvtCommitteeNoConfidence :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsPvtHardForkInitiation :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsPvtppSecurityGroup :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtMotionNoConfidence :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtCommitteeNormal :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtCommitteeNoConfidence :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtUpdateToConstitution :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtHardForkInitiation :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtPPNetworkGroup :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtPPEconomicGroup :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtPPTechnicalGroup :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtPPGovGroup :: Maybe Rational
  , ProtocolParams -> Maybe Rational
_protocolParamsDvtTreasuryWithdrawal :: Maybe Rational
  , ProtocolParams -> Maybe Quantity
_protocolParamsCommitteeMinSize :: Maybe Quantity
  , ProtocolParams -> Maybe Quantity
_protocolParamsCommitteeMaxTermLength :: Maybe Quantity
  , ProtocolParams -> Maybe Quantity
_protocolParamsGovActionLifetime :: Maybe Quantity
  , ProtocolParams -> Maybe Lovelaces
_protocolParamsGovActionDeposit :: Maybe Lovelaces
  , ProtocolParams -> Maybe Lovelaces
_protocolParamsDrepDeposit :: Maybe Lovelaces
  , ProtocolParams -> Maybe Quantity
_protocolParamsDrepActivity :: Maybe Quantity
  , ProtocolParams -> Maybe Rational
_protocolParamsMinFeeRefScriptCostPerByte :: Maybe Rational
  }
  deriving stock (Int -> ProtocolParams -> ShowS
[ProtocolParams] -> ShowS
ProtocolParams -> String
(Int -> ProtocolParams -> ShowS)
-> (ProtocolParams -> String)
-> ([ProtocolParams] -> ShowS)
-> Show ProtocolParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ProtocolParams -> ShowS
showsPrec :: Int -> ProtocolParams -> ShowS
$cshow :: ProtocolParams -> String
show :: ProtocolParams -> String
$cshowList :: [ProtocolParams] -> ShowS
showList :: [ProtocolParams] -> ShowS
Show, ProtocolParams -> ProtocolParams -> Bool
(ProtocolParams -> ProtocolParams -> Bool)
-> (ProtocolParams -> ProtocolParams -> Bool) -> Eq ProtocolParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProtocolParams -> ProtocolParams -> Bool
== :: ProtocolParams -> ProtocolParams -> Bool
$c/= :: ProtocolParams -> ProtocolParams -> Bool
/= :: ProtocolParams -> ProtocolParams -> Bool
Eq, (forall x. ProtocolParams -> Rep ProtocolParams x)
-> (forall x. Rep ProtocolParams x -> ProtocolParams)
-> Generic ProtocolParams
forall x. Rep ProtocolParams x -> ProtocolParams
forall x. ProtocolParams -> Rep ProtocolParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ProtocolParams -> Rep ProtocolParams x
from :: forall x. ProtocolParams -> Rep ProtocolParams x
$cto :: forall x. Rep ProtocolParams x -> ProtocolParams
to :: forall x. Rep ProtocolParams x -> ProtocolParams
Generic)
  deriving (Maybe ProtocolParams
Value -> Parser [ProtocolParams]
Value -> Parser ProtocolParams
(Value -> Parser ProtocolParams)
-> (Value -> Parser [ProtocolParams])
-> Maybe ProtocolParams
-> FromJSON ProtocolParams
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ProtocolParams
parseJSON :: Value -> Parser ProtocolParams
$cparseJSONList :: Value -> Parser [ProtocolParams]
parseJSONList :: Value -> Parser [ProtocolParams]
$comittedField :: Maybe ProtocolParams
omittedField :: Maybe ProtocolParams
FromJSON, [ProtocolParams] -> Value
[ProtocolParams] -> Encoding
ProtocolParams -> Bool
ProtocolParams -> Value
ProtocolParams -> Encoding
(ProtocolParams -> Value)
-> (ProtocolParams -> Encoding)
-> ([ProtocolParams] -> Value)
-> ([ProtocolParams] -> Encoding)
-> (ProtocolParams -> Bool)
-> ToJSON ProtocolParams
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ProtocolParams -> Value
toJSON :: ProtocolParams -> Value
$ctoEncoding :: ProtocolParams -> Encoding
toEncoding :: ProtocolParams -> Encoding
$ctoJSONList :: [ProtocolParams] -> Value
toJSONList :: [ProtocolParams] -> Value
$ctoEncodingList :: [ProtocolParams] -> Encoding
toEncodingList :: [ProtocolParams] -> Encoding
$comitField :: ProtocolParams -> Bool
omitField :: ProtocolParams -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_protocolParams", CamelToSnake, Rename "dvt_pp_network_group" "dvt_p_p_network_group", Rename "dvt_pp_economic_group" "dvt_p_p_economic_group", Rename "dvt_pp_technical_group" "dvt_p_p_technical_group", Rename "dvt_pp_gov_group" "dvt_p_p_gov_group"]] ProtocolParams

instance ToSample ProtocolParams where
  toSamples :: Proxy ProtocolParams -> [(Text, ProtocolParams)]
toSamples = [(Text, ProtocolParams)]
-> Proxy ProtocolParams -> [(Text, ProtocolParams)]
forall a. a -> Proxy ProtocolParams -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, ProtocolParams)]
 -> Proxy ProtocolParams -> [(Text, ProtocolParams)])
-> [(Text, ProtocolParams)]
-> Proxy ProtocolParams
-> [(Text, ProtocolParams)]
forall a b. (a -> b) -> a -> b
$ ProtocolParams -> [(Text, ProtocolParams)]
forall a. a -> [(Text, a)]
singleSample
    ProtocolParams
      { $sel:_protocolParamsEpoch:ProtocolParams :: Epoch
_protocolParamsEpoch = Epoch
225
      , $sel:_protocolParamsMinFeeA:ProtocolParams :: Integer
_protocolParamsMinFeeA = Integer
44
      , $sel:_protocolParamsMinFeeB:ProtocolParams :: Integer
_protocolParamsMinFeeB = Integer
155381
      , $sel:_protocolParamsMaxBlockSize:ProtocolParams :: Integer
_protocolParamsMaxBlockSize = Integer
65536
      , $sel:_protocolParamsMaxTxSize:ProtocolParams :: Integer
_protocolParamsMaxTxSize = Integer
16384
      , $sel:_protocolParamsMaxBlockHeaderSize:ProtocolParams :: Integer
_protocolParamsMaxBlockHeaderSize = Integer
1100
      , $sel:_protocolParamsKeyDeposit:ProtocolParams :: Lovelaces
_protocolParamsKeyDeposit = Discrete' "ADA" '(1000000, 1)
Lovelaces
2000000
      , $sel:_protocolParamsPoolDeposit:ProtocolParams :: Lovelaces
_protocolParamsPoolDeposit = Discrete' "ADA" '(1000000, 1)
Lovelaces
500000000
      , $sel:_protocolParamsEMax:ProtocolParams :: Integer
_protocolParamsEMax = Integer
18
      , $sel:_protocolParamsNOpt:ProtocolParams :: Integer
_protocolParamsNOpt = Integer
150
      , $sel:_protocolParamsA0:ProtocolParams :: Rational
_protocolParamsA0 = Rational
0.3
      , $sel:_protocolParamsRho:ProtocolParams :: Rational
_protocolParamsRho = Rational
0.003
      , $sel:_protocolParamsTau:ProtocolParams :: Rational
_protocolParamsTau = Rational
0.2
      , $sel:_protocolParamsDecentralisationParam:ProtocolParams :: Rational
_protocolParamsDecentralisationParam = Rational
0.5
      , $sel:_protocolParamsExtraEntropy:ProtocolParams :: Maybe Text
_protocolParamsExtraEntropy = Maybe Text
forall a. Maybe a
Nothing
      , $sel:_protocolParamsProtocolMajorVer:ProtocolParams :: Integer
_protocolParamsProtocolMajorVer = Integer
2
      , $sel:_protocolParamsProtocolMinorVer:ProtocolParams :: Integer
_protocolParamsProtocolMinorVer = Integer
0
      , $sel:_protocolParamsMinUtxo:ProtocolParams :: Lovelaces
_protocolParamsMinUtxo = Discrete' "ADA" '(1000000, 1)
Lovelaces
1000000
      , $sel:_protocolParamsMinPoolCost:ProtocolParams :: Lovelaces
_protocolParamsMinPoolCost = Discrete' "ADA" '(1000000, 1)
Lovelaces
340000000
      , $sel:_protocolParamsNonce:ProtocolParams :: Text
_protocolParamsNonce = Text
"1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81"
      , $sel:_protocolParamsCostModels:ProtocolParams :: CostModels
_protocolParamsCostModels = CostModels
costModelsSample
      , $sel:_protocolParamsCostModelsRaw:ProtocolParams :: CostModelsRaw
_protocolParamsCostModelsRaw = CostModelsRaw
costModelsRawSample
      , $sel:_protocolParamsPriceMem:ProtocolParams :: Rational
_protocolParamsPriceMem = Rational
0.0577
      , $sel:_protocolParamsPriceStep:ProtocolParams :: Rational
_protocolParamsPriceStep = Rational
0.0000721
      , $sel:_protocolParamsMaxTxExMem:ProtocolParams :: Quantity
_protocolParamsMaxTxExMem = Quantity
10000000
      , $sel:_protocolParamsMaxTxExSteps:ProtocolParams :: Quantity
_protocolParamsMaxTxExSteps = Quantity
10000000000
      , $sel:_protocolParamsMaxBlockExMem:ProtocolParams :: Quantity
_protocolParamsMaxBlockExMem = Quantity
50000000
      , $sel:_protocolParamsMaxBlockExSteps:ProtocolParams :: Quantity
_protocolParamsMaxBlockExSteps = Quantity
40000000000
      , $sel:_protocolParamsMaxValSize:ProtocolParams :: Quantity
_protocolParamsMaxValSize = Quantity
5000
      , $sel:_protocolParamsCollateralPercent:ProtocolParams :: Integer
_protocolParamsCollateralPercent = Integer
150
      , $sel:_protocolParamsMaxCollateralInputs:ProtocolParams :: Integer
_protocolParamsMaxCollateralInputs = Integer
3
      , $sel:_protocolParamsCoinsPerUtxoSize:ProtocolParams :: Lovelaces
_protocolParamsCoinsPerUtxoSize = Discrete' "ADA" '(1000000, 1)
Lovelaces
34482
      , $sel:_protocolParamsCoinsPerUtxoWord:ProtocolParams :: Lovelaces
_protocolParamsCoinsPerUtxoWord = Discrete' "ADA" '(1000000, 1)
Lovelaces
34482
      , $sel:_protocolParamsPvtMotionNoConfidence:ProtocolParams :: Maybe Rational
_protocolParamsPvtMotionNoConfidence = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.51
      , $sel:_protocolParamsPvtCommitteeNormal:ProtocolParams :: Maybe Rational
_protocolParamsPvtCommitteeNormal = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.51
      , $sel:_protocolParamsPvtCommitteeNoConfidence:ProtocolParams :: Maybe Rational
_protocolParamsPvtCommitteeNoConfidence = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.51
      , $sel:_protocolParamsPvtHardForkInitiation:ProtocolParams :: Maybe Rational
_protocolParamsPvtHardForkInitiation = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.51
      , $sel:_protocolParamsPvtppSecurityGroup:ProtocolParams :: Maybe Rational
_protocolParamsPvtppSecurityGroup = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.51
      , $sel:_protocolParamsDvtMotionNoConfidence:ProtocolParams :: Maybe Rational
_protocolParamsDvtMotionNoConfidence = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.67
      , $sel:_protocolParamsDvtCommitteeNormal:ProtocolParams :: Maybe Rational
_protocolParamsDvtCommitteeNormal = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.67
      , $sel:_protocolParamsDvtCommitteeNoConfidence:ProtocolParams :: Maybe Rational
_protocolParamsDvtCommitteeNoConfidence = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.6
      , $sel:_protocolParamsDvtUpdateToConstitution:ProtocolParams :: Maybe Rational
_protocolParamsDvtUpdateToConstitution = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.75
      , $sel:_protocolParamsDvtHardForkInitiation:ProtocolParams :: Maybe Rational
_protocolParamsDvtHardForkInitiation = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.6
      , $sel:_protocolParamsDvtPPNetworkGroup:ProtocolParams :: Maybe Rational
_protocolParamsDvtPPNetworkGroup = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.67
      , $sel:_protocolParamsDvtPPEconomicGroup:ProtocolParams :: Maybe Rational
_protocolParamsDvtPPEconomicGroup = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.67
      , $sel:_protocolParamsDvtPPTechnicalGroup:ProtocolParams :: Maybe Rational
_protocolParamsDvtPPTechnicalGroup = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.67
      , $sel:_protocolParamsDvtPPGovGroup:ProtocolParams :: Maybe Rational
_protocolParamsDvtPPGovGroup = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.75
      , $sel:_protocolParamsDvtTreasuryWithdrawal:ProtocolParams :: Maybe Rational
_protocolParamsDvtTreasuryWithdrawal = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
0.67
      , $sel:_protocolParamsCommitteeMinSize:ProtocolParams :: Maybe Quantity
_protocolParamsCommitteeMinSize = Quantity -> Maybe Quantity
forall a. a -> Maybe a
Just Quantity
7
      , $sel:_protocolParamsCommitteeMaxTermLength:ProtocolParams :: Maybe Quantity
_protocolParamsCommitteeMaxTermLength = Quantity -> Maybe Quantity
forall a. a -> Maybe a
Just Quantity
146
      , $sel:_protocolParamsGovActionLifetime:ProtocolParams :: Maybe Quantity
_protocolParamsGovActionLifetime = Quantity -> Maybe Quantity
forall a. a -> Maybe a
Just Quantity
6
      , $sel:_protocolParamsGovActionDeposit:ProtocolParams :: Maybe Lovelaces
_protocolParamsGovActionDeposit = Discrete' "ADA" '(1000000, 1)
-> Maybe (Discrete' "ADA" '(1000000, 1))
forall a. a -> Maybe a
Just Discrete' "ADA" '(1000000, 1)
100000000000
      , $sel:_protocolParamsDrepDeposit:ProtocolParams :: Maybe Lovelaces
_protocolParamsDrepDeposit = Discrete' "ADA" '(1000000, 1)
-> Maybe (Discrete' "ADA" '(1000000, 1))
forall a. a -> Maybe a
Just Discrete' "ADA" '(1000000, 1)
500000000
      , $sel:_protocolParamsDrepActivity:ProtocolParams :: Maybe Quantity
_protocolParamsDrepActivity = Quantity -> Maybe Quantity
forall a. a -> Maybe a
Just Quantity
20
      , $sel:_protocolParamsMinFeeRefScriptCostPerByte:ProtocolParams :: Maybe Rational
_protocolParamsMinFeeRefScriptCostPerByte = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
15
      }

newtype CostModels = CostModels { CostModels -> Map ScriptType (Map Text Integer)
unCostModels :: Map ScriptType (Map Text Integer) }
  deriving (CostModels -> CostModels -> Bool
(CostModels -> CostModels -> Bool)
-> (CostModels -> CostModels -> Bool) -> Eq CostModels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CostModels -> CostModels -> Bool
== :: CostModels -> CostModels -> Bool
$c/= :: CostModels -> CostModels -> Bool
/= :: CostModels -> CostModels -> Bool
Eq, Int -> CostModels -> ShowS
[CostModels] -> ShowS
CostModels -> String
(Int -> CostModels -> ShowS)
-> (CostModels -> String)
-> ([CostModels] -> ShowS)
-> Show CostModels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CostModels -> ShowS
showsPrec :: Int -> CostModels -> ShowS
$cshow :: CostModels -> String
show :: CostModels -> String
$cshowList :: [CostModels] -> ShowS
showList :: [CostModels] -> ShowS
Show, (forall x. CostModels -> Rep CostModels x)
-> (forall x. Rep CostModels x -> CostModels) -> Generic CostModels
forall x. Rep CostModels x -> CostModels
forall x. CostModels -> Rep CostModels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CostModels -> Rep CostModels x
from :: forall x. CostModels -> Rep CostModels x
$cto :: forall x. Rep CostModels x -> CostModels
to :: forall x. Rep CostModels x -> CostModels
Generic)

instance ToJSON CostModels where
  toJSON :: CostModels -> Value
toJSON =
      [Pair] -> Value
object
    ([Pair] -> Value) -> (CostModels -> [Pair]) -> CostModels -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((ScriptType, Map Text Integer) -> Pair)
-> [(ScriptType, Map Text Integer)] -> [Pair]
forall a b. (a -> b) -> [a] -> [b]
map (\(ScriptType
lang, Map Text Integer
params) ->
        ( String -> Key
Data.Aeson.Key.fromString (String -> Key) -> String -> Key
forall a b. (a -> b) -> a -> b
$ ScriptType -> String
forall a. Show a => a -> String
show ScriptType
lang
        , [Pair] -> Value
object
          ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ ((Text, Integer) -> Pair) -> [(Text, Integer)] -> [Pair]
forall a b. (a -> b) -> [a] -> [b]
map (\(Text
key, Integer
param) ->
              ( Text -> Key
Data.Aeson.Key.fromText Text
key
              , Integer -> Value
forall a. ToJSON a => a -> Value
toJSON Integer
param)
            )
            ([(Text, Integer)] -> [Pair]) -> [(Text, Integer)] -> [Pair]
forall a b. (a -> b) -> a -> b
$ Map Text Integer -> [(Text, Integer)]
forall k a. Map k a -> [(k, a)]
Data.Map.toList Map Text Integer
params
        ))
    ([(ScriptType, Map Text Integer)] -> [Pair])
-> (CostModels -> [(ScriptType, Map Text Integer)])
-> CostModels
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map ScriptType (Map Text Integer)
-> [(ScriptType, Map Text Integer)]
forall k a. Map k a -> [(k, a)]
Data.Map.toList
    (Map ScriptType (Map Text Integer)
 -> [(ScriptType, Map Text Integer)])
-> (CostModels -> Map ScriptType (Map Text Integer))
-> CostModels
-> [(ScriptType, Map Text Integer)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CostModels -> Map ScriptType (Map Text Integer)
unCostModels

instance FromJSON CostModels where
  parseJSON :: Value -> Parser CostModels
parseJSON = String
-> (Object -> Parser CostModels) -> Value -> Parser CostModels
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"CostModel" ((Object -> Parser CostModels) -> Value -> Parser CostModels)
-> (Object -> Parser CostModels) -> Value -> Parser CostModels
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
    let parseParams :: Value -> Parser [(Text, Integer)]
parseParams = String
-> (Object -> Parser [(Text, Integer)])
-> Value
-> Parser [(Text, Integer)]
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"CostModelParams" ((Object -> Parser [(Text, Integer)])
 -> Value -> Parser [(Text, Integer)])
-> (Object -> Parser [(Text, Integer)])
-> Value
-> Parser [(Text, Integer)]
forall a b. (a -> b) -> a -> b
$ \Object
po -> do
          (Pair -> Parser (Text, Integer))
-> [Pair] -> Parser [(Text, Integer)]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM (Value -> Parser (Text, Integer)
forall a. FromJSON a => Value -> Parser a
parseJSON (Value -> Parser (Text, Integer))
-> (Pair -> Value) -> Pair -> Parser (Text, Integer)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Pair -> Value
forall a. ToJSON a => a -> Value
toJSON) ([Pair] -> Parser [(Text, Integer)])
-> [Pair] -> Parser [(Text, Integer)]
forall a b. (a -> b) -> a -> b
$ Object -> [Pair]
forall v. KeyMap v -> [(Key, v)]
Data.Aeson.KeyMap.toList Object
po

    [(ScriptType, Map Text Integer)]
langs <- (Pair -> Parser (ScriptType, Map Text Integer))
-> [Pair] -> Parser [(ScriptType, Map Text Integer)]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM
               (\(Key
kLang, Value
vParams) -> do
                 ScriptType
l <- Value -> Parser ScriptType
forall a. FromJSON a => Value -> Parser a
parseJSON
                    (Value -> Parser ScriptType) -> Value -> Parser ScriptType
forall a b. (a -> b) -> a -> b
$ String -> Value
forall a. ToJSON a => a -> Value
toJSON
                    (String -> Value) -> String -> Value
forall a b. (a -> b) -> a -> b
$ (\String
lang -> case String
lang of
                        [] -> ShowS
forall a. String -> [a]
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Absurd empty language in CostModels"
                        (Char
x:String
xs) -> Char -> Char
Data.Char.toLower Char
xChar -> ShowS
forall a. a -> [a] -> [a]
:String
xs
                      )
                    ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ Key -> String
Data.Aeson.Key.toString Key
kLang
                 [(Text, Integer)]
ps <- Value -> Parser [(Text, Integer)]
parseParams Value
vParams
                 (ScriptType, Map Text Integer)
-> Parser (ScriptType, Map Text Integer)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ScriptType
l, [(Text, Integer)] -> Map Text Integer
forall k a. Ord k => [(k, a)] -> Map k a
Data.Map.fromList [(Text, Integer)]
ps)
               )
               ([Pair] -> Parser [(ScriptType, Map Text Integer)])
-> [Pair] -> Parser [(ScriptType, Map Text Integer)]
forall a b. (a -> b) -> a -> b
$ Object -> [Pair]
forall v. KeyMap v -> [(Key, v)]
Data.Aeson.KeyMap.toList Object
o

    CostModels -> Parser CostModels
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (CostModels -> Parser CostModels)
-> CostModels -> Parser CostModels
forall a b. (a -> b) -> a -> b
$ Map ScriptType (Map Text Integer) -> CostModels
CostModels (Map ScriptType (Map Text Integer) -> CostModels)
-> Map ScriptType (Map Text Integer) -> CostModels
forall a b. (a -> b) -> a -> b
$ [(ScriptType, Map Text Integer)]
-> Map ScriptType (Map Text Integer)
forall k a. Ord k => [(k, a)] -> Map k a
Data.Map.fromList [(ScriptType, Map Text Integer)]
langs

newtype CostModelsRaw = CostModelsRaw { CostModelsRaw -> Map ScriptType [Integer]
unCostModelsRaw :: Map ScriptType [Integer] }
  deriving (CostModelsRaw -> CostModelsRaw -> Bool
(CostModelsRaw -> CostModelsRaw -> Bool)
-> (CostModelsRaw -> CostModelsRaw -> Bool) -> Eq CostModelsRaw
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CostModelsRaw -> CostModelsRaw -> Bool
== :: CostModelsRaw -> CostModelsRaw -> Bool
$c/= :: CostModelsRaw -> CostModelsRaw -> Bool
/= :: CostModelsRaw -> CostModelsRaw -> Bool
Eq, Int -> CostModelsRaw -> ShowS
[CostModelsRaw] -> ShowS
CostModelsRaw -> String
(Int -> CostModelsRaw -> ShowS)
-> (CostModelsRaw -> String)
-> ([CostModelsRaw] -> ShowS)
-> Show CostModelsRaw
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CostModelsRaw -> ShowS
showsPrec :: Int -> CostModelsRaw -> ShowS
$cshow :: CostModelsRaw -> String
show :: CostModelsRaw -> String
$cshowList :: [CostModelsRaw] -> ShowS
showList :: [CostModelsRaw] -> ShowS
Show, (forall x. CostModelsRaw -> Rep CostModelsRaw x)
-> (forall x. Rep CostModelsRaw x -> CostModelsRaw)
-> Generic CostModelsRaw
forall x. Rep CostModelsRaw x -> CostModelsRaw
forall x. CostModelsRaw -> Rep CostModelsRaw x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CostModelsRaw -> Rep CostModelsRaw x
from :: forall x. CostModelsRaw -> Rep CostModelsRaw x
$cto :: forall x. Rep CostModelsRaw x -> CostModelsRaw
to :: forall x. Rep CostModelsRaw x -> CostModelsRaw
Generic)

instance ToJSON CostModelsRaw where
  toJSON :: CostModelsRaw -> Value
toJSON =
      [Pair] -> Value
object
    ([Pair] -> Value)
-> (CostModelsRaw -> [Pair]) -> CostModelsRaw -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((ScriptType, [Integer]) -> Pair)
-> [(ScriptType, [Integer])] -> [Pair]
forall a b. (a -> b) -> [a] -> [b]
map (\(ScriptType
lang, [Integer]
params) ->
        ( String -> Key
Data.Aeson.Key.fromString (String -> Key) -> String -> Key
forall a b. (a -> b) -> a -> b
$ ScriptType -> String
forall a. Show a => a -> String
show ScriptType
lang
        , [Integer] -> Value
forall a. ToJSON a => a -> Value
toJSON [Integer]
params)
        )
    ([(ScriptType, [Integer])] -> [Pair])
-> (CostModelsRaw -> [(ScriptType, [Integer])])
-> CostModelsRaw
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map ScriptType [Integer] -> [(ScriptType, [Integer])]
forall k a. Map k a -> [(k, a)]
Data.Map.toList
    (Map ScriptType [Integer] -> [(ScriptType, [Integer])])
-> (CostModelsRaw -> Map ScriptType [Integer])
-> CostModelsRaw
-> [(ScriptType, [Integer])]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CostModelsRaw -> Map ScriptType [Integer]
unCostModelsRaw

instance FromJSON CostModelsRaw where
  parseJSON :: Value -> Parser CostModelsRaw
parseJSON = String
-> (Object -> Parser CostModelsRaw)
-> Value
-> Parser CostModelsRaw
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"CostModelsRaw" ((Object -> Parser CostModelsRaw) -> Value -> Parser CostModelsRaw)
-> (Object -> Parser CostModelsRaw)
-> Value
-> Parser CostModelsRaw
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
    [(ScriptType, [Integer])]
langs <- (Pair -> Parser (ScriptType, [Integer]))
-> [Pair] -> Parser [(ScriptType, [Integer])]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM
               (\(Key
kLang, Value
vParams) -> do
                 ScriptType
l <- Value -> Parser ScriptType
forall a. FromJSON a => Value -> Parser a
parseJSON
                    (Value -> Parser ScriptType) -> Value -> Parser ScriptType
forall a b. (a -> b) -> a -> b
$ String -> Value
forall a. ToJSON a => a -> Value
toJSON
                    (String -> Value) -> String -> Value
forall a b. (a -> b) -> a -> b
$ (\String
lang -> case String
lang of
                        [] -> ShowS
forall a. String -> [a]
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Absurd empty language in CostModelsRaw"
                        (Char
x:String
xs) -> Char -> Char
Data.Char.toLower Char
xChar -> ShowS
forall a. a -> [a] -> [a]
:String
xs
                      )
                    ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ Key -> String
Data.Aeson.Key.toString Key
kLang
                 [Integer]
ps <- Value -> Parser [Integer]
forall a. FromJSON a => Value -> Parser a
parseJSON Value
vParams
                 (ScriptType, [Integer]) -> Parser (ScriptType, [Integer])
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ScriptType
l, [Integer]
ps)
               )
               ([Pair] -> Parser [(ScriptType, [Integer])])
-> [Pair] -> Parser [(ScriptType, [Integer])]
forall a b. (a -> b) -> a -> b
$ Object -> [Pair]
forall v. KeyMap v -> [(Key, v)]
Data.Aeson.KeyMap.toList Object
o

    CostModelsRaw -> Parser CostModelsRaw
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (CostModelsRaw -> Parser CostModelsRaw)
-> CostModelsRaw -> Parser CostModelsRaw
forall a b. (a -> b) -> a -> b
$ Map ScriptType [Integer] -> CostModelsRaw
CostModelsRaw (Map ScriptType [Integer] -> CostModelsRaw)
-> Map ScriptType [Integer] -> CostModelsRaw
forall a b. (a -> b) -> a -> b
$ [(ScriptType, [Integer])] -> Map ScriptType [Integer]
forall k a. Ord k => [(k, a)] -> Map k a
Data.Map.fromList [(ScriptType, [Integer])]
langs

costModelsSample :: CostModels
costModelsSample :: CostModels
costModelsSample = Map ScriptType (Map Text Integer) -> CostModels
CostModels
      (Map ScriptType (Map Text Integer) -> CostModels)
-> Map ScriptType (Map Text Integer) -> CostModels
forall a b. (a -> b) -> a -> b
$ [(ScriptType, Map Text Integer)]
-> Map ScriptType (Map Text Integer)
forall k a. Ord k => [(k, a)] -> Map k a
Data.Map.fromList
      [ ( ScriptType
PlutusV1
        , [(Text, Integer)] -> Map Text Integer
forall k a. Ord k => [(k, a)] -> Map k a
Data.Map.fromList
          [ (Text
"addInteger-cpu-arguments-intercept", Integer
197209)
          , (Text
"addInteger-cpu-arguments-slope", Integer
0)
          ]
        )
      , (ScriptType
PlutusV2
        , [(Text, Integer)] -> Map Text Integer
forall k a. Ord k => [(k, a)] -> Map k a
Data.Map.fromList
          [ (Text
"addInteger-cpu-arguments-intercept", Integer
197209)
          , (Text
"addInteger-cpu-arguments-slope", Integer
0)
          ]
        )
      ]

instance ToSample CostModels where
  toSamples :: Proxy CostModels -> [(Text, CostModels)]
toSamples = [(Text, CostModels)] -> Proxy CostModels -> [(Text, CostModels)]
forall a. a -> Proxy CostModels -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, CostModels)] -> Proxy CostModels -> [(Text, CostModels)])
-> [(Text, CostModels)] -> Proxy CostModels -> [(Text, CostModels)]
forall a b. (a -> b) -> a -> b
$ CostModels -> [(Text, CostModels)]
forall a. a -> [(Text, a)]
singleSample CostModels
costModelsSample

costModelsRawSample :: CostModelsRaw
costModelsRawSample :: CostModelsRaw
costModelsRawSample = Map ScriptType [Integer] -> CostModelsRaw
CostModelsRaw
      (Map ScriptType [Integer] -> CostModelsRaw)
-> Map ScriptType [Integer] -> CostModelsRaw
forall a b. (a -> b) -> a -> b
$ [(ScriptType, [Integer])] -> Map ScriptType [Integer]
forall k a. Ord k => [(k, a)] -> Map k a
Data.Map.fromList
      [ ( ScriptType
PlutusV1
        , [ Integer
197209
          , Integer
0
          ]
        )
      , (ScriptType
PlutusV2
        , [ Integer
197209
          , Integer
0
          ]
        )
      ]

instance ToSample CostModelsRaw where
  toSamples :: Proxy CostModelsRaw -> [(Text, CostModelsRaw)]
toSamples = [(Text, CostModelsRaw)]
-> Proxy CostModelsRaw -> [(Text, CostModelsRaw)]
forall a. a -> Proxy CostModelsRaw -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, CostModelsRaw)]
 -> Proxy CostModelsRaw -> [(Text, CostModelsRaw)])
-> [(Text, CostModelsRaw)]
-> Proxy CostModelsRaw
-> [(Text, CostModelsRaw)]
forall a b. (a -> b) -> a -> b
$ CostModelsRaw -> [(Text, CostModelsRaw)]
forall a. a -> [(Text, a)]
singleSample CostModelsRaw
costModelsRawSample

-- | Active stake distribution for an epoch
data StakeDistribution = StakeDistribution
  { StakeDistribution -> Address
_stakeDistributionStakeAddress :: Address -- ^ Stake address
  , StakeDistribution -> PoolId
_stakeDistributionPoolId       :: PoolId -- ^ Bech32 prefix of the pool delegated to
  , StakeDistribution -> Lovelaces
_stakeDistributionAmount       :: Lovelaces -- ^ Amount of active delegated stake in Lovelaces
  }
  deriving stock (Int -> StakeDistribution -> ShowS
[StakeDistribution] -> ShowS
StakeDistribution -> String
(Int -> StakeDistribution -> ShowS)
-> (StakeDistribution -> String)
-> ([StakeDistribution] -> ShowS)
-> Show StakeDistribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StakeDistribution -> ShowS
showsPrec :: Int -> StakeDistribution -> ShowS
$cshow :: StakeDistribution -> String
show :: StakeDistribution -> String
$cshowList :: [StakeDistribution] -> ShowS
showList :: [StakeDistribution] -> ShowS
Show, StakeDistribution -> StakeDistribution -> Bool
(StakeDistribution -> StakeDistribution -> Bool)
-> (StakeDistribution -> StakeDistribution -> Bool)
-> Eq StakeDistribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StakeDistribution -> StakeDistribution -> Bool
== :: StakeDistribution -> StakeDistribution -> Bool
$c/= :: StakeDistribution -> StakeDistribution -> Bool
/= :: StakeDistribution -> StakeDistribution -> Bool
Eq, (forall x. StakeDistribution -> Rep StakeDistribution x)
-> (forall x. Rep StakeDistribution x -> StakeDistribution)
-> Generic StakeDistribution
forall x. Rep StakeDistribution x -> StakeDistribution
forall x. StakeDistribution -> Rep StakeDistribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. StakeDistribution -> Rep StakeDistribution x
from :: forall x. StakeDistribution -> Rep StakeDistribution x
$cto :: forall x. Rep StakeDistribution x -> StakeDistribution
to :: forall x. Rep StakeDistribution x -> StakeDistribution
Generic)
  deriving (Maybe StakeDistribution
Value -> Parser [StakeDistribution]
Value -> Parser StakeDistribution
(Value -> Parser StakeDistribution)
-> (Value -> Parser [StakeDistribution])
-> Maybe StakeDistribution
-> FromJSON StakeDistribution
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser StakeDistribution
parseJSON :: Value -> Parser StakeDistribution
$cparseJSONList :: Value -> Parser [StakeDistribution]
parseJSONList :: Value -> Parser [StakeDistribution]
$comittedField :: Maybe StakeDistribution
omittedField :: Maybe StakeDistribution
FromJSON, [StakeDistribution] -> Value
[StakeDistribution] -> Encoding
StakeDistribution -> Bool
StakeDistribution -> Value
StakeDistribution -> Encoding
(StakeDistribution -> Value)
-> (StakeDistribution -> Encoding)
-> ([StakeDistribution] -> Value)
-> ([StakeDistribution] -> Encoding)
-> (StakeDistribution -> Bool)
-> ToJSON StakeDistribution
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: StakeDistribution -> Value
toJSON :: StakeDistribution -> Value
$ctoEncoding :: StakeDistribution -> Encoding
toEncoding :: StakeDistribution -> Encoding
$ctoJSONList :: [StakeDistribution] -> Value
toJSONList :: [StakeDistribution] -> Value
$ctoEncodingList :: [StakeDistribution] -> Encoding
toEncodingList :: [StakeDistribution] -> Encoding
$comitField :: StakeDistribution -> Bool
omitField :: StakeDistribution -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_stakeDistribution", CamelToSnake]] StakeDistribution

instance ToSample StakeDistribution where
  toSamples :: Proxy StakeDistribution -> [(Text, StakeDistribution)]
toSamples = [(Text, StakeDistribution)]
-> Proxy StakeDistribution -> [(Text, StakeDistribution)]
forall a. a -> Proxy StakeDistribution -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, StakeDistribution)]
 -> Proxy StakeDistribution -> [(Text, StakeDistribution)])
-> [(Text, StakeDistribution)]
-> Proxy StakeDistribution
-> [(Text, StakeDistribution)]
forall a b. (a -> b) -> a -> b
$ StakeDistribution -> [(Text, StakeDistribution)]
forall a. a -> [(Text, a)]
singleSample
    StakeDistribution
      { $sel:_stakeDistributionStakeAddress:StakeDistribution :: Address
_stakeDistributionStakeAddress = Address
"stake1u9l5q5jwgelgagzyt6nuaasefgmn8pd25c8e9qpeprq0tdcp0e3uk"
      , $sel:_stakeDistributionPoolId:StakeDistribution :: PoolId
_stakeDistributionPoolId = PoolId
"pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"
      , $sel:_stakeDistributionAmount:StakeDistribution :: Lovelaces
_stakeDistributionAmount = Discrete' "ADA" '(1000000, 1)
Lovelaces
4440295078
      }

-- | Stake distribution for an epoch for specific pool
data PoolStakeDistribution = PoolStakeDistribution
  { PoolStakeDistribution -> Address
_poolStakeDistributionStakeAddress :: Address -- ^ Stake address
  , PoolStakeDistribution -> Lovelaces
_poolStakeDistributionAmount       :: Lovelaces -- ^ Amount of active delegated stake in Lovelaces
  }
  deriving stock (Int -> PoolStakeDistribution -> ShowS
[PoolStakeDistribution] -> ShowS
PoolStakeDistribution -> String
(Int -> PoolStakeDistribution -> ShowS)
-> (PoolStakeDistribution -> String)
-> ([PoolStakeDistribution] -> ShowS)
-> Show PoolStakeDistribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolStakeDistribution -> ShowS
showsPrec :: Int -> PoolStakeDistribution -> ShowS
$cshow :: PoolStakeDistribution -> String
show :: PoolStakeDistribution -> String
$cshowList :: [PoolStakeDistribution] -> ShowS
showList :: [PoolStakeDistribution] -> ShowS
Show, PoolStakeDistribution -> PoolStakeDistribution -> Bool
(PoolStakeDistribution -> PoolStakeDistribution -> Bool)
-> (PoolStakeDistribution -> PoolStakeDistribution -> Bool)
-> Eq PoolStakeDistribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolStakeDistribution -> PoolStakeDistribution -> Bool
== :: PoolStakeDistribution -> PoolStakeDistribution -> Bool
$c/= :: PoolStakeDistribution -> PoolStakeDistribution -> Bool
/= :: PoolStakeDistribution -> PoolStakeDistribution -> Bool
Eq, (forall x. PoolStakeDistribution -> Rep PoolStakeDistribution x)
-> (forall x. Rep PoolStakeDistribution x -> PoolStakeDistribution)
-> Generic PoolStakeDistribution
forall x. Rep PoolStakeDistribution x -> PoolStakeDistribution
forall x. PoolStakeDistribution -> Rep PoolStakeDistribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PoolStakeDistribution -> Rep PoolStakeDistribution x
from :: forall x. PoolStakeDistribution -> Rep PoolStakeDistribution x
$cto :: forall x. Rep PoolStakeDistribution x -> PoolStakeDistribution
to :: forall x. Rep PoolStakeDistribution x -> PoolStakeDistribution
Generic)
  deriving (Maybe PoolStakeDistribution
Value -> Parser [PoolStakeDistribution]
Value -> Parser PoolStakeDistribution
(Value -> Parser PoolStakeDistribution)
-> (Value -> Parser [PoolStakeDistribution])
-> Maybe PoolStakeDistribution
-> FromJSON PoolStakeDistribution
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PoolStakeDistribution
parseJSON :: Value -> Parser PoolStakeDistribution
$cparseJSONList :: Value -> Parser [PoolStakeDistribution]
parseJSONList :: Value -> Parser [PoolStakeDistribution]
$comittedField :: Maybe PoolStakeDistribution
omittedField :: Maybe PoolStakeDistribution
FromJSON, [PoolStakeDistribution] -> Value
[PoolStakeDistribution] -> Encoding
PoolStakeDistribution -> Bool
PoolStakeDistribution -> Value
PoolStakeDistribution -> Encoding
(PoolStakeDistribution -> Value)
-> (PoolStakeDistribution -> Encoding)
-> ([PoolStakeDistribution] -> Value)
-> ([PoolStakeDistribution] -> Encoding)
-> (PoolStakeDistribution -> Bool)
-> ToJSON PoolStakeDistribution
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PoolStakeDistribution -> Value
toJSON :: PoolStakeDistribution -> Value
$ctoEncoding :: PoolStakeDistribution -> Encoding
toEncoding :: PoolStakeDistribution -> Encoding
$ctoJSONList :: [PoolStakeDistribution] -> Value
toJSONList :: [PoolStakeDistribution] -> Value
$ctoEncodingList :: [PoolStakeDistribution] -> Encoding
toEncodingList :: [PoolStakeDistribution] -> Encoding
$comitField :: PoolStakeDistribution -> Bool
omitField :: PoolStakeDistribution -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_poolStakeDistribution", CamelToSnake]] PoolStakeDistribution

instance ToSample PoolStakeDistribution where
  toSamples :: Proxy PoolStakeDistribution -> [(Text, PoolStakeDistribution)]
toSamples = [(Text, PoolStakeDistribution)]
-> Proxy PoolStakeDistribution -> [(Text, PoolStakeDistribution)]
forall a. a -> Proxy PoolStakeDistribution -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, PoolStakeDistribution)]
 -> Proxy PoolStakeDistribution -> [(Text, PoolStakeDistribution)])
-> [(Text, PoolStakeDistribution)]
-> Proxy PoolStakeDistribution
-> [(Text, PoolStakeDistribution)]
forall a b. (a -> b) -> a -> b
$ PoolStakeDistribution -> [(Text, PoolStakeDistribution)]
forall a. a -> [(Text, a)]
singleSample
    PoolStakeDistribution
      { $sel:_poolStakeDistributionStakeAddress:PoolStakeDistribution :: Address
_poolStakeDistributionStakeAddress = Address
"stake1u9l5q5jwgelgagzyt6nuaasefgmn8pd25c8e9qpeprq0tdcp0e3uk"
      , $sel:_poolStakeDistributionAmount:PoolStakeDistribution :: Lovelaces
_poolStakeDistributionAmount = Discrete' "ADA" '(1000000, 1)
Lovelaces
4440295078
      }