{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Allegra.State.Stake () where

import Cardano.Ledger.Allegra.Core ()
import Cardano.Ledger.Allegra.Era (AllegraEra)
import Cardano.Ledger.Shelley.State (
  EraStake (..),
  ShelleyInstantStake,
  addShelleyInstantStake,
  deleteShelleyInstantStake,
  resolveShelleyInstantStake,
  shelleyInstantStakeCredentialsL,
 )

instance EraStake AllegraEra where
  type InstantStake AllegraEra = ShelleyInstantStake AllegraEra
  instantStakeCredentialsL :: Lens'
  (InstantStake AllegraEra)
  (Map (Credential 'Staking) (CompactForm Coin))
instantStakeCredentialsL = (Map (Credential 'Staking) (CompactForm Coin)
 -> f (Map (Credential 'Staking) (CompactForm Coin)))
-> InstantStake AllegraEra -> f (InstantStake AllegraEra)
(Map (Credential 'Staking) (CompactForm Coin)
 -> f (Map (Credential 'Staking) (CompactForm Coin)))
-> ShelleyInstantStake AllegraEra
-> f (ShelleyInstantStake AllegraEra)
forall era (f :: * -> *).
Functor f =>
(Map (Credential 'Staking) (CompactForm Coin)
 -> f (Map (Credential 'Staking) (CompactForm Coin)))
-> ShelleyInstantStake era -> f (ShelleyInstantStake era)
shelleyInstantStakeCredentialsL
  addInstantStake :: UTxO AllegraEra
-> InstantStake AllegraEra -> InstantStake AllegraEra
addInstantStake = UTxO AllegraEra
-> InstantStake AllegraEra -> InstantStake AllegraEra
UTxO AllegraEra
-> ShelleyInstantStake AllegraEra -> ShelleyInstantStake AllegraEra
forall era.
EraTxOut era =>
UTxO era -> ShelleyInstantStake era -> ShelleyInstantStake era
addShelleyInstantStake
  deleteInstantStake :: UTxO AllegraEra
-> InstantStake AllegraEra -> InstantStake AllegraEra
deleteInstantStake = UTxO AllegraEra
-> InstantStake AllegraEra -> InstantStake AllegraEra
UTxO AllegraEra
-> ShelleyInstantStake AllegraEra -> ShelleyInstantStake AllegraEra
forall era.
EraTxOut era =>
UTxO era -> ShelleyInstantStake era -> ShelleyInstantStake era
deleteShelleyInstantStake
  resolveInstantStake :: InstantStake AllegraEra -> UMap -> Stake
resolveInstantStake = InstantStake AllegraEra -> UMap -> Stake
ShelleyInstantStake AllegraEra -> UMap -> Stake
forall era.
(EraStake era, InstantStake era ~ ShelleyInstantStake era) =>
ShelleyInstantStake era -> UMap -> Stake
resolveShelleyInstantStake