Skip to content

Commit

Permalink
clearpool, uma and enzyme were fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonmezturk committed Aug 21, 2023
1 parent 89649fb commit 470ed2a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 29 deletions.
27 changes: 19 additions & 8 deletions src/factory/providers/ethereum/clearpool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,26 @@ async function tvl(params: ITvlParams): Promise<Partial<ITvlReturn>> {
);
} catch {}

const logs = await util.getLogs(
Math.max(START_BLOCK, poolsAndTokens.start),
block,
'0x9c5d829b9b23efc461f9aeef91979ec04bb903feb3bee4f26d22114abfc7335b',
POOL_FACTORY,
web3,
);
const blocksLimit = 10000;
const poolLogs = [];
for (
let i = Math.max(START_BLOCK, poolsAndTokens.start);
i < block;
i += blocksLimit
) {
const logs = (
await util.getLogs(
i,
Math.min(i + blocksLimit, block),
'0x9c5d829b9b23efc461f9aeef91979ec04bb903feb3bee4f26d22114abfc7335b',
POOL_FACTORY,
web3,
)
).output;
Array.prototype.push.apply(poolLogs, logs);
}

logs.output.forEach((log) => {
poolLogs.forEach((log) => {
const token = `0x${log.topics[3].substring(26, 66)}`;
const pool = `0x${log.topics[1].substring(26, 66)}`;
if (!poolsAndTokens.tokens.includes(token)) {
Expand Down
30 changes: 19 additions & 11 deletions src/factory/providers/ethereum/enzyme/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,26 @@ async function tvl(params: ITvlParams): Promise<any[]> {
};
}

/* pull melon fund holding addresses */
const logs = (
await util.getLogs(
Math.max(_v2Vaults.start, START_BLOCK),
block,
'0xa50560b448ad796ef60adfeffe1c19ed34daf94c2aa6905d0e209017dbc19f58',
DISPATCHER,
web3,
)
).output;
const blocksLimit = 10000;
const poolLogs = [];
for (
let i = Math.max(START_BLOCK, _v2Vaults.start);
i < block;
i += blocksLimit
) {
const logs = (
await util.getLogs(
i,
Math.min(i + blocksLimit, block),
'0xa50560b448ad796ef60adfeffe1c19ed34daf94c2aa6905d0e209017dbc19f58',
DISPATCHER,
web3,
)
).output;
Array.prototype.push.apply(poolLogs, logs);
}

const vaultProxies = logs.map((log) =>
const vaultProxies = poolLogs.map((log) =>
`0x${log.data.slice(64 - 40 + 2, 64 + 2)}`.toLowerCase(),
);

Expand Down
25 changes: 15 additions & 10 deletions src/factory/providers/ethereum/uma/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ async function tvl(params: ITvlParams): Promise<Partial<ITvlReturn>> {
};
}

const logs = (
await util.getLogs(
Math.max(pools.start, STARTBLOCK),
block,
'0xf360b00b309dfe6565667df6b06eab15d0e0958d5e82d89a399ae7dd417b4b09',
CREATOR,
web3,
)
).output;
const blocksLimit = 10000;
const poolLogs = [];
for (let i = Math.max(STARTBLOCK, pools.start); i < block; i += blocksLimit) {
const logs = (
await util.getLogs(
i,
Math.min(i + blocksLimit, block),
'0xf360b00b309dfe6565667df6b06eab15d0e0958d5e82d89a399ae7dd417b4b09',
CREATOR,
web3,
)
).output;
Array.prototype.push.apply(poolLogs, logs);
}

const financialContracts = logs.map((log) =>
const financialContracts = poolLogs.map((log) =>
`0x${log.topics[1].slice(64 - 40 + 2, 64 + 2)}`.toLowerCase(),
);

Expand Down

0 comments on commit 470ed2a

Please sign in to comment.