Skip to content
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

Add multicall support to ReadContract #1559

Open
DannyDelott opened this issue Oct 14, 2024 · 1 comment
Open

Add multicall support to ReadContract #1559

DannyDelott opened this issue Oct 14, 2024 · 1 comment
Assignees

Comments

@DannyDelott
Copy link
Contributor

DannyDelott commented Oct 14, 2024

The Compute Unit cost of using eth_getLogs is almost 3x higher than a standard eth_call, eg: calling balanceOf. Currently, we make two eth_getLogs calls to track a user’s open positions—one to get all events where they received tokens, and another for when they sent tokens. By using multicall via Drift, we can optimize this by making just one eth_getLogs request for receiving tokens, and then a single multicall3 eth_call to batch request balanceOf and check if they still hold a balance. This should also make the portfolio load faster, and our sdk logic quite a bit simpler (no need to reduce over two event arrays)

Image

@DannyDelott
Copy link
Contributor Author

We should wait to do this until we rewrite the SDK using Drift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants