[assets-controllers] Migrate Token price batch update to token prices service
- Dominant language
- TypeScript
- Stars
- 413
- Forks
- 308
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 253
Description
We have support for updating token prices in batches. This functionality is built-in to the `TokenRatesController`, and was separately implemented as the `fetchTokenContractExchangeRates` utility function (see #3657).
We should migrate this functionality to the token price service itself. It makes sense for this to be in-scope for the responsibilities of that service, because the whole reason for updating token prices in batches is to optimize our usage of this service and workaround its limitations. For example, the original batch size of 100 was chosen due to the maximum supported query string length for this service, and the later update to use a batch size of 30 was done to optimize costs for running this service. This functionality is intrinsically tied to this specific service, it should be managed in the same place.
Migrating this logic into the service would also reduce duplication between the `TokenRatesController` and the `fetchTokenContractExchangeRates` utility function.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the TokenRatesController and the fetchTokenContractExchangeRates utility function, then trace the token price service they use. Confirm where batch sizing and exchange-rate fetching are implemented. Done means the token price service owns this batching behavior and the duplicated logic is removed from the other entry points.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100