module Agora.Proposal.Scripts (
proposalValidator,
proposalPolicy,
) where
import Agora.Proposal (
PProposalDatum (PProposalDatum),
PProposalRedeemer (..),
PProposalStatus (..),
PProposalVotes (PProposalVotes),
Proposal (governorSTAssetClass, stakeSTAssetClass),
ProposalStatus (..),
pretractVotes,
pwinner',
)
import Agora.Proposal.Time (
currentProposalTime,
isDraftPeriod,
isExecutionPeriod,
isLockingPeriod,
isVotingPeriod,
)
import Agora.Stake (
PProposalLock (..),
PStakeDatum (..),
PStakeUsage (..),
findStakeOwnedBy,
pgetStakeUsage,
)
import Agora.Utils (
getMintingPolicySymbol,
mustBePJust,
mustFindDatum',
)
import Plutarch.Api.V1 (
PMintingPolicy,
PScriptContext (PScriptContext),
PScriptPurpose (PMinting, PSpending),
PTxInfo (PTxInfo),
PValidator,
)
import Plutarch.Api.V1.AssetClass (passetClass, passetClassValueOf)
import Plutarch.Api.V1.ScriptContext (
pfindTxInByTxOutRef,
pisTokenSpent,
ptxSignedBy,
pvalueSpent,
)
import "liqwid-plutarch-extra" Plutarch.Api.V1.Value (psymbolValueOf)
import Plutarch.Extra.Comonad (pextract)
import Plutarch.Extra.List (pisUniqBy)
import Plutarch.Extra.Map (plookup, pupdate)
import Plutarch.Extra.Maybe (pisJust)
import Plutarch.Extra.Record (mkRecordConstr, (.&), (.=))
import Plutarch.Extra.TermCont (
pguardC,
pletC,
pletFieldsC,
pmatchC,
ptryFromC,
)
import Plutarch.SafeMoney (PDiscrete (..))
import Plutarch.Unsafe (punsafeCoerce)
import PlutusLedgerApi.V1.Value (AssetClass (AssetClass))
proposalPolicy ::
AssetClass ->
ClosedTerm PMintingPolicy
proposalPolicy :: AssetClass -> ClosedTerm PMintingPolicy
proposalPolicy (AssetClass (CurrencySymbol
govCs, TokenName
govTn)) =
(Term s PData -> Term s PScriptContext -> Term s POpaque)
-> Term s PMintingPolicy
forall a (b :: PType) (s :: S) (c :: PType).
PLamN a b s =>
(Term s c -> a) -> Term s (c :--> b)
plam ((Term s PData -> Term s PScriptContext -> Term s POpaque)
-> Term s PMintingPolicy)
-> (Term s PData -> Term s PScriptContext -> Term s POpaque)
-> Term s PMintingPolicy
forall a b. (a -> b) -> a -> b
$ \Term s PData
_redeemer Term s PScriptContext
ctx' -> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @POpaque s (Term s POpaque) -> Term s POpaque)
-> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ do
PScriptContext Term
s
(PDataRecord
((':)
@PLabeledType
("txInfo" ':= PTxInfo)
((':)
@PLabeledType ("purpose" ':= PScriptPurpose) ('[] @PLabeledType))))
ctx' <- Term s PScriptContext -> TermCont @POpaque s (PScriptContext s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC Term s PScriptContext
ctx'
HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
ctx <- ((HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type)))))
forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont (((HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))))
-> ((HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type)))))
forall a b. (a -> b) -> a -> b
$ forall (fs :: [Symbol]) (a :: PType) (s :: S) (b :: PType)
(ps :: [PLabeledType]) (bs :: [ToBind]).
(PDataFields a,
(ps :: [PLabeledType]) ~ (PFields a :: [PLabeledType]),
(bs :: [ToBind]) ~ (Bindings ps fs :: [ToBind]),
BindFields ps bs) =>
Term s a -> (HRecOf a fs s -> Term s b) -> Term s b
pletFields @'["txInfo", "purpose"] Term
s
(PDataRecord
((':)
@PLabeledType
("txInfo" ':= PTxInfo)
((':)
@PLabeledType ("purpose" ':= PScriptPurpose) ('[] @PLabeledType))))
ctx'
PTxInfo Term
s
(PDataRecord
((':)
@PLabeledType
("inputs" ':= PBuiltinList (PAsData PTxInInfo))
((':)
@PLabeledType
("outputs" ':= PBuiltinList (PAsData PTxOut))
((':)
@PLabeledType
("fee" ':= PValue 'Sorted 'Positive)
((':)
@PLabeledType
("mint" ':= PValue 'Sorted 'NoGuarantees)
((':)
@PLabeledType
("dcert" ':= PBuiltinList (PAsData PDCert))
((':)
@PLabeledType
("wdrl"
':= PBuiltinList
(PAsData (PTuple PStakingCredential (PInteger @S))))
((':)
@PLabeledType
("validRange" ':= PPOSIXTimeRange)
((':)
@PLabeledType
("signatories" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("datums" ':= PBuiltinList (PAsData (PTuple PDatumHash PDatum)))
((':) @PLabeledType ("id" ':= PTxId) ('[] @PLabeledType))))))))))))
txInfo' <- Term s PTxInfo -> TermCont @POpaque s (PTxInfo s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC (Term s PTxInfo -> TermCont @POpaque s (PTxInfo s))
-> Term s PTxInfo -> TermCont @POpaque s (PTxInfo s)
forall a b. (a -> b) -> a -> b
$ Term s (PAsData PTxInfo) -> Term s PTxInfo
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
ctx.txInfo
HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
('[] @(Symbol, Type))))
txInfo <- ((HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
('[] @(Symbol, Type))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
('[] @(Symbol, Type)))))
forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont (((HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
('[] @(Symbol, Type))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
('[] @(Symbol, Type))))))
-> ((HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
('[] @(Symbol, Type))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
('[] @(Symbol, Type)))))
forall a b. (a -> b) -> a -> b
$ forall (fs :: [Symbol]) (a :: PType) (s :: S) (b :: PType)
(ps :: [PLabeledType]) (bs :: [ToBind]).
(PDataFields a,
(ps :: [PLabeledType]) ~ (PFields a :: [PLabeledType]),
(bs :: [ToBind]) ~ (Bindings ps fs :: [ToBind]),
BindFields ps bs) =>
Term s a -> (HRecOf a fs s -> Term s b) -> Term s b
pletFields @'["inputs", "mint"] Term
s
(PDataRecord
((':)
@PLabeledType
("inputs" ':= PBuiltinList (PAsData PTxInInfo))
((':)
@PLabeledType
("outputs" ':= PBuiltinList (PAsData PTxOut))
((':)
@PLabeledType
("fee" ':= PValue 'Sorted 'Positive)
((':)
@PLabeledType
("mint" ':= PValue 'Sorted 'NoGuarantees)
((':)
@PLabeledType
("dcert" ':= PBuiltinList (PAsData PDCert))
((':)
@PLabeledType
("wdrl"
':= PBuiltinList
(PAsData (PTuple PStakingCredential (PInteger @S))))
((':)
@PLabeledType
("validRange" ':= PPOSIXTimeRange)
((':)
@PLabeledType
("signatories" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("datums" ':= PBuiltinList (PAsData (PTuple PDatumHash PDatum)))
((':) @PLabeledType ("id" ':= PTxId) ('[] @PLabeledType))))))))))))
txInfo'
PMinting Term
s
(PDataRecord
((':)
@PLabeledType ("_0" ':= PCurrencySymbol) ('[] @PLabeledType)))
_ownSymbol <- Term s PScriptPurpose -> TermCont @POpaque s (PScriptPurpose s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC (Term s PScriptPurpose -> TermCont @POpaque s (PScriptPurpose s))
-> Term s PScriptPurpose -> TermCont @POpaque s (PScriptPurpose s)
forall a b. (a -> b) -> a -> b
$ Term s (PAsData PScriptPurpose) -> Term s PScriptPurpose
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
ctx.purpose
let inputs :: Term s (PBuiltinList (PAsData PTxInInfo))
inputs = HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
('[] @(Symbol, Type))))
txInfo.inputs
mintedValue :: Term s (PValue 'Sorted 'NoGuarantees)
mintedValue = Term s (PAsData (PValue 'Sorted 'NoGuarantees))
-> Term s (PValue 'Sorted 'NoGuarantees)
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
('[] @(Symbol, Type))))
txInfo.mint
PMinting Term
s
(PDataRecord
((':)
@PLabeledType ("_0" ':= PCurrencySymbol) ('[] @PLabeledType)))
ownSymbol' <- Term s PScriptPurpose -> TermCont @POpaque s (PScriptPurpose s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC (Term s PScriptPurpose -> TermCont @POpaque s (PScriptPurpose s))
-> Term s PScriptPurpose -> TermCont @POpaque s (PScriptPurpose s)
forall a b. (a -> b) -> a -> b
$ Term s (PAsData PScriptPurpose) -> Term s PScriptPurpose
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
ctx.purpose
let mintedProposalST :: Term s (PInteger @S)
mintedProposalST =
Term
s
(PValue 'Sorted 'NoGuarantees :--> (PAssetClass :--> PInteger @S))
forall (s :: S) (keys :: KeyGuarantees)
(amounts :: AmountGuarantees).
Term s (PValue keys amounts :--> (PAssetClass :--> PInteger @S))
passetClassValueOf
# mintedValue
# (passetClass # (pfield @"_0" # ownSymbol') # pconstant "")
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Governance state-thread token must move" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term
s (PAssetClass :--> (PBuiltinList (PAsData PTxInInfo) :--> PBool))
forall {s :: S}.
Term
s (PAssetClass :--> (PBuiltinList (PAsData PTxInInfo) :--> PBool))
pisTokenSpent
# (passetClass # pconstant govCs # pconstant govTn)
# inputs
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Minted exactly one proposal ST" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s (PInteger @S)
mintedProposalST Term s (PInteger @S) -> Term s (PInteger @S) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s (PInteger @S)
1
Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s POpaque -> TermCont @POpaque s (Term s POpaque))
-> Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall a b. (a -> b) -> a -> b
$ Term s (PUnit @S) -> Term s POpaque
forall (s :: S) (a :: PType). Term s a -> Term s POpaque
popaque (PLifted (PUnit @S) -> Term s (PUnit @S)
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant ())
proposalValidator :: Proposal -> ClosedTerm PValidator
proposalValidator :: Proposal -> ClosedTerm PValidator
proposalValidator Proposal
proposal =
(Term s PData
-> Term s PData -> Term s PScriptContext -> Term s POpaque)
-> Term s PValidator
forall a (b :: PType) (s :: S) (c :: PType).
PLamN a b s =>
(Term s c -> a) -> Term s (c :--> b)
plam ((Term s PData
-> Term s PData -> Term s PScriptContext -> Term s POpaque)
-> Term s PValidator)
-> (Term s PData
-> Term s PData -> Term s PScriptContext -> Term s POpaque)
-> Term s PValidator
forall a b. (a -> b) -> a -> b
$ \Term s PData
datum Term s PData
redeemer Term s PScriptContext
ctx' -> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @POpaque s (Term s POpaque) -> Term s POpaque)
-> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ do
PScriptContext Term
s
(PDataRecord
((':)
@PLabeledType
("txInfo" ':= PTxInfo)
((':)
@PLabeledType ("purpose" ':= PScriptPurpose) ('[] @PLabeledType))))
ctx' <- Term s PScriptContext -> TermCont @POpaque s (PScriptContext s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC Term s PScriptContext
ctx'
HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
ctx <- ((HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type)))))
forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont (((HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))))
-> ((HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type)))))
forall a b. (a -> b) -> a -> b
$ forall (fs :: [Symbol]) (a :: PType) (s :: S) (b :: PType)
(ps :: [PLabeledType]) (bs :: [ToBind]).
(PDataFields a,
(ps :: [PLabeledType]) ~ (PFields a :: [PLabeledType]),
(bs :: [ToBind]) ~ (Bindings ps fs :: [ToBind]),
BindFields ps bs) =>
Term s a -> (HRecOf a fs s -> Term s b) -> Term s b
pletFields @'["txInfo", "purpose"] Term
s
(PDataRecord
((':)
@PLabeledType
("txInfo" ':= PTxInfo)
((':)
@PLabeledType ("purpose" ':= PScriptPurpose) ('[] @PLabeledType))))
ctx'
Term s PTxInfo
txInfo <- Term s PTxInfo -> TermCont @POpaque s (Term s PTxInfo)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PTxInfo -> TermCont @POpaque s (Term s PTxInfo))
-> Term s PTxInfo -> TermCont @POpaque s (Term s PTxInfo)
forall a b. (a -> b) -> a -> b
$ Term s (PAsData PTxInfo) -> Term s PTxInfo
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
ctx.txInfo
PTxInfo Term
s
(PDataRecord
((':)
@PLabeledType
("inputs" ':= PBuiltinList (PAsData PTxInInfo))
((':)
@PLabeledType
("outputs" ':= PBuiltinList (PAsData PTxOut))
((':)
@PLabeledType
("fee" ':= PValue 'Sorted 'Positive)
((':)
@PLabeledType
("mint" ':= PValue 'Sorted 'NoGuarantees)
((':)
@PLabeledType
("dcert" ':= PBuiltinList (PAsData PDCert))
((':)
@PLabeledType
("wdrl"
':= PBuiltinList
(PAsData (PTuple PStakingCredential (PInteger @S))))
((':)
@PLabeledType
("validRange" ':= PPOSIXTimeRange)
((':)
@PLabeledType
("signatories" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("datums" ':= PBuiltinList (PAsData (PTuple PDatumHash PDatum)))
((':) @PLabeledType ("id" ':= PTxId) ('[] @PLabeledType))))))))))))
txInfo' <- Term s PTxInfo -> TermCont @POpaque s (PTxInfo s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC Term s PTxInfo
txInfo
HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
txInfoF <-
((HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type)))))))))
forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont (((HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))))
-> ((HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type)))))))))
forall a b. (a -> b) -> a -> b
$
forall (fs :: [Symbol]) (a :: PType) (s :: S) (b :: PType)
(ps :: [PLabeledType]) (bs :: [ToBind]).
(PDataFields a,
(ps :: [PLabeledType]) ~ (PFields a :: [PLabeledType]),
(bs :: [ToBind]) ~ (Bindings ps fs :: [ToBind]),
BindFields ps bs) =>
Term s a -> (HRecOf a fs s -> Term s b) -> Term s b
pletFields
@'[ "inputs"
, "outputs"
, "mint"
, "datums"
, "signatories"
, "validRange"
]
Term
s
(PDataRecord
((':)
@PLabeledType
("inputs" ':= PBuiltinList (PAsData PTxInInfo))
((':)
@PLabeledType
("outputs" ':= PBuiltinList (PAsData PTxOut))
((':)
@PLabeledType
("fee" ':= PValue 'Sorted 'Positive)
((':)
@PLabeledType
("mint" ':= PValue 'Sorted 'NoGuarantees)
((':)
@PLabeledType
("dcert" ':= PBuiltinList (PAsData PDCert))
((':)
@PLabeledType
("wdrl"
':= PBuiltinList
(PAsData (PTuple PStakingCredential (PInteger @S))))
((':)
@PLabeledType
("validRange" ':= PPOSIXTimeRange)
((':)
@PLabeledType
("signatories" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("datums" ':= PBuiltinList (PAsData (PTuple PDatumHash PDatum)))
((':) @PLabeledType ("id" ':= PTxId) ('[] @PLabeledType))))))))))))
txInfo'
PSpending ((forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"_0" #) -> Term s PTxOutRef
txOutRef) <- Term s PScriptPurpose -> TermCont @POpaque s (PScriptPurpose s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC (Term s PScriptPurpose -> TermCont @POpaque s (PScriptPurpose s))
-> Term s PScriptPurpose -> TermCont @POpaque s (PScriptPurpose s)
forall a b. (a -> b) -> a -> b
$ Term s (PAsData PScriptPurpose) -> Term s PScriptPurpose
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("txInfo", Term s (PAsData PTxInfo))
((':)
@(Symbol, Type)
'("purpose", Term s (PAsData PScriptPurpose))
('[] @(Symbol, Type))))
ctx.purpose
PJust ((forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"resolved" #) -> Term s (PAsData PTxOut)
txOut) <- Term s (PMaybe PTxInInfo)
-> TermCont @POpaque s (PMaybe PTxInInfo s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC (Term s (PMaybe PTxInInfo)
-> TermCont @POpaque s (PMaybe PTxInInfo s))
-> Term s (PMaybe PTxInInfo)
-> TermCont @POpaque s (PMaybe PTxInInfo s)
forall a b. (a -> b) -> a -> b
$ Term
s
(PTxOutRef
:--> (PBuiltinList (PAsData PTxInInfo) :--> PMaybe PTxInInfo))
forall (s :: S).
Term
s
(PTxOutRef
:--> (PBuiltinList (PAsData PTxInInfo) :--> PMaybe PTxInInfo))
pfindTxInByTxOutRef Term
s
(PTxOutRef
:--> (PBuiltinList (PAsData PTxInInfo) :--> PMaybe PTxInInfo))
-> Term s PTxOutRef
-> Term s (PBuiltinList (PAsData PTxInInfo) :--> PMaybe PTxInInfo)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PTxOutRef
txOutRef Term s (PBuiltinList (PAsData PTxInInfo) :--> PMaybe PTxInInfo)
-> Term s (PBuiltinList (PAsData PTxInInfo))
-> Term s (PMaybe PTxInInfo)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
txInfoF.inputs
HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s)
txOutF <- ((HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s)
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s))
forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont (((HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s)
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s)))
-> ((HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s)
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s))
forall a b. (a -> b) -> a -> b
$ forall (fs :: [Symbol]) (a :: PType) (s :: S) (b :: PType)
(ps :: [PLabeledType]) (bs :: [ToBind]).
(PDataFields a,
(ps :: [PLabeledType]) ~ (PFields a :: [PLabeledType]),
(bs :: [ToBind]) ~ (Bindings ps fs :: [ToBind]),
BindFields ps bs) =>
Term s a -> (HRecOf a fs s -> Term s b) -> Term s b
pletFields @'["address", "value"] (Term s (PAsData PTxOut)
-> (HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s)
-> Term s POpaque)
-> Term s POpaque)
-> Term s (PAsData PTxOut)
-> (HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s)
-> Term s POpaque)
-> Term s POpaque
forall a b. (a -> b) -> a -> b
$ Term s (PAsData PTxOut)
txOut
(Term s (PAsData PProposalDatum) -> Term s PProposalDatum
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData -> Term s PProposalDatum
proposalDatum, ()
_) <-
forall (b :: PType) (r :: PType) (a :: PType) (s :: S).
PTryFrom a b =>
Term s a
-> TermCont @r s (Term s b, Reduce @Type (PTryFromExcess a b s))
ptryFromC @(PAsData PProposalDatum) Term s PData
datum
(Term s (PAsData PProposalRedeemer) -> Term s PProposalRedeemer
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData -> Term s PProposalRedeemer
proposalRedeemer, Reduce @Type (PTryFromExcess PData (PAsData PProposalRedeemer) s)
_) <-
forall (b :: PType) (r :: PType) (a :: PType) (s :: S).
PTryFrom a b =>
Term s a
-> TermCont @r s (Term s b, Reduce @Type (PTryFromExcess a b s))
ptryFromC @(PAsData PProposalRedeemer) Term s PData
redeemer
HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF <-
((HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type)))))))))))
forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont (((HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))))
-> ((HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
-> Term s POpaque)
-> Term s POpaque)
-> TermCont
@POpaque
s
(HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type)))))))))))
forall a b. (a -> b) -> a -> b
$
forall (fs :: [Symbol]) (a :: PType) (s :: S) (b :: PType)
(ps :: [PLabeledType]) (bs :: [ToBind]).
(PDataFields a,
(ps :: [PLabeledType]) ~ (PFields a :: [PLabeledType]),
(bs :: [ToBind]) ~ (Bindings ps fs :: [ToBind]),
BindFields ps bs) =>
Term s a -> (HRecOf a fs s -> Term s b) -> Term s b
pletFields
@'[ "proposalId"
, "effects"
, "status"
, "cosigners"
, "thresholds"
, "votes"
, "timingConfig"
, "startingTime"
]
Term s PProposalDatum
proposalDatum
Term s (PAsData PAddress)
ownAddress <- Term s (PAsData PAddress)
-> TermCont @POpaque s (Term s (PAsData PAddress))
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s (PAsData PAddress)
-> TermCont @POpaque s (Term s (PAsData PAddress)))
-> Term s (PAsData PAddress)
-> TermCont @POpaque s (Term s (PAsData PAddress))
forall a b. (a -> b) -> a -> b
$ HRec
(BoundTerms
(PFields (PAsData PTxOut))
(Bindings
(PFields (PAsData PTxOut))
((':) @Symbol "address" ((':) @Symbol "value" ('[] @Symbol))))
s)
txOutF.address
let stCurrencySymbol :: Term s PCurrencySymbol
stCurrencySymbol =
PLifted PCurrencySymbol -> Term s PCurrencySymbol
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant (PLifted PCurrencySymbol -> Term s PCurrencySymbol)
-> PLifted PCurrencySymbol -> Term s PCurrencySymbol
forall a b. (a -> b) -> a -> b
$ ClosedTerm PMintingPolicy -> CurrencySymbol
getMintingPolicySymbol (AssetClass -> ClosedTerm PMintingPolicy
proposalPolicy Proposal
proposal.governorSTAssetClass)
Term s (PValue 'Sorted 'Positive)
valueSpent <- Term s (PValue 'Sorted 'Positive)
-> TermCont @POpaque s (Term s (PValue 'Sorted 'Positive))
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s (PValue 'Sorted 'Positive)
-> TermCont @POpaque s (Term s (PValue 'Sorted 'Positive)))
-> Term s (PValue 'Sorted 'Positive)
-> TermCont @POpaque s (Term s (PValue 'Sorted 'Positive))
forall a b. (a -> b) -> a -> b
$ Term
s (PBuiltinList (PAsData PTxInInfo) :--> PValue 'Sorted 'Positive)
forall (s :: S).
Term
s (PBuiltinList (PAsData PTxInInfo) :--> PValue 'Sorted 'Positive)
pvalueSpent Term
s (PBuiltinList (PAsData PTxInInfo) :--> PValue 'Sorted 'Positive)
-> Term s (PBuiltinList (PAsData PTxInInfo))
-> Term s (PValue 'Sorted 'Positive)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
txInfoF.inputs
Term s (PAsData PPubKeyHash :--> PBool)
signedBy <- Term s (PAsData PPubKeyHash :--> PBool)
-> TermCont @POpaque s (Term s (PAsData PPubKeyHash :--> PBool))
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s (PAsData PPubKeyHash :--> PBool)
-> TermCont @POpaque s (Term s (PAsData PPubKeyHash :--> PBool)))
-> Term s (PAsData PPubKeyHash :--> PBool)
-> TermCont @POpaque s (Term s (PAsData PPubKeyHash :--> PBool))
forall a b. (a -> b) -> a -> b
$ Term
s
(PBuiltinList (PAsData PPubKeyHash)
:--> (PAsData PPubKeyHash :--> PBool))
forall (s :: S).
Term
s
(PBuiltinList (PAsData PPubKeyHash)
:--> (PAsData PPubKeyHash :--> PBool))
ptxSignedBy Term
s
(PBuiltinList (PAsData PPubKeyHash)
:--> (PAsData PPubKeyHash :--> PBool))
-> Term s (PBuiltinList (PAsData PPubKeyHash))
-> Term s (PAsData PPubKeyHash :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
txInfoF.signatories
Term s PProposalTime
currentTime <- Term s PProposalTime -> TermCont @POpaque s (Term s PProposalTime)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PProposalTime
-> TermCont @POpaque s (Term s PProposalTime))
-> Term s PProposalTime
-> TermCont @POpaque s (Term s PProposalTime)
forall a b. (a -> b) -> a -> b
$ Term s (PPOSIXTimeRange :--> PProposalTime)
forall (s :: S). Term s (PPOSIXTimeRange :--> PProposalTime)
currentProposalTime Term s (PPOSIXTimeRange :--> PProposalTime)
-> Term s PPOSIXTimeRange -> Term s PProposalTime
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
txInfoF.validRange
Term s (PAsData PTxOut)
ownOutput <-
Term s (PAsData PTxOut)
-> TermCont @POpaque s (Term s (PAsData PTxOut))
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s (PAsData PTxOut)
-> TermCont @POpaque s (Term s (PAsData PTxOut)))
-> Term s (PAsData PTxOut)
-> TermCont @POpaque s (Term s (PAsData PTxOut))
forall a b. (a -> b) -> a -> b
$
Term
s (PString @S :--> (PMaybe (PAsData PTxOut) :--> PAsData PTxOut))
forall (a :: PType) (s :: S).
Term s (PString @S :--> (PMaybe a :--> a))
mustBePJust Term
s (PString @S :--> (PMaybe (PAsData PTxOut) :--> PAsData PTxOut))
-> Term s (PString @S)
-> Term s (PMaybe (PAsData PTxOut) :--> PAsData PTxOut)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PString @S)
"Own output should be present" Term s (PMaybe (PAsData PTxOut) :--> PAsData PTxOut)
-> Term s (PMaybe (PAsData PTxOut)) -> Term s (PAsData PTxOut)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
#$ Term
s
((PAsData PTxOut :--> PBool)
:--> (PBuiltinList (PAsData PTxOut) :--> PMaybe (PAsData PTxOut)))
forall (l :: PType -> PType) (a :: PType) (s :: S).
PIsListLike l a =>
Term s ((a :--> PBool) :--> (l a :--> PMaybe a))
pfind
# plam
( \input -> unTermCont $ do
inputF <- tcont $ pletFields @'["address", "value", "datumHash"] input
let datum =
mustFindDatum' @PProposalDatum
# inputF.datumHash
# txInfoF.datums
proposalId = pfield @"proposalId" # datum
pure $
inputF.address #== ownAddress
#&& psymbolValueOf # stCurrencySymbol # inputF.value #== 1
#&& proposalId #== proposalF.proposalId
)
# pfromData txInfoF.outputs
Term s PProposalDatum
proposalOut <-
Term s PProposalDatum
-> TermCont @POpaque s (Term s PProposalDatum)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PProposalDatum
-> TermCont @POpaque s (Term s PProposalDatum))
-> Term s PProposalDatum
-> TermCont @POpaque s (Term s PProposalDatum)
forall a b. (a -> b) -> a -> b
$
forall (datum :: PType) (s :: S).
(PIsData datum, PTryFrom PData (PAsData datum)) =>
Term
s
(PMaybeData PDatumHash
:--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum))
:--> datum))
mustFindDatum' @PProposalDatum
# (pfield @"datumHash" # ownOutput)
# txInfoF.datums
Term s PBool
proposalUnchanged <- Term s PBool -> TermCont @POpaque s (Term s PBool)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PBool -> TermCont @POpaque s (Term s PBool))
-> Term s PBool -> TermCont @POpaque s (Term s PBool)
forall a b. (a -> b) -> a -> b
$ Term s PProposalDatum
proposalOut Term s PProposalDatum -> Term s PProposalDatum -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PProposalDatum
proposalDatum
let AssetClass (CurrencySymbol
stakeSym, TokenName
stakeTn) = Proposal
proposal.stakeSTAssetClass
Term s PAssetClass
stakeSTAssetClass <-
Term s PAssetClass -> TermCont @POpaque s (Term s PAssetClass)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PAssetClass -> TermCont @POpaque s (Term s PAssetClass))
-> Term s PAssetClass -> TermCont @POpaque s (Term s PAssetClass)
forall a b. (a -> b) -> a -> b
$ Term s (PCurrencySymbol :--> (PTokenName :--> PAssetClass))
forall (s :: S).
Term s (PCurrencySymbol :--> (PTokenName :--> PAssetClass))
passetClass Term s (PCurrencySymbol :--> (PTokenName :--> PAssetClass))
-> Term s PCurrencySymbol -> Term s (PTokenName :--> PAssetClass)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# PLifted PCurrencySymbol -> Term s PCurrencySymbol
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant PLifted PCurrencySymbol
CurrencySymbol
stakeSym Term s (PTokenName :--> PAssetClass)
-> Term s PTokenName -> Term s PAssetClass
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# PLifted PTokenName -> Term s PTokenName
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant PLifted PTokenName
TokenName
stakeTn
Term s (PInteger @S)
spentStakeST <-
Term s (PInteger @S) -> TermCont @POpaque s (Term s (PInteger @S))
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s (PInteger @S)
-> TermCont @POpaque s (Term s (PInteger @S)))
-> Term s (PInteger @S)
-> TermCont @POpaque s (Term s (PInteger @S))
forall a b. (a -> b) -> a -> b
$ Term
s (PValue 'Sorted 'Positive :--> (PAssetClass :--> PInteger @S))
forall (s :: S) (keys :: KeyGuarantees)
(amounts :: AmountGuarantees).
Term s (PValue keys amounts :--> (PAssetClass :--> PInteger @S))
passetClassValueOf Term
s (PValue 'Sorted 'Positive :--> (PAssetClass :--> PInteger @S))
-> Term s (PValue 'Sorted 'Positive)
-> Term s (PAssetClass :--> PInteger @S)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PValue 'Sorted 'Positive)
valueSpent Term s (PAssetClass :--> PInteger @S)
-> Term s PAssetClass -> Term s (PInteger @S)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PAssetClass
stakeSTAssetClass
let stakeInput :: Term
s
(PAsData
(PUnLabel
(IndexList
@PLabeledType
(PLabelIndex "resolved" (PFields (PAsData PTxInInfo)))
(PFields (PAsData PTxInInfo)))))
stakeInput =
forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"resolved"
#$ mustBePJust
# "Stake input should be present"
#$ pfind
# plam
( \(pfromData . (pfield @"value" #) . (pfield @"resolved" #) -> value) ->
passetClassValueOf # value # stakeSTAssetClass #== 1
)
# pfromData txInfoF.inputs
Term s PStakeDatum
stakeIn <- Term s PStakeDatum -> TermCont @POpaque s (Term s PStakeDatum)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PStakeDatum -> TermCont @POpaque s (Term s PStakeDatum))
-> Term s PStakeDatum -> TermCont @POpaque s (Term s PStakeDatum)
forall a b. (a -> b) -> a -> b
$ forall (datum :: PType) (s :: S).
(PIsData datum, PTryFrom PData (PAsData datum)) =>
Term
s
(PMaybeData PDatumHash
:--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum))
:--> datum))
mustFindDatum' @PStakeDatum Term
s
(PMaybeData PDatumHash
:--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum))
:--> PStakeDatum))
-> Term s (PMaybeData PDatumHash)
-> Term
s
(PBuiltinList (PAsData (PTuple PDatumHash PDatum))
:--> PStakeDatum)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# (forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"datumHash" Term
s
(PAsData
(PUnLabel
(IndexList
@PLabeledType
(PLabelIndex "resolved" (PFields (PAsData PTxInInfo)))
(PFields (PAsData PTxInInfo))))
:--> PMaybeData PDatumHash)
-> Term
s
(PAsData
(PUnLabel
(IndexList
@PLabeledType
(PLabelIndex "resolved" (PFields (PAsData PTxInInfo)))
(PFields (PAsData PTxInInfo)))))
-> Term s (PMaybeData PDatumHash)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term
s
(PAsData
(PUnLabel
(IndexList
@PLabeledType
(PLabelIndex "resolved" (PFields (PAsData PTxInInfo)))
(PFields (PAsData PTxInInfo)))))
stakeInput) Term
s
(PBuiltinList (PAsData (PTuple PDatumHash PDatum))
:--> PStakeDatum)
-> Term s (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))
-> Term s PStakeDatum
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
txInfoF.datums
HRec
((':)
@(Symbol, Type)
'("stakedAmount", Term s (PAsData (PDiscrete @Type GTTag)))
((':)
@(Symbol, Type)
'("owner", Term s (PAsData PPubKeyHash))
((':)
@(Symbol, Type)
'("lockedBy",
Term s (PAsData (PBuiltinList (PAsData PProposalLock))))
('[] @(Symbol, Type)))))
stakeInF <- forall (fs :: [Symbol]) (a :: PType) (s :: S) (b :: PType)
(ps :: [PLabeledType]) (bs :: [ToBind]).
(PDataFields a,
(ps :: [PLabeledType]) ~ (PFields a :: [PLabeledType]),
(bs :: [ToBind]) ~ (Bindings ps fs :: [ToBind]),
BindFields ps bs) =>
Term s a -> TermCont @b s (HRec (BoundTerms ps bs s))
pletFieldsC @'["stakedAmount", "lockedBy", "owner"] Term s PStakeDatum
stakeIn
let stakeOutput :: Term s (PAsData PTxOut)
stakeOutput =
Term
s (PString @S :--> (PMaybe (PAsData PTxOut) :--> PAsData PTxOut))
forall (a :: PType) (s :: S).
Term s (PString @S :--> (PMaybe a :--> a))
mustBePJust Term
s (PString @S :--> (PMaybe (PAsData PTxOut) :--> PAsData PTxOut))
-> Term s (PString @S)
-> Term s (PMaybe (PAsData PTxOut) :--> PAsData PTxOut)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PString @S)
"Stake output should be present"
#$ pfind
# plam
( \(pfromData . (pfield @"value" #) -> value) ->
passetClassValueOf # value # stakeSTAssetClass #== 1
)
# pfromData txInfoF.outputs
Term s PStakeDatum
stakeOut <- Term s PStakeDatum -> TermCont @POpaque s (Term s PStakeDatum)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PStakeDatum -> TermCont @POpaque s (Term s PStakeDatum))
-> Term s PStakeDatum -> TermCont @POpaque s (Term s PStakeDatum)
forall a b. (a -> b) -> a -> b
$ forall (datum :: PType) (s :: S).
(PIsData datum, PTryFrom PData (PAsData datum)) =>
Term
s
(PMaybeData PDatumHash
:--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum))
:--> datum))
mustFindDatum' @PStakeDatum Term
s
(PMaybeData PDatumHash
:--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum))
:--> PStakeDatum))
-> Term s (PMaybeData PDatumHash)
-> Term
s
(PBuiltinList (PAsData (PTuple PDatumHash PDatum))
:--> PStakeDatum)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# (forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"datumHash" Term s (PAsData PTxOut :--> PMaybeData PDatumHash)
-> Term s (PAsData PTxOut) -> Term s (PMaybeData PDatumHash)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PAsData PTxOut)
stakeOutput) Term
s
(PBuiltinList (PAsData (PTuple PDatumHash PDatum))
:--> PStakeDatum)
-> Term s (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))
-> Term s PStakeDatum
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("inputs", Term s (PAsData (PBuiltinList (PAsData PTxInInfo))))
((':)
@(Symbol, Type)
'("outputs", Term s (PAsData (PBuiltinList (PAsData PTxOut))))
((':)
@(Symbol, Type)
'("mint", Term s (PAsData (PValue 'Sorted 'NoGuarantees)))
((':)
@(Symbol, Type)
'("validRange", Term s (PAsData PPOSIXTimeRange))
((':)
@(Symbol, Type)
'("signatories",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("datums",
Term
s (PAsData (PBuiltinList (PAsData (PTuple PDatumHash PDatum)))))
('[] @(Symbol, Type))))))))
txInfoF.datums
Term s PBool
stakeUnchanged <- Term s PBool -> TermCont @POpaque s (Term s PBool)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PBool -> TermCont @POpaque s (Term s PBool))
-> Term s PBool -> TermCont @POpaque s (Term s PBool)
forall a b. (a -> b) -> a -> b
$ Term s PStakeDatum
stakeIn Term s PStakeDatum -> Term s PStakeDatum -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PStakeDatum
stakeOut
Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s POpaque -> TermCont @POpaque s (Term s POpaque))
-> Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall a b. (a -> b) -> a -> b
$
Term s PProposalRedeemer
-> (PProposalRedeemer s -> Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch Term s PProposalRedeemer
proposalRedeemer ((PProposalRedeemer s -> Term s POpaque) -> Term s POpaque)
-> (PProposalRedeemer s -> Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ \case
PVote Term
s
(PDataRecord
((':)
@PLabeledType ("resultTag" ':= PResultTag) ('[] @PLabeledType)))
r -> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @POpaque s (Term s POpaque) -> Term s POpaque)
-> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ do
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Input proposal must be in VotingReady state" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status Term s PProposalStatus -> Term s PProposalStatus -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== PLifted PProposalStatus -> Term s PProposalStatus
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant PLifted PProposalStatus
ProposalStatus
VotingReady
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Proposal time should be wthin the voting period" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
isVotingPeriod Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
-> Term s PProposalTimingConfig
-> Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.timingConfig Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.startingTime Term s (PProposalTime :--> PBool)
-> Term s PProposalTime -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PProposalTime
currentTime
PProposalVotes Term s (PMap 'Unsorted PResultTag (PInteger @S))
voteMap <- Term s PProposalVotes -> TermCont @POpaque s (PProposalVotes s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.votes
Term s PResultTag
voteFor <- Term s PResultTag -> TermCont @POpaque s (Term s PResultTag)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PResultTag -> TermCont @POpaque s (Term s PResultTag))
-> Term s PResultTag -> TermCont @POpaque s (Term s PResultTag)
forall a b. (a -> b) -> a -> b
$ Term s (PAsData PResultTag) -> Term s PResultTag
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData (Term s (PAsData PResultTag) -> Term s PResultTag)
-> Term s (PAsData PResultTag) -> Term s PResultTag
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"resultTag" Term
s
(PDataRecord
((':)
@PLabeledType ("resultTag" ':= PResultTag) ('[] @PLabeledType))
:--> PAsData PResultTag)
-> Term
s
(PDataRecord
((':)
@PLabeledType ("resultTag" ':= PResultTag) ('[] @PLabeledType)))
-> Term s (PAsData PResultTag)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term
s
(PDataRecord
((':)
@PLabeledType ("resultTag" ':= PResultTag) ('[] @PLabeledType)))
r
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Vote option should be valid" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s (PMaybe (PInteger @S) :--> PBool)
forall (a :: PType) (s :: S). Term s (PMaybe a :--> PBool)
pisJust Term s (PMaybe (PInteger @S) :--> PBool)
-> Term s (PMaybe (PInteger @S)) -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
#$ Term
s
(PResultTag
:--> (PMap 'Unsorted PResultTag (PInteger @S)
:--> PMaybe (PInteger @S)))
forall (k :: PType) (v :: PType) (keys :: KeyGuarantees) (s :: S).
(PIsData v, PIsData k, PEq k) =>
Term s (k :--> (PMap keys k v :--> PMaybe v))
plookup Term
s
(PResultTag
:--> (PMap 'Unsorted PResultTag (PInteger @S)
:--> PMaybe (PInteger @S)))
-> Term s PResultTag
-> Term
s
(PMap 'Unsorted PResultTag (PInteger @S) :--> PMaybe (PInteger @S))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PResultTag
voteFor Term
s
(PMap 'Unsorted PResultTag (PInteger @S) :--> PMaybe (PInteger @S))
-> Term s (PMap 'Unsorted PResultTag (PInteger @S))
-> Term s (PMaybe (PInteger @S))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PMap 'Unsorted PResultTag (PInteger @S))
voteMap
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Same stake shouldn't vote on the same proposal twice" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s (PBool :--> PBool)
forall (s :: S). Term s (PBool :--> PBool)
pnot Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
#$ Term
s
((PAsData PProposalLock :--> PBool)
:--> (PBuiltinList (PAsData PProposalLock) :--> PBool))
forall (list :: PType -> PType) (a :: PType) (s :: S).
PIsListLike list a =>
Term s ((a :--> PBool) :--> (list a :--> PBool))
pany
# plam
( \((pfield @"proposalTag" #) . pfromData -> pid) ->
pid #== proposalF.proposalId
)
# pfromData stakeInF.lockedBy
let
expectedNewVotes :: Term s PProposalVotes
expectedNewVotes = Term s PProposalVotes
-> (PProposalVotes s -> Term s PProposalVotes)
-> Term s PProposalVotes
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch (Term s (PAsData PProposalVotes) -> Term s PProposalVotes
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.votes) ((PProposalVotes s -> Term s PProposalVotes)
-> Term s PProposalVotes)
-> (PProposalVotes s -> Term s PProposalVotes)
-> Term s PProposalVotes
forall a b. (a -> b) -> a -> b
$ \(PProposalVotes Term s (PMap 'Unsorted PResultTag (PInteger @S))
m) ->
PProposalVotes s -> Term s PProposalVotes
forall (a :: PType) (s :: S). PCon a => a s -> Term s a
pcon (PProposalVotes s -> Term s PProposalVotes)
-> PProposalVotes s -> Term s PProposalVotes
forall a b. (a -> b) -> a -> b
$
Term s (PMap 'Unsorted PResultTag (PInteger @S))
-> PProposalVotes s
forall (s :: S).
Term s (PMap 'Unsorted PResultTag (PInteger @S))
-> PProposalVotes s
PProposalVotes (Term s (PMap 'Unsorted PResultTag (PInteger @S))
-> PProposalVotes s)
-> Term s (PMap 'Unsorted PResultTag (PInteger @S))
-> PProposalVotes s
forall a b. (a -> b) -> a -> b
$
Term
s
((PInteger @S :--> PMaybe (PInteger @S))
:--> (PResultTag
:--> (PMap 'Unsorted PResultTag (PInteger @S)
:--> PMap 'Unsorted PResultTag (PInteger @S))))
forall (k :: PType) (v :: PType) (keys :: KeyGuarantees) (s :: S).
(PIsData k, PIsData v) =>
Term
s
((v :--> PMaybe v)
:--> (k :--> (PMap keys k v :--> PMap keys k v)))
pupdate
# plam
( \votes -> unTermCont $ do
PDiscrete v <- pmatchC stakeInF.stakedAmount
pure $ pcon $ PJust $ votes + (pextract # v)
)
# voteFor
# m
expectedProposalOut :: Term s PProposalDatum
expectedProposalOut =
(forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))))
-> PProposalDatum s')
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
-> Term s PProposalDatum
forall (r :: [PLabeledType]) (s :: S) (pt :: PType).
PlutusType pt =>
(forall (s' :: S). Term s' (PDataRecord r) -> pt s')
-> RecordMorphism s ('[] @PLabeledType) r -> Term s pt
mkRecordConstr
forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))))
-> PProposalDatum s'
PProposalDatum
( FieldName "proposalId"
#proposalId FieldName "proposalId"
-> Term s (PAsData PProposalId)
-> RecordMorphism
s
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.proposalId
RecordMorphism
s
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "effects"
#effects FieldName "effects"
-> Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash)))
-> RecordMorphism
s
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.effects
RecordMorphism
s
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "status"
#status FieldName "status"
-> Term s (PAsData PProposalStatus)
-> RecordMorphism
s
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status
RecordMorphism
s
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "cosigners"
#cosigners FieldName "cosigners"
-> Term s (PAsData (PBuiltinList (PAsData PPubKeyHash)))
-> RecordMorphism
s
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.cosigners
RecordMorphism
s
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "thresholds"
#thresholds FieldName "thresholds"
-> Term s (PAsData PProposalThresholds)
-> RecordMorphism
s
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.thresholds
RecordMorphism
s
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "votes"
#votes FieldName "votes"
-> Term s (PAsData PProposalVotes)
-> RecordMorphism
s
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= Term s PProposalVotes -> Term s (PAsData PProposalVotes)
forall (a :: PType) (s :: S).
PIsData a =>
Term s a -> Term s (PAsData a)
pdata Term s PProposalVotes
expectedNewVotes
RecordMorphism
s
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "timingConfig"
#timingConfig FieldName "timingConfig"
-> Term s (PAsData PProposalTimingConfig)
-> RecordMorphism
s
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.timingConfig
RecordMorphism
s
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "startingTime"
#startingTime FieldName "startingTime"
-> Term s (PAsData PProposalStartingTime)
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.startingTime
)
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Output proposal should be valid" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$ Term s PProposalDatum
proposalOut Term s PProposalDatum -> Term s PProposalDatum -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PProposalDatum
expectedProposalOut
let newProposalLock :: Term s PProposalLock
newProposalLock =
(forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("vote" ':= PResultTag)
((':)
@PLabeledType
("proposalTag" ':= PProposalId)
('[] @PLabeledType))))
-> PProposalLock s')
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("vote" ':= PResultTag)
((':)
@PLabeledType ("proposalTag" ':= PProposalId) ('[] @PLabeledType)))
-> Term s PProposalLock
forall (r :: [PLabeledType]) (s :: S) (pt :: PType).
PlutusType pt =>
(forall (s' :: S). Term s' (PDataRecord r) -> pt s')
-> RecordMorphism s ('[] @PLabeledType) r -> Term s pt
mkRecordConstr
forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("vote" ':= PResultTag)
((':)
@PLabeledType
("proposalTag" ':= PProposalId)
('[] @PLabeledType))))
-> PProposalLock s'
PProposalLock
( FieldName "vote"
#vote FieldName "vote"
-> Term s (PAsData PResultTag)
-> RecordMorphism
s
((':)
@PLabeledType ("proposalTag" ':= PProposalId) ('[] @PLabeledType))
((':)
@PLabeledType
("vote" ':= PResultTag)
((':)
@PLabeledType ("proposalTag" ':= PProposalId) ('[] @PLabeledType)))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= Term s PResultTag -> Term s (PAsData PResultTag)
forall (a :: PType) (s :: S).
PIsData a =>
Term s a -> Term s (PAsData a)
pdata Term s PResultTag
voteFor
RecordMorphism
s
((':)
@PLabeledType ("proposalTag" ':= PProposalId) ('[] @PLabeledType))
((':)
@PLabeledType
("vote" ':= PResultTag)
((':)
@PLabeledType ("proposalTag" ':= PProposalId) ('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType ("proposalTag" ':= PProposalId) ('[] @PLabeledType))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("vote" ':= PResultTag)
((':)
@PLabeledType ("proposalTag" ':= PProposalId) ('[] @PLabeledType)))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "proposalTag"
#proposalTag FieldName "proposalTag"
-> Term s (PAsData PProposalId)
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType ("proposalTag" ':= PProposalId) ('[] @PLabeledType))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.proposalId
)
expectedProposalLocks :: Term s (PBuiltinList (PAsData PProposalLock))
expectedProposalLocks =
Term
s
(PAsData PProposalLock
:--> (PBuiltinList (PAsData PProposalLock)
:--> PBuiltinList (PAsData PProposalLock)))
forall (list :: PType -> PType) (a :: PType) (s :: S).
(PListLike list, PElemConstraint list a) =>
Term s (a :--> (list a :--> list a))
pcons
# pdata newProposalLock
# pfromData stakeInF.lockedBy
expectedStakeOut :: Term s PStakeDatum
expectedStakeOut =
(forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))))
-> PStakeDatum s')
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))))
-> Term s PStakeDatum
forall (r :: [PLabeledType]) (s :: S) (pt :: PType).
PlutusType pt =>
(forall (s' :: S). Term s' (PDataRecord r) -> pt s')
-> RecordMorphism s ('[] @PLabeledType) r -> Term s pt
mkRecordConstr
forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))))
-> PStakeDatum s'
PStakeDatum
( FieldName "stakedAmount"
#stakedAmount FieldName "stakedAmount"
-> Term s (PAsData (PDiscrete @Type GTTag))
-> RecordMorphism
s
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("stakedAmount", Term s (PAsData (PDiscrete @Type GTTag)))
((':)
@(Symbol, Type)
'("owner", Term s (PAsData PPubKeyHash))
((':)
@(Symbol, Type)
'("lockedBy",
Term s (PAsData (PBuiltinList (PAsData PProposalLock))))
('[] @(Symbol, Type)))))
stakeInF.stakedAmount
RecordMorphism
s
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "owner"
#owner FieldName "owner"
-> Term s (PAsData PPubKeyHash)
-> RecordMorphism
s
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("stakedAmount", Term s (PAsData (PDiscrete @Type GTTag)))
((':)
@(Symbol, Type)
'("owner", Term s (PAsData PPubKeyHash))
((':)
@(Symbol, Type)
'("lockedBy",
Term s (PAsData (PBuiltinList (PAsData PProposalLock))))
('[] @(Symbol, Type)))))
stakeInF.owner
RecordMorphism
s
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "lockedBy"
#lockedBy FieldName "lockedBy"
-> Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= Term s (PBuiltinList (PAsData PProposalLock))
-> Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
forall (a :: PType) (s :: S).
PIsData a =>
Term s a -> Term s (PAsData a)
pdata Term s (PBuiltinList (PAsData PProposalLock))
expectedProposalLocks
)
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Output stake should be locked by the proposal" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$ Term s PStakeDatum
expectedStakeOut Term s PStakeDatum -> Term s PStakeDatum -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PStakeDatum
stakeOut
Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s POpaque -> TermCont @POpaque s (Term s POpaque))
-> Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall a b. (a -> b) -> a -> b
$ Term s (PUnit @S) -> Term s POpaque
forall (s :: S) (a :: PType). Term s a -> Term s POpaque
popaque (PLifted (PUnit @S) -> Term s (PUnit @S)
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant ())
PCosign Term
s
(PDataRecord
((':)
@PLabeledType
("newCosigners" ':= PBuiltinList (PAsData PPubKeyHash))
('[] @PLabeledType)))
r -> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @POpaque s (Term s POpaque) -> Term s POpaque)
-> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ do
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Stake should not change" Term s PBool
stakeUnchanged
Term s (PBuiltinList (PAsData PPubKeyHash))
newSigs <- Term s (PBuiltinList (PAsData PPubKeyHash))
-> TermCont
@POpaque s (Term s (PBuiltinList (PAsData PPubKeyHash)))
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s (PBuiltinList (PAsData PPubKeyHash))
-> TermCont
@POpaque s (Term s (PBuiltinList (PAsData PPubKeyHash))))
-> Term s (PBuiltinList (PAsData PPubKeyHash))
-> TermCont
@POpaque s (Term s (PBuiltinList (PAsData PPubKeyHash)))
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"newCosigners" Term
s
(PDataRecord
((':)
@PLabeledType
("newCosigners" ':= PBuiltinList (PAsData PPubKeyHash))
('[] @PLabeledType))
:--> PBuiltinList (PAsData PPubKeyHash))
-> Term
s
(PDataRecord
((':)
@PLabeledType
("newCosigners" ':= PBuiltinList (PAsData PPubKeyHash))
('[] @PLabeledType)))
-> Term s (PBuiltinList (PAsData PPubKeyHash))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term
s
(PDataRecord
((':)
@PLabeledType
("newCosigners" ':= PBuiltinList (PAsData PPubKeyHash))
('[] @PLabeledType)))
r
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Cosigners are unique" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term
s
((PAsData PPubKeyHash :--> (PAsData PPubKeyHash :--> PBool))
:--> ((PAsData PPubKeyHash :--> (PAsData PPubKeyHash :--> PBool))
:--> (PBuiltinList (PAsData PPubKeyHash) :--> PBool)))
forall (a :: PType) (s :: S) (list :: PType -> PType).
(PIsListLike list a, PIsListLike list (list a)) =>
Term
s
((a :--> (a :--> PBool))
:--> ((a :--> (a :--> PBool)) :--> (list a :--> PBool)))
pisUniqBy
# phoistAcyclic (plam (#==))
# phoistAcyclic (plam $ \(pfromData -> x) (pfromData -> y) -> x #< y)
# newSigs
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Signed by all new cosigners" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term
s
((PAsData PPubKeyHash :--> PBool)
:--> (PBuiltinList (PAsData PPubKeyHash) :--> PBool))
forall (list :: PType -> PType) (a :: PType) (s :: S).
PIsListLike list a =>
Term s ((a :--> PBool) :--> (list a :--> PBool))
pall Term
s
((PAsData PPubKeyHash :--> PBool)
:--> (PBuiltinList (PAsData PPubKeyHash) :--> PBool))
-> Term s (PAsData PPubKeyHash :--> PBool)
-> Term s (PBuiltinList (PAsData PPubKeyHash) :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PAsData PPubKeyHash :--> PBool)
signedBy Term s (PBuiltinList (PAsData PPubKeyHash) :--> PBool)
-> Term s (PBuiltinList (PAsData PPubKeyHash)) -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PBuiltinList (PAsData PPubKeyHash))
newSigs
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"As many new cosigners as Stake datums" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s (PInteger @S)
spentStakeST Term s (PInteger @S) -> Term s (PInteger @S) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s (PBuiltinList (PAsData PPubKeyHash) :--> PInteger @S)
forall (list :: PType -> PType) (a :: PType) (s :: S).
PIsListLike list a =>
Term s (list a :--> PInteger @S)
plength Term s (PBuiltinList (PAsData PPubKeyHash) :--> PInteger @S)
-> Term s (PBuiltinList (PAsData PPubKeyHash))
-> Term s (PInteger @S)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PBuiltinList (PAsData PPubKeyHash))
newSigs
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"All new cosigners are witnessed by their Stake datums" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term
s
((PAsData PPubKeyHash :--> PBool)
:--> (PBuiltinList (PAsData PPubKeyHash) :--> PBool))
forall (list :: PType -> PType) (a :: PType) (s :: S).
PIsListLike list a =>
Term s ((a :--> PBool) :--> (list a :--> PBool))
pall
# plam
( \sig ->
pmatch
( findStakeOwnedBy # stakeSTAssetClass
# pfromData sig
# txInfoF.datums
# txInfoF.inputs
)
$ \case
PNothing -> pcon PFalse
PJust _ -> pcon PTrue
)
# newSigs
let updatedSigs :: Term s (PBuiltinList (PAsData PPubKeyHash))
updatedSigs = Term
s
(PBuiltinList (PAsData PPubKeyHash)
:--> (PBuiltinList (PAsData PPubKeyHash)
:--> PBuiltinList (PAsData PPubKeyHash)))
forall (list :: PType -> PType) (a :: PType) (s :: S).
PIsListLike list a =>
Term s (list a :--> (list a :--> list a))
pconcat Term
s
(PBuiltinList (PAsData PPubKeyHash)
:--> (PBuiltinList (PAsData PPubKeyHash)
:--> PBuiltinList (PAsData PPubKeyHash)))
-> Term s (PBuiltinList (PAsData PPubKeyHash))
-> Term
s
(PBuiltinList (PAsData PPubKeyHash)
:--> PBuiltinList (PAsData PPubKeyHash))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PBuiltinList (PAsData PPubKeyHash))
newSigs Term
s
(PBuiltinList (PAsData PPubKeyHash)
:--> PBuiltinList (PAsData PPubKeyHash))
-> Term s (PBuiltinList (PAsData PPubKeyHash))
-> Term s (PBuiltinList (PAsData PPubKeyHash))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.cosigners
expectedDatum :: Term s PProposalDatum
expectedDatum =
(forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))))
-> PProposalDatum s')
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
-> Term s PProposalDatum
forall (r :: [PLabeledType]) (s :: S) (pt :: PType).
PlutusType pt =>
(forall (s' :: S). Term s' (PDataRecord r) -> pt s')
-> RecordMorphism s ('[] @PLabeledType) r -> Term s pt
mkRecordConstr
forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))))
-> PProposalDatum s'
PProposalDatum
( FieldName "proposalId"
#proposalId FieldName "proposalId"
-> Term s (PAsData PProposalId)
-> RecordMorphism
s
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.proposalId
RecordMorphism
s
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "effects"
#effects FieldName "effects"
-> Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash)))
-> RecordMorphism
s
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.effects
RecordMorphism
s
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "status"
#status FieldName "status"
-> Term s (PAsData PProposalStatus)
-> RecordMorphism
s
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status
RecordMorphism
s
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "cosigners"
#cosigners FieldName "cosigners"
-> Term s (PAsData (PBuiltinList (PAsData PPubKeyHash)))
-> RecordMorphism
s
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= Term s (PBuiltinList (PAsData PPubKeyHash))
-> Term s (PAsData (PBuiltinList (PAsData PPubKeyHash)))
forall (a :: PType) (s :: S).
PIsData a =>
Term s a -> Term s (PAsData a)
pdata Term s (PBuiltinList (PAsData PPubKeyHash))
updatedSigs
RecordMorphism
s
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "thresholds"
#thresholds FieldName "thresholds"
-> Term s (PAsData PProposalThresholds)
-> RecordMorphism
s
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.thresholds
RecordMorphism
s
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "votes"
#votes FieldName "votes"
-> Term s (PAsData PProposalVotes)
-> RecordMorphism
s
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.votes
RecordMorphism
s
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "timingConfig"
#timingConfig FieldName "timingConfig"
-> Term s (PAsData PProposalTimingConfig)
-> RecordMorphism
s
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.timingConfig
RecordMorphism
s
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "startingTime"
#startingTime FieldName "startingTime"
-> Term s (PAsData PProposalStartingTime)
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.startingTime
)
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Signatures are correctly added to cosignature list" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s PProposalDatum
proposalOut Term s PProposalDatum -> Term s PProposalDatum -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PProposalDatum
expectedDatum
Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s POpaque -> TermCont @POpaque s (Term s POpaque))
-> Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall a b. (a -> b) -> a -> b
$ Term s (PUnit @S) -> Term s POpaque
forall (s :: S) (a :: PType). Term s a -> Term s POpaque
popaque (PLifted (PUnit @S) -> Term s (PUnit @S)
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant ())
PUnlock Term
s
(PDataRecord
((':)
@PLabeledType ("resultTag" ':= PResultTag) ('[] @PLabeledType)))
r -> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @POpaque s (Term s POpaque) -> Term s POpaque)
-> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ do
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Shouldn't retract votes from a draft proposal" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s (PBool :--> PBool)
forall (s :: S). Term s (PBool :--> PBool)
pnot Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
#$ HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status Term s (PAsData PProposalStatus)
-> Term s (PAsData PProposalStatus) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== ProposalStatus -> Term s (PAsData PProposalStatus)
forall (p :: PType) h (s :: S).
(ToData h, (PLifted p :: Type) ~ (h :: Type),
(PConstanted h :: PType) ~ (p :: PType)) =>
h -> Term s (PAsData p)
pconstantData ProposalStatus
Draft
Term s PResultTag
retractFrom <- Term s PResultTag -> TermCont @POpaque s (Term s PResultTag)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PResultTag -> TermCont @POpaque s (Term s PResultTag))
-> Term s PResultTag -> TermCont @POpaque s (Term s PResultTag)
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"resultTag" Term
s
(PDataRecord
((':)
@PLabeledType ("resultTag" ':= PResultTag) ('[] @PLabeledType))
:--> PResultTag)
-> Term
s
(PDataRecord
((':)
@PLabeledType ("resultTag" ':= PResultTag) ('[] @PLabeledType)))
-> Term s PResultTag
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term
s
(PDataRecord
((':)
@PLabeledType ("resultTag" ':= PResultTag) ('[] @PLabeledType)))
r
Term s PStakeUsage
stakeUsage <- Term s PStakeUsage -> TermCont @POpaque s (Term s PStakeUsage)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PStakeUsage -> TermCont @POpaque s (Term s PStakeUsage))
-> Term s PStakeUsage -> TermCont @POpaque s (Term s PStakeUsage)
forall a b. (a -> b) -> a -> b
$ Term
s
(PBuiltinList (PAsData PProposalLock)
:--> (PProposalId :--> PStakeUsage))
forall {w :: S}.
Term
w
(PBuiltinList (PAsData PProposalLock)
:--> (PProposalId :--> PStakeUsage))
pgetStakeUsage Term
s
(PBuiltinList (PAsData PProposalLock)
:--> (PProposalId :--> PStakeUsage))
-> Term s (PBuiltinList (PAsData PProposalLock))
-> Term s (PProposalId :--> PStakeUsage)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("stakedAmount", Term s (PAsData (PDiscrete @Type GTTag)))
((':)
@(Symbol, Type)
'("owner", Term s (PAsData PPubKeyHash))
((':)
@(Symbol, Type)
'("lockedBy",
Term s (PAsData (PBuiltinList (PAsData PProposalLock))))
('[] @(Symbol, Type)))))
stakeInF.lockedBy Term s (PProposalId :--> PStakeUsage)
-> Term s PProposalId -> Term s PStakeUsage
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.proposalId
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Stake input relevant" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s PStakeUsage
-> (PStakeUsage s -> Term s PBool) -> Term s PBool
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch Term s PStakeUsage
stakeUsage ((PStakeUsage s -> Term s PBool) -> Term s PBool)
-> (PStakeUsage s -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \case
PStakeUsage s
PDidNothing ->
Term s (PString @S) -> Term s PBool -> Term s PBool
forall (s :: S).
Term s (PString @S) -> Term s PBool -> Term s PBool
ptraceIfFalse Term s (PString @S)
"Stake should be relevant" (Term s PBool -> Term s PBool) -> Term s PBool -> Term s PBool
forall a b. (a -> b) -> a -> b
$
PLifted PBool -> Term s PBool
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant Bool
PLifted PBool
False
PStakeUsage s
PCreated ->
Term s (PString @S) -> Term s PBool -> Term s PBool
forall (s :: S).
Term s (PString @S) -> Term s PBool -> Term s PBool
ptraceIfFalse Term s (PString @S)
"Removing creator's locks means status is Finished" (Term s PBool -> Term s PBool) -> Term s PBool -> Term s PBool
forall a b. (a -> b) -> a -> b
$
HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status Term s (PAsData PProposalStatus)
-> Term s (PAsData PProposalStatus) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== ProposalStatus -> Term s (PAsData PProposalStatus)
forall (p :: PType) h (s :: S).
(ToData h, (PLifted p :: Type) ~ (h :: Type),
(PConstanted h :: PType) ~ (p :: PType)) =>
h -> Term s (PAsData p)
pconstantData ProposalStatus
Finished
PVotedFor Term s PResultTag
rt ->
Term s (PString @S) -> Term s PBool -> Term s PBool
forall (s :: S).
Term s (PString @S) -> Term s PBool -> Term s PBool
ptraceIfFalse Term s (PString @S)
"Result tag should match the one given in the redeemer" (Term s PBool -> Term s PBool) -> Term s PBool -> Term s PBool
forall a b. (a -> b) -> a -> b
$
Term s PResultTag
rt Term s PResultTag -> Term s PResultTag -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PResultTag
retractFrom
Term s (PInteger @S)
retractCount <-
Term s (PInteger @S) -> TermCont @POpaque s (Term s (PInteger @S))
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s (PInteger @S)
-> TermCont @POpaque s (Term s (PInteger @S)))
-> Term s (PInteger @S)
-> TermCont @POpaque s (Term s (PInteger @S))
forall a b. (a -> b) -> a -> b
$
Term s (PDiscrete @Type GTTag)
-> (PDiscrete @Type GTTag s -> Term s (PInteger @S))
-> Term s (PInteger @S)
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch HRec
((':)
@(Symbol, Type)
'("stakedAmount", Term s (PAsData (PDiscrete @Type GTTag)))
((':)
@(Symbol, Type)
'("owner", Term s (PAsData PPubKeyHash))
((':)
@(Symbol, Type)
'("lockedBy",
Term s (PAsData (PBuiltinList (PAsData PProposalLock))))
('[] @(Symbol, Type)))))
stakeInF.stakedAmount ((PDiscrete @Type GTTag s -> Term s (PInteger @S))
-> Term s (PInteger @S))
-> (PDiscrete @Type GTTag s -> Term s (PInteger @S))
-> Term s (PInteger @S)
forall a b. (a -> b) -> a -> b
$ \(PDiscrete Term s (PTagged @Type GTTag (PInteger @S))
v) -> Term s (PTagged @Type GTTag (PInteger @S) :--> PInteger @S)
forall (w :: PType -> PType) (a :: PType) (s :: S).
(PComonad w, PSubcategory w a) =>
Term s (w a :--> a)
pextract Term s (PTagged @Type GTTag (PInteger @S) :--> PInteger @S)
-> Term s (PTagged @Type GTTag (PInteger @S))
-> Term s (PInteger @S)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PTagged @Type GTTag (PInteger @S))
v
let shouldUpdateVotes :: Term s PBool
shouldUpdateVotes =
HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status Term s (PAsData PProposalStatus)
-> Term s (PAsData PProposalStatus) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== ProposalStatus -> Term s (PAsData PProposalStatus)
forall (p :: PType) h (s :: S).
(ToData h, (PLifted p :: Type) ~ (h :: Type),
(PConstanted h :: PType) ~ (p :: PType)) =>
h -> Term s (PAsData p)
pconstantData ProposalStatus
VotingReady
#&& pnot # (pcon PCreated #== stakeUsage)
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Proposal output correct" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s PBool -> Term s PBool -> Term s PBool -> Term s PBool
forall (s :: S) (a :: PType).
Term s PBool -> Term s a -> Term s a -> Term s a
pif
Term s PBool
shouldUpdateVotes
( let
expectedVotes :: Term s PProposalVotes
expectedVotes = Term
s
(PResultTag
:--> (PInteger @S :--> (PProposalVotes :--> PProposalVotes)))
forall (s :: S).
Term
s
(PResultTag
:--> (PInteger @S :--> (PProposalVotes :--> PProposalVotes)))
pretractVotes Term
s
(PResultTag
:--> (PInteger @S :--> (PProposalVotes :--> PProposalVotes)))
-> Term s PResultTag
-> Term s (PInteger @S :--> (PProposalVotes :--> PProposalVotes))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PResultTag
retractFrom Term s (PInteger @S :--> (PProposalVotes :--> PProposalVotes))
-> Term s (PInteger @S)
-> Term s (PProposalVotes :--> PProposalVotes)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PInteger @S)
retractCount Term s (PProposalVotes :--> PProposalVotes)
-> Term s PProposalVotes -> Term s PProposalVotes
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.votes
expectedProposalOut :: Term s PProposalDatum
expectedProposalOut =
(forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))))
-> PProposalDatum s')
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
-> Term s PProposalDatum
forall (r :: [PLabeledType]) (s :: S) (pt :: PType).
PlutusType pt =>
(forall (s' :: S). Term s' (PDataRecord r) -> pt s')
-> RecordMorphism s ('[] @PLabeledType) r -> Term s pt
mkRecordConstr
forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))))
-> PProposalDatum s'
PProposalDatum
( FieldName "proposalId"
#proposalId FieldName "proposalId"
-> Term s (PAsData PProposalId)
-> RecordMorphism
s
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.proposalId
RecordMorphism
s
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "effects"
#effects FieldName "effects"
-> Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash)))
-> RecordMorphism
s
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.effects
RecordMorphism
s
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "status"
#status FieldName "status"
-> Term s (PAsData PProposalStatus)
-> RecordMorphism
s
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status
RecordMorphism
s
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "cosigners"
#cosigners FieldName "cosigners"
-> Term s (PAsData (PBuiltinList (PAsData PPubKeyHash)))
-> RecordMorphism
s
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.cosigners
RecordMorphism
s
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "thresholds"
#thresholds FieldName "thresholds"
-> Term s (PAsData PProposalThresholds)
-> RecordMorphism
s
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.thresholds
RecordMorphism
s
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "votes"
#votes FieldName "votes"
-> Term s (PAsData PProposalVotes)
-> RecordMorphism
s
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= Term s PProposalVotes -> Term s (PAsData PProposalVotes)
forall (a :: PType) (s :: S).
PIsData a =>
Term s a -> Term s (PAsData a)
pdata Term s PProposalVotes
expectedVotes
RecordMorphism
s
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "timingConfig"
#timingConfig FieldName "timingConfig"
-> Term s (PAsData PProposalTimingConfig)
-> RecordMorphism
s
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.timingConfig
RecordMorphism
s
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "startingTime"
#startingTime FieldName "startingTime"
-> Term s (PAsData PProposalStartingTime)
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.startingTime
)
in Term s (PString @S) -> Term s PBool -> Term s PBool
forall (s :: S).
Term s (PString @S) -> Term s PBool -> Term s PBool
ptraceIfFalse Term s (PString @S)
"Update votes" (Term s PBool -> Term s PBool) -> Term s PBool -> Term s PBool
forall a b. (a -> b) -> a -> b
$
Term s PProposalDatum
expectedProposalOut Term s PProposalDatum -> Term s PProposalDatum -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PProposalDatum
proposalOut
)
(Term s PBool -> Term s PBool) -> Term s PBool -> Term s PBool
forall a b. (a -> b) -> a -> b
$ Term s (PString @S) -> Term s PBool -> Term s PBool
forall (s :: S).
Term s (PString @S) -> Term s PBool -> Term s PBool
ptraceIfFalse Term s (PString @S)
"Proposal unchanged" Term s PBool
proposalUnchanged
Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
stakeOutputLocks <- Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
-> TermCont
@POpaque
s
(Term s (PAsData (PBuiltinList (PAsData PProposalLock))))
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
-> TermCont
@POpaque
s
(Term s (PAsData (PBuiltinList (PAsData PProposalLock)))))
-> Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
-> TermCont
@POpaque
s
(Term s (PAsData (PBuiltinList (PAsData PProposalLock))))
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"lockedBy" Term
s (PStakeDatum :--> PAsData (PBuiltinList (PAsData PProposalLock)))
-> Term s PStakeDatum
-> Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PStakeDatum
stakeOut
let templateStakeOut :: Term s PStakeDatum
templateStakeOut =
(forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))))
-> PStakeDatum s')
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))))
-> Term s PStakeDatum
forall (r :: [PLabeledType]) (s :: S) (pt :: PType).
PlutusType pt =>
(forall (s' :: S). Term s' (PDataRecord r) -> pt s')
-> RecordMorphism s ('[] @PLabeledType) r -> Term s pt
mkRecordConstr
forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))))
-> PStakeDatum s'
PStakeDatum
( FieldName "stakedAmount"
#stakedAmount FieldName "stakedAmount"
-> Term s (PAsData (PDiscrete @Type GTTag))
-> RecordMorphism
s
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("stakedAmount", Term s (PAsData (PDiscrete @Type GTTag)))
((':)
@(Symbol, Type)
'("owner", Term s (PAsData PPubKeyHash))
((':)
@(Symbol, Type)
'("lockedBy",
Term s (PAsData (PBuiltinList (PAsData PProposalLock))))
('[] @(Symbol, Type)))))
stakeInF.stakedAmount
RecordMorphism
s
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("stakedAmount" ':= PDiscrete @Type GTTag)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "owner"
#owner FieldName "owner"
-> Term s (PAsData PPubKeyHash)
-> RecordMorphism
s
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("stakedAmount", Term s (PAsData (PDiscrete @Type GTTag)))
((':)
@(Symbol, Type)
'("owner", Term s (PAsData PPubKeyHash))
((':)
@(Symbol, Type)
'("lockedBy",
Term s (PAsData (PBuiltinList (PAsData PProposalLock))))
('[] @(Symbol, Type)))))
stakeInF.owner
RecordMorphism
s
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("owner" ':= PPubKeyHash)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType)))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "lockedBy"
#lockedBy FieldName "lockedBy"
-> Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("lockedBy" ':= PBuiltinList (PAsData PProposalLock))
('[] @PLabeledType))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
stakeOutputLocks
)
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Only locks updated in the output stake" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s PStakeDatum
templateStakeOut Term s PStakeDatum -> Term s PStakeDatum -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PStakeDatum
stakeOut
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"All relevant locks removed from the stake" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term
s
(PBuiltinList (PAsData PProposalLock)
:--> (PProposalId :--> PStakeUsage))
forall {w :: S}.
Term
w
(PBuiltinList (PAsData PProposalLock)
:--> (PProposalId :--> PStakeUsage))
pgetStakeUsage Term
s
(PBuiltinList (PAsData PProposalLock)
:--> (PProposalId :--> PStakeUsage))
-> Term s (PBuiltinList (PAsData PProposalLock))
-> Term s (PProposalId :--> PStakeUsage)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
-> Term s (PBuiltinList (PAsData PProposalLock))
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData Term s (PAsData (PBuiltinList (PAsData PProposalLock)))
stakeOutputLocks
# proposalF.proposalId #== pcon PDidNothing
Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s POpaque -> TermCont @POpaque s (Term s POpaque))
-> Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall a b. (a -> b) -> a -> b
$ Term s (PUnit @S) -> Term s POpaque
forall (s :: S) (a :: PType). Term s a -> Term s POpaque
popaque (PLifted (PUnit @S) -> Term s (PUnit @S)
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant ())
PAdvanceProposal Term s (PDataRecord ('[] @PLabeledType))
_r -> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @POpaque s (Term s POpaque) -> Term s POpaque)
-> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ do
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Stake should not change" Term s PBool
stakeUnchanged
Term s (PAsData PProposalStatus)
proposalOutStatus <- Term s (PAsData PProposalStatus)
-> TermCont @POpaque s (Term s (PAsData PProposalStatus))
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s (PAsData PProposalStatus)
-> TermCont @POpaque s (Term s (PAsData PProposalStatus)))
-> Term s (PAsData PProposalStatus)
-> TermCont @POpaque s (Term s (PAsData PProposalStatus))
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) (p :: PType) (s :: S) (a :: PType)
(as :: [PLabeledType]) (n :: Nat) (b :: PType).
(PDataFields p,
(as :: [PLabeledType]) ~ (PFields p :: [PLabeledType]),
(n :: Nat) ~ (PLabelIndex name as :: Nat), KnownNat n,
(a :: PType) ~ (PUnLabel (IndexList @PLabeledType n as) :: PType),
PFromDataable a b) =>
Term s (p :--> b)
pfield @"status" Term s (PProposalDatum :--> PAsData PProposalStatus)
-> Term s PProposalDatum -> Term s (PAsData PProposalStatus)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PProposalDatum
proposalOut
let
templateProposalOut :: Term s PProposalDatum
templateProposalOut =
(forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))))
-> PProposalDatum s')
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
-> Term s PProposalDatum
forall (r :: [PLabeledType]) (s :: S) (pt :: PType).
PlutusType pt =>
(forall (s' :: S). Term s' (PDataRecord r) -> pt s')
-> RecordMorphism s ('[] @PLabeledType) r -> Term s pt
mkRecordConstr
forall (s' :: S).
Term
s'
(PDataRecord
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))))
-> PProposalDatum s'
PProposalDatum
( FieldName "proposalId"
#proposalId FieldName "proposalId"
-> Term s (PAsData PProposalId)
-> RecordMorphism
s
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.proposalId
RecordMorphism
s
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("proposalId" ':= PProposalId)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "effects"
#effects FieldName "effects"
-> Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash)))
-> RecordMorphism
s
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.effects
RecordMorphism
s
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("effects"
':= PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "status"
#status FieldName "status"
-> Term s (PAsData PProposalStatus)
-> RecordMorphism
s
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= Term s (PAsData PProposalStatus)
proposalOutStatus
RecordMorphism
s
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("status" ':= PProposalStatus)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "cosigners"
#cosigners FieldName "cosigners"
-> Term s (PAsData (PBuiltinList (PAsData PPubKeyHash)))
-> RecordMorphism
s
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.cosigners
RecordMorphism
s
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("cosigners" ':= PBuiltinList (PAsData PPubKeyHash))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "thresholds"
#thresholds FieldName "thresholds"
-> Term s (PAsData PProposalThresholds)
-> RecordMorphism
s
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.thresholds
RecordMorphism
s
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("thresholds" ':= PProposalThresholds)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "votes"
#votes FieldName "votes"
-> Term s (PAsData PProposalVotes)
-> RecordMorphism
s
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.votes
RecordMorphism
s
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("votes" ':= PProposalVotes)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "timingConfig"
#timingConfig FieldName "timingConfig"
-> Term s (PAsData PProposalTimingConfig)
-> RecordMorphism
s
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.timingConfig
RecordMorphism
s
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("timingConfig" ':= PProposalTimingConfig)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType)))
forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType])
(c :: [PLabeledType]).
RecordMorphism s b c
-> RecordMorphism s a b -> RecordMorphism s a c
.& FieldName "startingTime"
#startingTime FieldName "startingTime"
-> Term s (PAsData PProposalStartingTime)
-> RecordMorphism
s
('[] @PLabeledType)
((':)
@PLabeledType
("startingTime" ':= PProposalStartingTime)
('[] @PLabeledType))
forall (sym :: Symbol) (a :: PType) (as :: [PLabeledType])
(s :: S).
FieldName sym
-> Term s (PAsData a)
-> RecordMorphism s as ((':) @PLabeledType (sym ':= a) as)
.= HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.startingTime
)
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Only status changes in the output proposal" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s PProposalDatum
templateProposalOut Term s PProposalDatum -> Term s PProposalDatum -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PProposalDatum
proposalOut
Term s PBool
inDraftPeriod <- Term s PBool -> TermCont @POpaque s (Term s PBool)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PBool -> TermCont @POpaque s (Term s PBool))
-> Term s PBool -> TermCont @POpaque s (Term s PBool)
forall a b. (a -> b) -> a -> b
$ Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
isDraftPeriod Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
-> Term s PProposalTimingConfig
-> Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.timingConfig Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.startingTime Term s (PProposalTime :--> PBool)
-> Term s PProposalTime -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PProposalTime
currentTime
Term s PBool
inVotingPeriod <- Term s PBool -> TermCont @POpaque s (Term s PBool)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PBool -> TermCont @POpaque s (Term s PBool))
-> Term s PBool -> TermCont @POpaque s (Term s PBool)
forall a b. (a -> b) -> a -> b
$ Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
isVotingPeriod Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
-> Term s PProposalTimingConfig
-> Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.timingConfig Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.startingTime Term s (PProposalTime :--> PBool)
-> Term s PProposalTime -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PProposalTime
currentTime
Term s PBool
inLockedPeriod <- Term s PBool -> TermCont @POpaque s (Term s PBool)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PBool -> TermCont @POpaque s (Term s PBool))
-> Term s PBool -> TermCont @POpaque s (Term s PBool)
forall a b. (a -> b) -> a -> b
$ Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
isLockingPeriod Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
-> Term s PProposalTimingConfig
-> Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.timingConfig Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.startingTime Term s (PProposalTime :--> PBool)
-> Term s PProposalTime -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PProposalTime
currentTime
Term s PBool
inExecutionPeriod <- Term s PBool -> TermCont @POpaque s (Term s PBool)
forall {r :: PType} (s :: S) (a :: PType).
Term s a -> TermCont @r s (Term s a)
pletC (Term s PBool -> TermCont @POpaque s (Term s PBool))
-> Term s PBool -> TermCont @POpaque s (Term s PBool)
forall a b. (a -> b) -> a -> b
$ Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
isExecutionPeriod Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
-> Term s PProposalTimingConfig
-> Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.timingConfig Term s (PProposalStartingTime :--> (PProposalTime :--> PBool))
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.startingTime Term s (PProposalTime :--> PBool)
-> Term s PProposalTime -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PProposalTime
currentTime
let isFinished :: Term s PBool
isFinished = HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status Term s (PAsData PProposalStatus)
-> Term s (PAsData PProposalStatus) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== ProposalStatus -> Term s (PAsData PProposalStatus)
forall (p :: PType) h (s :: S).
(ToData h, (PLifted p :: Type) ~ (h :: Type),
(PConstanted h :: PType) ~ (p :: PType)) =>
h -> Term s (PAsData p)
pconstantData ProposalStatus
Finished
notTooLate :: Term s PBool
notTooLate = Term s PProposalStatus
-> (PProposalStatus s -> Term s PBool) -> Term s PBool
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch (Term s (PAsData PProposalStatus) -> Term s PProposalStatus
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status) ((PProposalStatus s -> Term s PBool) -> Term s PBool)
-> (PProposalStatus s -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \case
PDraft Term s (PDataRecord ('[] @PLabeledType))
_ -> Term s PBool
inDraftPeriod
PVotingReady Term s (PDataRecord ('[] @PLabeledType))
_ -> Term s PBool
inLockedPeriod
PLocked Term s (PDataRecord ('[] @PLabeledType))
_ -> Term s PBool
inExecutionPeriod
PProposalStatus s
_ -> PLifted PBool -> Term s PBool
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant Bool
PLifted PBool
False
notTooEarly :: Term s PBool
notTooEarly = Term s PProposalStatus
-> (PProposalStatus s -> Term s PBool) -> Term s PBool
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch (Term s (PAsData PProposalStatus) -> Term s PProposalStatus
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status) ((PProposalStatus s -> Term s PBool) -> Term s PBool)
-> (PProposalStatus s -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \case
PVotingReady Term s (PDataRecord ('[] @PLabeledType))
_ -> Term s (PBool :--> PBool)
forall (s :: S). Term s (PBool :--> PBool)
pnot Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
inVotingPeriod
PLocked Term s (PDataRecord ('[] @PLabeledType))
_ -> Term s (PBool :--> PBool)
forall (s :: S). Term s (PBool :--> PBool)
pnot Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
inLockedPeriod
PProposalStatus s
_ -> PLifted PBool -> Term s PBool
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant Bool
PLifted PBool
True
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Cannot advance ahead of time" Term s PBool
notTooEarly
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Finished proposals cannot be advanced" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$ Term s (PBool :--> PBool)
forall (s :: S). Term s (PBool :--> PBool)
pnot Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
isFinished
HRec
(BoundTerms
(PFields (PAsData PProposalThresholds))
(Bindings
(PFields (PAsData PProposalThresholds))
((':) @Symbol "execute" ('[] @Symbol)))
s)
thresholdsF <- forall (fs :: [Symbol]) (a :: PType) (s :: S) (b :: PType)
(ps :: [PLabeledType]) (bs :: [ToBind]).
(PDataFields a,
(ps :: [PLabeledType]) ~ (PFields a :: [PLabeledType]),
(bs :: [ToBind]) ~ (Bindings ps fs :: [ToBind]),
BindFields ps bs) =>
Term s a -> TermCont @b s (HRec (BoundTerms ps bs s))
pletFieldsC @'["execute"] HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.thresholds
Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s POpaque -> TermCont @POpaque s (Term s POpaque))
-> Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall a b. (a -> b) -> a -> b
$
Term s PBool -> Term s POpaque -> Term s POpaque -> Term s POpaque
forall (s :: S) (a :: PType).
Term s PBool -> Term s a -> Term s a -> Term s a
pif
Term s PBool
notTooLate
( Term s PProposalStatus
-> (PProposalStatus s -> Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch (Term s (PAsData PProposalStatus) -> Term s PProposalStatus
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.status) ((PProposalStatus s -> Term s POpaque) -> Term s POpaque)
-> (PProposalStatus s -> Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ \case
PDraft Term s (PDataRecord ('[] @PLabeledType))
_ -> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @POpaque s (Term s POpaque) -> Term s POpaque)
-> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ do
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Proposal status set to VotingReady" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s (PAsData PProposalStatus)
proposalOutStatus Term s (PAsData PProposalStatus)
-> Term s (PAsData PProposalStatus) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== ProposalStatus -> Term s (PAsData PProposalStatus)
forall (p :: PType) h (s :: S).
(ToData h, (PLifted p :: Type) ~ (h :: Type),
(PConstanted h :: PType) ~ (p :: PType)) =>
h -> Term s (PAsData p)
pconstantData ProposalStatus
VotingReady
Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s POpaque -> TermCont @POpaque s (Term s POpaque))
-> Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall a b. (a -> b) -> a -> b
$ Term s (PUnit @S) -> Term s POpaque
forall (s :: S) (a :: PType). Term s a -> Term s POpaque
popaque (PLifted (PUnit @S) -> Term s (PUnit @S)
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant ())
PVotingReady Term s (PDataRecord ('[] @PLabeledType))
_ -> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @POpaque s (Term s POpaque) -> Term s POpaque)
-> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ do
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Proposal status set to Locked" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s (PAsData PProposalStatus)
proposalOutStatus Term s (PAsData PProposalStatus)
-> Term s (PAsData PProposalStatus) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== ProposalStatus -> Term s (PAsData PProposalStatus)
forall (p :: PType) h (s :: S).
(ToData h, (PLifted p :: Type) ~ (h :: Type),
(PConstanted h :: PType) ~ (p :: PType)) =>
h -> Term s (PAsData p)
pconstantData ProposalStatus
Locked
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Winner outcome not found" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s (PMaybe PResultTag :--> PBool)
forall (a :: PType) (s :: S). Term s (PMaybe a :--> PBool)
pisJust Term s (PMaybe PResultTag :--> PBool)
-> Term s (PMaybe PResultTag) -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
#$ Term s (PProposalVotes :--> (PInteger @S :--> PMaybe PResultTag))
forall (s :: S).
Term s (PProposalVotes :--> (PInteger @S :--> PMaybe PResultTag))
pwinner' Term s (PProposalVotes :--> (PInteger @S :--> PMaybe PResultTag))
-> Term s PProposalVotes
-> Term s (PInteger @S :--> PMaybe PResultTag)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# HRec
((':)
@(Symbol, Type)
'("proposalId", Term s (PAsData PProposalId))
((':)
@(Symbol, Type)
'("effects",
Term
s
(PAsData
(PMap
'Unsorted PResultTag (PMap 'Unsorted PValidatorHash PDatumHash))))
((':)
@(Symbol, Type)
'("status", Term s (PAsData PProposalStatus))
((':)
@(Symbol, Type)
'("cosigners",
Term s (PAsData (PBuiltinList (PAsData PPubKeyHash))))
((':)
@(Symbol, Type)
'("thresholds", Term s (PAsData PProposalThresholds))
((':)
@(Symbol, Type)
'("votes", Term s (PAsData PProposalVotes))
((':)
@(Symbol, Type)
'("timingConfig", Term s (PAsData PProposalTimingConfig))
((':)
@(Symbol, Type)
'("startingTime", Term s (PAsData PProposalStartingTime))
('[] @(Symbol, Type))))))))))
proposalF.votes
#$ punsafeCoerce
$ pfromData thresholdsF.execute
Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s POpaque -> TermCont @POpaque s (Term s POpaque))
-> Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall a b. (a -> b) -> a -> b
$ Term s (PUnit @S) -> Term s POpaque
forall (s :: S) (a :: PType). Term s a -> Term s POpaque
popaque (PLifted (PUnit @S) -> Term s (PUnit @S)
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant ())
PLocked Term s (PDataRecord ('[] @PLabeledType))
_ -> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @POpaque s (Term s POpaque) -> Term s POpaque)
-> TermCont @POpaque s (Term s POpaque) -> Term s POpaque
forall a b. (a -> b) -> a -> b
$ do
Term s (PString @S) -> Term s PBool -> TermCont @POpaque s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"Proposal status set to Finished" (Term s PBool -> TermCont @POpaque s ())
-> Term s PBool -> TermCont @POpaque s ()
forall a b. (a -> b) -> a -> b
$
Term s (PAsData PProposalStatus)
proposalOutStatus Term s (PAsData PProposalStatus)
-> Term s (PAsData PProposalStatus) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== ProposalStatus -> Term s (PAsData PProposalStatus)
forall (p :: PType) h (s :: S).
(ToData h, (PLifted p :: Type) ~ (h :: Type),
(PConstanted h :: PType) ~ (p :: PType)) =>
h -> Term s (PAsData p)
pconstantData ProposalStatus
Finished
Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s POpaque -> TermCont @POpaque s (Term s POpaque))
-> Term s POpaque -> TermCont @POpaque s (Term s POpaque)
forall a b. (a -> b) -> a -> b
$ Term s (PUnit @S) -> Term s POpaque
forall (s :: S) (a :: PType). Term s a -> Term s POpaque
popaque (PLifted (PUnit @S) -> Term s (PUnit @S)
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant ())
PProposalStatus s
_ -> Term s (PUnit @S) -> Term s POpaque
forall (s :: S) (a :: PType). Term s a -> Term s POpaque
popaque (PLifted (PUnit @S) -> Term s (PUnit @S)
forall (p :: PType) (s :: S). PLift p => PLifted p -> Term s p
pconstant ())
)
( Term s PBool -> Term s POpaque
forall (s :: S) (a :: PType). Term s a -> Term s POpaque
popaque (Term s PBool -> Term s POpaque) -> Term s PBool -> Term s POpaque
forall a b. (a -> b) -> a -> b
$
Term s (PString @S) -> Term s PBool -> Term s PBool
forall (s :: S).
Term s (PString @S) -> Term s PBool -> Term s PBool
ptraceIfFalse Term s (PString @S)
"Proposal should fail: not on time" (Term s PBool -> Term s PBool) -> Term s PBool -> Term s PBool
forall a b. (a -> b) -> a -> b
$
Term s (PAsData PProposalStatus)
proposalOutStatus Term s (PAsData PProposalStatus)
-> Term s (PAsData PProposalStatus) -> Term s PBool
forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== ProposalStatus -> Term s (PAsData PProposalStatus)
forall (p :: PType) h (s :: S).
(ToData h, (PLifted p :: Type) ~ (h :: Type),
(PConstanted h :: PType) ~ (p :: PType)) =>
h -> Term s (PAsData p)
pconstantData ProposalStatus
Finished
)