Skip to content

Commit

Permalink
Merge pull request #42 from galacticcouncil/dexscreener-fixes-6
Browse files Browse the repository at this point in the history
Dexscreener fixes 6
  • Loading branch information
green-jay authored Oct 29, 2024
2 parents 9de070d + 76b6d27 commit 0e18f25
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions queries/dexscreener/v1/events.sql
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ xyk_casted AS (
SELECT
block_id,
extrinsic_id,
CAST((regexp_matches(extrinsic_id, '-([0-9]+)-'))[1] AS INTEGER) AS extrinsic_index,
CAST(asset_1_id AS numeric) AS asset_1_id,
CAST(asset_2_id AS numeric) AS asset_2_id,
CAST(amount_1 AS numeric) AS amount_1,
Expand All @@ -182,6 +183,7 @@ xyk_ordered AS (
SELECT
block_id,
extrinsic_id,
extrinsic_index,
asset_1_id as asset_in_id,
asset_2_id as asset_out_id,
CASE WHEN asset_1_id < asset_2_id THEN asset_1_id ELSE asset_2_id END AS asset_1_id,
Expand All @@ -203,9 +205,9 @@ xyk_aggr AS (
WHEN xyk.eventType = 'swap' AND asset_1_id = asset_out_id THEN 'sell'
ELSE xyk.eventType
END AS eventType,
concat(block.height, '-', xyk.index_in_block) AS txnId,
xyk.index_in_block AS txnIndex,
xyk.pos AS eventIndex,
concat(block.height, '-', xyk.extrinsic_index) AS txnId,
xyk.extrinsic_index AS txnIndex,
concat(block.height, '-', xyk.index_in_block) AS eventIndex,
xyk.sender AS maker,
xyk.pairId,
ABS(xyk.amount_1 / 10^tm.decimals) AS amount0,
Expand Down

0 comments on commit 0e18f25

Please sign in to comment.