From 8b5264725390f387e6eaac6fb157ad6b6d57871d Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Fri, 6 Sep 2024 19:22:24 +0530 Subject: [PATCH] feat(#58): add conway related protocol parameters --- .../src/Blockfrost/Types/Cardano/Epochs.hs | 46 ++++++++++++++++++- blockfrost-api/test/Cardano/Epochs.hs | 46 ++++++++++++++++++- 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/blockfrost-api/src/Blockfrost/Types/Cardano/Epochs.hs b/blockfrost-api/src/Blockfrost/Types/Cardano/Epochs.hs index a0c8df6..3114f21 100644 --- a/blockfrost-api/src/Blockfrost/Types/Cardano/Epochs.hs +++ b/blockfrost-api/src/Blockfrost/Types/Cardano/Epochs.hs @@ -88,10 +88,32 @@ data ProtocolParams = ProtocolParams , _protocolParamsMaxCollateralInputs :: Integer -- ^ The maximum number of collateral inputs allowed in a transaction , _protocolParamsCoinsPerUtxoSize :: Lovelaces -- ^ The cost per UTxO size. Cost per UTxO *word* for Alozno. Cost per UTxO *byte* for Babbage and later , _protocolParamsCoinsPerUtxoWord :: Lovelaces -- ^ The cost per UTxO word (DEPRECATED) + , _protocolParamsPvtMotionNoConfidence :: Maybe Rational + , _protocolParamsPvtCommitteeNormal :: Maybe Rational + , _protocolParamsPvtCommitteeNoConfidence :: Maybe Rational + , _protocolParamsPvtHardForkInitiation :: Maybe Rational + , _protocolParamsPvtppSecurityGroup :: Maybe Rational + , _protocolParamsDvtMotionNoConfidence :: Maybe Rational + , _protocolParamsDvtCommitteeNormal :: Maybe Rational + , _protocolParamsDvtCommitteeNoConfidence :: Maybe Rational + , _protocolParamsDvtUpdateToConstitution :: Maybe Rational + , _protocolParamsDvtHardForkInitiation :: Maybe Rational + , _protocolParamsDvtPPNetworkGroup :: Maybe Rational + , _protocolParamsDvtPPEconomicGroup :: Maybe Rational + , _protocolParamsDvtPPTechnicalGroup :: Maybe Rational + , _protocolParamsDvtPPGovGroup :: Maybe Rational + , _protocolParamsDvtTreasuryWithdrawal :: Maybe Rational + , _protocolParamsCommitteeMinSize :: Maybe Quantity + , _protocolParamsCommitteeMaxTermLength :: Maybe Quantity + , _protocolParamsGovActionLifetime :: Maybe Quantity + , _protocolParamsGovActionDeposit :: Maybe Lovelaces + , _protocolParamsDrepDeposit :: Maybe Lovelaces + , _protocolParamsDrepActivity :: Maybe Quantity + , _protocolParamsMinFeeRefScriptCostPerByte :: Maybe Integer } deriving stock (Show, Eq, Generic) deriving (FromJSON, ToJSON) - via CustomJSON '[FieldLabelModifier '[StripPrefix "_protocolParams", CamelToSnake]] ProtocolParams + 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 = pure $ singleSample @@ -128,6 +150,28 @@ instance ToSample ProtocolParams where , _protocolParamsMaxCollateralInputs = 3 , _protocolParamsCoinsPerUtxoSize = 34482 , _protocolParamsCoinsPerUtxoWord = 34482 + , _protocolParamsPvtMotionNoConfidence = Just 0.51 + , _protocolParamsPvtCommitteeNormal = Just 0.51 + , _protocolParamsPvtCommitteeNoConfidence = Just 0.51 + , _protocolParamsPvtHardForkInitiation = Just 0.51 + , _protocolParamsPvtppSecurityGroup = Just 0.51 + , _protocolParamsDvtMotionNoConfidence = Just 0.67 + , _protocolParamsDvtCommitteeNormal = Just 0.67 + , _protocolParamsDvtCommitteeNoConfidence = Just 0.6 + , _protocolParamsDvtUpdateToConstitution = Just 0.75 + , _protocolParamsDvtHardForkInitiation = Just 0.6 + , _protocolParamsDvtPPNetworkGroup = Just 0.67 + , _protocolParamsDvtPPEconomicGroup = Just 0.67 + , _protocolParamsDvtPPTechnicalGroup = Just 0.67 + , _protocolParamsDvtPPGovGroup = Just 0.75 + , _protocolParamsDvtTreasuryWithdrawal = Just 0.67 + , _protocolParamsCommitteeMinSize = Just 7 + , _protocolParamsCommitteeMaxTermLength = Just 146 + , _protocolParamsGovActionLifetime = Just 6 + , _protocolParamsGovActionDeposit = Just 100000000000 + , _protocolParamsDrepDeposit = Just 500000000 + , _protocolParamsDrepActivity = Just 20 + , _protocolParamsMinFeeRefScriptCostPerByte = Just 15 } newtype CostModels = CostModels { unCostModels :: Map ScriptType (Map Text Integer) } diff --git a/blockfrost-api/test/Cardano/Epochs.hs b/blockfrost-api/test/Cardano/Epochs.hs index ffd78b1..29b5045 100644 --- a/blockfrost-api/test/Cardano/Epochs.hs +++ b/blockfrost-api/test/Cardano/Epochs.hs @@ -110,7 +110,29 @@ protocolParamsSample = [r| "collateral_percent": 150, "max_collateral_inputs": 3, "coins_per_utxo_size": "34482", - "coins_per_utxo_word": "34482" + "coins_per_utxo_word": "34482", + "pvt_motion_no_confidence": 0.51, + "pvt_committee_normal": 0.51, + "pvt_committee_no_confidence": 0.51, + "pvt_hard_fork_initiation": 0.51, + "dvt_motion_no_confidence": 0.67, + "dvt_committee_normal": 0.67, + "dvt_committee_no_confidence": 0.6, + "dvt_update_to_constitution": 0.75, + "dvt_hard_fork_initiation": 0.6, + "dvt_p_p_network_group": 0.67, + "dvt_p_p_economic_group": 0.67, + "dvt_p_p_technical_group": 0.67, + "dvt_p_p_gov_group": 0.75, + "dvt_treasury_withdrawal": 0.67, + "committee_min_size": "7", + "committee_max_term_length": "146", + "gov_action_lifetime": "6", + "gov_action_deposit": "100000000000", + "drep_deposit": "500000000", + "drep_activity": "20", + "pvtpp_security_group": 0.51, + "min_fee_ref_script_cost_per_byte": 15 } |] @@ -164,6 +186,28 @@ protocolParamsExpected = , _protocolParamsCoinsPerUtxoSize = 34482 -- deprecated , _protocolParamsCoinsPerUtxoWord = 34482 + , _protocolParamsPvtMotionNoConfidence = Just 0.51 + , _protocolParamsPvtCommitteeNormal = Just 0.51 + , _protocolParamsPvtCommitteeNoConfidence = Just 0.51 + , _protocolParamsPvtHardForkInitiation = Just 0.51 + , _protocolParamsPvtppSecurityGroup = Just 0.51 + , _protocolParamsDvtMotionNoConfidence = Just 0.67 + , _protocolParamsDvtCommitteeNormal = Just 0.67 + , _protocolParamsDvtCommitteeNoConfidence = Just 0.6 + , _protocolParamsDvtUpdateToConstitution = Just 0.75 + , _protocolParamsDvtHardForkInitiation = Just 0.6 + , _protocolParamsDvtPPNetworkGroup = Just 0.67 + , _protocolParamsDvtPPEconomicGroup = Just 0.67 + , _protocolParamsDvtPPTechnicalGroup = Just 0.67 + , _protocolParamsDvtPPGovGroup = Just 0.75 + , _protocolParamsDvtTreasuryWithdrawal = Just 0.67 + , _protocolParamsCommitteeMinSize = Just 7 + , _protocolParamsCommitteeMaxTermLength = Just 146 + , _protocolParamsGovActionLifetime = Just 6 + , _protocolParamsGovActionDeposit = Just 100000000000 + , _protocolParamsDrepDeposit = Just 500000000 + , _protocolParamsDrepActivity = Just 20 + , _protocolParamsMinFeeRefScriptCostPerByte = Just 15 } stakeDistributionSample = [r|