diff --git a/agora/Agora/Proposal/Scripts.hs b/agora/Agora/Proposal/Scripts.hs index 51078a4..f9d9b9c 100644 --- a/agora/Agora/Proposal/Scripts.hs +++ b/agora/Agora/Proposal/Scripts.hs @@ -320,18 +320,14 @@ proposalValidator as maximumCosigners = spendStakes' :: Term _ ((PStakeInputsContext :--> PUnit) :--> PUnit) <- pletC $ - plam $ \val -> unTermCont $ do + plam $ let stakeInputs = pmapMaybe # (pfield @"resolved" #>>> getStakeDatum) # pfromData txInfoF.inputs ctx = pcon $ PStakeInputsContext stakeInputs - - pguardC "No stake burnt" $ - passetClassValueOf # txInfoF.mint # sstAssetClass #== 0 - - pure $ val # ctx + in (# ctx) let spendStakes :: ( PStakeInputsContext _ -> diff --git a/agora/Agora/Stake/Redeemers.hs b/agora/Agora/Stake/Redeemers.hs index d4df2e2..7e8dafb 100644 --- a/agora/Agora/Stake/Redeemers.hs +++ b/agora/Agora/Stake/Redeemers.hs @@ -22,6 +22,7 @@ import Agora.Proposal ( import Agora.Stake ( PProposalContext ( PNewProposal, + PNoProposal, PSpendProposal ), PProposalLock (PCreated, PVoted), @@ -57,6 +58,21 @@ import "liqwid-plutarch-extra" Plutarch.Extra.TermCont (pguardC, pletC, pmatchC) import Plutarch.Numeric.Additive (AdditiveMonoid (zero), AdditiveSemigroup ((+))) import Prelude hiding (Num ((+))) +pwithoutProposal :: + forall (s :: S). + Term + s + (PStakeRedeemerHandler :--> PStakeRedeemerHandler) +pwithoutProposal = phoistAcyclic $ + plam $ \f ctx -> pmatch ctx $ \ctxF -> + pif + ( pmatch ctxF.proposalContext $ \case + PNoProposal -> pconstant True + _ -> pconstant False + ) + (f # ctx) + (ptraceError "No proposal is allowed") + pbatchUpdateInputs :: forall (s :: S). Term @@ -227,7 +243,7 @@ pdelegateHelper :: :--> PStakeRedeemerHandler ) pdelegateHelper = phoistAcyclic $ - plam $ \f ctx -> unTermCont $ do + plam $ \f -> pwithoutProposal #$ plam $ \ctx -> unTermCont $ do ctxF <- pmatchC ctx sigCtxF <- pmatchC ctxF.sigContext @@ -287,7 +303,7 @@ pclearDelegate = pdelegateHelper #$ phoistAcyclic $ -} pdestroy :: forall (s :: S). Term s PStakeRedeemerHandler pdestroy = phoistAcyclic $ - plam $ \ctx -> unTermCont $ do + pwithoutProposal #$ plam $ \ctx -> unTermCont $ do ctxF <- pmatchC ctx pguardC "Owner signs this transaction" $ @@ -304,7 +320,7 @@ pdestroy = phoistAcyclic $ -} pdepositWithdraw :: forall (s :: S). Term s PStakeRedeemerHandler pdepositWithdraw = phoistAcyclic $ - plam $ \ctx -> unTermCont $ do + pwithoutProposal #$ plam $ \ctx -> unTermCont $ do ctxF <- pmatchC ctx pguardC "Owner signs this transaction" $