Skip to content

Commit 0461b36

Browse files
committed
chore: Fourmolize!
1 parent 99af23c commit 0461b36

File tree

18 files changed

+271
-263
lines changed

18 files changed

+271
-263
lines changed

cardano-chain-gen/src/Cardano/Mock/Query.hs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ queryDRepDistrAmount ::
9999
queryDRepDistrAmount drepHash epochNo = do
100100
res <- selectOne $ do
101101
(distr :& hash) <-
102-
from
103-
$ table @Db.DrepDistr
102+
from $
103+
table @Db.DrepDistr
104104
`innerJoin` table @Db.DrepHash
105-
`on` (\(distr :& hash) -> (hash ^. Db.DrepHashId) ==. (distr ^. Db.DrepDistrHashId))
105+
`on` (\(distr :& hash) -> (hash ^. Db.DrepHashId) ==. (distr ^. Db.DrepDistrHashId))
106106

107107
where_ $ hash ^. Db.DrepHashRaw ==. just (val drepHash)
108108
where_ $ distr ^. Db.DrepDistrEpochNo ==. val epochNo
@@ -141,16 +141,16 @@ queryConstitutionAnchor ::
141141
queryConstitutionAnchor epochNo = do
142142
res <- selectOne $ do
143143
(_ :& anchor :& epochState) <-
144-
from
145-
$ table @Db.Constitution
144+
from $
145+
table @Db.Constitution
146146
`innerJoin` table @Db.VotingAnchor
147-
`on` ( \(constit :& anchor) ->
148-
(constit ^. Db.ConstitutionVotingAnchorId) ==. (anchor ^. Db.VotingAnchorId)
149-
)
147+
`on` ( \(constit :& anchor) ->
148+
(constit ^. Db.ConstitutionVotingAnchorId) ==. (anchor ^. Db.VotingAnchorId)
149+
)
150150
`innerJoin` table @Db.EpochState
151-
`on` ( \(constit :& _ :& epoch) ->
152-
just (constit ^. Db.ConstitutionId) ==. (epoch ^. Db.EpochStateConstitutionId)
153-
)
151+
`on` ( \(constit :& _ :& epoch) ->
152+
just (constit ^. Db.ConstitutionId) ==. (epoch ^. Db.EpochStateConstitutionId)
153+
)
154154

155155
where_ (epochState ^. Db.EpochStateEpochNo ==. val epochNo)
156156

@@ -194,10 +194,10 @@ queryVoteCounts txHash idx = do
194194
countVotes v = do
195195
res <- selectOne $ do
196196
(vote :& tx) <-
197-
from
198-
$ table @Db.VotingProcedure
197+
from $
198+
table @Db.VotingProcedure
199199
`innerJoin` table @Db.Tx
200-
`on` (\(vote :& tx) -> vote ^. Db.VotingProcedureTxId ==. tx ^. Db.TxId)
200+
`on` (\(vote :& tx) -> vote ^. Db.VotingProcedureTxId ==. tx ^. Db.TxId)
201201
where_ $
202202
vote
203203
^. Db.VotingProcedureVote
@@ -226,16 +226,16 @@ queryCommitteeByTxHash ::
226226
queryCommitteeByTxHash txHash = do
227227
res <- selectOne $ do
228228
(committee :& _ :& tx) <-
229-
from
230-
$ table @Db.Committee
229+
from $
230+
table @Db.Committee
231231
`innerJoin` table @Db.GovActionProposal
232-
`on` ( \(committee :& govAction) ->
233-
committee ^. Db.CommitteeGovActionProposalId ==. just (govAction ^. Db.GovActionProposalId)
234-
)
232+
`on` ( \(committee :& govAction) ->
233+
committee ^. Db.CommitteeGovActionProposalId ==. just (govAction ^. Db.GovActionProposalId)
234+
)
235235
`innerJoin` table @Db.Tx
236-
`on` ( \(_ :& govAction :& tx) ->
237-
govAction ^. Db.GovActionProposalTxId ==. tx ^. Db.TxId
238-
)
236+
`on` ( \(_ :& govAction :& tx) ->
237+
govAction ^. Db.GovActionProposalTxId ==. tx ^. Db.TxId
238+
)
239239
where_ (tx ^. Db.TxHash ==. val txHash)
240240
pure committee
241241

@@ -248,20 +248,20 @@ queryCommitteeMemberCountByTxHash ::
248248
queryCommitteeMemberCountByTxHash txHash = do
249249
res <- selectOne $ do
250250
(_ :& committee :& _ :& tx) <-
251-
from
252-
$ table @Db.CommitteeMember
251+
from $
252+
table @Db.CommitteeMember
253253
`innerJoin` table @Db.Committee
254-
`on` ( \(member :& committee) ->
255-
member ^. Db.CommitteeMemberCommitteeId ==. committee ^. Db.CommitteeId
256-
)
254+
`on` ( \(member :& committee) ->
255+
member ^. Db.CommitteeMemberCommitteeId ==. committee ^. Db.CommitteeId
256+
)
257257
`leftJoin` table @Db.GovActionProposal
258-
`on` ( \(_ :& committee :& govAction) ->
259-
committee ^. Db.CommitteeGovActionProposalId ==. govAction ?. Db.GovActionProposalId
260-
)
258+
`on` ( \(_ :& committee :& govAction) ->
259+
committee ^. Db.CommitteeGovActionProposalId ==. govAction ?. Db.GovActionProposalId
260+
)
261261
`leftJoin` table @Db.Tx
262-
`on` ( \(_ :& _ :& govAction :& tx) ->
263-
govAction ?. Db.GovActionProposalTxId ==. tx ?. Db.TxId
264-
)
262+
`on` ( \(_ :& _ :& govAction :& tx) ->
263+
govAction ?. Db.GovActionProposalTxId ==. tx ?. Db.TxId
264+
)
265265

266266
where_ $
267267
case txHash of

cardano-db-sync/app/test-http-get-json-metadata.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ queryTestOffChainData :: MonadIO m => ReaderT SqlBackend m [TestOffChain]
142142
queryTestOffChainData = do
143143
res <- select $ do
144144
(pod :& pmr) <-
145-
from
146-
$ table @OffChainPoolData
145+
from $
146+
table @OffChainPoolData
147147
`innerJoin` table @PoolMetadataRef
148-
`on` (\(pod :& pmr) -> pod ^. OffChainPoolDataPmrId ==. pmr ^. PoolMetadataRefId)
148+
`on` (\(pod :& pmr) -> pod ^. OffChainPoolDataPmrId ==. pmr ^. PoolMetadataRefId)
149149
where_ $ notExists (from (table @PoolRetire) >>= \pr -> where_ (pod ^. OffChainPoolDataPoolId ==. pr ^. PoolRetireHashId))
150150
pure
151151
( pod ^. OffChainPoolDataTickerName

cardano-db-sync/src/Cardano/DbSync/Epoch.hs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,20 @@ updateEpochStart syncEnv cache slotDetails isNewEpochEvent isBoundaryBlock = do
8282
let curEpochNo = unEpochNo $ sdEpochNo slotDetails
8383

8484
if
85-
-- The tip has been reached so now replace/update the epoch every block.
86-
| getSyncStatus slotDetails == SyncFollowing ->
87-
handleEpochWhenFollowing syncEnv cache mLastMapEpochFromCache mEpochBlockDiff curEpochNo
88-
-- When syncing we check if current block is the first block in an epoch.
89-
-- If so then it's time to put the previous epoch into the DB.
90-
| isNewEpochEvent ->
91-
updateEpochWhenSyncing syncEnv cache mEpochBlockDiff mLastMapEpochFromCache curEpochNo isBoundaryBlock
92-
-- we're syncing and the epochNo are the same so we just update the cache until above check passes.
93-
| otherwise ->
94-
handleEpochCachingWhenSyncing
95-
syncEnv
96-
cache
97-
mLastMapEpochFromCache
98-
mEpochBlockDiff
85+
-- The tip has been reached so now replace/update the epoch every block.
86+
| getSyncStatus slotDetails == SyncFollowing ->
87+
handleEpochWhenFollowing syncEnv cache mLastMapEpochFromCache mEpochBlockDiff curEpochNo
88+
-- When syncing we check if current block is the first block in an epoch.
89+
-- If so then it's time to put the previous epoch into the DB.
90+
| isNewEpochEvent ->
91+
updateEpochWhenSyncing syncEnv cache mEpochBlockDiff mLastMapEpochFromCache curEpochNo isBoundaryBlock
92+
-- we're syncing and the epochNo are the same so we just update the cache until above check passes.
93+
| otherwise ->
94+
handleEpochCachingWhenSyncing
95+
syncEnv
96+
cache
97+
mLastMapEpochFromCache
98+
mEpochBlockDiff
9999

100100
-----------------------------------------------------------------------------------------------------
101101
-- When Following

cardano-db-sync/src/Cardano/DbSync/Era/Shelley/ValidateWithdrawal.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ queryBadWithdrawals :: MonadIO m => ReaderT SqlBackend m [AddressInfo]
136136
queryBadWithdrawals = do
137137
res <- select $ do
138138
(rwd :& sa :& wdrl) <-
139-
from
140-
$ table @Db.Reward
139+
from $
140+
table @Db.Reward
141141
`innerJoin` table @Db.StakeAddress
142-
`on` (\(rwd :& sa) -> rwd ^. Db.RewardAddrId ==. sa ^. Db.StakeAddressId)
142+
`on` (\(rwd :& sa) -> rwd ^. Db.RewardAddrId ==. sa ^. Db.StakeAddressId)
143143
`innerJoin` table @Db.Withdrawal
144-
`on` (\(rwd :& _sa :& wdrl) -> rwd ^. Db.RewardAddrId ==. wdrl ^. Db.WithdrawalAddrId)
144+
`on` (\(rwd :& _sa :& wdrl) -> rwd ^. Db.RewardAddrId ==. wdrl ^. Db.WithdrawalAddrId)
145145
groupBy (sa ^. Db.StakeAddressId)
146146
let sumReward = sum_ (rwd ^. Db.RewardAmount)
147147
sumWithdraw = sum_ (wdrl ^. Db.WithdrawalAmount)

cardano-db-sync/src/Cardano/DbSync/Era/Universal/Validate.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ queryRewardMap ::
104104
queryRewardMap (EpochNo epochNo) = do
105105
res <- select $ do
106106
(rwd :& saddr) <-
107-
from
108-
$ table @Db.Reward
107+
from $
108+
table @Db.Reward
109109
`InnerJoin` table @Db.StakeAddress
110-
`on` ( \(rwd :& saddr) ->
111-
rwd ^. Db.RewardAddrId ==. saddr ^. Db.StakeAddressId
112-
)
110+
`on` ( \(rwd :& saddr) ->
111+
rwd ^. Db.RewardAddrId ==. saddr ^. Db.StakeAddressId
112+
)
113113
where_ (rwd ^. Db.RewardSpendableEpoch ==. val epochNo)
114114
where_ (not_ $ rwd ^. Db.RewardType ==. val Db.RwdDepositRefund)
115115
where_ (not_ $ rwd ^. Db.RewardType ==. val Db.RwdTreasury)

cardano-db-sync/src/Cardano/DbSync/Ledger/State.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -829,19 +829,19 @@ getPrices st = case ledgerState $ clsState st of
829829
Strict.Just
830830
( Shelley.nesEs (Consensus.shelleyLedgerState als)
831831
^. Shelley.curPParamsEpochStateL
832-
. Alonzo.ppPricesL
832+
. Alonzo.ppPricesL
833833
)
834834
LedgerStateBabbage bls ->
835835
Strict.Just
836836
( Shelley.nesEs (Consensus.shelleyLedgerState bls)
837837
^. Shelley.curPParamsEpochStateL
838-
. Alonzo.ppPricesL
838+
. Alonzo.ppPricesL
839839
)
840840
LedgerStateConway bls ->
841841
Strict.Just
842842
( Shelley.nesEs (Consensus.shelleyLedgerState bls)
843843
^. Shelley.curPParamsEpochStateL
844-
. Alonzo.ppPricesL
844+
. Alonzo.ppPricesL
845845
)
846846
_ -> Strict.Nothing
847847

cardano-db-sync/src/Cardano/DbSync/OffChain/Http.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ httpGetBytes manager request bytesToRead maxBytes url =
174174
( "application/json"
175175
`BS.isInfixOf` ct
176176
|| "application/ld+json"
177-
`BS.isInfixOf` ct
177+
`BS.isInfixOf` ct
178178
|| "text/plain"
179-
`BS.isInfixOf` ct
179+
`BS.isInfixOf` ct
180180
|| "binary/octet-stream"
181-
`BS.isInfixOf` ct
181+
`BS.isInfixOf` ct
182182
|| "application/octet-stream"
183-
`BS.isInfixOf` ct
183+
`BS.isInfixOf` ct
184184
|| "application/binary"
185-
`BS.isInfixOf` ct
185+
`BS.isInfixOf` ct
186186
)
187187
. left
188188
$ OCFErrBadContentType url (Text.decodeLatin1 ct)

cardano-db-sync/src/Cardano/DbSync/OffChain/Query.hs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ queryOffChainVoteWorkQueue :: MonadIO m => UTCTime -> Int -> ReaderT SqlBackend
114114
queryOffChainVoteWorkQueue _now maxCount = do
115115
res <- select $ do
116116
(va :& ocpfe) <-
117-
from
118-
$ table @VotingAnchor
117+
from $
118+
table @VotingAnchor
119119
`innerJoin` table @OffChainVoteFetchError
120-
`on` (\(va :& ocpfe) -> ocpfe ^. OffChainVoteFetchErrorVotingAnchorId ==. va ^. VotingAnchorId)
120+
`on` (\(va :& ocpfe) -> ocpfe ^. OffChainVoteFetchErrorVotingAnchorId ==. va ^. VotingAnchorId)
121121
orderBy [asc (ocpfe ^. OffChainVoteFetchErrorId)]
122122
where_ (just (ocpfe ^. OffChainVoteFetchErrorId) `in_` latestRefs)
123123
where_ (va ^. VotingAnchorType !=. val ConstitutionAnchor)
@@ -173,10 +173,10 @@ queryNewPoolWorkQueue :: MonadIO m => POSIXTime -> Int -> ReaderT SqlBackend m [
173173
queryNewPoolWorkQueue now maxCount = do
174174
res <- select $ do
175175
(ph :& pmr) <-
176-
from
177-
$ table @PoolHash
176+
from $
177+
table @PoolHash
178178
`innerJoin` table @PoolMetadataRef
179-
`on` (\(ph :& pmr) -> ph ^. PoolHashId ==. pmr ^. PoolMetadataRefPoolId)
179+
`on` (\(ph :& pmr) -> ph ^. PoolHashId ==. pmr ^. PoolMetadataRefPoolId)
180180
where_ (just (pmr ^. PoolMetadataRefId) `in_` latestRefs)
181181
where_
182182
( notExists $
@@ -224,12 +224,12 @@ queryOffChainPoolWorkQueue :: MonadIO m => UTCTime -> Int -> ReaderT SqlBackend
224224
queryOffChainPoolWorkQueue _now maxCount = do
225225
res <- select $ do
226226
(ph :& pmr :& pofe) <-
227-
from
228-
$ table @PoolHash
227+
from $
228+
table @PoolHash
229229
`innerJoin` table @PoolMetadataRef
230-
`on` (\(ph :& pmr) -> ph ^. PoolHashId ==. pmr ^. PoolMetadataRefPoolId)
230+
`on` (\(ph :& pmr) -> ph ^. PoolHashId ==. pmr ^. PoolMetadataRefPoolId)
231231
`innerJoin` table @OffChainPoolFetchError
232-
`on` (\(_ph :& pmr :& pofe) -> pofe ^. OffChainPoolFetchErrorPmrId ==. pmr ^. PoolMetadataRefId)
232+
`on` (\(_ph :& pmr :& pofe) -> pofe ^. OffChainPoolFetchErrorPmrId ==. pmr ^. PoolMetadataRefId)
233233
where_ (just (pofe ^. OffChainPoolFetchErrorId) `in_` latestRefs)
234234
orderBy [asc (pofe ^. OffChainPoolFetchErrorId)]
235235
limit $ fromIntegral maxCount

cardano-db-tool/src/Cardano/DbTool/Report/Balance.hs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ queryStakeAddressBalance txOutTableType address = do
104104
TxOutVariantAddress -> do
105105
res <- select $ do
106106
(txo :& addr) <-
107-
from
108-
$ table @V.TxOut
107+
from $
108+
table @V.TxOut
109109
`innerJoin` table @V.Address
110-
`on` (\(txo :& addr) -> txo ^. V.TxOutAddressId ==. addr ^. V.AddressId)
110+
`on` (\(txo :& addr) -> txo ^. V.TxOutAddressId ==. addr ^. V.AddressId)
111111
where_ (addr ^. V.AddressStakeAddressId ==. just (val saId))
112112
pure (sum_ (txo ^. V.TxOutValue))
113113
pure $ unValueSumAda (listToMaybe res)
@@ -135,26 +135,26 @@ queryStakeAddressBalance txOutTableType address = do
135135
TxOutCore -> do
136136
res <- select $ do
137137
(txOut :& tx :& _txIn) <-
138-
from
139-
$ table @C.TxOut
138+
from $
139+
table @C.TxOut
140140
`innerJoin` table @Tx
141-
`on` (\(txOut :& tx) -> txOut ^. C.TxOutTxId ==. tx ^. TxId)
141+
`on` (\(txOut :& tx) -> txOut ^. C.TxOutTxId ==. tx ^. TxId)
142142
`innerJoin` table @TxIn
143-
`on` (\(txOut :& tx :& txIn) -> txIn ^. TxInTxOutId ==. tx ^. TxId &&. txIn ^. TxInTxOutIndex ==. txOut ^. C.TxOutIndex)
143+
`on` (\(txOut :& tx :& txIn) -> txIn ^. TxInTxOutId ==. tx ^. TxId &&. txIn ^. TxInTxOutIndex ==. txOut ^. C.TxOutIndex)
144144
where_ (txOut ^. C.TxOutStakeAddressId ==. just (val saId))
145145
pure (sum_ (txOut ^. C.TxOutValue), sum_ (tx ^. TxFee), sum_ (tx ^. TxDeposit))
146146
pure $ maybe (0, 0, 0) convert (listToMaybe res)
147147
TxOutVariantAddress -> do
148148
res <- select $ do
149149
(txOut :& addr :& tx :& _txIn) <-
150-
from
151-
$ table @V.TxOut
150+
from $
151+
table @V.TxOut
152152
`innerJoin` table @V.Address
153-
`on` (\(txOut :& addr) -> txOut ^. V.TxOutAddressId ==. addr ^. V.AddressId)
153+
`on` (\(txOut :& addr) -> txOut ^. V.TxOutAddressId ==. addr ^. V.AddressId)
154154
`innerJoin` table @Tx
155-
`on` (\(txOut :& _addr :& tx) -> txOut ^. V.TxOutTxId ==. tx ^. TxId)
155+
`on` (\(txOut :& _addr :& tx) -> txOut ^. V.TxOutTxId ==. tx ^. TxId)
156156
`innerJoin` table @TxIn
157-
`on` (\(txOut :& _addr :& tx :& txIn) -> txIn ^. TxInTxOutId ==. tx ^. TxId &&. txIn ^. TxInTxOutIndex ==. txOut ^. V.TxOutIndex)
157+
`on` (\(txOut :& _addr :& tx :& txIn) -> txIn ^. TxInTxOutId ==. tx ^. TxId &&. txIn ^. TxInTxOutIndex ==. txOut ^. V.TxOutIndex)
158158
where_ (addr ^. V.AddressStakeAddressId ==. just (val saId))
159159
pure (sum_ (txOut ^. V.TxOutValue), sum_ (tx ^. TxFee), sum_ (tx ^. TxDeposit))
160160
pure $ maybe (0, 0, 0) convert (listToMaybe res)

cardano-db-tool/src/Cardano/DbTool/Report/StakeReward/History.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ queryHistoryStakeRewards address = do
8585
queryDelegation maxEpoch = do
8686
res <- select $ do
8787
(ep :& es :& saddr) <-
88-
from
89-
$ table @Epoch
88+
from $
89+
table @Epoch
9090
`innerJoin` table @EpochStake
91-
`on` (\(ep :& es) -> ep ^. EpochNo ==. es ^. EpochStakeEpochNo)
91+
`on` (\(ep :& es) -> ep ^. EpochNo ==. es ^. EpochStakeEpochNo)
9292
`innerJoin` table @StakeAddress
93-
`on` (\(_ep :& es :& saddr) -> saddr ^. StakeAddressId ==. es ^. EpochStakeAddrId)
93+
`on` (\(_ep :& es :& saddr) -> saddr ^. StakeAddressId ==. es ^. EpochStakeAddrId)
9494
where_ (saddr ^. StakeAddressView ==. val address)
9595
where_ (es ^. EpochStakeEpochNo <=. val maxEpoch)
9696
pure
@@ -109,12 +109,12 @@ queryHistoryStakeRewards address = do
109109
queryReward (saId, en, date, DbLovelace delegated, poolId) = do
110110
res <- select $ do
111111
(saddr :& rwd :& ep) <-
112-
from
113-
$ table @StakeAddress
112+
from $
113+
table @StakeAddress
114114
`innerJoin` table @Reward
115-
`on` (\(saddr :& rwd) -> saddr ^. StakeAddressId ==. rwd ^. RewardAddrId)
115+
`on` (\(saddr :& rwd) -> saddr ^. StakeAddressId ==. rwd ^. RewardAddrId)
116116
`innerJoin` table @Epoch
117-
`on` (\(_saddr :& rwd :& ep) -> ep ^. EpochNo ==. rwd ^. RewardEarnedEpoch)
117+
`on` (\(_saddr :& rwd :& ep) -> ep ^. EpochNo ==. rwd ^. RewardEarnedEpoch)
118118
where_ (ep ^. EpochNo ==. val en)
119119
where_ (saddr ^. StakeAddressId ==. val saId)
120120
orderBy [asc (ep ^. EpochNo)]

0 commit comments

Comments
 (0)