Skip to content

Commit

Permalink
update balance sql query
Browse files Browse the repository at this point in the history
  • Loading branch information
ajeet97 committed Aug 19, 2024
1 parent 2c601f3 commit 923ed21
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions adapters/renzo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,11 @@ const API_KEY = process.env.RENZO_API_KEY || ''
const QUERY_SIZE = 500000
const getSQLQuery = (blockNumber: number) => `
SELECT
id, ezETHBalance
FROM
AccountSnapshot t1
JOIN (
SELECT
id,
max(__genBlockNumber__) as block
FROM
AccountSnapshot
WHERE
__genBlockNumber__ <= ${blockNumber}
GROUP BY id
) t2
ON
t1.id = t2.id AND
t1.__genBlockNumber__ = t2.block
id,
argMax(ezETHBalance, __genBlockNumber__) as ezETHBalance
FROM AccountSnapshot_raw
WHERE __genBlockNumber__ <= ${blockNumber}
GROUP BY id
`

export const getUserTVLByBlock = async (block: BlockData): Promise<OutputDataRow[]> => {
Expand Down

0 comments on commit 923ed21

Please sign in to comment.