Skip to content

Commit

Permalink
quotedetails
Browse files Browse the repository at this point in the history
  • Loading branch information
parodime committed Feb 22, 2025
1 parent d1a87b0 commit 40b5b97
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/rfq-indexer/indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev:local": "rm -rf .ponder && APP_ENV=local ponder dev",
"check-env": "dotenv -e .env.local -- printenv | grep DATABASE_URL",
"dev": "ponder dev",
"devlog": "ponder dev --log-level trace",
"start": "ponder start",
"codegen": "ponder codegen",
"lint": "eslint .",
Expand Down
9 changes: 9 additions & 0 deletions packages/rfq-indexer/indexer/ponder.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ export default createSchema((p) => ({
transactionHash: p.string(),
}),

BridgeQuoteDetails: p.createTable({
id: p.string(),
transactionId: p.string(),
quoteId: p.string(),
blockNumber: p.bigint(),
blockTimestamp: p.int(),
transactionHash: p.string(),
}),

BridgeDepositRefundedEvents: p.createTable({
id: p.string(),
transactionId: p.string(),
Expand Down
36 changes: 36 additions & 0 deletions packages/rfq-indexer/indexer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,42 @@ import { contractNetworks_FastBridgeV1, contractNetworks_FastBridgeV2 } from '@/

/* ORIGIN CHAIN EVENTS */

ponder.on('v2:BridgeQuoteDetails', async ({ event, context }) => {

if (!validContractAddresses.FastBridgeV2.includes(event.log.address)) return;


if (!validContractAddresses.FastBridgeV2.includes(event.log.address)) return;

const {
db: { BridgeQuoteDetails },
network: { chainId },
} = context

const {
args: {
transactionId,
quoteId
},
block: { timestamp },
transaction: { hash },
log: { blockNumber },
} = event

await BridgeQuoteDetails.create({
id: transactionId,
data: {
transactionId,
quoteId: quoteId,
blockNumber: BigInt(blockNumber),
blockTimestamp: Number(timestamp),
transactionHash: hash
},
})

})


ponder.on('v2:BridgeRequested', async ({ event, context }) => {

if (!validContractAddresses.FastBridgeV2.includes(event.log.address)) return;
Expand Down

0 comments on commit 40b5b97

Please sign in to comment.