-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mmi 3924 implement new de fi adapter for uniswap v 3 in new repo #71
Mmi 3924 implement new de fi adapter for uniswap v 3 in new repo #71
Conversation
e90f552
to
67b2812
Compare
src/adapters/uniswap-v3/contracts/factories/UniswapPoolFactory__factory.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this contract likely to be needed in future? It doesn't look like it's being used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ill remove until its needed
}) | ||
|
||
const tokenIds = await Promise.all( | ||
[...Array(Number(balanceOf)).keys()].map((index) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could result in a pretty big loop. We might want to come back to this eventually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure what the best policy would be here.
I'm pretty sure we could have a single async map that returns nonZeroPositions
directly without looping three times with something like this.
const nonZeroPositions = await Promise.all(
filterMap([...Array(Number(balanceOf)).keys()], async (index) => {
const tokenId = await positionsManagerContract.tokenOfOwnerByIndex(
userAddress,
index,
{
blockTag: blockNumber,
},
)
const position = await positionsManagerContract.positions(tokenId, {
blockTag: blockNumber,
})
if (position.liquidity == 0n) {
return undefined
}
return {
liquidity: position.liquidity,
token0: position.token0,
token1: position.token1,
fee: position.fee,
tokenId: tokenIds[index],
}
}),
)
I'm unsure whether it'll save any time at all. We would need to run profiling with users with a lot of positions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually ignore my previous code. It won't work as filterMap
doesn't work with promises.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ive implemented
No description provided.