fix tests; add negative tests for unlocking in cooldown

This commit is contained in:
Hongrui Fang 2022-11-14 20:42:52 +08:00
parent 07f6f1e04d
commit 688ed1ef02
11 changed files with 124 additions and 50 deletions

View file

@ -40,7 +40,8 @@ import Agora.Proposal.Time (
)
import Agora.SafeMoney (GTTag)
import Agora.Stake (
ProposalLock (Cosigned, Created),
ProposalAction (Cosigned, Created),
ProposalLock (ProposalLock),
StakeDatum (..),
StakeRedeemer (PermitVote),
)
@ -196,7 +197,7 @@ mkStakeInputDatum ps =
amount = mkStakeAmount sps.gtAmount
owner = mkStakeOwner sps.stakeOwner
locks = case sps.stakeOwner of
Creator -> [Created defProposalId]
Creator -> [ProposalLock defProposalId Created]
_ -> []
in StakeDatum
{ stakedAmount = amount
@ -212,7 +213,7 @@ mkStakeOuputDatum ps =
locks =
if sps.dontUpdateLocks
then inpDatum.lockedBy
else Cosigned defProposalId : inpDatum.lockedBy
else ProposalLock defProposalId Cosigned : inpDatum.lockedBy
in inpDatum {lockedBy = locks}
stakeRedeemer :: StakeRedeemer