eval (dsFutureGenDelegs ds ⨃ singleton (FutureGenDeleg s' gkh) (GenDelegPair vkh vrf))
-
DCertMir (MIRCert targetPot (StakeAddressesMIR credCoinMap)) -> do
-
if HardForks.allowMIRTransfer pp
-
sp <- liftSTS $ asks stabilityWindow
-
ei <- liftSTS $ asks epochInfoPure
-
EpochNo currEpoch <- liftSTS $ epochInfoEpoch ei slot
-
let newEpoch = EpochNo (currEpoch + 1)
-
tellEvent (NewEpoch newEpoch)
-
firstSlot <- liftSTS $ epochInfoFirst ei newEpoch
-
let tooLate = firstSlot *- Duration sp
-
?! MIRCertificateTooLateinEpochDELEG slot tooLate
-
let (potAmount, delta, instantaneousRewards) =
-
ReservesMIR -> (asReserves acnt, deltaReserves $ dsIRewards ds, iRReserves $ dsIRewards ds)
-
TreasuryMIR -> (asTreasury acnt, deltaTreasury $ dsIRewards ds, iRTreasury $ dsIRewards ds)
-
credCoinMap' = Map.map (\(DeltaCoin x) -> Coin x) credCoinMap
-
combinedMap = Map.unionWith (<>) credCoinMap' instantaneousRewards
-
requiredForRewards = fold combinedMap
-
available = potAmount `addDeltaCoin` delta
+
DCertMir (MIRCert targetPot mirTarget) ->
+
sp <- liftSTS $ asks stabilityWindow
+
ei <- liftSTS $ asks epochInfoPure
+
EpochNo currEpoch <- liftSTS $ epochInfoEpoch ei slot
+
let newEpoch = EpochNo (currEpoch + 1)
+
tellEvent (NewEpoch newEpoch)
+
firstSlot <- liftSTS $ epochInfoFirst ei newEpoch
+
let tooLate = firstSlot *- Duration sp
+
?! MIRCertificateTooLateinEpochDELEG slot tooLate
+
(StakeAddressesMIR credCoinMap) -> do
+
(potAmount, delta, combinedMap) <- if HardForks.allowMIRTransfer pp
+
let (potAmount, delta, instantaneousRewards) =
+
ReservesMIR -> (asReserves acnt, deltaReserves $ dsIRewards ds, iRReserves $ dsIRewards ds)
+
TreasuryMIR -> (asTreasury acnt, deltaTreasury $ dsIRewards ds, iRTreasury $ dsIRewards ds)
+
let credCoinMap' = Map.map (\(DeltaCoin x) -> Coin x) credCoinMap
+
combinedMap = Map.unionWith (<>) credCoinMap' instantaneousRewards
+
all (>= mempty) combinedMap ?! MIRProducesNegativeUpdate
+
pure (potAmount, delta, combinedMap)
+
let (potAmount, instantaneousRewards) =
+
ReservesMIR -> (asReserves acnt, iRReserves $ dsIRewards ds)
+
TreasuryMIR -> (asTreasury acnt, iRTreasury $ dsIRewards ds)
+
let credCoinMap' = Map.map (\(DeltaCoin x) -> Coin x) credCoinMap
+
combinedMap = Map.union credCoinMap' instantaneousRewards
-
all (>= mempty) combinedMap ?! MIRProducesNegativeUpdate
+
all (>= mempty) credCoinMap ?! MIRNegativesNotCurrentlyAllowed
+
pure (potAmount, 0, combinedMap)
+
let requiredForRewards = fold combinedMap
+
available = potAmount `addDeltaCoin` delta
ReservesMIR -> ds {dsIRewards = (dsIRewards ds) {iRReserves = combinedMap}}
TreasuryMIR -> ds {dsIRewards = (dsIRewards ds) {iRTreasury = combinedMap}}
-
sp <- liftSTS $ asks stabilityWindow
-
ei <- liftSTS $ asks epochInfoPure
-
EpochNo currEpoch <- liftSTS $ epochInfoEpoch ei slot
-
let newEpoch = EpochNo (currEpoch + 1)
-
tellEvent (NewEpoch newEpoch)
-
firstSlot <- liftSTS $ epochInfoFirst ei newEpoch
-
let tooLate = firstSlot *- Duration sp
-
?! MIRCertificateTooLateinEpochDELEG slot tooLate
-
all (>= mempty) credCoinMap ?! MIRNegativesNotCurrentlyAllowed
-
let (potAmount, instantaneousRewards) =
-
ReservesMIR -> (asReserves acnt, iRReserves $ dsIRewards ds)
-
TreasuryMIR -> (asTreasury acnt, iRTreasury $ dsIRewards ds)
-
let credCoinMap' = Map.map (\(DeltaCoin x) -> Coin x) credCoinMap
-
combinedMap = Map.union credCoinMap' instantaneousRewards
-
requiredForRewards = fold combinedMap
-
?! InsufficientForInstantaneousRewardsDELEG targetPot requiredForRewards potAmount
-
ReservesMIR -> pure $ ds {dsIRewards = (dsIRewards ds) {iRReserves = combinedMap}}
-
TreasuryMIR -> pure $ ds {dsIRewards = (dsIRewards ds) {iRTreasury = combinedMap}}
-
DCertMir (MIRCert targetPot (SendToOppositePotMIR coin)) ->
-
if HardForks.allowMIRTransfer pp
-
sp <- liftSTS $ asks stabilityWindow
-
ei <- liftSTS $ asks epochInfoPure
-
EpochNo currEpoch <- liftSTS $ epochInfoEpoch ei slot
-
let newEpoch = EpochNo (currEpoch + 1)
-
tellEvent (NewEpoch newEpoch)
-
firstSlot <- liftSTS $ epochInfoFirst ei newEpoch
-
let tooLate = firstSlot *- Duration sp
-
?! MIRCertificateTooLateinEpochDELEG slot tooLate
-
let available = availableAfterMIR targetPot acnt (dsIRewards ds)
-
?! MIRNegativeTransfer targetPot coin
-
?! InsufficientForTransferDELEG targetPot coin available
-
{ deltaReserves = dr <> invert (toDeltaCoin coin),
-
deltaTreasury = dt <> toDeltaCoin coin
-
{ deltaReserves = dr <> toDeltaCoin coin,
-
deltaTreasury = dt <> invert (toDeltaCoin coin)
-
failBecause MIRTransferNotCurrentlyAllowed
+
(SendToOppositePotMIR coin) ->
+
if HardForks.allowMIRTransfer pp
+
let available = availableAfterMIR targetPot acnt (dsIRewards ds)
+
?! MIRNegativeTransfer targetPot coin
+
?! InsufficientForTransferDELEG targetPot coin available
+
{ deltaReserves = dr <> invert (toDeltaCoin coin),
+
deltaTreasury = dt <> toDeltaCoin coin
+
{ deltaReserves = dr <> toDeltaCoin coin,
+
deltaTreasury = dt <> invert (toDeltaCoin coin)
+
failBecause MIRTransferNotCurrentlyAllowed
failBecause WrongCertificateTypeDELEG -- this always fails