module Byron.Spec.Ledger.GlobalParams (
epochFirstSlot,
lovelaceCap,
slotsPerEpoch,
slotsPerEpochToK,
c,
)
where
import Byron.Spec.Ledger.Core (BlockCount (BlockCount), Epoch (..), Slot (..), lovelaceCap)
import Data.Word (Word64)
slotsPerEpoch :: Integral n => BlockCount -> n
slotsPerEpoch :: forall n. Integral n => BlockCount -> n
slotsPerEpoch (BlockCount Word64
bc) = forall a b. (Integral a, Num b) => a -> b
fromIntegral forall a b. (a -> b) -> a -> b
$ Word64
bc forall a. Num a => a -> a -> a
* Word64
10
slotsPerEpochToK :: Integral n => n -> BlockCount
slotsPerEpochToK :: forall n. Integral n => n -> BlockCount
slotsPerEpochToK n
n = Word64 -> BlockCount
BlockCount forall a b. (a -> b) -> a -> b
$ forall a b. (RealFrac a, Integral b) => a -> b
floor forall a b. (a -> b) -> a -> b
$ (forall a b. (Integral a, Num b) => a -> b
fromIntegral n
n :: Double) forall a. Fractional a => a -> a -> a
/ Double
10
epochFirstSlot :: BlockCount -> Epoch -> Slot
epochFirstSlot :: BlockCount -> Epoch -> Slot
epochFirstSlot BlockCount
bc (Epoch Word64
epochs) = Word64 -> Slot
Slot forall a b. (a -> b) -> a -> b
$ Word64
epochs forall a. Num a => a -> a -> a
* forall n. Integral n => BlockCount -> n
slotsPerEpoch BlockCount
bc
c :: Word64
c :: Word64
c = Word64
4096