Began applying Emily's suggestions

This commit is contained in:
Jack Hodgkinson 2022-03-02 16:46:09 +00:00
parent 3fc7a39902
commit fbf87a9165
3 changed files with 6 additions and 12 deletions

View file

@ -1,6 +1,6 @@
SHELL := /usr/bin/env bash SHELL := /usr/bin/env bash
.PHONY: hoogle format usage .PHONY: hoogle format haddock usage
usage: usage:
@echo "usage: make <command> [OPTIONS]" @echo "usage: make <command> [OPTIONS]"

View file

@ -76,7 +76,6 @@ common lang
TypeOperators TypeOperators
TypeSynonymInstances TypeSynonymInstances
UndecidableInstances UndecidableInstances
UndecidableInstances
ViewPatterns ViewPatterns
OverloadedRecordDot OverloadedRecordDot
QualifiedDo QualifiedDo

View file

@ -1,5 +1,3 @@
{-# OPTIONS_GHC -Wwarn #-}
{- | {- |
Module: Agora.Treasury Module: Agora.Treasury
Maintainer: jack@mlabs.city Maintainer: jack@mlabs.city
@ -8,7 +6,7 @@ Description: Treasury scripts.
Contains the datum, redeemer and validator for a template DAO Contains the datum, redeemer and validator for a template DAO
treasury. treasury.
-} -}
module Agora.Treasury where module Agora.Treasury (treasuryV) where
import GHC.Generics qualified as GHC import GHC.Generics qualified as GHC
import Generics.SOP import Generics.SOP
@ -20,8 +18,8 @@ import Plutarch.Api.V1.Contexts (
import Plutarch.Api.V1.Maybe (PMaybeData (PDJust)) import Plutarch.Api.V1.Maybe (PMaybeData (PDJust))
import Plutarch.Api.V1.Scripts (PDatum, PDatumHash) import Plutarch.Api.V1.Scripts (PDatum, PDatumHash)
import Plutarch.Api.V1.Tx ( import Plutarch.Api.V1.Tx (
PTxInInfo (PTxInInfo), PTxInInfo,
PTxOut (PTxOut), PTxOut,
) )
import Plutarch.Api.V1.Value (PCurrencySymbol, PValue) import Plutarch.Api.V1.Value (PCurrencySymbol, PValue)
import Plutarch.Builtin (pforgetData) import Plutarch.Builtin (pforgetData)
@ -107,7 +105,7 @@ getTrDatumHash = plam $ \d l -> P.do
) )
matchDatums = plam $ \d t' -> matchDatums = plam $ \d t' ->
let t = pfield @"_1" # t' let t = pfield @"_1" # t'
in (pforgetData d) #== (pforgetData t) in pforgetData d #== pforgetData t
-- | Get the "resolved" field of a TxInInfo. -- | Get the "resolved" field of a TxInInfo.
toResolved :: Term s (PAsData PTxInInfo :--> PAsData PTxOut) toResolved :: Term s (PAsData PTxInInfo :--> PAsData PTxOut)
@ -133,8 +131,6 @@ getValAtDHash = plam $ \dh outs -> P.do
{- | Plutarch level type representing datum of the treasury. {- | Plutarch level type representing datum of the treasury.
Contains: Contains:
- @reserves@ representing the current value kept in the
treasury.
- @stateThread@ representing the asset class of the - @stateThread@ representing the asset class of the
treasury's state thread token. treasury's state thread token.
-} -}
@ -143,8 +139,7 @@ newtype PTreasuryDatum (s :: S)
( Term ( Term
s s
( PDataRecord ( PDataRecord
'[ "reserves" ':= PValue '[ "stateThread" ':= PCurrencySymbol
, "stateThread" ':= PCurrencySymbol
] ]
) )
) )