From 16211998f63ce8beb9aa16b97d2ea55630f8e50b Mon Sep 17 00:00:00 2001 From: Emily Martins Date: Fri, 4 Mar 2022 17:16:16 +0100 Subject: [PATCH] rename `AlterTrParams` to `AlterTreasuryParams` --- docs/tech-design/treasury.md | 10 +++++----- flake.lock | 2 ++ src/Agora/Treasury.hs | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/tech-design/treasury.md b/docs/tech-design/treasury.md index fe15702..8d3993b 100644 --- a/docs/tech-design/treasury.md +++ b/docs/tech-design/treasury.md @@ -55,8 +55,8 @@ The script for an Agora treasury is described in this section. For clarity, all ### Datum ```hs -newtype TreasuryDtum = TreasuryDatum - { -- | Currency symbol of the treasury state thread. +newtype TreasuryDatum = TreasuryDatum + { -- | Currency symbol of the treasury state thread. stateThread :: CurrencySymbol } ``` @@ -64,16 +64,16 @@ newtype TreasuryDtum = TreasuryDatum ### Redeemers ```hs -newtype TreasuryRedeemer = AlterTrParams +newtype TreasuryRedeemer = AlterTreasuryParams ``` -At the current stage, it is sufficient to allow users to simply grant funds to the treasury, without an explicit redeemer. The only redeemer that is required is `AlterTrParams`, for when the treasury's parameters are subject to change by a proposal effect. +At the current stage, it is sufficient to allow users to simply grant funds to the treasury, without an explicit redeemer. The only redeemer that is required is `AlterTreasuryParams`, for when the treasury's parameters are subject to change by a proposal effect. ### Validators ```hs treasuryV :: - CurrencySymbol -> + CurrencySymbol -> TreasuryDatum -> TreasuryRedeemer -> ScriptContext -> diff --git a/flake.lock b/flake.lock index 6247424..f5ab6be 100644 --- a/flake.lock +++ b/flake.lock @@ -440,6 +440,8 @@ "hpc-coveralls": "hpc-coveralls", "nix-tools": "nix-tools", "nixpkgs": [ + "plutarch", + "haskell-nix", "nixpkgs-2111" ], "nixpkgs-2003": "nixpkgs-2003", diff --git a/src/Agora/Treasury.hs b/src/Agora/Treasury.hs index 9bf407f..3fb0b33 100644 --- a/src/Agora/Treasury.hs +++ b/src/Agora/Treasury.hs @@ -38,12 +38,12 @@ treasuryV cs tn = plam $ \_d r ctx' -> P.do -- plet required fields from script context. ctx <- pletFields @["txInfo", "purpose"] ctx' - -- Ensure redeemer type is valid. - PAlterTrParams _ <- pmatch $ pfromData r - -- Ensure that script is for burning i.e. minting a negative amount. PMinting _ <- pmatch ctx.purpose + -- Ensure redeemer type is valid. + PAlterTreasuryParams _ <- pmatch $ pfromData r + -- Get the minted value from txInfo. txInfo' <- plet ctx.txInfo txInfo <- pletFields @'["mint"] txInfo' @@ -84,7 +84,7 @@ newtype PTreasuryDatum (s :: S) newtype PTreasuryRedeemer (s :: S) = -- | Alters treasury parameters, subject to the burning of a -- governance authority token. - PAlterTrParams (Term s (PDataRecord '[])) + PAlterTreasuryParams (Term s (PDataRecord '[])) deriving stock (GHC.Generic) deriving anyclass (Generic, PIsDataRepr) deriving