rename proposal redeemer Unlock to UnlockStake

This commit is contained in:
Hongrui Fang 2022-10-24 18:14:58 +08:00
parent 85fa6c81da
commit cd3ccfe350
5 changed files with 11 additions and 11 deletions

View file

@ -8,7 +8,7 @@ module Sample.Proposal.PrivilegeEscalate (
import Agora.Proposal ( import Agora.Proposal (
ProposalDatum (..), ProposalDatum (..),
ProposalId (ProposalId), ProposalId (ProposalId),
ProposalRedeemer (Unlock, Vote), ProposalRedeemer (UnlockStake, Vote),
ProposalStatus (VotingReady), ProposalStatus (VotingReady),
ProposalVotes (ProposalVotes), ProposalVotes (ProposalVotes),
ResultTag (ResultTag), ResultTag (ResultTag),
@ -102,7 +102,7 @@ mkProposalInputOutputDatum op =
in wrap op (,) proposal proposalWithVotes in wrap op (,) proposal proposalWithVotes
mkProposalRedeemer :: Operation -> ProposalRedeemer mkProposalRedeemer :: Operation -> ProposalRedeemer
mkProposalRedeemer op = wrap op const (Vote defResultTag) Unlock mkProposalRedeemer op = wrap op const (Vote defResultTag) UnlockStake
proposalRef :: TxOutRef proposalRef :: TxOutRef
proposalRef = TxOutRef proposalTxRef 1 proposalRef = TxOutRef proposalTxRef 1

View file

@ -35,7 +35,7 @@ import Agora.Proposal (
ProposalDatum (..), ProposalDatum (..),
ProposalEffectGroup, ProposalEffectGroup,
ProposalId (..), ProposalId (..),
ProposalRedeemer (Unlock), ProposalRedeemer (UnlockStake),
ProposalStatus (..), ProposalStatus (..),
ProposalVotes (..), ProposalVotes (..),
ResultTag (..), ResultTag (..),
@ -210,7 +210,7 @@ proposalRef :: TxOutRef
proposalRef = TxOutRef stakeTxRef 0 proposalRef = TxOutRef stakeTxRef 0
proposalRedeemer :: ProposalRedeemer proposalRedeemer :: ProposalRedeemer
proposalRedeemer = Unlock proposalRedeemer = UnlockStake
mkProposalInputDatum :: mkProposalInputDatum ::
StakeParameters -> StakeParameters ->

View file

@ -381,7 +381,7 @@ data ProposalRedeemer
-- proposal, provided enough GT is shared among them. -- proposal, provided enough GT is shared among them.
Cosign Cosign
| -- | Allow unlocking one or more stakes with votes towards particular 'ResultTag'. | -- | Allow unlocking one or more stakes with votes towards particular 'ResultTag'.
Unlock UnlockStake
| -- | Advance the proposal, performing the required checks for whether that is legal. | -- | Advance the proposal, performing the required checks for whether that is legal.
-- --
-- These are roughly the checks for each possible transition: -- These are roughly the checks for each possible transition:
@ -421,7 +421,7 @@ PlutusTx.makeIsDataIndexed
''ProposalRedeemer ''ProposalRedeemer
[ ('Vote, 0) [ ('Vote, 0)
, ('Cosign, 1) , ('Cosign, 1)
, ('Unlock, 2) , ('UnlockStake, 2)
, ('AdvanceProposal, 3) , ('AdvanceProposal, 3)
] ]
@ -750,7 +750,7 @@ deriving via (DerivePConstantViaDataList ProposalDatum PProposalDatum) instance
data PProposalRedeemer (s :: S) data PProposalRedeemer (s :: S)
= PVote (Term s (PDataRecord '["resultTag" ':= PResultTag])) = PVote (Term s (PDataRecord '["resultTag" ':= PResultTag]))
| PCosign (Term s (PDataRecord '[])) | PCosign (Term s (PDataRecord '[]))
| PUnlock (Term s (PDataRecord '[])) | PUnlockStake (Term s (PDataRecord '[]))
| PAdvanceProposal (Term s (PDataRecord '[])) | PAdvanceProposal (Term s (PDataRecord '[]))
deriving stock deriving stock
( -- | @since 0.1.0 ( -- | @since 0.1.0

View file

@ -12,7 +12,7 @@ module Agora.Proposal.Scripts (
import Agora.Proposal ( import Agora.Proposal (
PProposalDatum (PProposalDatum), PProposalDatum (PProposalDatum),
PProposalRedeemer (PAdvanceProposal, PCosign, PUnlock, PVote), PProposalRedeemer (PAdvanceProposal, PCosign, PUnlockStake, PVote),
PProposalStatus (PDraft, PFinished, PLocked, PVotingReady), PProposalStatus (PDraft, PFinished, PLocked, PVotingReady),
PProposalVotes (PProposalVotes), PProposalVotes (PProposalVotes),
ProposalStatus (Draft, Finished, Locked, VotingReady), ProposalStatus (Draft, Finished, Locked, VotingReady),
@ -520,7 +520,7 @@ proposalValidator =
---------------------------------------------------------------------- ----------------------------------------------------------------------
PUnlock _ -> spendStakes $ \sctxF -> do PUnlockStake _ -> spendStakes $ \sctxF -> do
let expectedVotes = let expectedVotes =
pfoldl pfoldl
# plam # plam

View file

@ -16,7 +16,7 @@ module Agora.Stake.Redeemers (
import Agora.Proposal ( import Agora.Proposal (
PProposalId, PProposalId,
PProposalRedeemer (PCosign, PUnlock, PVote), PProposalRedeemer (PCosign, PUnlockStake, PVote),
ProposalStatus (Finished), ProposalStatus (Finished),
) )
import Agora.Stake ( import Agora.Stake (
@ -266,7 +266,7 @@ pretractVote = pvoteHelper #$ phoistAcyclic $
flip pmatch $ \ctxF -> flip pmatch $ \ctxF ->
pmatch ctxF.proposalContext $ \case pmatch ctxF.proposalContext $ \case
PSpendProposal pid s r -> pmatch r $ \case PSpendProposal pid s r -> pmatch r $ \case
PUnlock _ -> PUnlockStake _ ->
let mode = let mode =
pif pif
(s #== pconstant Finished) (s #== pconstant Finished)