explicitly check no proposal when necessary
This commit is contained in:
parent
ffdaaf9659
commit
7a8e067e47
2 changed files with 21 additions and 9 deletions
|
|
@ -320,18 +320,14 @@ proposalValidator as maximumCosigners =
|
||||||
|
|
||||||
spendStakes' :: Term _ ((PStakeInputsContext :--> PUnit) :--> PUnit) <-
|
spendStakes' :: Term _ ((PStakeInputsContext :--> PUnit) :--> PUnit) <-
|
||||||
pletC $
|
pletC $
|
||||||
plam $ \val -> unTermCont $ do
|
plam $
|
||||||
let stakeInputs =
|
let stakeInputs =
|
||||||
pmapMaybe
|
pmapMaybe
|
||||||
# (pfield @"resolved" #>>> getStakeDatum)
|
# (pfield @"resolved" #>>> getStakeDatum)
|
||||||
# pfromData txInfoF.inputs
|
# pfromData txInfoF.inputs
|
||||||
|
|
||||||
ctx = pcon $ PStakeInputsContext stakeInputs
|
ctx = pcon $ PStakeInputsContext stakeInputs
|
||||||
|
in (# ctx)
|
||||||
pguardC "No stake burnt" $
|
|
||||||
passetClassValueOf # txInfoF.mint # sstAssetClass #== 0
|
|
||||||
|
|
||||||
pure $ val # ctx
|
|
||||||
|
|
||||||
let spendStakes ::
|
let spendStakes ::
|
||||||
( PStakeInputsContext _ ->
|
( PStakeInputsContext _ ->
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import Agora.Proposal (
|
||||||
import Agora.Stake (
|
import Agora.Stake (
|
||||||
PProposalContext (
|
PProposalContext (
|
||||||
PNewProposal,
|
PNewProposal,
|
||||||
|
PNoProposal,
|
||||||
PSpendProposal
|
PSpendProposal
|
||||||
),
|
),
|
||||||
PProposalLock (PCreated, PVoted),
|
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 Plutarch.Numeric.Additive (AdditiveMonoid (zero), AdditiveSemigroup ((+)))
|
||||||
import Prelude hiding (Num ((+)))
|
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 ::
|
pbatchUpdateInputs ::
|
||||||
forall (s :: S).
|
forall (s :: S).
|
||||||
Term
|
Term
|
||||||
|
|
@ -227,7 +243,7 @@ pdelegateHelper ::
|
||||||
:--> PStakeRedeemerHandler
|
:--> PStakeRedeemerHandler
|
||||||
)
|
)
|
||||||
pdelegateHelper = phoistAcyclic $
|
pdelegateHelper = phoistAcyclic $
|
||||||
plam $ \f ctx -> unTermCont $ do
|
plam $ \f -> pwithoutProposal #$ plam $ \ctx -> unTermCont $ do
|
||||||
ctxF <- pmatchC ctx
|
ctxF <- pmatchC ctx
|
||||||
sigCtxF <- pmatchC ctxF.sigContext
|
sigCtxF <- pmatchC ctxF.sigContext
|
||||||
|
|
||||||
|
|
@ -287,7 +303,7 @@ pclearDelegate = pdelegateHelper #$ phoistAcyclic $
|
||||||
-}
|
-}
|
||||||
pdestroy :: forall (s :: S). Term s PStakeRedeemerHandler
|
pdestroy :: forall (s :: S). Term s PStakeRedeemerHandler
|
||||||
pdestroy = phoistAcyclic $
|
pdestroy = phoistAcyclic $
|
||||||
plam $ \ctx -> unTermCont $ do
|
pwithoutProposal #$ plam $ \ctx -> unTermCont $ do
|
||||||
ctxF <- pmatchC ctx
|
ctxF <- pmatchC ctx
|
||||||
|
|
||||||
pguardC "Owner signs this transaction" $
|
pguardC "Owner signs this transaction" $
|
||||||
|
|
@ -304,7 +320,7 @@ pdestroy = phoistAcyclic $
|
||||||
-}
|
-}
|
||||||
pdepositWithdraw :: forall (s :: S). Term s PStakeRedeemerHandler
|
pdepositWithdraw :: forall (s :: S). Term s PStakeRedeemerHandler
|
||||||
pdepositWithdraw = phoistAcyclic $
|
pdepositWithdraw = phoistAcyclic $
|
||||||
plam $ \ctx -> unTermCont $ do
|
pwithoutProposal #$ plam $ \ctx -> unTermCont $ do
|
||||||
ctxF <- pmatchC ctx
|
ctxF <- pmatchC ctx
|
||||||
|
|
||||||
pguardC "Owner signs this transaction" $
|
pguardC "Owner signs this transaction" $
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue