Skip to content

Commit

Permalink
worldchain explorer updates (#3351)
Browse files Browse the repository at this point in the history
* explorer UI updated

* rfq-indexer update

* explorer backend update

* [goreleaser] trigger explorer version bump

* rfq indexer with the right contracts

* [goreleaser] adding catch

* response error fixes and wld decimals

* adding address

* feat(rfq-indexer): add `request` column to `BridgeRequested` for refunds (#3287)

* feat(rfq-relayer): add MaxRelayAmount (#3259)

* Feat: add quoteParams helper for test

* Feat: add MaxQuoteAmount to relconfig

* Feat: use MaxQuoteAmount

* Feat: handle MaxQuoteAmount in quoter test

* Replace: MaxQuoteAmount -> MaxRelayAmount

* Feat: shouldProcess() returns false if max relay amount exceeded

* Feat: add test for MaxRelayAmount

* add request field for refunds

* adding to events typing

---------

Co-authored-by: dwasse <wassermandaniel8@gmail.com>
Co-authored-by: defi-moses <jakedinero@protonmail.com>

* fix api docs

* linting fixes

* fixing irrelavent files

---------

Co-authored-by: vro <168573323+golangisfun123@users.noreply.github.com>
Co-authored-by: dwasse <wassermandaniel8@gmail.com>
  • Loading branch information
3 people authored Oct 29, 2024
1 parent ecf33ae commit a330c8b
Show file tree
Hide file tree
Showing 36 changed files with 1,071 additions and 877 deletions.
6 changes: 6 additions & 0 deletions packages/explorer-ui/components/ChainChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ export const OverviewChart: React.FC<OverviewChartProps> = ({
stackId="a"
fill={loading ? 'rgba(255, 255, 255, 0.1)' : '#000000'}
/>
<Bar
isAnimationActive={false}
dataKey="worldchain"
stackId="a"
fill={loading ? 'rgba(255, 255, 255, 0.1)' : '#FFFFFF'}
/>
</>
)}
</BarChart>
Expand Down
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
@@ -1,14 +1,7 @@
import { Request, Response } from 'express'

import { db } from '../db'
import {
qDeposits,
qRelays,
qProofs,
qClaims,
qRefunds,
qDisputes,
} from '../queries'
import { qDeposits, qRelays, qProofs, qClaims, qRefunds } from '../queries'
import { nest_results } from '../utils/nestResults'

const sevenDaysAgo = Math.floor(Date.now() / 1000) - 7 * 24 * 60 * 60
Expand All @@ -21,7 +14,7 @@ export const pendingTransactionsMissingClaimController = async (
const query = db
.with('deposits', () => qDeposits())
.with('relays', () => qRelays())
.with('proofs', () => qProofs({activeOnly: true}))
.with('proofs', () => qProofs({ activeOnly: true }))
.with('claims', () => qClaims())
.with('combined', (qb) =>
qb
Expand All @@ -45,7 +38,7 @@ export const pendingTransactionsMissingClaimController = async (
res.json(nestedResults)
} else {
res
.status(404)
.status(200)
.json({ message: 'No pending transactions missing claim found' })
}
} catch (error) {
Expand All @@ -62,7 +55,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 All @@ -83,7 +76,7 @@ export const pendingTransactionsMissingProofController = async (
res.json(nestedResults)
} else {
res
.status(404)
.status(200)
.json({ message: 'No pending transactions missing proof found' })
}
} catch (error) {
Expand Down Expand Up @@ -128,7 +121,7 @@ export const pendingTransactionsMissingRelayController = async (
res.json(nestedResults)
} else {
res
.status(404)
.status(200)
.json({ message: 'No pending transactions missing relay found' })
}
} catch (error) {
Expand Down Expand Up @@ -173,7 +166,7 @@ export const pendingTransactionsMissingRelayExceedDeadlineController = async (
res.json(nestedResults)
} else {
res
.status(404)
.status(200)
.json({ message: 'No pending transactions missing relay found' })
}
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { Request, Response } from 'express'

import { db } from '../db'
import { qDeposits, qRelays, qProofs, qClaims, qRefunds, qDisputes } from '../queries'
import {
qDeposits,
qRelays,
qProofs,
qClaims,
qRefunds,
qDisputes,
} from '../queries'
import { nest_results } from '../utils/nestResults'

export const getTransactionById = async (req: Request, res: Response) => {
Expand All @@ -18,16 +25,20 @@ export const getTransactionById = async (req: Request, res: Response) => {
)
)
.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) =>
qb
.selectFrom('deposits')
.leftJoin('relays', 'transactionId_deposit', 'transactionId_relay')
.leftJoin('proofs', 'transactionId_deposit', 'transactionId_proof')
.leftJoin('disputes', 'transactionId_deposit', 'transactionId_dispute')
.leftJoin(
'disputes',
'transactionId_deposit',
'transactionId_dispute'
)
.leftJoin('claims', 'transactionId_deposit', 'transactionId_claim')
.leftJoin('refunds', 'transactionId_deposit', 'transactionId_refund')
.selectAll('deposits')
Expand Down
1 change: 1 addition & 0 deletions packages/rfq-indexer/api/src/graphql/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const qDeposits = () => {
'BridgeRequestEvents.originAmountFormatted',
'BridgeRequestEvents.destAmountFormatted',
'BridgeRequestEvents.sender',
'BridgeRequestEvents.request',
'BridgeRequestEvents.sendChainGas',
])
.where('BridgeRequestEvents.blockTimestamp', '>', 1722729600)
Expand Down
1 change: 1 addition & 0 deletions packages/rfq-indexer/api/src/graphql/types/events.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ scalar BigInt
destAmountFormatted: String!
destChainId: Int!
destChain: String!
request: String!
sendChainGas: Boolean!
}

Expand Down
1 change: 1 addition & 0 deletions packages/rfq-indexer/api/src/queries/depositsQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const qDeposits = () => {
'BridgeRequestEvents.originAmountFormatted',
'BridgeRequestEvents.destAmountFormatted',
'BridgeRequestEvents.sender',
'BridgeRequestEvents.request',
'BridgeRequestEvents.sendChainGas',
])
.where('BridgeRequestEvents.blockTimestamp', '>', 1722729600)
Expand Down
11 changes: 1 addition & 10 deletions packages/rfq-indexer/api/src/routes/conflictingProofsRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const router = express.Router()
* description: Retrieves a list of transactions where the relayer in the proof differs from the relayer in the relay event
* responses:
* 200:
* description: Successful response
* description: Successful response (may be an empty array if no conflicting proofs found)
* content:
* application/json:
* schema:
Expand Down Expand Up @@ -41,15 +41,6 @@ const router = express.Router()
* BridgeDispute:
* type: object
* description: Dispute information (if available)
* 404:
* description: No conflicting proofs found
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* 500:
* description: Server error
* content:
Expand Down
11 changes: 1 addition & 10 deletions packages/rfq-indexer/api/src/routes/disputesRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const router = express.Router()
* description: Retrieves a list of all active disputes
* responses:
* 200:
* description: Successful response
* description: Successful response (may be an empty array)
* content:
* application/json:
* schema:
Expand Down Expand Up @@ -41,15 +41,6 @@ const router = express.Router()
* BridgeDispute:
* type: object
* description: Dispute information (if available)
* 404:
* description: No disputes found
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* 500:
* description: Server error
* content:
Expand Down
11 changes: 1 addition & 10 deletions packages/rfq-indexer/api/src/routes/invalidRelaysRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const router = express.Router()
* description: Retrieves a list of recent invalid relay events from the past 2 weeks
* responses:
* 200:
* description: Successful response
* description: Successful response (may be an empty array)
* content:
* application/json:
* schema:
Expand Down Expand Up @@ -41,15 +41,6 @@ const router = express.Router()
* BridgeDispute:
* type: object
* description: Dispute information (if available)
* 404:
* description: No recent invalid relays found
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* 500:
* description: Server error
* content:
Expand Down
44 changes: 4 additions & 40 deletions packages/rfq-indexer/api/src/routes/pendingTransactionsRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const router = express.Router()
* description: Retrieves a list of transactions that have been deposited, relayed, and proven, but not yet claimed
* responses:
* 200:
* description: Successful response
* description: Successful response (may be an empty array)
* content:
* application/json:
* schema:
Expand Down Expand Up @@ -46,15 +46,6 @@ const router = express.Router()
* BridgeDispute:
* type: object
* description: Dispute information (if available)
* 404:
* description: No pending transactions missing claim found
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* 500:
* description: Server error
* content:
Expand All @@ -75,7 +66,7 @@ router.get('/missing-claim', pendingTransactionsMissingClaimController)
* description: Retrieves a list of transactions that have been deposited and relayed, but not yet proven
* responses:
* 200:
* description: Successful response
* description: Successful response (may be an empty array)
* content:
* application/json:
* schema:
Expand All @@ -87,15 +78,6 @@ router.get('/missing-claim', pendingTransactionsMissingClaimController)
* type: object
* relay:
* type: object
* 404:
* description: No pending transactions missing proof found
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* 500:
* description: Server error
* content:
Expand All @@ -116,7 +98,7 @@ router.get('/missing-proof', pendingTransactionsMissingProofController)
* description: Retrieves a list of transactions that have been deposited, but not yet relayed or refunded
* responses:
* 200:
* description: Successful response
* description: Successful response (may be an empty array)
* content:
* application/json:
* schema:
Expand All @@ -126,15 +108,6 @@ router.get('/missing-proof', pendingTransactionsMissingProofController)
* properties:
* deposit:
* type: object
* 404:
* description: No pending transactions missing relay found
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* 500:
* description: Server error
* content:
Expand All @@ -155,7 +128,7 @@ router.get('/missing-relay', pendingTransactionsMissingRelayController)
* description: Retrieves a list of transactions that have been deposited, but not yet relayed or refunded and have exceeded the deadline
* responses:
* 200:
* description: Successful response
* description: Successful response (may be an empty array)
* content:
* application/json:
* schema:
Expand All @@ -165,15 +138,6 @@ router.get('/missing-relay', pendingTransactionsMissingRelayController)
* properties:
* deposit:
* type: object
* 404:
* description: No pending transactionst that exceed the deadline found
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* 500:
* description: Server error
* content:
Expand Down
11 changes: 1 addition & 10 deletions packages/rfq-indexer/api/src/routes/refundedAndRelayedRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const router = express.Router()
* description: Retrieves a list of transactions that have been both refunded and relayed
* responses:
* 200:
* description: Successful response
* description: Successful response (may be an empty array)
* content:
* application/json:
* schema:
Expand Down Expand Up @@ -41,15 +41,6 @@ const router = express.Router()
* BridgeDispute:
* type: object
* description: Dispute information (if available)
* 404:
* description: No refunded and relayed transactions found
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* 500:
* description: Server error
* content:
Expand Down
Loading

0 comments on commit a330c8b

Please sign in to comment.