Skip to content

Commit

Permalink
feat: used token metadata caching (#104)
Browse files Browse the repository at this point in the history
* feat: add token caching

* fix: removed debugging code
  • Loading branch information
jstashh authored Sep 2, 2021
1 parent f062dff commit 4b3977f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/interfaces/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,14 @@ export class VaultInterface<T extends ChainId> extends ServiceInterface<T> {
const tokenAddresses = await adapter.tokens(overrides);
const tokens = await this.yearn.services.helper.tokens(tokenAddresses, overrides);
const icons = this.yearn.services.asset.icon(tokenAddresses.concat(EthAddress));
const tokensMetadata = await this.yearn.tokens.metadata(tokenAddresses);
return Promise.all(
tokens.map(async token => ({
...token,
icon: icons[token.address],
supported: {},
priceUsdc: await this.yearn.services.oracle.getPriceUsdc(token.address, overrides),
metadata: await this.yearn.services.meta.token(token.address)
metadata: tokensMetadata.find(metadata => metadata.address === token.address)
}))
);
})
Expand Down

0 comments on commit 4b3977f

Please sign in to comment.