File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
cardano-db-sync/src/Cardano/DbSync Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import Cardano.DbSync.Error
2525import Cardano.DbSync.Ledger.Event
2626import Cardano.DbSync.Types
2727import Cardano.DbSync.Util
28+ import qualified Cardano.Ledger.Address as Ledger
2829import Cardano.Prelude
2930import Cardano.Slotting.Slot (EpochNo (.. ))
3031import Control.Monad.Extra (whenJust )
@@ -105,9 +106,8 @@ insertNewEpochLedgerEvents syncEnv currentEpochNo@(EpochNo curEpoch) =
105106 forM_ en $ \ gar -> whenJust (garMTreasury gar) $ \ treasuryMap -> do
106107 gaId <- resolveGovActionProposal (garGovActionId gar)
107108 lift $ void $ DB. updateGovActionEnacted gaId (unEpochNo currentEpochNo)
108- forM_ (Map. toList treasuryMap) $ \ (_ra, _c) ->
109- -- TODO: Add reward
110- pure ()
109+ let rewards = Map. mapKeys Ledger. raCredential $ Map. map (Set. singleton . mkTreasuryReward) treasuryMap
110+ insertRewardRests ntw (subFromCurrentEpoch 1 ) currentEpochNo cache (Map. toList rewards)
111111 LedgerMirDist rwd -> do
112112 unless (Map. null rwd) $ do
113113 let rewards = Map. toList rwd
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ module Cardano.DbSync.Ledger.Event (
1515 LedgerEvent (.. ),
1616 GovActionRefunded (.. ),
1717 convertAuxLedgerEvent ,
18+ mkTreasuryReward ,
1819 convertPoolRewards ,
1920 ledgerEventName ,
2021 splitDeposits ,
@@ -324,6 +325,13 @@ convertMirRewards resPay trePay =
324325 , Generic. irAmount = coin
325326 }
326327
328+ mkTreasuryReward :: Coin -> Generic. RewardRest
329+ mkTreasuryReward c =
330+ Generic. RewardRest
331+ { Generic. irSource = RwdTreasury
332+ , Generic. irAmount = c
333+ }
334+
327335convertPoolRewards ::
328336 Map StakeCred (Set (Ledger. Reward StandardCrypto )) ->
329337 Generic. Rewards
You can’t perform that action at this time.
0 commit comments