You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Looping through the transaction results, each result has a list of events to be looped through
191
191
varincludedEvents []domain.EventWrapper
192
-
txResults:=res.GetTxResults()
193
-
for_, txResult:=rangetxResults {
194
-
events:=txResult.GetEvents()
195
-
// Iterate through the events in the transaction
196
-
// Include these events only:
197
-
// - token_swapped
198
-
// - pool_joined
199
-
// - pool_exited
200
-
// - create_position
201
-
// - withdraw_position
202
-
fori, event:=rangeevents {
203
-
clonedEvent:=deepCloneEvent(&event)
204
-
// Add the token liquidity to the event
205
-
err:=s.addTokenLiquidity(ctx, clonedEvent)
192
+
193
+
txnResult:=res.TxResults[txnIndex]
194
+
iftxnResult.IsErr() {
195
+
// Skip if the transaction is not successful, so that its corresponding events are not included in the publishing and not counted in by the dexscreener
196
+
continue
197
+
}
198
+
events:=txnResult.GetEvents()
199
+
200
+
// Iterate through the events in the transaction
201
+
// Include these events only:
202
+
// - token_swapped
203
+
// - pool_joined
204
+
// - pool_exited
205
+
// - create_position
206
+
// - withdraw_position
207
+
fori, event:=rangeevents {
208
+
clonedEvent:=deepCloneEvent(&event)
209
+
// Add the token liquidity to the event
210
+
err:=s.addTokenLiquidity(ctx, clonedEvent)
211
+
iferr!=nil {
212
+
s.logger.Error("Error adding token liquidity to event", "error", err)
includedEvents=append(includedEvents, domain.EventWrapper{Index: i, Event: *clonedEvent})
231
+
}
232
+
// Track the newly created pool ID
233
+
// IMPORTANT NOTE:
234
+
// 1. Using event attributes in a transaction, ONLY pool ID of the newly created pool is available and being tracked by the underlying pool tracker.
235
+
// 2. For the other pool metadata of the newly created pool, such as denoms and fees, they are available and tracked thru OnWrite listeners in the common/writelistener package.
236
+
// 3. See: block_updates_indexer_block_process_strategy.go::publishCreatedPools for more details.
includedEvents=append(includedEvents, domain.EventWrapper{Index: i, Event: *clonedEvent})
226
-
}
227
-
// Track the newly created pool ID
228
-
// IMPORTANT NOTE:
229
-
// 1. Using event attributes in a transaction, ONLY pool ID of the newly created pool is available and being tracked by the underlying pool tracker.
230
-
// 2. For the other pool metadata of the newly created pool, such as denoms and fees, they are available and tracked thru OnWrite listeners in the common/writelistener package.
231
-
// 3. See: block_updates_indexer_block_process_strategy.go::publishCreatedPools for more details.
0 commit comments