apply review suggestions
This commit is contained in:
parent
00d5a102b2
commit
86e60657d4
4 changed files with 90 additions and 91 deletions
|
|
@ -312,7 +312,7 @@ data ProposalEffectMetadata = ProposalEffectMetadata
|
|||
)
|
||||
via (ProductIsData ProposalEffectMetadata)
|
||||
|
||||
-- | @since 0.3.0
|
||||
-- | @since 1.0.0
|
||||
type ProposalEffectGroup = StrictMap.Map ValidatorHash ProposalEffectMetadata
|
||||
|
||||
{- | Haskell-level datum for Proposal scripts.
|
||||
|
|
@ -725,7 +725,7 @@ newtype PProposalDatum (s :: S) = PProposalDatum
|
|||
PEq
|
||||
)
|
||||
|
||||
-- | @since 0.2.0
|
||||
-- | @since 1.0.0
|
||||
instance DerivePlutusType PProposalDatum where
|
||||
type DPTStrat _ = PlutusTypeDataList
|
||||
|
||||
|
|
@ -798,7 +798,6 @@ phasNeutralEffect = phoistAcyclic $ PAssocMap.pany # PAssocMap.pnull
|
|||
-}
|
||||
pisEffectsVotesCompatible ::
|
||||
forall (s :: S).
|
||||
(PIsListLike PList PResultTag) =>
|
||||
Term
|
||||
s
|
||||
( PMap 'Sorted PResultTag PProposalEffectGroup
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ proposalPolicy (AssetClass (govCs, govTn)) =
|
|||
|
||||
@since 1.0.0
|
||||
-}
|
||||
data PWitneseMultipleStakeContext (s :: S) = PWitneseMultipleStakeContext
|
||||
data PWitnessMultipleStakeContext (s :: S) = PWitnessMultipleStakeContext
|
||||
{ totalAmount :: Term s PInteger
|
||||
, orderedOwners :: Term s (PList PCredential)
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ data PWitneseMultipleStakeContext (s :: S) = PWitneseMultipleStakeContext
|
|||
)
|
||||
|
||||
-- | @since 1.0.0
|
||||
instance DerivePlutusType PWitneseMultipleStakeContext where
|
||||
instance DerivePlutusType PWitnessMultipleStakeContext where
|
||||
type DPTStrat _ = PlutusTypeScott
|
||||
|
||||
{- | Validation context for redeemers which need to modify a single stake.
|
||||
|
|
@ -351,7 +351,7 @@ proposalValidator as maximumCosigners =
|
|||
witnessStakes' ::
|
||||
Term
|
||||
s
|
||||
( (PWitneseMultipleStakeContext :--> PUnit) :--> PUnit
|
||||
( (PWitnessMultipleStakeContext :--> PUnit) :--> PUnit
|
||||
) <-
|
||||
pletC $
|
||||
let updateCtx = plam $ \ctx' stake -> unTermCont $ do
|
||||
|
|
@ -363,7 +363,7 @@ proposalValidator as maximumCosigners =
|
|||
|
||||
pure $
|
||||
pcon $
|
||||
PWitneseMultipleStakeContext
|
||||
PWitnessMultipleStakeContext
|
||||
{ totalAmount =
|
||||
ctxF.totalAmount
|
||||
+ punsafeCoerce
|
||||
|
|
@ -381,7 +381,7 @@ proposalValidator as maximumCosigners =
|
|||
sortOwners = plam $
|
||||
flip pmatch $ \ctxF ->
|
||||
pcon $
|
||||
PWitneseMultipleStakeContext
|
||||
PWitnessMultipleStakeContext
|
||||
{ totalAmount = ctxF.totalAmount
|
||||
, orderedOwners = pmsort # ctxF.orderedOwners
|
||||
}
|
||||
|
|
@ -390,12 +390,12 @@ proposalValidator as maximumCosigners =
|
|||
sortOwners
|
||||
#$ pfoldl
|
||||
# f
|
||||
# pcon (PWitneseMultipleStakeContext 0 pnil)
|
||||
# pcon (PWitnessMultipleStakeContext 0 pnil)
|
||||
# txInfoF.referenceInputs
|
||||
in plam (# ctx)
|
||||
|
||||
let witnessStakes ::
|
||||
( PWitneseMultipleStakeContext _ ->
|
||||
( PWitnessMultipleStakeContext _ ->
|
||||
TermCont _ ()
|
||||
) ->
|
||||
Term _ POpaque
|
||||
|
|
@ -419,7 +419,7 @@ proposalValidator as maximumCosigners =
|
|||
unTermCont $ do
|
||||
lF <- pmatchC l
|
||||
t <- pletC $ getStakeDatum # txOut
|
||||
tF <- pmatchC l
|
||||
tF <- pmatchC t
|
||||
|
||||
pure $ case (lF, tF) of
|
||||
(PJust _, PJust _) ->
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ import Plutarch.Orphans ()
|
|||
import Plutarch.SafeMoney (Discrete, PDiscrete)
|
||||
import PlutusLedgerApi.V2 (Credential)
|
||||
import PlutusTx qualified
|
||||
import Prelude hiding (Num (..))
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -124,7 +123,7 @@ PlutusTx.makeIsDataIndexed
|
|||
|
||||
{- | Haskell-level redeemer for Stake scripts.
|
||||
|
||||
@since 0.1.0
|
||||
@since 1.0.0
|
||||
-}
|
||||
data StakeRedeemer
|
||||
= -- | Deposit or withdraw a discrete amount of the staked governance token.
|
||||
|
|
@ -237,22 +236,22 @@ newtype PStakeDatum (s :: S) = PStakeDatum
|
|||
instance DerivePlutusType PStakeDatum where
|
||||
type DPTStrat _ = PlutusTypeDataList
|
||||
|
||||
-- | @since 0.1.0
|
||||
instance Plutarch.Lift.PUnsafeLiftDecl PStakeDatum where
|
||||
-- | @since 1.0.0
|
||||
instance PUnsafeLiftDecl PStakeDatum where
|
||||
type PLifted PStakeDatum = StakeDatum
|
||||
|
||||
-- | @since 0.1.0
|
||||
deriving via
|
||||
(DerivePConstantViaDataList StakeDatum PStakeDatum)
|
||||
instance
|
||||
(Plutarch.Lift.PConstantDecl StakeDatum)
|
||||
(PConstantDecl StakeDatum)
|
||||
|
||||
-- | @since 0.1.0
|
||||
instance PTryFrom PData (PAsData PStakeDatum)
|
||||
|
||||
{- | Plutarch-level redeemer for Stake scripts.
|
||||
|
||||
@since 0.1.0
|
||||
@since 1.0.0
|
||||
-}
|
||||
data PStakeRedeemer (s :: S)
|
||||
= -- | Deposit or withdraw a discrete amount of the staked governance token.
|
||||
|
|
@ -276,6 +275,7 @@ data PStakeRedeemer (s :: S)
|
|||
PIsData
|
||||
)
|
||||
|
||||
-- | @since 0.2.0
|
||||
instance DerivePlutusType PStakeRedeemer where
|
||||
type DPTStrat _ = PlutusTypeData
|
||||
|
||||
|
|
@ -283,14 +283,14 @@ instance DerivePlutusType PStakeRedeemer where
|
|||
instance PTryFrom PData PStakeRedeemer
|
||||
|
||||
-- | @since 0.1.0
|
||||
instance Plutarch.Lift.PUnsafeLiftDecl PStakeRedeemer where
|
||||
instance PUnsafeLiftDecl PStakeRedeemer where
|
||||
type PLifted PStakeRedeemer = StakeRedeemer
|
||||
|
||||
-- | @since 0.1.0
|
||||
deriving via
|
||||
(DerivePConstantViaData StakeRedeemer PStakeRedeemer)
|
||||
instance
|
||||
(Plutarch.Lift.PConstantDecl StakeRedeemer)
|
||||
(PConstantDecl StakeRedeemer)
|
||||
|
||||
{- | Plutarch-level version of 'ProposalLock'.
|
||||
|
||||
|
|
@ -338,14 +338,14 @@ instance PTryFrom PData PProposalLock
|
|||
instance PTryFrom PData (PAsData PProposalLock)
|
||||
|
||||
-- | @since 0.1.0
|
||||
instance Plutarch.Lift.PUnsafeLiftDecl PProposalLock where
|
||||
instance PUnsafeLiftDecl PProposalLock where
|
||||
type PLifted PProposalLock = ProposalLock
|
||||
|
||||
-- | @since 0.1.0
|
||||
deriving via
|
||||
(DerivePConstantViaData ProposalLock PProposalLock)
|
||||
instance
|
||||
(Plutarch.Lift.PConstantDecl ProposalLock)
|
||||
(PConstantDecl ProposalLock)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue