Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Improve data fetching #156

Open
wnz99 opened this issue Dec 4, 2018 · 1 comment
Open

Improve data fetching #156

wnz99 opened this issue Dec 4, 2018 · 1 comment
Assignees
Labels

Comments

@wnz99
Copy link
Contributor

wnz99 commented Dec 4, 2018

Mainnet is generally slow, therefore we need to find ways to improve the dapp responsiveness.

One part of the job is to optimize the number of calls to the back-end node (currently Infura).

At the moment the dapp gathers info by doing various calls to various methods. For example:

  let dragoData = poolApi.contract.drago.getData()
  let dragoTotalSupply = poolApi.contract.drago.totalSupply()
  let dragoETH = poolApi.contract.drago.getBalance()
  let dragoWETH = poolApi.contract.drago.getBalanceWETH()

It would be very helpful if that could be accomplished with a single call. The above is just an example, therefore we should review the protocol contracts to see what information can be centralized in a single proxy contract. The most, the better.

A further step could be to have the proxy to return an array of funds, so for example we could call the proxy and pass an array of pools' addresses, and the fund would return ad array of information (those previously suggested).

This would help a lot when we need to show information for many funds, for example in the home page:

image

In the above screen I would like to show the fund's prices, supply and so on. This means that dapp needs to make calls for each funds. A good solution would be to call the proxy funds with batches of 5 funds each time (or more if feasible), so that the dapp would only make 1 single call for each page.

@gabririgo
Copy link
Contributor

this one addresses the first 3 at once
https://github.com/RigoBlock/rigoblock-monorepo/blob/feature/drago-data-helper/packages/contracts/src/examples/helpers/HGetDragoData.sol
cannot return more data for stack too deep

multiple token balances for a drago can be queried at once by calling this:
https://github.com/RigoBlock/rigoblock-monorepo/blob/ce3fc181c154c2bd8c0a7a6ddfe3b6b94b10e162/packages/contracts/src/examples/helpers/HGetMultipleBalances.sol#L58

by combining the two, you could potentially reduce down to 2 what is now done in 3 + x token pairs calls.

If works in principle, can work more on it, test and deploy.

@wnz99 wnz99 changed the title Improve events fetching Improve data fetching Dec 10, 2018
@wnz99 wnz99 self-assigned this Dec 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants