Skip to content

Commit

Permalink
fix: Reduce amount of user wallets with amount greated than 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Apegurus committed Oct 10, 2024
1 parent 61303a6 commit f30ccaa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion adapters/lynex/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const getUserStakedTVLByBlock = async ({
tokenBalanceMap[user_address] = tokenBalanceMap[user_address] ?? {};
tokenBalanceMap[user_address][token0Address] = BigNumber(
tokenBalanceMap[user_address][token0Address] ?? 0
).plus(userVote.result.amount.toString());
).plus(userVote.result.amount?.toString() ?? '0');
}
}

Expand Down
5 changes: 4 additions & 1 deletion adapters/lynex/src/sdk/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export const V3_SUBGRAPH_URL =

export const client = createPublicClient({
chain: linea,
transport: http("https://rpc.linea.build"),
transport: http("https://rpc.linea.build", {
retryCount: 5,
timeout: 60_000,
}),
});

export const PROBLEM_POOLS = {
Expand Down
2 changes: 1 addition & 1 deletion adapters/lynex/src/sdk/lensDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const fetchUserPools = async (
blockNumber
)) as any;
const delay = (ms: number | undefined) => new Promise(resolve => setTimeout(resolve, ms))
await delay(100)
await delay(10000)
return res.map((r: any) => {
if (r.status !== 'success') {
throw new Error("RPC call error. Status: " + r.status);
Expand Down
4 changes: 2 additions & 2 deletions adapters/lynex/src/sdk/subgraphDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getUserAddresses = async (
while (fetchNext) {
let query = `
query UserQuery {
users(${blockQuery} first:1000,skip:${skip}) {
users(${blockQuery} first:1000,skip:${skip}, where:{liquidityPositions_: {amount_gt: 0}}) {
id
liquidityPositions {
id
Expand Down Expand Up @@ -50,7 +50,7 @@ export const getUserAddresses = async (
headers: { "Content-Type": "application/json" },
});
let data = await response.json();
let userStakes = data.data.users;
let userStakes = data.data?.users ?? [];
for (let i = 0; i < userStakes.length; i++) {
let userStake = userStakes[i];
let transformedUserStake: UserStake = {
Expand Down

0 comments on commit f30ccaa

Please sign in to comment.