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)
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)