apply Emily's suggestions

This commit is contained in:
fanghr 2022-05-16 19:59:11 +08:00
parent 28afcf2f65
commit f45b919d0e
2 changed files with 9 additions and 16 deletions

View file

@ -22,9 +22,8 @@ import Plutarch.SafeMoney.Tagged
import Plutus.V1.Ledger.Address (scriptHashAddress) import Plutus.V1.Ledger.Address (scriptHashAddress)
import Plutus.V1.Ledger.Api ( import Plutus.V1.Ledger.Api (
Address (..), Address (..),
Credential (PubKeyCredential), Credential (ScriptCredential),
Datum (..), Datum (..),
PubKeyHash,
ScriptContext (..), ScriptContext (..),
ScriptPurpose (Minting, Spending), ScriptPurpose (Minting, Spending),
ToData (toBuiltinData), ToData (toBuiltinData),
@ -126,11 +125,10 @@ mintGST =
--- ---
-- TODO: Can the witness be a script? witness :: ValidatorHash
witness :: PubKeyHash
witness = "a926a9a72a0963f428e3252caa8354e655603996fb8892d6b8323fd072345924" witness = "a926a9a72a0963f428e3252caa8354e655603996fb8892d6b8323fd072345924"
witnessAddress :: Address witnessAddress :: Address
witnessAddress = Address (PubKeyCredential witness) Nothing witnessAddress = Address (ScriptCredential witness) Nothing
--- ---
@ -142,13 +140,13 @@ mintGST =
, txOutValue = mempty , txOutValue = mempty
, txOutDatumHash = Nothing , txOutDatumHash = Nothing
} }
witnessUTXO :: TxInInfo initialSpend :: TxInInfo
witnessUTXO = TxInInfo gstUTXORef witnessInput initialSpend = TxInInfo gstUTXORef witnessInput
in ScriptContext in ScriptContext
{ scriptContextTxInfo = { scriptContextTxInfo =
TxInfo TxInfo
{ txInfoInputs = { txInfoInputs =
[ witnessUTXO [ initialSpend
] ]
, txInfoOutputs = [governorOutput] , txInfoOutputs = [governorOutput]
, -- Some ada to cover the transaction fee , -- Some ada to cover the transaction fee
@ -158,7 +156,7 @@ mintGST =
, txInfoDCert = [] , txInfoDCert = []
, txInfoWdrl = [] , txInfoWdrl = []
, txInfoValidRange = Interval.always , txInfoValidRange = Interval.always
, txInfoSignatories = [witness] , txInfoSignatories = [signer]
, txInfoData = [datumPair governorOutputDatum] , txInfoData = [datumPair governorOutputDatum]
, txInfoId = "90906d3e6b4d6dec2e747dcdd9617940ea8358164c7244694cfa39dec18bd9d4" , txInfoId = "90906d3e6b4d6dec2e747dcdd9617940ea8358164c7244694cfa39dec18bd9d4"
} }
@ -407,8 +405,7 @@ mintGATs =
{ P.proposalId = ProposalId 0 { P.proposalId = ProposalId 0
, effects = effects , effects = effects
, status = Locked , status = Locked
, -- TODO: Any need to check minimun amount of cosigners here? , cosigners = [signer, signer2]
cosigners = [signer, signer2]
, thresholds = defaultProposalThresholds , thresholds = defaultProposalThresholds
, votes = proposalVotes , votes = proposalVotes
} }

View file

@ -416,11 +416,7 @@ proposalDatumValid proposal =
let atLeastOneNegativeResult = let atLeastOneNegativeResult =
pany pany
# phoistAcyclic # phoistAcyclic
( plam $ \m -> (plam $ \m -> pnull #$ pto $ pfromData $ psndBuiltin # m)
let l :: Term _ (PBuiltinList _)
l = pto $ pfromData $ psndBuiltin # m
in pnull # l
)
#$ pto #$ pto
$ pfromData datum.effects $ pfromData datum.effects