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

Commit

Permalink
feat(uniswap-v2): Build cache key from subgraph URL (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich committed Jun 26, 2022
1 parent 6da7a7b commit 7d5c2e6
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -4,7 +4,6 @@ import { range, uniq } from 'lodash';

import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { Cache } from '~cache/cache.decorator';
import { Network } from '~types/network.interface';

import { UniswapFactory, UniswapPair } from '../contracts';

Expand Down Expand Up @@ -46,8 +45,10 @@ export class UniswapV2TheGraphPoolTokenAddressStrategy {
constructor(@Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit) {}

@Cache({
key: (network: Network, appId: string, groupId: string) =>
`studio-the-graph-pool-token-addresses:${network}:${appId}:${groupId}`,
key: (subgraphUrl: string) => {
const [namespace, name] = subgraphUrl.split('/').slice(-2);
return `studio:uniswap-v2-fork:pool-token-addresses:${namespace}:${name}`;
},
ttl: 5 * 60,
})
async getPoolAddresses(
Expand Down

0 comments on commit 7d5c2e6

Please sign in to comment.