fix compilation errors; rename stuff
This commit is contained in:
parent
d49a1367fe
commit
ca951031dc
3 changed files with 17 additions and 17 deletions
|
|
@ -83,7 +83,7 @@ import "liqwid-plutarch-extra" Plutarch.Extra.TermCont (
|
|||
pmatchC,
|
||||
ptryFromC,
|
||||
)
|
||||
import Plutarch.Extra.Time (PCurrentTime)
|
||||
import Plutarch.Extra.Time (PFullyBoundedTimeRange)
|
||||
import Plutarch.Extra.Traversable (pfoldMap)
|
||||
import Plutarch.Extra.Value (psymbolValueOf')
|
||||
import Plutarch.Unsafe (punsafeCoerce)
|
||||
|
|
@ -310,18 +310,18 @@ proposalValidator =
|
|||
|
||||
currentTime <- pletC $ pcurrentProposalTime # txInfoF.validRange
|
||||
|
||||
let withCurrentTime ::
|
||||
let withBoundedValidTimeRange ::
|
||||
forall (a :: PType).
|
||||
Term _ (PCurrentTime :--> a) ->
|
||||
Term _ (PFullyBoundedTimeRange :--> a) ->
|
||||
Term _ a
|
||||
withCurrentTime f =
|
||||
withBoundedValidTimeRange f =
|
||||
pmatch currentTime $ \case
|
||||
PJust currentTime -> f # currentTime
|
||||
PNothing -> ptraceError "Unable to resolve current time"
|
||||
|
||||
getTimingRelation' <-
|
||||
pletC $
|
||||
withCurrentTime $
|
||||
withBoundedValidTimeRange $
|
||||
pgetRelation
|
||||
# proposalInputDatumF.timingConfig
|
||||
# proposalInputDatumF.startingTime
|
||||
|
|
@ -511,7 +511,7 @@ proposalValidator =
|
|||
pisWithin # getTimingRelation PVotingPeriod
|
||||
|
||||
pguardC "Width of time should meet maximum requirement" $
|
||||
withCurrentTime $
|
||||
withBoundedValidTimeRange $
|
||||
psatisfyMaximumWidth
|
||||
#$ pfield @"votingTimeRangeMaxWidth"
|
||||
# proposalInputDatumF.timingConfig
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ import Plutarch.Extra.IsData (PlutusTypeEnumData)
|
|||
import Plutarch.Extra.Maybe (pjust, pmaybe, pnothing)
|
||||
import "liqwid-plutarch-extra" Plutarch.Extra.TermCont (pletC, pmatchC)
|
||||
import Plutarch.Extra.Time (
|
||||
PCurrentTime (PCurrentTime),
|
||||
pcurrentTimeDuration,
|
||||
pisWithinCurrentTime,
|
||||
PFullyBoundedTimeRange (PFullyBoundedTimeRange),
|
||||
pisWithinTimeRange,
|
||||
ptimeRangeDuration,
|
||||
)
|
||||
import Plutarch.Lift (
|
||||
DerivePConstantViaNewtype (DerivePConstantViaNewtype),
|
||||
|
|
@ -173,7 +173,7 @@ PlutusTx.makeIsDataIndexed 'ProposalTimingConfig [('ProposalTimingConfig, 0)]
|
|||
|
||||
@since 0.1.0
|
||||
-}
|
||||
type PProposalTime = PCurrentTime
|
||||
type PProposalTime = PFullyBoundedTimeRange
|
||||
|
||||
-- | Plutarch-level version of 'ProposalStartingTime'.
|
||||
newtype PProposalStartingTime (s :: S) = PProposalStartingTime (Term s PPOSIXTime)
|
||||
|
|
@ -362,7 +362,7 @@ pvalidateProposalStartingTime = phoistAcyclic $
|
|||
isInCurrentTimeRange =
|
||||
ptraceIfFalse
|
||||
"createProposalStartingTime: starting time should be in current time range"
|
||||
$ pisWithinCurrentTime # st # ct
|
||||
$ pisWithinTimeRange # st # ct
|
||||
in isTightEnough #&& isInCurrentTimeRange
|
||||
)
|
||||
# (pcurrentProposalTime # iv)
|
||||
|
|
@ -406,7 +406,7 @@ pcurrentProposalTime = phoistAcyclic $
|
|||
passert
|
||||
"Upper bound bigger than lower bound"
|
||||
(lb #< ub)
|
||||
(pcon $ PCurrentTime lb ub)
|
||||
(pcon $ PFullyBoundedTimeRange lb ub)
|
||||
|
||||
pure $ pliftA2 # mkTime # lowerBound # upperBound
|
||||
|
||||
|
|
@ -495,7 +495,7 @@ pgetRelation = phoistAcyclic $
|
|||
configF <- pletAllC config
|
||||
|
||||
PProposalStartingTime s <- pmatchC startingTime
|
||||
PCurrentTime lb ub <- pmatchC currentTime
|
||||
PFullyBoundedTimeRange lb ub <- pmatchC currentTime
|
||||
|
||||
dub <- pletC $ s + configF.draftTime
|
||||
vub <- pletC $ dub + configF.votingTime
|
||||
|
|
@ -531,6 +531,6 @@ psatisfyMaximumWidth ::
|
|||
)
|
||||
psatisfyMaximumWidth = phoistAcyclic $
|
||||
plam $ \maxWidth time ->
|
||||
let width = pcurrentTimeDuration # time
|
||||
let width = ptimeRangeDuration # time
|
||||
max = pto maxWidth
|
||||
in width #<= max
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ import "liqwid-plutarch-extra" Plutarch.Extra.List (
|
|||
import Plutarch.Extra.Maybe (pdjust, pdnothing, pmaybeData)
|
||||
import Plutarch.Extra.Record (mkRecordConstr, (.&), (.=))
|
||||
import "liqwid-plutarch-extra" Plutarch.Extra.TermCont (pguardC, pletC, pletFieldsC, pmatchC)
|
||||
import Plutarch.Extra.Time (PCurrentTime (PCurrentTime))
|
||||
import Plutarch.Extra.Time (PFullyBoundedTimeRange (PFullyBoundedTimeRange))
|
||||
|
||||
-- | A wrapper which ensures that no proposal is presented in the transaction.
|
||||
pwithoutProposal ::
|
||||
|
|
@ -229,7 +229,7 @@ ppermitVote = pvoteHelper #$ phoistAcyclic $
|
|||
pguardC "Owner or delegatee signs the transaction" $
|
||||
pisSignedBy # pconstant True # ctx
|
||||
|
||||
PCurrentTime _ upperBound <- pmatchC currentTime
|
||||
PFullyBoundedTimeRange _ upperBound <- pmatchC currentTime
|
||||
|
||||
let action =
|
||||
mkRecordConstr
|
||||
|
|
@ -286,7 +286,7 @@ premoveLocks =
|
|||
plam $ \proposalId unlockCooldown currentTime mode -> unTermCont $ do
|
||||
shouldRemoveAllLocks <- pletC $ mode #== pcon PRemoveAllLocks
|
||||
|
||||
PCurrentTime lowerBound _ <- pmatchC currentTime
|
||||
PFullyBoundedTimeRange lowerBound _ <- pmatchC currentTime
|
||||
|
||||
let handleVoter
|
||||
( (pfield @"createdAt" #) ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue