-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Improvement] Load Compound rates faster #3
Comments
Would
|
ah, sorry, you need the rates... How about
|
Two things- 1) How would I call getBorrowRate at a specific block number? rtoken-analytics/src/RTokenAnalytics.js Line 237 in 1bae351
|
for 2) use for 1) this can be solved with this undocumented feature of web3.js: web3/web3.js#1287 I tested it in remix:
Note that 9258683 is the block number of the supplyRatePerBlock I wanted to query with. |
Problem
Currently we are using the compound historical API to calculate interest sent over time. This requires a single call (potentially more in the future) to the API for each loan transfer event. The API has performed well so far, but I'd prefer if we moved to something faster, more robust, and that we not depend on a 3rd party for certain features to work.
Suggested Solution
Get the historical rate directly from Eth network using the
getStorageAt(contract, slot, blockNumber)
method. To make this easier, I suggest finding an existing library to help compute the Compound rate directly from contract state, without writing all this logic over again.The text was updated successfully, but these errors were encountered: