From fa9bf56f4a0ee07c29f00a9dd98dc25bf3c20c29 Mon Sep 17 00:00:00 2001 From: Emily Martins Date: Wed, 2 Mar 2022 21:23:40 +0100 Subject: [PATCH] add signer assertion to Stake validator --- src/Agora/Stake.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Agora/Stake.hs b/src/Agora/Stake.hs index a4dcc24..74a4c65 100644 --- a/src/Agora/Stake.hs +++ b/src/Agora/Stake.hs @@ -215,6 +215,7 @@ stakeValidator stake = PJust txInInfo <- pmatch $ pfindTxInByTxOutRef # (pfield @"_0" # txOutRef) # txInfo' ownAddress <- plet $ pfield @"address" #$ pfield @"resolved" # txInInfo let continuingValue = pfield @"value" #$ pfield @"resolved" # txInInfo + ownerSignsTransaction <- plet $ ptxSignedBy # ctx.txInfo # stakeDatum.owner stCurrencySymbol <- plet $ pconstant $ mintingPolicySymbol $ mkMintingPolicy (stakePolicy stake) mintedST <- plet $ psymbolValueOf # stCurrencySymbol # txInfo.mint spentST <- plet $ psymbolValueOf # stCurrencySymbol #$ pvalueSpent # txInfo' @@ -227,12 +228,16 @@ stakeValidator stake = mintedST #== -1 passert "Stake unlocked" $ pnot #$ stakeLocked # stakeDatum' + passert "Owner signs this transaction" $ + ownerSignsTransaction popaque (pconstant ()) PDepositWithdraw r -> P.do passert "ST at inputs must be 1" $ spentST #== 1 passert "Stake unlocked" $ pnot #$ stakeLocked # stakeDatum' + passert "Owner signs this transaction" $ + ownerSignsTransaction passert "A UTXO must exist with the correct output" $ anyOutput @(PStakeDatum gt) # txInfo' #$ plam