From cbd77e27612ea7d9bc8389b48f8a1992243fb474 Mon Sep 17 00:00:00 2001 From: matveyb Date: Sun, 21 Apr 2024 13:05:45 +0200 Subject: [PATCH] fix test --- adapters/overnight/src/index.ts | 4 ++-- adapters/overnight/src/sdk/config.ts | 4 ++-- adapters/overnight/src/sdk/subgraphDetails.ts | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/adapters/overnight/src/index.ts b/adapters/overnight/src/index.ts index 6058737b..6d89ee0c 100644 --- a/adapters/overnight/src/index.ts +++ b/adapters/overnight/src/index.ts @@ -1,5 +1,5 @@ import { CHAINS, PROTOCOLS, SNAPSHOTS_BLOCKS, OVN_CONTRACTS, LP_LYNEX, LP_LYNEX_SYMBOL, USD_PLUS_SYMBOL, USD_PLUS_LINEA, USDT_PLUS_SYMBOL, USDT_PLUS_LINEA } from "./sdk/config"; -import { Position, getLPValueByUserAndPoolFromPositions, getPositionsForAddressByPoolAtBlock, getRebaseForUsersByPoolAtBlock, getTimestampAtBlock } from "./sdk/subgraphDetails"; +import { getLPValueByUserAndPoolFromPositions, getUserTVLByBlock, getRebaseForUsersByPoolAtBlock, getTimestampAtBlock } from "./sdk/subgraphDetails"; (BigInt.prototype as any).toJSON = function () { return this.toString(); @@ -22,7 +22,7 @@ const getData = async () => { const csvRows_rebase: CSVRow[] = []; for (let block of SNAPSHOTS_BLOCKS) { - const positions = await getPositionsForAddressByPoolAtBlock( + const positions = await getUserTVLByBlock( block, "", "", CHAINS.LINEA, PROTOCOLS.OVN ); console.log("Positions: ", positions.length); diff --git a/adapters/overnight/src/sdk/config.ts b/adapters/overnight/src/sdk/config.ts index 1403371f..9e6f3fdc 100644 --- a/adapters/overnight/src/sdk/config.ts +++ b/adapters/overnight/src/sdk/config.ts @@ -55,10 +55,10 @@ export const RPC_URLS = { export const SNAPSHOTS_BLOCKS = [ - 2361808, 2761808, 3161808 + 2361808, 2761808, 3161808, 3461808 ]; -export const CHUNKS_SPLIT = 100; +export const CHUNKS_SPLIT = 10; export const LINEA_RPC = "https://lb.drpc.org/ogrpc?network=linea&dkey=AsCWb9aYukugqNphr9pEGw5L893HadYR7ooVbrjxQOzW" export const LP_LYNEX_SYMBOL = "oLYNX"; export const LP_LYNEX = "0x63349BA5E1F71252eCD56E8F950D1A518B400b60" diff --git a/adapters/overnight/src/sdk/subgraphDetails.ts b/adapters/overnight/src/sdk/subgraphDetails.ts index 650b3e98..6673d6ea 100644 --- a/adapters/overnight/src/sdk/subgraphDetails.ts +++ b/adapters/overnight/src/sdk/subgraphDetails.ts @@ -86,7 +86,8 @@ const countNetRebase = async ( const rebased = balanceDiff.minus(val).plus(userRedeem); // sometimes rebase can be negative - const rebasedChecked = rebased.gt(0) ? rebased.toFixed() : "0" + // const rebasedChecked = rebased.gt(0) ? rebased.toFixed() : "0" + const rebasedChecked = rebased.toFixed() usersRebaseProfit.set(key, rebasedChecked); } catch(e) { console.log(e) @@ -229,7 +230,7 @@ export const getRebaseForUsersByPoolAtBlock = async ( // OVN pools // 0x58aacbccaec30938cb2bb11653cad726e5c4194a usdc/usd+ // 0xc5f4c5c2077bbbac5a8381cf30ecdf18fde42a91 usdt+/usd+ -export const getPositionsForAddressByPoolAtBlock = async ( +export const getUserTVLByBlock = async ( blockNumber: number, address: string, poolId: string,