Skip to content

Commit

Permalink
Merge pull request #307 from Apegurus/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
0xroll authored Oct 28, 2024
2 parents 62a2c89 + 86f35f7 commit ae6e258
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions adapters/lynex/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const getUserStakedTVLByBlock = async ({
let userPoolFetch = [];
let userVotesFetch = [];

const batchSize = 400;
const batchSize = 100;
let position = 0;
let userFetchResult: any = [];
let userVotesResult: any = [];
Expand All @@ -112,6 +112,9 @@ export const getUserStakedTVLByBlock = async ({
...(await Promise.all(userVotesFetch)),
];
userVotesFetch = [];
console.timeEnd("Batch");
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))
await delay(60000)
}
position++;
}
Expand Down Expand Up @@ -155,7 +158,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(3000)
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 ae6e258

Please sign in to comment.