atlas-cardano-0.6.2: Application backend for Plutus smart contracts on Cardano
Copyright(c) 2023 GYELD GMBH
LicenseApache 2.0
Maintainer[email protected]
Stabilitydevelop
Safe HaskellSafe-Inferred
LanguageGHC2021

GeniusYield.Types.SlotConfig

Description

 
Synopsis

Documentation

data GYSlotConfig #

Slot config for each era, alongside the absolute system start time.

Invariants ==

  • List must be ordered on era, with earliest era first, and current era last.
  • Each era element must be continuous.

i.e for [x, y], the slot start of y must be the end slot of x (see EraHistory). - The final era element must be the current era, and it is _assumed_ that its end is unbounded (realistic).

Instances

Instances details
Show GYSlotConfig # 
Instance details

Defined in GeniusYield.Types.SlotConfig

Eq GYSlotConfig # 
Instance details

Defined in GeniusYield.Types.SlotConfig

data GYEraSlotConfig #

Information about slot config for a particular ledger era.

Instances

Instances details
Show GYEraSlotConfig # 
Instance details

Defined in GeniusYield.Types.SlotConfig

Eq GYEraSlotConfig # 
Instance details

Defined in GeniusYield.Types.SlotConfig

makeSlotConfigSystemStartEraHistoryEither String GYSlotConfig #

Create a GYSlotConfig from the system start and the cardano era history.

This is the recommended, robust, way to create slot config.

simpleSlotConfigUTCTimeNominalDiffTimeGYSlotConfig #

Create a single era slot config (useful for emulator traces).

DO NOT USE for testnets/mainnet. Please use makeSlotConfig instead.

slotToBeginTimePureGYSlotConfigGYSlotGYTime #

Get the starting GYTime of a GYSlot given a GYSlotConfig.

>>> slotToBeginTimePure (simpleSlotConfig (Time.posixSecondsToUTCTime 10) 2) (unsafeSlotFromInteger 1)
GYTime 12s

slotToEndTimePureGYSlotConfigGYSlotGYTime #

Get the ending GYTime of a GYSlot (inclusive) given a GYSlotConfig.

>>> slotToEndTimePure (simpleSlotConfig (Time.posixSecondsToUTCTime 10) 2) (unsafeSlotFromInteger 1)
GYTime 13.999s

enclosingSlotFromTimePureGYSlotConfigGYTimeMaybe GYSlot #

Get the GYSlot of a GYTime given a GYSlotConfig.

Returns Nothing if given time is before known system start.

>>> enclosingSlotFromTimePure (simpleSlotConfig (Time.posixSecondsToUTCTime 10) 2) (timeFromPOSIX 12)
Just (GYSlot 1)
>>> enclosingSlotFromTimePure (simpleSlotConfig (Time.posixSecondsToUTCTime 10) 2) (timeFromPOSIX 14)
Just (GYSlot 2)