Skip to content

Commit

Permalink
v4 pool currency0 and currency1 get address
Browse files Browse the repository at this point in the history
  • Loading branch information
jsy1218 committed Sep 23, 2024
1 parent ebb85c1 commit c745fdc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/providers/v4/pool-provider.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { ADDRESS_ZERO } from '@uniswap/router-sdk';
import { ChainId, Currency } from '@uniswap/sdk-core';
import { Pool } from '@uniswap/v4-sdk';
import retry, { Options as RetryOptions } from 'async-retry';
import { log, STATE_VIEW_ADDRESSES } from '../../util';
import { IMulticallProvider, Result } from '../multicall-provider';
import { ProviderConfig } from '../provider';

import { StateView__factory } from '../../types/other/factories/StateView__factory';
import { getAddress, log, STATE_VIEW_ADDRESSES } from '../../util';
import { IMulticallProvider, Result } from '../multicall-provider';
import { ILiquidity, ISlot0, PoolProvider } from '../pool-provider';
import { ProviderConfig } from '../provider';

type V4ISlot0 = ISlot0 & {
poolId: string;
Expand Down Expand Up @@ -154,12 +153,8 @@ export class V4PoolProvider
const [currency0, currency1] = sortsBefore(currencyA, currencyB)
? [currencyA, currencyB]
: [currencyB, currencyA];
const currency0Addr = currency0.isNative
? ADDRESS_ZERO
: currency0.wrapped.address;
const currency1Addr = currency1.isNative
? ADDRESS_ZERO
: currency1.wrapped.address;
const currency0Addr = getAddress(currency0);
const currency1Addr = getAddress(currency1);

const cacheKey = `${this.chainId}/${currency0Addr}/${currency1Addr}/${fee}/${tickSpacing}/${hooks}`;

Expand Down

0 comments on commit c745fdc

Please sign in to comment.