Closed karelianpie closed 2 years ago
Path | Size |
---|---|
dist/sdk.cjs.production.min.js | 44.29 KB (+0.01% 🔺) |
dist/sdk.esm.js | 44.66 KB (+0.01% 🔺) |
Thanks @karelianpie this makes sense as to the reason why we're having the issue. The reason why we are 'paginating' the results is because if we attempted to fetch all of the vaults at once then the call would run out of gas, instead we split it into multiple separate calls, and aggregate the result. A lot of the reason why it runs out of gas is because it's fetching prices from the oracle, which can be very gas intensive - https://github.com/yearn/yearn-lens/tree/master/contracts/Oracle
I think this PR would fix it, but I think it'd be better to fix it at this line here - https://github.com/yearn/yearn-caching-api/blob/master/jobs/vaults.mjs#L29. Perhaps by using concat
rather than push
. This will let us leave the implementation in the sdk the same, consistent with other reads from the cache, and it'll be quicker for us to deploy the fix. Would you be happy making that change?
Thanks @karelianpie this makes sense as to the reason why we're having the issue. The reason why we are 'paginating' the results is because if we attempted to fetch all of the vaults at once then the call would run out of gas, instead we split it into multiple separate calls, and aggregate the result. A lot of the reason why it runs out of gas is because it's fetching prices from the oracle, which can be very gas intensive - https://github.com/yearn/yearn-lens/tree/master/contracts/Oracle
I think this PR would fix it, but I think it'd be better to fix it at this line here - https://github.com/yearn/yearn-caching-api/blob/master/jobs/vaults.mjs#L29. Perhaps by using
concat
rather thanpush
. This will let us leave the implementation in the sdk the same, consistent with other reads from the cache, and it'll be quicker for us to deploy the fix. Would you be happy making that change?
Sounds good, done with https://github.com/yearn/yearn-caching-api/pull/53
I think that repo could do with some tests too at some point
Description
The endpoint https://cache.yearn.finance/v1/chains/1/vaults/getDynamic is returning an array of arrays, however we are filtering the addresses as if it was a flat array. Wondering if anyone has some context on why we are grouping this array into chunks of 20 and if we should get a flat array from that endpoint?
It's working for https://cache.yearn.finance/v1/chains/1/vaults/get because it's a flat array and both are using exactly the same filtering, but unfortunately that only works for the flatten one:
Related Issue
Fixes https://github.com/yearn/yearn-sdk/issues/274
How Has This Been Tested?
Tested by running the sdk/fe locally
Screenshots (if appropriate):