{-# LANGUAGE TemplateHaskell #-}
module Agora.Proposal.Time (
ProposalTimingConfig (..),
ProposalStartingTime (..),
MaxTimeRangeWidth (..),
PProposalTime (..),
PProposalTimingConfig (..),
PProposalStartingTime (..),
PMaxTimeRangeWidth (..),
createProposalStartingTime,
currentProposalTime,
isDraftPeriod,
isVotingPeriod,
isLockingPeriod,
isExecutionPeriod,
) where
import Agora.Plutarch.Orphans ()
import GHC.Generics qualified as GHC
import Generics.SOP (Generic, HasDatatypeInfo, I (I))
import Plutarch.Api.V1 (
PExtended (PFinite),
PInterval (PInterval),
PLowerBound (PLowerBound),
PPOSIXTime,
PPOSIXTimeRange,
PUpperBound (PUpperBound),
)
import Plutarch.DataRepr (
DerivePConstantViaData (..),
PDataFields,
PIsDataReprInstances (..),
)
import Plutarch.Extra.TermCont (pguardC, pmatchC)
import Plutarch.Lift (
DerivePConstantViaNewtype (..),
PConstantDecl,
PUnsafeLiftDecl (..),
)
import Plutarch.Numeric.Additive (AdditiveSemigroup ((+)))
import PlutusLedgerApi.V1.Time (POSIXTime)
import PlutusTx qualified
import Prelude hiding ((+))
newtype ProposalStartingTime = ProposalStartingTime
{ ProposalStartingTime -> POSIXTime
getProposalStartingTime :: POSIXTime
}
deriving newtype (ProposalStartingTime -> BuiltinData
(ProposalStartingTime -> BuiltinData)
-> ToData ProposalStartingTime
forall a. (a -> BuiltinData) -> ToData a
toBuiltinData :: ProposalStartingTime -> BuiltinData
$ctoBuiltinData :: ProposalStartingTime -> BuiltinData
PlutusTx.ToData, BuiltinData -> Maybe ProposalStartingTime
(BuiltinData -> Maybe ProposalStartingTime)
-> FromData ProposalStartingTime
forall a. (BuiltinData -> Maybe a) -> FromData a
fromBuiltinData :: BuiltinData -> Maybe ProposalStartingTime
$cfromBuiltinData :: BuiltinData -> Maybe ProposalStartingTime
PlutusTx.FromData, BuiltinData -> ProposalStartingTime
(BuiltinData -> ProposalStartingTime)
-> UnsafeFromData ProposalStartingTime
forall a. (BuiltinData -> a) -> UnsafeFromData a
unsafeFromBuiltinData :: BuiltinData -> ProposalStartingTime
$cunsafeFromBuiltinData :: BuiltinData -> ProposalStartingTime
PlutusTx.UnsafeFromData)
deriving stock (ProposalStartingTime -> ProposalStartingTime -> Bool
(ProposalStartingTime -> ProposalStartingTime -> Bool)
-> (ProposalStartingTime -> ProposalStartingTime -> Bool)
-> Eq ProposalStartingTime
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProposalStartingTime -> ProposalStartingTime -> Bool
$c/= :: ProposalStartingTime -> ProposalStartingTime -> Bool
== :: ProposalStartingTime -> ProposalStartingTime -> Bool
$c== :: ProposalStartingTime -> ProposalStartingTime -> Bool
Eq, Int -> ProposalStartingTime -> ShowS
[ProposalStartingTime] -> ShowS
ProposalStartingTime -> String
(Int -> ProposalStartingTime -> ShowS)
-> (ProposalStartingTime -> String)
-> ([ProposalStartingTime] -> ShowS)
-> Show ProposalStartingTime
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProposalStartingTime] -> ShowS
$cshowList :: [ProposalStartingTime] -> ShowS
show :: ProposalStartingTime -> String
$cshow :: ProposalStartingTime -> String
showsPrec :: Int -> ProposalStartingTime -> ShowS
$cshowsPrec :: Int -> ProposalStartingTime -> ShowS
Show, (forall x. ProposalStartingTime -> Rep ProposalStartingTime x)
-> (forall x. Rep ProposalStartingTime x -> ProposalStartingTime)
-> Generic ProposalStartingTime
forall x. Rep ProposalStartingTime x -> ProposalStartingTime
forall x. ProposalStartingTime -> Rep ProposalStartingTime x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProposalStartingTime x -> ProposalStartingTime
$cfrom :: forall x. ProposalStartingTime -> Rep ProposalStartingTime x
GHC.Generic)
data ProposalTimingConfig = ProposalTimingConfig
{ ProposalTimingConfig -> POSIXTime
draftTime :: POSIXTime
, ProposalTimingConfig -> POSIXTime
votingTime :: POSIXTime
, ProposalTimingConfig -> POSIXTime
lockingTime :: POSIXTime
, ProposalTimingConfig -> POSIXTime
executingTime :: POSIXTime
}
deriving stock
(
ProposalTimingConfig -> ProposalTimingConfig -> Bool
(ProposalTimingConfig -> ProposalTimingConfig -> Bool)
-> (ProposalTimingConfig -> ProposalTimingConfig -> Bool)
-> Eq ProposalTimingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProposalTimingConfig -> ProposalTimingConfig -> Bool
$c/= :: ProposalTimingConfig -> ProposalTimingConfig -> Bool
== :: ProposalTimingConfig -> ProposalTimingConfig -> Bool
$c== :: ProposalTimingConfig -> ProposalTimingConfig -> Bool
Eq
,
Int -> ProposalTimingConfig -> ShowS
[ProposalTimingConfig] -> ShowS
ProposalTimingConfig -> String
(Int -> ProposalTimingConfig -> ShowS)
-> (ProposalTimingConfig -> String)
-> ([ProposalTimingConfig] -> ShowS)
-> Show ProposalTimingConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProposalTimingConfig] -> ShowS
$cshowList :: [ProposalTimingConfig] -> ShowS
show :: ProposalTimingConfig -> String
$cshow :: ProposalTimingConfig -> String
showsPrec :: Int -> ProposalTimingConfig -> ShowS
$cshowsPrec :: Int -> ProposalTimingConfig -> ShowS
Show
,
(forall x. ProposalTimingConfig -> Rep ProposalTimingConfig x)
-> (forall x. Rep ProposalTimingConfig x -> ProposalTimingConfig)
-> Generic ProposalTimingConfig
forall x. Rep ProposalTimingConfig x -> ProposalTimingConfig
forall x. ProposalTimingConfig -> Rep ProposalTimingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProposalTimingConfig x -> ProposalTimingConfig
$cfrom :: forall x. ProposalTimingConfig -> Rep ProposalTimingConfig x
GHC.Generic
)
PlutusTx.makeIsDataIndexed ''ProposalTimingConfig [('ProposalTimingConfig, 0)]
newtype MaxTimeRangeWidth = MaxTimeRangeWidth {MaxTimeRangeWidth -> POSIXTime
getMaxWidth :: POSIXTime}
deriving stock
(
MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
(MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool)
-> (MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool)
-> Eq MaxTimeRangeWidth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
$c/= :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
== :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
$c== :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
Eq
,
Int -> MaxTimeRangeWidth -> ShowS
[MaxTimeRangeWidth] -> ShowS
MaxTimeRangeWidth -> String
(Int -> MaxTimeRangeWidth -> ShowS)
-> (MaxTimeRangeWidth -> String)
-> ([MaxTimeRangeWidth] -> ShowS)
-> Show MaxTimeRangeWidth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MaxTimeRangeWidth] -> ShowS
$cshowList :: [MaxTimeRangeWidth] -> ShowS
show :: MaxTimeRangeWidth -> String
$cshow :: MaxTimeRangeWidth -> String
showsPrec :: Int -> MaxTimeRangeWidth -> ShowS
$cshowsPrec :: Int -> MaxTimeRangeWidth -> ShowS
Show
,
Eq MaxTimeRangeWidth
Eq MaxTimeRangeWidth
-> (MaxTimeRangeWidth -> MaxTimeRangeWidth -> Ordering)
-> (MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool)
-> (MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool)
-> (MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool)
-> (MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool)
-> (MaxTimeRangeWidth -> MaxTimeRangeWidth -> MaxTimeRangeWidth)
-> (MaxTimeRangeWidth -> MaxTimeRangeWidth -> MaxTimeRangeWidth)
-> Ord MaxTimeRangeWidth
MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
MaxTimeRangeWidth -> MaxTimeRangeWidth -> Ordering
MaxTimeRangeWidth -> MaxTimeRangeWidth -> MaxTimeRangeWidth
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> MaxTimeRangeWidth
$cmin :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> MaxTimeRangeWidth
max :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> MaxTimeRangeWidth
$cmax :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> MaxTimeRangeWidth
>= :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
$c>= :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
> :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
$c> :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
<= :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
$c<= :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
< :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
$c< :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Bool
compare :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Ordering
$ccompare :: MaxTimeRangeWidth -> MaxTimeRangeWidth -> Ordering
Ord
,
(forall x. MaxTimeRangeWidth -> Rep MaxTimeRangeWidth x)
-> (forall x. Rep MaxTimeRangeWidth x -> MaxTimeRangeWidth)
-> Generic MaxTimeRangeWidth
forall x. Rep MaxTimeRangeWidth x -> MaxTimeRangeWidth
forall x. MaxTimeRangeWidth -> Rep MaxTimeRangeWidth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MaxTimeRangeWidth x -> MaxTimeRangeWidth
$cfrom :: forall x. MaxTimeRangeWidth -> Rep MaxTimeRangeWidth x
GHC.Generic
)
deriving newtype
(
MaxTimeRangeWidth -> BuiltinData
(MaxTimeRangeWidth -> BuiltinData) -> ToData MaxTimeRangeWidth
forall a. (a -> BuiltinData) -> ToData a
toBuiltinData :: MaxTimeRangeWidth -> BuiltinData
$ctoBuiltinData :: MaxTimeRangeWidth -> BuiltinData
PlutusTx.ToData
,
BuiltinData -> Maybe MaxTimeRangeWidth
(BuiltinData -> Maybe MaxTimeRangeWidth)
-> FromData MaxTimeRangeWidth
forall a. (BuiltinData -> Maybe a) -> FromData a
fromBuiltinData :: BuiltinData -> Maybe MaxTimeRangeWidth
$cfromBuiltinData :: BuiltinData -> Maybe MaxTimeRangeWidth
PlutusTx.FromData
,
BuiltinData -> MaxTimeRangeWidth
(BuiltinData -> MaxTimeRangeWidth)
-> UnsafeFromData MaxTimeRangeWidth
forall a. (BuiltinData -> a) -> UnsafeFromData a
unsafeFromBuiltinData :: BuiltinData -> MaxTimeRangeWidth
$cunsafeFromBuiltinData :: BuiltinData -> MaxTimeRangeWidth
PlutusTx.UnsafeFromData
)
data PProposalTime (s :: S) = PProposalTime
{ forall (s :: S). PProposalTime s -> Term s PPOSIXTime
lowerBound :: Term s PPOSIXTime
, forall (s :: S). PProposalTime s -> Term s PPOSIXTime
upperBound :: Term s PPOSIXTime
}
deriving stock
(
(forall x. PProposalTime s -> Rep (PProposalTime s) x)
-> (forall x. Rep (PProposalTime s) x -> PProposalTime s)
-> Generic (PProposalTime s)
forall x. Rep (PProposalTime s) x -> PProposalTime s
forall x. PProposalTime s -> Rep (PProposalTime s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PProposalTime s) x -> PProposalTime s
forall (s :: S) x. PProposalTime s -> Rep (PProposalTime s) x
$cto :: forall (s :: S) x. Rep (PProposalTime s) x -> PProposalTime s
$cfrom :: forall (s :: S) x. PProposalTime s -> Rep (PProposalTime s) x
GHC.Generic
)
deriving anyclass
(
All @[Type] (SListI @Type) (Code (PProposalTime s))
All @[Type] (SListI @Type) (Code (PProposalTime s))
-> (PProposalTime s -> Rep (PProposalTime s))
-> (Rep (PProposalTime s) -> PProposalTime s)
-> Generic (PProposalTime s)
Rep (PProposalTime s) -> PProposalTime s
PProposalTime s -> Rep (PProposalTime s)
forall a.
All @[Type] (SListI @Type) (Code a)
-> (a -> Rep a) -> (Rep a -> a) -> Generic a
forall {s :: S}.
All @[Type] (SListI @Type) (Code (PProposalTime s))
forall (s :: S). Rep (PProposalTime s) -> PProposalTime s
forall (s :: S). PProposalTime s -> Rep (PProposalTime s)
to :: Rep (PProposalTime s) -> PProposalTime s
$cto :: forall (s :: S). Rep (PProposalTime s) -> PProposalTime s
from :: PProposalTime s -> Rep (PProposalTime s)
$cfrom :: forall (s :: S). PProposalTime s -> Rep (PProposalTime s)
Generic
,
PCon PProposalTime
PMatch PProposalTime
PCon PProposalTime
-> PMatch PProposalTime
-> (forall (s :: S) (b :: PType).
PProposalTime s -> Term s (PInner PProposalTime b))
-> (forall (s :: S) (b :: PType).
Term s (PInner PProposalTime b)
-> (PProposalTime s -> Term s b) -> Term s b)
-> PlutusType PProposalTime
forall (s :: S) (b :: PType).
Term s (PInner PProposalTime b)
-> (PProposalTime s -> Term s b) -> Term s b
forall (s :: S) (b :: PType).
PProposalTime s -> Term s (PInner PProposalTime b)
forall (a :: PType).
PCon a
-> PMatch a
-> (forall (s :: S) (b :: PType). a s -> Term s (PInner a b))
-> (forall (s :: S) (b :: PType).
Term s (PInner a b) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PProposalTime b)
-> (PProposalTime s -> Term s b) -> Term s b
$cpmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PProposalTime b)
-> (PProposalTime s -> Term s b) -> Term s b
pcon' :: forall (s :: S) (b :: PType).
PProposalTime s -> Term s (PInner PProposalTime b)
$cpcon' :: forall (s :: S) (b :: PType).
PProposalTime s -> Term s (PInner PProposalTime b)
PlutusType
,
Generic (PProposalTime s)
Generic (PProposalTime s)
-> (forall (proxy :: Type -> Type).
proxy (PProposalTime s) -> DatatypeInfo (Code (PProposalTime s)))
-> HasDatatypeInfo (PProposalTime s)
forall a.
Generic a
-> (forall (proxy :: Type -> Type).
proxy a -> DatatypeInfo (Code a))
-> HasDatatypeInfo a
forall (s :: S). Generic (PProposalTime s)
forall (s :: S) (proxy :: Type -> Type).
proxy (PProposalTime s) -> DatatypeInfo (Code (PProposalTime s))
forall (proxy :: Type -> Type).
proxy (PProposalTime s) -> DatatypeInfo (Code (PProposalTime s))
datatypeInfo :: forall (proxy :: Type -> Type).
proxy (PProposalTime s) -> DatatypeInfo (Code (PProposalTime s))
$cdatatypeInfo :: forall (s :: S) (proxy :: Type -> Type).
proxy (PProposalTime s) -> DatatypeInfo (Code (PProposalTime s))
HasDatatypeInfo
,
(forall (s :: S).
Term s PProposalTime -> Term s PProposalTime -> Term s PBool)
-> PEq PProposalTime
forall (s :: S).
Term s PProposalTime -> Term s PProposalTime -> Term s PBool
forall (t :: PType).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
#== :: forall (s :: S).
Term s PProposalTime -> Term s PProposalTime -> Term s PBool
$c#== :: forall (s :: S).
Term s PProposalTime -> Term s PProposalTime -> Term s PBool
PEq
)
newtype PProposalStartingTime (s :: S) = PProposalStartingTime (Term s PPOSIXTime)
deriving
(
PCon PProposalStartingTime
PMatch PProposalStartingTime
PCon PProposalStartingTime
-> PMatch PProposalStartingTime
-> (forall (s :: S) (b :: PType).
PProposalStartingTime s -> Term s (PInner PProposalStartingTime b))
-> (forall (s :: S) (b :: PType).
Term s (PInner PProposalStartingTime b)
-> (PProposalStartingTime s -> Term s b) -> Term s b)
-> PlutusType PProposalStartingTime
forall (s :: S) (b :: PType).
Term s (PInner PProposalStartingTime b)
-> (PProposalStartingTime s -> Term s b) -> Term s b
forall (s :: S) (b :: PType).
PProposalStartingTime s -> Term s (PInner PProposalStartingTime b)
forall (a :: PType).
PCon a
-> PMatch a
-> (forall (s :: S) (b :: PType). a s -> Term s (PInner a b))
-> (forall (s :: S) (b :: PType).
Term s (PInner a b) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PProposalStartingTime b)
-> (PProposalStartingTime s -> Term s b) -> Term s b
$cpmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PProposalStartingTime b)
-> (PProposalStartingTime s -> Term s b) -> Term s b
pcon' :: forall (s :: S) (b :: PType).
PProposalStartingTime s -> Term s (PInner PProposalStartingTime b)
$cpcon' :: forall (s :: S) (b :: PType).
PProposalStartingTime s -> Term s (PInner PProposalStartingTime b)
PlutusType
,
(forall (s :: S).
Term s (PAsData PProposalStartingTime)
-> Term s PProposalStartingTime)
-> (forall (s :: S). Term s PProposalStartingTime -> Term s PData)
-> PIsData PProposalStartingTime
forall (s :: S).
Term s (PAsData PProposalStartingTime)
-> Term s PProposalStartingTime
forall (s :: S). Term s PProposalStartingTime -> Term s PData
forall (a :: PType).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
pdataImpl :: forall (s :: S). Term s PProposalStartingTime -> Term s PData
$cpdataImpl :: forall (s :: S). Term s PProposalStartingTime -> Term s PData
pfromDataImpl :: forall (s :: S).
Term s (PAsData PProposalStartingTime)
-> Term s PProposalStartingTime
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PProposalStartingTime)
-> Term s PProposalStartingTime
PIsData
,
(forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool)
-> PEq PProposalStartingTime
forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool
forall (t :: PType).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
#== :: forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool
$c#== :: forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool
PEq
,
PEq PProposalStartingTime
PEq PProposalStartingTime
-> (forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool)
-> (forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool)
-> POrd PProposalStartingTime
forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool
forall (t :: PType).
PEq t
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> POrd t
#< :: forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool
$c#< :: forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool
#<= :: forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool
$c#<= :: forall (s :: S).
Term s PProposalStartingTime
-> Term s PProposalStartingTime -> Term s PBool
POrd
)
via (DerivePNewtype PProposalStartingTime PPOSIXTime)
instance PUnsafeLiftDecl PProposalStartingTime where
type PLifted PProposalStartingTime = ProposalStartingTime
deriving via
PAsData (DerivePNewtype PProposalStartingTime PPOSIXTime)
instance
PTryFrom PData (PAsData PProposalStartingTime)
deriving via
(DerivePConstantViaNewtype ProposalStartingTime PProposalStartingTime PPOSIXTime)
instance
(PConstantDecl ProposalStartingTime)
newtype PProposalTimingConfig (s :: S) = PProposalTimingConfig
{ forall (s :: S).
PProposalTimingConfig s
-> Term
s
(PDataRecord
((':)
@PLabeledType
("draftTime" ':= PPOSIXTime)
((':)
@PLabeledType
("votingTime" ':= PPOSIXTime)
((':)
@PLabeledType
("lockingTime" ':= PPOSIXTime)
((':)
@PLabeledType
("executingTime" ':= PPOSIXTime)
('[] @PLabeledType))))))
getProposalTimingConfig ::
Term
s
( PDataRecord
'[ "draftTime" ':= PPOSIXTime
, "votingTime" ':= PPOSIXTime
, "lockingTime" ':= PPOSIXTime
, "executingTime" ':= PPOSIXTime
]
)
}
deriving stock
(
(forall x.
PProposalTimingConfig s -> Rep (PProposalTimingConfig s) x)
-> (forall x.
Rep (PProposalTimingConfig s) x -> PProposalTimingConfig s)
-> Generic (PProposalTimingConfig s)
forall x.
Rep (PProposalTimingConfig s) x -> PProposalTimingConfig s
forall x.
PProposalTimingConfig s -> Rep (PProposalTimingConfig s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x.
Rep (PProposalTimingConfig s) x -> PProposalTimingConfig s
forall (s :: S) x.
PProposalTimingConfig s -> Rep (PProposalTimingConfig s) x
$cto :: forall (s :: S) x.
Rep (PProposalTimingConfig s) x -> PProposalTimingConfig s
$cfrom :: forall (s :: S) x.
PProposalTimingConfig s -> Rep (PProposalTimingConfig s) x
GHC.Generic
)
deriving anyclass
(
All @[Type] (SListI @Type) (Code (PProposalTimingConfig s))
All @[Type] (SListI @Type) (Code (PProposalTimingConfig s))
-> (PProposalTimingConfig s -> Rep (PProposalTimingConfig s))
-> (Rep (PProposalTimingConfig s) -> PProposalTimingConfig s)
-> Generic (PProposalTimingConfig s)
Rep (PProposalTimingConfig s) -> PProposalTimingConfig s
PProposalTimingConfig s -> Rep (PProposalTimingConfig s)
forall a.
All @[Type] (SListI @Type) (Code a)
-> (a -> Rep a) -> (Rep a -> a) -> Generic a
forall {s :: S}.
All @[Type] (SListI @Type) (Code (PProposalTimingConfig s))
forall (s :: S).
Rep (PProposalTimingConfig s) -> PProposalTimingConfig s
forall (s :: S).
PProposalTimingConfig s -> Rep (PProposalTimingConfig s)
to :: Rep (PProposalTimingConfig s) -> PProposalTimingConfig s
$cto :: forall (s :: S).
Rep (PProposalTimingConfig s) -> PProposalTimingConfig s
from :: PProposalTimingConfig s -> Rep (PProposalTimingConfig s)
$cfrom :: forall (s :: S).
PProposalTimingConfig s -> Rep (PProposalTimingConfig s)
Generic
)
deriving anyclass
(
PIsData PProposalTimingConfig
PlutusType PProposalTimingConfig
PlutusType PProposalTimingConfig
-> PIsData PProposalTimingConfig
-> (forall (s :: S).
PProposalTimingConfig s
-> Term s (PDataSum (PIsDataReprRepr PProposalTimingConfig)))
-> (forall (s :: S) (b :: PType).
Term s (PDataSum (PIsDataReprRepr PProposalTimingConfig))
-> (PProposalTimingConfig s -> Term s b) -> Term s b)
-> PIsDataRepr PProposalTimingConfig
forall (s :: S).
PProposalTimingConfig s
-> Term s (PDataSum (PIsDataReprRepr PProposalTimingConfig))
forall (s :: S) (b :: PType).
Term s (PDataSum (PIsDataReprRepr PProposalTimingConfig))
-> (PProposalTimingConfig s -> Term s b) -> Term s b
forall (a :: PType).
PlutusType a
-> PIsData a
-> (forall (s :: S). a s -> Term s (PDataSum (PIsDataReprRepr a)))
-> (forall (s :: S) (b :: PType).
Term s (PDataSum (PIsDataReprRepr a))
-> (a s -> Term s b) -> Term s b)
-> PIsDataRepr a
pmatchRepr :: forall (s :: S) (b :: PType).
Term s (PDataSum (PIsDataReprRepr PProposalTimingConfig))
-> (PProposalTimingConfig s -> Term s b) -> Term s b
$cpmatchRepr :: forall (s :: S) (b :: PType).
Term s (PDataSum (PIsDataReprRepr PProposalTimingConfig))
-> (PProposalTimingConfig s -> Term s b) -> Term s b
pconRepr :: forall (s :: S).
PProposalTimingConfig s
-> Term s (PDataSum (PIsDataReprRepr PProposalTimingConfig))
$cpconRepr :: forall (s :: S).
PProposalTimingConfig s
-> Term s (PDataSum (PIsDataReprRepr PProposalTimingConfig))
PIsDataRepr
)
deriving
(
PCon PProposalTimingConfig
PMatch PProposalTimingConfig
PCon PProposalTimingConfig
-> PMatch PProposalTimingConfig
-> (forall (s :: S) (b :: PType).
PProposalTimingConfig s -> Term s (PInner PProposalTimingConfig b))
-> (forall (s :: S) (b :: PType).
Term s (PInner PProposalTimingConfig b)
-> (PProposalTimingConfig s -> Term s b) -> Term s b)
-> PlutusType PProposalTimingConfig
forall (s :: S) (b :: PType).
Term s (PInner PProposalTimingConfig b)
-> (PProposalTimingConfig s -> Term s b) -> Term s b
forall (s :: S) (b :: PType).
PProposalTimingConfig s -> Term s (PInner PProposalTimingConfig b)
forall (a :: PType).
PCon a
-> PMatch a
-> (forall (s :: S) (b :: PType). a s -> Term s (PInner a b))
-> (forall (s :: S) (b :: PType).
Term s (PInner a b) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PProposalTimingConfig b)
-> (PProposalTimingConfig s -> Term s b) -> Term s b
$cpmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PProposalTimingConfig b)
-> (PProposalTimingConfig s -> Term s b) -> Term s b
pcon' :: forall (s :: S) (b :: PType).
PProposalTimingConfig s -> Term s (PInner PProposalTimingConfig b)
$cpcon' :: forall (s :: S) (b :: PType).
PProposalTimingConfig s -> Term s (PInner PProposalTimingConfig b)
PlutusType
,
(forall (s :: S).
Term s (PAsData PProposalTimingConfig)
-> Term s PProposalTimingConfig)
-> (forall (s :: S). Term s PProposalTimingConfig -> Term s PData)
-> PIsData PProposalTimingConfig
forall (s :: S).
Term s (PAsData PProposalTimingConfig)
-> Term s PProposalTimingConfig
forall (s :: S). Term s PProposalTimingConfig -> Term s PData
forall (a :: PType).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
pdataImpl :: forall (s :: S). Term s PProposalTimingConfig -> Term s PData
$cpdataImpl :: forall (s :: S). Term s PProposalTimingConfig -> Term s PData
pfromDataImpl :: forall (s :: S).
Term s (PAsData PProposalTimingConfig)
-> Term s PProposalTimingConfig
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PProposalTimingConfig)
-> Term s PProposalTimingConfig
PIsData
,
(forall (s :: S).
Term s PProposalTimingConfig
-> Term s (PDataRecord (PFields PProposalTimingConfig)))
-> PDataFields PProposalTimingConfig
forall (s :: S).
Term s PProposalTimingConfig
-> Term s (PDataRecord (PFields PProposalTimingConfig))
forall (a :: PType).
(forall (s :: S). Term s a -> Term s (PDataRecord (PFields a)))
-> PDataFields a
ptoFields :: forall (s :: S).
Term s PProposalTimingConfig
-> Term s (PDataRecord (PFields PProposalTimingConfig))
$cptoFields :: forall (s :: S).
Term s PProposalTimingConfig
-> Term s (PDataRecord (PFields PProposalTimingConfig))
PDataFields
)
via (PIsDataReprInstances PProposalTimingConfig)
deriving via PAsData (PIsDataReprInstances PProposalTimingConfig) instance PTryFrom PData (PAsData PProposalTimingConfig)
instance PUnsafeLiftDecl PProposalTimingConfig where
type PLifted PProposalTimingConfig = ProposalTimingConfig
deriving via
(DerivePConstantViaData ProposalTimingConfig PProposalTimingConfig)
instance
(PConstantDecl ProposalTimingConfig)
newtype PMaxTimeRangeWidth (s :: S)
= PMaxTimeRangeWidth (Term s PPOSIXTime)
deriving
(
PCon PMaxTimeRangeWidth
PMatch PMaxTimeRangeWidth
PCon PMaxTimeRangeWidth
-> PMatch PMaxTimeRangeWidth
-> (forall (s :: S) (b :: PType).
PMaxTimeRangeWidth s -> Term s (PInner PMaxTimeRangeWidth b))
-> (forall (s :: S) (b :: PType).
Term s (PInner PMaxTimeRangeWidth b)
-> (PMaxTimeRangeWidth s -> Term s b) -> Term s b)
-> PlutusType PMaxTimeRangeWidth
forall (s :: S) (b :: PType).
Term s (PInner PMaxTimeRangeWidth b)
-> (PMaxTimeRangeWidth s -> Term s b) -> Term s b
forall (s :: S) (b :: PType).
PMaxTimeRangeWidth s -> Term s (PInner PMaxTimeRangeWidth b)
forall (a :: PType).
PCon a
-> PMatch a
-> (forall (s :: S) (b :: PType). a s -> Term s (PInner a b))
-> (forall (s :: S) (b :: PType).
Term s (PInner a b) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PMaxTimeRangeWidth b)
-> (PMaxTimeRangeWidth s -> Term s b) -> Term s b
$cpmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PMaxTimeRangeWidth b)
-> (PMaxTimeRangeWidth s -> Term s b) -> Term s b
pcon' :: forall (s :: S) (b :: PType).
PMaxTimeRangeWidth s -> Term s (PInner PMaxTimeRangeWidth b)
$cpcon' :: forall (s :: S) (b :: PType).
PMaxTimeRangeWidth s -> Term s (PInner PMaxTimeRangeWidth b)
PlutusType
,
(forall (s :: S).
Term s (PAsData PMaxTimeRangeWidth) -> Term s PMaxTimeRangeWidth)
-> (forall (s :: S). Term s PMaxTimeRangeWidth -> Term s PData)
-> PIsData PMaxTimeRangeWidth
forall (s :: S).
Term s (PAsData PMaxTimeRangeWidth) -> Term s PMaxTimeRangeWidth
forall (s :: S). Term s PMaxTimeRangeWidth -> Term s PData
forall (a :: PType).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
pdataImpl :: forall (s :: S). Term s PMaxTimeRangeWidth -> Term s PData
$cpdataImpl :: forall (s :: S). Term s PMaxTimeRangeWidth -> Term s PData
pfromDataImpl :: forall (s :: S).
Term s (PAsData PMaxTimeRangeWidth) -> Term s PMaxTimeRangeWidth
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PMaxTimeRangeWidth) -> Term s PMaxTimeRangeWidth
PIsData
,
(forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool)
-> PEq PMaxTimeRangeWidth
forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool
forall (t :: PType).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
#== :: forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool
$c#== :: forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool
PEq
,
PEq PMaxTimeRangeWidth
PEq PMaxTimeRangeWidth
-> (forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool)
-> (forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool)
-> POrd PMaxTimeRangeWidth
forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool
forall (t :: PType).
PEq t
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> POrd t
#< :: forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool
$c#< :: forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool
#<= :: forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool
$c#<= :: forall (s :: S).
Term s PMaxTimeRangeWidth
-> Term s PMaxTimeRangeWidth -> Term s PBool
POrd
)
via (DerivePNewtype PMaxTimeRangeWidth PPOSIXTime)
deriving via PAsData (DerivePNewtype PMaxTimeRangeWidth PPOSIXTime) instance PTryFrom PData (PAsData PMaxTimeRangeWidth)
instance PUnsafeLiftDecl PMaxTimeRangeWidth where type PLifted PMaxTimeRangeWidth = MaxTimeRangeWidth
deriving via
(DerivePConstantViaNewtype MaxTimeRangeWidth PMaxTimeRangeWidth PPOSIXTime)
instance
(PConstantDecl MaxTimeRangeWidth)
createProposalStartingTime :: forall (s :: S). Term s (PMaxTimeRangeWidth :--> PPOSIXTimeRange :--> PProposalStartingTime)
createProposalStartingTime :: forall (s :: S).
Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime))
createProposalStartingTime = (forall (s :: S).
Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime)))
-> Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime))
forall (a :: PType) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S).
Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime)))
-> Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime)))
-> (forall (s :: S).
Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime)))
-> Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime))
forall a b. (a -> b) -> a -> b
$
(Term s PMaxTimeRangeWidth
-> Term s PPOSIXTimeRange -> Term s PProposalStartingTime)
-> Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime))
forall a (b :: PType) (s :: S) (c :: PType).
PLamN a b s =>
(Term s c -> a) -> Term s (c :--> b)
plam ((Term s PMaxTimeRangeWidth
-> Term s PPOSIXTimeRange -> Term s PProposalStartingTime)
-> Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime)))
-> (Term s PMaxTimeRangeWidth
-> Term s PPOSIXTimeRange -> Term s PProposalStartingTime)
-> Term
s
(PMaxTimeRangeWidth
:--> (PPOSIXTimeRange :--> PProposalStartingTime))
forall a b. (a -> b) -> a -> b
$ \(Term s PMaxTimeRangeWidth
-> forall (b :: PType). Term s (PInner PMaxTimeRangeWidth b)
forall (s :: S) (a :: PType).
Term s a -> forall (b :: PType). Term s (PInner a b)
pto -> forall (b :: PType). Term s (PInner PMaxTimeRangeWidth b)
maxDuration) Term s PPOSIXTimeRange
iv -> TermCont @PProposalStartingTime s (Term s PProposalStartingTime)
-> Term s PProposalStartingTime
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @PProposalStartingTime s (Term s PProposalStartingTime)
-> Term s PProposalStartingTime)
-> TermCont @PProposalStartingTime s (Term s PProposalStartingTime)
-> Term s PProposalStartingTime
forall a b. (a -> b) -> a -> b
$ do
PProposalTime s
currentTimeF <- Term s PProposalTime
-> TermCont @PProposalStartingTime s (PProposalTime s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC (Term s PProposalTime
-> TermCont @PProposalStartingTime s (PProposalTime s))
-> Term s PProposalTime
-> TermCont @PProposalStartingTime s (PProposalTime s)
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
# Term s PPOSIXTimeRange
iv
let duration :: Term s PPOSIXTime
duration = PProposalTime s
currentTimeF.upperBound Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PPOSIXTime
forall a. Num a => a -> a -> a
- PProposalTime s
currentTimeF.lowerBound
startingTime :: Term s PPOSIXTime
startingTime =
Term s (PPOSIXTime :--> (PPOSIXTime :--> PPOSIXTime))
forall (a :: PType) (s :: S).
PIntegral a =>
Term s (a :--> (a :--> a))
pdiv
# (currentTimeF.lowerBound + currentTimeF.upperBound)
# 2
Term s (PString @S)
-> Term s PBool -> TermCont @PProposalStartingTime s ()
forall {r :: PType} (s :: S).
Term s (PString @S) -> Term s PBool -> TermCont @r s ()
pguardC Term s (PString @S)
"createProposalStartingTime: given time range should be tight enough" (Term s PBool -> TermCont @PProposalStartingTime s ())
-> Term s PBool -> TermCont @PProposalStartingTime s ()
forall a b. (a -> b) -> a -> b
$
Term s PPOSIXTime
duration Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PBool
forall (t :: PType) (s :: S).
POrd t =>
Term s t -> Term s t -> Term s PBool
#<= Term s PPOSIXTime
forall (b :: PType). Term s (PInner PMaxTimeRangeWidth b)
maxDuration
Term s PProposalStartingTime
-> TermCont @PProposalStartingTime s (Term s PProposalStartingTime)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s PProposalStartingTime
-> TermCont
@PProposalStartingTime s (Term s PProposalStartingTime))
-> Term s PProposalStartingTime
-> TermCont @PProposalStartingTime s (Term s PProposalStartingTime)
forall a b. (a -> b) -> a -> b
$ PProposalStartingTime s -> Term s PProposalStartingTime
forall (a :: PType) (s :: S). PCon a => a s -> Term s a
pcon (PProposalStartingTime s -> Term s PProposalStartingTime)
-> PProposalStartingTime s -> Term s PProposalStartingTime
forall a b. (a -> b) -> a -> b
$ Term s PPOSIXTime -> PProposalStartingTime s
forall (s :: S). Term s PPOSIXTime -> PProposalStartingTime s
PProposalStartingTime Term s PPOSIXTime
startingTime
currentProposalTime :: forall (s :: S). Term s (PPOSIXTimeRange :--> PProposalTime)
currentProposalTime :: forall (s :: S). Term s (PPOSIXTimeRange :--> PProposalTime)
currentProposalTime = (forall (s :: S). Term s (PPOSIXTimeRange :--> PProposalTime))
-> Term s (PPOSIXTimeRange :--> PProposalTime)
forall (a :: PType) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S). Term s (PPOSIXTimeRange :--> PProposalTime))
-> Term s (PPOSIXTimeRange :--> PProposalTime))
-> (forall (s :: S). Term s (PPOSIXTimeRange :--> PProposalTime))
-> Term s (PPOSIXTimeRange :--> PProposalTime)
forall a b. (a -> b) -> a -> b
$
(Term s PPOSIXTimeRange -> Term s PProposalTime)
-> Term s (PPOSIXTimeRange :--> PProposalTime)
forall a (b :: PType) (s :: S) (c :: PType).
PLamN a b s =>
(Term s c -> a) -> Term s (c :--> b)
plam ((Term s PPOSIXTimeRange -> Term s PProposalTime)
-> Term s (PPOSIXTimeRange :--> PProposalTime))
-> (Term s PPOSIXTimeRange -> Term s PProposalTime)
-> Term s (PPOSIXTimeRange :--> PProposalTime)
forall a b. (a -> b) -> a -> b
$ \Term s PPOSIXTimeRange
iv -> TermCont @PProposalTime s (Term s PProposalTime)
-> Term s PProposalTime
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @PProposalTime s (Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont @PProposalTime s (Term s PProposalTime)
-> Term s PProposalTime
forall a b. (a -> b) -> a -> b
$ do
PInterval Term
s
(PDataRecord
((':)
@PLabeledType
("from" ':= PLowerBound PPOSIXTime)
((':)
@PLabeledType
("to" ':= PUpperBound PPOSIXTime)
('[] @PLabeledType))))
iv' <- Term s PPOSIXTimeRange
-> TermCont @PProposalTime s (PInterval PPOSIXTime s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC Term s PPOSIXTimeRange
iv
HRec
((':)
@(Symbol, Type)
'("from", Term s (PAsData (PLowerBound PPOSIXTime)))
((':)
@(Symbol, Type)
'("to", Term s (PAsData (PUpperBound PPOSIXTime)))
('[] @(Symbol, Type))))
ivf <- ((HRec
((':)
@(Symbol, Type)
'("from", Term s (PAsData (PLowerBound PPOSIXTime)))
((':)
@(Symbol, Type)
'("to", Term s (PAsData (PUpperBound PPOSIXTime)))
('[] @(Symbol, Type))))
-> Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont
@PProposalTime
s
(HRec
((':)
@(Symbol, Type)
'("from", Term s (PAsData (PLowerBound PPOSIXTime)))
((':)
@(Symbol, Type)
'("to", Term s (PAsData (PUpperBound PPOSIXTime)))
('[] @(Symbol, Type)))))
forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont (((HRec
((':)
@(Symbol, Type)
'("from", Term s (PAsData (PLowerBound PPOSIXTime)))
((':)
@(Symbol, Type)
'("to", Term s (PAsData (PUpperBound PPOSIXTime)))
('[] @(Symbol, Type))))
-> Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont
@PProposalTime
s
(HRec
((':)
@(Symbol, Type)
'("from", Term s (PAsData (PLowerBound PPOSIXTime)))
((':)
@(Symbol, Type)
'("to", Term s (PAsData (PUpperBound PPOSIXTime)))
('[] @(Symbol, Type))))))
-> ((HRec
((':)
@(Symbol, Type)
'("from", Term s (PAsData (PLowerBound PPOSIXTime)))
((':)
@(Symbol, Type)
'("to", Term s (PAsData (PUpperBound PPOSIXTime)))
('[] @(Symbol, Type))))
-> Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont
@PProposalTime
s
(HRec
((':)
@(Symbol, Type)
'("from", Term s (PAsData (PLowerBound PPOSIXTime)))
((':)
@(Symbol, Type)
'("to", Term s (PAsData (PUpperBound PPOSIXTime)))
('[] @(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 @'["from", "to"] Term
s
(PDataRecord
((':)
@PLabeledType
("from" ':= PLowerBound PPOSIXTime)
((':)
@PLabeledType
("to" ':= PUpperBound PPOSIXTime)
('[] @PLabeledType))))
iv'
PLowerBound Term
s
(PDataRecord
((':)
@PLabeledType
("_0" ':= PExtended PPOSIXTime)
((':) @PLabeledType ("_1" ':= PBool) ('[] @PLabeledType))))
lb <- Term s (PLowerBound PPOSIXTime)
-> TermCont @PProposalTime s (PLowerBound PPOSIXTime s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC HRec
((':)
@(Symbol, Type)
'("from", Term s (PAsData (PLowerBound PPOSIXTime)))
((':)
@(Symbol, Type)
'("to", Term s (PAsData (PUpperBound PPOSIXTime)))
('[] @(Symbol, Type))))
ivf.from
PUpperBound Term
s
(PDataRecord
((':)
@PLabeledType
("_0" ':= PExtended PPOSIXTime)
((':) @PLabeledType ("_1" ':= PBool) ('[] @PLabeledType))))
ub <- Term s (PUpperBound PPOSIXTime)
-> TermCont @PProposalTime s (PUpperBound PPOSIXTime s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC HRec
((':)
@(Symbol, Type)
'("from", Term s (PAsData (PLowerBound PPOSIXTime)))
((':)
@(Symbol, Type)
'("to", Term s (PAsData (PUpperBound PPOSIXTime)))
('[] @(Symbol, Type))))
ivf.to
HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
lbf <- ((HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
-> Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont
@PProposalTime
s
(HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type)))))
forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont (((HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
-> Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont
@PProposalTime
s
(HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))))
-> ((HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
-> Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont
@PProposalTime
s
(HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(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 @'["_0", "_1"] Term
s
(PDataRecord
((':)
@PLabeledType
("_0" ':= PExtended PPOSIXTime)
((':) @PLabeledType ("_1" ':= PBool) ('[] @PLabeledType))))
lb
HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
ubf <- ((HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
-> Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont
@PProposalTime
s
(HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type)))))
forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont (((HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
-> Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont
@PProposalTime
s
(HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))))
-> ((HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
-> Term s PProposalTime)
-> Term s PProposalTime)
-> TermCont
@PProposalTime
s
(HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(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 @'["_0", "_1"] Term
s
(PDataRecord
((':)
@PLabeledType
("_0" ':= PExtended PPOSIXTime)
((':) @PLabeledType ("_1" ':= PBool) ('[] @PLabeledType))))
ub
Term s PProposalTime
-> TermCont @PProposalTime s (Term s PProposalTime)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s PProposalTime
-> TermCont @PProposalTime s (Term s PProposalTime))
-> Term s PProposalTime
-> TermCont @PProposalTime s (Term s PProposalTime)
forall a b. (a -> b) -> a -> b
$
PProposalTime s -> Term s PProposalTime
forall (a :: PType) (s :: S). PCon a => a s -> Term s a
pcon (PProposalTime s -> Term s PProposalTime)
-> PProposalTime s -> Term s PProposalTime
forall a b. (a -> b) -> a -> b
$
PProposalTime
{ lowerBound :: Term s PPOSIXTime
lowerBound =
Term s (PExtended PPOSIXTime)
-> (PExtended PPOSIXTime s -> Term s PPOSIXTime)
-> Term s PPOSIXTime
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch
HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
lbf._0
( \case
PFinite ((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 PPOSIXTime
d) -> Term s PPOSIXTime
d
PExtended PPOSIXTime s
_ -> Term s (PString @S) -> Term s PPOSIXTime
forall (s :: S) (a :: PType). Term s (PString @S) -> Term s a
ptraceError Term s (PString @S)
"currentProposalTime: Can't get fully-bounded proposal time."
)
, upperBound :: Term s PPOSIXTime
upperBound =
Term s (PExtended PPOSIXTime)
-> (PExtended PPOSIXTime s -> Term s PPOSIXTime)
-> Term s PPOSIXTime
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch
HRec
((':)
@(Symbol, Type)
'("_0", Term s (PAsData (PExtended PPOSIXTime)))
((':)
@(Symbol, Type)
'("_1", Term s (PAsData PBool))
('[] @(Symbol, Type))))
ubf._0
( \case
PFinite ((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 PPOSIXTime
d) -> Term s PPOSIXTime
d
PExtended PPOSIXTime s
_ -> Term s (PString @S) -> Term s PPOSIXTime
forall (s :: S) (a :: PType). Term s (PString @S) -> Term s a
ptraceError Term s (PString @S)
"currentProposalTime: Can't get fully-bounded proposal time."
)
}
proposalTimeWithin ::
Term
s
( PPOSIXTime
:--> PPOSIXTime
:--> PProposalTime
:--> PBool
)
proposalTimeWithin :: forall (s :: S).
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
proposalTimeWithin = (forall (s :: S).
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool))))
-> Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
forall (a :: PType) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S).
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool))))
-> Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool))))
-> (forall (s :: S).
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool))))
-> Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$
(Term s PPOSIXTime
-> Term s PPOSIXTime -> Term s PProposalTime -> Term s PBool)
-> Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
forall a (b :: PType) (s :: S) (c :: PType).
PLamN a b s =>
(Term s c -> a) -> Term s (c :--> b)
plam ((Term s PPOSIXTime
-> Term s PPOSIXTime -> Term s PProposalTime -> Term s PBool)
-> Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool))))
-> (Term s PPOSIXTime
-> Term s PPOSIXTime -> Term s PProposalTime -> Term s PBool)
-> Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$ \Term s PPOSIXTime
l Term s PPOSIXTime
h Term s PProposalTime
proposalTime' -> TermCont @PBool s (Term s PBool) -> Term s PBool
forall (a :: PType) (s :: S). TermCont @a s (Term s a) -> Term s a
unTermCont (TermCont @PBool s (Term s PBool) -> Term s PBool)
-> TermCont @PBool s (Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ do
PProposalTime Term s PPOSIXTime
ut Term s PPOSIXTime
lt <- Term s PProposalTime -> TermCont @PBool s (PProposalTime s)
forall {r :: PType} (a :: PType) (s :: S).
PMatch a =>
Term s a -> TermCont @r s (a s)
pmatchC Term s PProposalTime
proposalTime'
Term s PBool -> TermCont @PBool s (Term s PBool)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (Term s PBool -> TermCont @PBool s (Term s PBool))
-> Term s PBool -> TermCont @PBool s (Term s PBool)
forall a b. (a -> b) -> a -> b
$
(Term s PBool -> Term s PBool -> Term s PBool)
-> [Term s PBool] -> Term s PBool
forall (t :: Type -> Type) a.
Foldable t =>
(a -> a -> a) -> t a -> a
foldr1
Term s PBool -> Term s PBool -> Term s PBool
forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool
(#&&)
[ Term s PPOSIXTime
l Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PBool
forall (t :: PType) (s :: S).
POrd t =>
Term s t -> Term s t -> Term s PBool
#<= Term s PPOSIXTime
lt
, Term s PPOSIXTime
ut Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PBool
forall (t :: PType) (s :: S).
POrd t =>
Term s t -> Term s t -> Term s PBool
#<= Term s PPOSIXTime
h
]
isDraftPeriod ::
forall (s :: S).
Term
s
( PProposalTimingConfig
:--> PProposalStartingTime
:--> PProposalTime
:--> PBool
)
isDraftPeriod :: forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
isDraftPeriod = (forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall (a :: PType) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> (forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$
(Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a (b :: PType) (s :: S) (c :: PType).
PLamN a b s =>
(Term s c -> a) -> Term s (c :--> b)
plam ((Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> (Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$ \Term s PProposalTimingConfig
config Term s PProposalStartingTime
s' -> Term s PProposalStartingTime
-> (PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch Term s PProposalStartingTime
s' ((PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool))
-> (PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall a b. (a -> b) -> a -> b
$ \(PProposalStartingTime Term s PPOSIXTime
s) ->
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
forall (s :: S).
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
proposalTimeWithin Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
-> Term s PPOSIXTime
-> Term s (PPOSIXTime :--> (PProposalTime :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PPOSIXTime
s Term s (PPOSIXTime :--> (PProposalTime :--> PBool))
-> Term s PPOSIXTime -> Term s (PProposalTime :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# (Term s PPOSIXTime
s Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PPOSIXTime
forall a. AdditiveSemigroup a => a -> a -> a
+ (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 @"draftTime" Term s (PProposalTimingConfig :--> PPOSIXTime)
-> Term s PProposalTimingConfig -> Term s PPOSIXTime
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PProposalTimingConfig
config))
isVotingPeriod ::
forall (s :: S).
Term
s
( PProposalTimingConfig
:--> PProposalStartingTime
:--> PProposalTime
:--> PBool
)
isVotingPeriod :: forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
isVotingPeriod = (forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall (a :: PType) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> (forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$
(Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a (b :: PType) (s :: S) (c :: PType).
PLamN a b s =>
(Term s c -> a) -> Term s (c :--> b)
plam ((Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> (Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$ \Term s PProposalTimingConfig
config Term s PProposalStartingTime
s' -> Term s PProposalStartingTime
-> (PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch Term s PProposalStartingTime
s' ((PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool))
-> (PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall a b. (a -> b) -> a -> b
$ \(PProposalStartingTime Term s PPOSIXTime
s) ->
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 @'["draftTime", "votingTime"] Term s PProposalTimingConfig
config ((HRecOf
PProposalTimingConfig
((':)
@Symbol "draftTime" ((':) @Symbol "votingTime" ('[] @Symbol)))
s
-> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool))
-> (HRecOf
PProposalTimingConfig
((':)
@Symbol "draftTime" ((':) @Symbol "votingTime" ('[] @Symbol)))
s
-> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall a b. (a -> b) -> a -> b
$ \HRecOf
PProposalTimingConfig
((':)
@Symbol "draftTime" ((':) @Symbol "votingTime" ('[] @Symbol)))
s
f ->
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
forall (s :: S).
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
proposalTimeWithin Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
-> Term s PPOSIXTime
-> Term s (PPOSIXTime :--> (PProposalTime :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PPOSIXTime
s Term s (PPOSIXTime :--> (PProposalTime :--> PBool))
-> Term s PPOSIXTime -> Term s (PProposalTime :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# (Term s PPOSIXTime
s Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PPOSIXTime
forall a. AdditiveSemigroup a => a -> a -> a
+ HRec
((':)
@(Symbol, Type)
'("draftTime", Term s (PAsData PPOSIXTime))
((':)
@(Symbol, Type)
'("votingTime", Term s (PAsData PPOSIXTime))
('[] @(Symbol, Type))))
HRecOf
PProposalTimingConfig
((':)
@Symbol "draftTime" ((':) @Symbol "votingTime" ('[] @Symbol)))
s
f.draftTime Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PPOSIXTime
forall a. AdditiveSemigroup a => a -> a -> a
+ HRec
((':)
@(Symbol, Type)
'("draftTime", Term s (PAsData PPOSIXTime))
((':)
@(Symbol, Type)
'("votingTime", Term s (PAsData PPOSIXTime))
('[] @(Symbol, Type))))
HRecOf
PProposalTimingConfig
((':)
@Symbol "draftTime" ((':) @Symbol "votingTime" ('[] @Symbol)))
s
f.votingTime)
isLockingPeriod ::
forall (s :: S).
Term
s
( PProposalTimingConfig
:--> PProposalStartingTime
:--> PProposalTime
:--> PBool
)
isLockingPeriod :: forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
isLockingPeriod = (forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall (a :: PType) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> (forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$
(Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a (b :: PType) (s :: S) (c :: PType).
PLamN a b s =>
(Term s c -> a) -> Term s (c :--> b)
plam ((Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> (Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$ \Term s PProposalTimingConfig
config Term s PProposalStartingTime
s' -> Term s PProposalStartingTime
-> (PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch Term s PProposalStartingTime
s' ((PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool))
-> (PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall a b. (a -> b) -> a -> b
$ \(PProposalStartingTime Term s PPOSIXTime
s) ->
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 @'["draftTime", "votingTime", "lockingTime"] Term s PProposalTimingConfig
config ((HRecOf
PProposalTimingConfig
((':)
@Symbol
"draftTime"
((':)
@Symbol "votingTime" ((':) @Symbol "lockingTime" ('[] @Symbol))))
s
-> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool))
-> (HRecOf
PProposalTimingConfig
((':)
@Symbol
"draftTime"
((':)
@Symbol "votingTime" ((':) @Symbol "lockingTime" ('[] @Symbol))))
s
-> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall a b. (a -> b) -> a -> b
$ \HRecOf
PProposalTimingConfig
((':)
@Symbol
"draftTime"
((':)
@Symbol "votingTime" ((':) @Symbol "lockingTime" ('[] @Symbol))))
s
f ->
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
forall (s :: S).
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
proposalTimeWithin Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
-> Term s PPOSIXTime
-> Term s (PPOSIXTime :--> (PProposalTime :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PPOSIXTime
s Term s (PPOSIXTime :--> (PProposalTime :--> PBool))
-> Term s PPOSIXTime -> Term s (PProposalTime :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# (Term s PPOSIXTime
s Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PPOSIXTime
forall a. AdditiveSemigroup a => a -> a -> a
+ HRec
((':)
@(Symbol, Type)
'("draftTime", Term s (PAsData PPOSIXTime))
((':)
@(Symbol, Type)
'("votingTime", Term s (PAsData PPOSIXTime))
((':)
@(Symbol, Type)
'("lockingTime", Term s (PAsData PPOSIXTime))
('[] @(Symbol, Type)))))
HRecOf
PProposalTimingConfig
((':)
@Symbol
"draftTime"
((':)
@Symbol "votingTime" ((':) @Symbol "lockingTime" ('[] @Symbol))))
s
f.draftTime Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PPOSIXTime
forall a. AdditiveSemigroup a => a -> a -> a
+ HRec
((':)
@(Symbol, Type)
'("draftTime", Term s (PAsData PPOSIXTime))
((':)
@(Symbol, Type)
'("votingTime", Term s (PAsData PPOSIXTime))
((':)
@(Symbol, Type)
'("lockingTime", Term s (PAsData PPOSIXTime))
('[] @(Symbol, Type)))))
HRecOf
PProposalTimingConfig
((':)
@Symbol
"draftTime"
((':)
@Symbol "votingTime" ((':) @Symbol "lockingTime" ('[] @Symbol))))
s
f.votingTime Term s PPOSIXTime -> Term s PPOSIXTime -> Term s PPOSIXTime
forall a. AdditiveSemigroup a => a -> a -> a
+ HRec
((':)
@(Symbol, Type)
'("draftTime", Term s (PAsData PPOSIXTime))
((':)
@(Symbol, Type)
'("votingTime", Term s (PAsData PPOSIXTime))
((':)
@(Symbol, Type)
'("lockingTime", Term s (PAsData PPOSIXTime))
('[] @(Symbol, Type)))))
HRecOf
PProposalTimingConfig
((':)
@Symbol
"draftTime"
((':)
@Symbol "votingTime" ((':) @Symbol "lockingTime" ('[] @Symbol))))
s
f.lockingTime)
isExecutionPeriod ::
forall (s :: S).
Term
s
( PProposalTimingConfig
:--> PProposalStartingTime
:--> PProposalTime
:--> PBool
)
isExecutionPeriod :: forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
isExecutionPeriod = (forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall (a :: PType) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> (forall (s :: S).
Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$
(Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a (b :: PType) (s :: S) (c :: PType).
PLamN a b s =>
(Term s c -> a) -> Term s (c :--> b)
plam ((Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool))))
-> (Term s PProposalTimingConfig
-> Term s PProposalStartingTime
-> Term s (PProposalTime :--> PBool))
-> Term
s
(PProposalTimingConfig
:--> (PProposalStartingTime :--> (PProposalTime :--> PBool)))
forall a b. (a -> b) -> a -> b
$ \Term s PProposalTimingConfig
config Term s PProposalStartingTime
s' -> Term s PProposalStartingTime
-> (PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall (a :: PType) (s :: S) (b :: PType).
PMatch a =>
Term s a -> (a s -> Term s b) -> Term s b
pmatch Term s PProposalStartingTime
s' ((PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool))
-> (PProposalStartingTime s -> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall a b. (a -> b) -> a -> b
$ \(PProposalStartingTime Term s PPOSIXTime
s) ->
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 @'["draftTime", "votingTime", "lockingTime", "executingTime"] Term s PProposalTimingConfig
config ((HRecOf
PProposalTimingConfig
((':)
@Symbol
"draftTime"
((':)
@Symbol
"votingTime"
((':)
@Symbol
"lockingTime"
((':) @Symbol "executingTime" ('[] @Symbol)))))
s
-> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool))
-> (HRecOf
PProposalTimingConfig
((':)
@Symbol
"draftTime"
((':)
@Symbol
"votingTime"
((':)
@Symbol
"lockingTime"
((':) @Symbol "executingTime" ('[] @Symbol)))))
s
-> Term s (PProposalTime :--> PBool))
-> Term s (PProposalTime :--> PBool)
forall a b. (a -> b) -> a -> b
$ \HRecOf
PProposalTimingConfig
((':)
@Symbol
"draftTime"
((':)
@Symbol
"votingTime"
((':)
@Symbol
"lockingTime"
((':) @Symbol "executingTime" ('[] @Symbol)))))
s
f ->
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
forall (s :: S).
Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
proposalTimeWithin Term
s (PPOSIXTime :--> (PPOSIXTime :--> (PProposalTime :--> PBool)))
-> Term s PPOSIXTime
-> Term s (PPOSIXTime :--> (PProposalTime :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PPOSIXTime
s
# (s + f.draftTime + f.votingTime + f.lockingTime + f.executingTime)