Skip to content

Commit

Permalink
rfq-indexer update
Browse files Browse the repository at this point in the history
  • Loading branch information
Defi-Moses committed Oct 10, 2024
1 parent 2ef3bbf commit 6cf146a
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 6 deletions.
12 changes: 12 additions & 0 deletions packages/rfq-indexer/api/src/constants/networkConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
linea,
bsc,
blast,
worldchain,
} from 'viem/chains'

import { FastBridgeV2Abi } from './abis/FastBridgeV2'
Expand Down Expand Up @@ -114,4 +115,15 @@ export const networkConfig: NetworkConfig = {
transport: http(),
}),
},
480: {
name: 'Worldchain',
FastBridgeV2: {
address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E',
abi: FastBridgeV2Abi,
},
client: createPublicClient({
chain: worldchain,
transport: http(),
}),
},
} as const
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const conflictingProofsController = async (
const query = db
.with('deposits', () => qDeposits())
.with('relays', () => qRelays())
.with('proofs', () => qProofs({activeOnly: true}))
.with('proofs', () => qProofs({ activeOnly: true }))
.with('combined', (qb) =>
qb
.selectFrom('deposits')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { nest_results } from '../utils/nestResults'
export const disputesController = async (req: Request, res: Response) => {
try {
const query = db
.with('disputes', () => qDisputes({activeOnly: true}))
.with('disputes', () => qDisputes({ activeOnly: true }))
.selectFrom('disputes')
.selectAll()
.orderBy('blockTimestamp_dispute', 'desc')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const pendingTransactionsMissingProofController = async (
const query = db
.with('deposits', () => qDeposits())
.with('relays', () => qRelays())
.with('proofs', () => qProofs({activeOnly: true}))
.with('proofs', () => qProofs({ activeOnly: true }))
.with('combined', (qb) =>
qb
.selectFrom('deposits')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export const getTransactionById = async (req: Request, res: Response) => {
qDeposits().where('transactionId', '=', transactionId as string)
)
.with('relays', () => qRelays())
.with('proofs', () => qProofs({activeOnly: false})) // display proofs even if they have been invalidated/replaced by a dispute
.with('disputes', () => qDisputes({activeOnly: true})) // do not show disputes that have been invalidated/replaced by a proof
.with('proofs', () => qProofs({ activeOnly: false })) // display proofs even if they have been invalidated/replaced by a dispute
.with('disputes', () => qDisputes({ activeOnly: true })) // do not show disputes that have been invalidated/replaced by a proof
.with('claims', () => qClaims())
.with('refunds', () => qRefunds())
.with('combined', (qb) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/rfq-indexer/indexer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BLAST_MAINNET_RPC=
SCROLL_MAINNET_RPC=
LINEA_MAINNET_RPC=
BNB_MAINNET_RPC=
WORLDCHAIN_MAINNET_RPC=

# (Optional) Postgres database URL. If not provided, SQLite will be used.
DATABASE_URL=

25 changes: 25 additions & 0 deletions packages/rfq-indexer/indexer/ponder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const blastChainId = 81457
const scrollChainId = 534352
const lineaChainId = 59144
const bnbChainId = 56
const worldchainChainId = 480

const configByChainId = {
[1]: {
Expand Down Expand Up @@ -69,6 +70,12 @@ const configByChainId = {
FastBridgeV2Address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E',
FastBridgeV2StartBlock: 40497843, // first block and new block
},
[480]: {
transport: http(process.env.WORLDCHAIN_MAINNET_RPC),
chainName: 'worldchain',
FastBridgeV2Address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E',
FastBridgeV2StartBlock: 4616214, // first block and new block
},
disableCache: true,
}

Expand Down Expand Up @@ -137,6 +144,14 @@ export const networkDetails = {
startBlock: configByChainId[bnbChainId].FastBridgeV2StartBlock,
},
},
[worldchainChainId]: {
name: configByChainId[worldchainChainId].chainName,
FastBridgeV2: {
address: configByChainId[worldchainChainId].FastBridgeV2Address,
abi: FastBridgeV2Abi,
startBlock: configByChainId[worldchainChainId].FastBridgeV2StartBlock,
},
},
} as Record<number, AddressConfig>

const config = createConfig({
Expand Down Expand Up @@ -181,6 +196,11 @@ const config = createConfig({
transport: configByChainId[bnbChainId].transport,
// disableCache: configByChainId.disableCache,
},
[configByChainId[worldchainChainId].chainName]: {
chainId: worldchainChainId,
transport: configByChainId[worldchainChainId].transport,
// disableCache: configByChainId.disableCache,
},
},
contracts: {
FastBridgeV2: {
Expand Down Expand Up @@ -217,6 +237,11 @@ const config = createConfig({
address: networkDetails[bnbChainId]?.FastBridgeV2.address,
startBlock: networkDetails[bnbChainId]?.FastBridgeV2.startBlock,
},
[configByChainId[worldchainChainId].chainName]: {
address: networkDetails[worldchainChainId]?.FastBridgeV2.address,
startBlock:
networkDetails[worldchainChainId]?.FastBridgeV2.startBlock,
},
},
abi: FastBridgeV2Abi,
},
Expand Down
1 change: 1 addition & 0 deletions packages/rfq-indexer/indexer/src/utils/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const chainIdToName: { [key: number]: string } = {
534352: 'scroll',
59144: 'linea',
56: 'bnb',
480: 'worldchain',
}

export const getChainName = (chainId: number): string => {
Expand Down

0 comments on commit 6cf146a

Please sign in to comment.