From ec831f8433057c7ee86228df308705f4bb3f10f7 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Tue, 29 Mar 2022 12:00:42 -0700 Subject: [PATCH] chore: destructure json imports (#3622) --- src/hooks/usePools.ts | 4 +--- src/hooks/useV2Pairs.ts | 4 +--- src/state/claim/hooks.ts | 4 +--- src/state/governance/hooks.ts | 7 ++----- src/state/stake/hooks.tsx | 3 +-- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/hooks/usePools.ts b/src/hooks/usePools.ts index 6411380ee3..9b750c18b0 100644 --- a/src/hooks/usePools.ts +++ b/src/hooks/usePools.ts @@ -1,6 +1,6 @@ import { Interface } from '@ethersproject/abi' import { BigintIsh, Currency, Token } from '@uniswap/sdk-core' -import IUniswapV3PoolStateJson from '@uniswap/v3-core/artifacts/contracts/interfaces/pool/IUniswapV3PoolState.sol/IUniswapV3PoolState.json' +import { abi as IUniswapV3PoolStateABI } from '@uniswap/v3-core/artifacts/contracts/interfaces/pool/IUniswapV3PoolState.sol/IUniswapV3PoolState.json' import { computePoolAddress } from '@uniswap/v3-sdk' import { FeeAmount, Pool } from '@uniswap/v3-sdk' import useActiveWeb3React from 'hooks/useActiveWeb3React' @@ -11,8 +11,6 @@ import { useMemo } from 'react' import { V3_CORE_FACTORY_ADDRESSES } from '../constants/addresses' import { IUniswapV3PoolStateInterface } from '../types/v3/IUniswapV3PoolState' -const { abi: IUniswapV3PoolStateABI } = IUniswapV3PoolStateJson - const POOL_STATE_INTERFACE = new Interface(IUniswapV3PoolStateABI) as IUniswapV3PoolStateInterface // Classes are expensive to instantiate, so this caches the recently instantiated pools. diff --git a/src/hooks/useV2Pairs.ts b/src/hooks/useV2Pairs.ts index 253c153a77..78b7d892f5 100644 --- a/src/hooks/useV2Pairs.ts +++ b/src/hooks/useV2Pairs.ts @@ -1,14 +1,12 @@ import { Interface } from '@ethersproject/abi' import { Currency, CurrencyAmount } from '@uniswap/sdk-core' -import IUniswapV2PairJson from '@uniswap/v2-core/build/IUniswapV2Pair.json' +import { abi as IUniswapV2PairABI } from '@uniswap/v2-core/build/IUniswapV2Pair.json' import { computePairAddress, Pair } from '@uniswap/v2-sdk' import { useMultipleContractSingleData } from 'lib/hooks/multicall' import { useMemo } from 'react' import { V2_FACTORY_ADDRESSES } from '../constants/addresses' -const { abi: IUniswapV2PairABI } = IUniswapV2PairJson - const PAIR_INTERFACE = new Interface(IUniswapV2PairABI) export enum PairState { diff --git a/src/state/claim/hooks.ts b/src/state/claim/hooks.ts index 702115053a..a21bce58b5 100644 --- a/src/state/claim/hooks.ts +++ b/src/state/claim/hooks.ts @@ -1,5 +1,5 @@ import { TransactionResponse } from '@ethersproject/providers' -import MerkleDistributorJson from '@uniswap/merkle-distributor/build/MerkleDistributor.json' +import { abi as MERKLE_DISTRIBUTOR_ABI } from '@uniswap/merkle-distributor/build/MerkleDistributor.json' import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { MERKLE_DISTRIBUTOR_ADDRESS } from 'constants/addresses' import useActiveWeb3React from 'hooks/useActiveWeb3React' @@ -14,8 +14,6 @@ import { calculateGasMargin } from '../../utils/calculateGasMargin' import { TransactionType } from '../transactions/actions' import { useTransactionAdder } from '../transactions/hooks' -const { abi: MERKLE_DISTRIBUTOR_ABI } = MerkleDistributorJson - function useMerkleDistributorContract() { return useContract(MERKLE_DISTRIBUTOR_ADDRESS, MERKLE_DISTRIBUTOR_ABI, true) } diff --git a/src/state/governance/hooks.ts b/src/state/governance/hooks.ts index 5fc5f11a29..22cd108ee4 100644 --- a/src/state/governance/hooks.ts +++ b/src/state/governance/hooks.ts @@ -5,8 +5,8 @@ import { TransactionResponse } from '@ethersproject/providers' import { toUtf8String, Utf8ErrorFuncs, Utf8ErrorReason } from '@ethersproject/strings' // eslint-disable-next-line no-restricted-imports import { t } from '@lingui/macro' -import GovernorAlphaJson from '@uniswap/governance/build/GovernorAlpha.json' -import UniJson from '@uniswap/governance/build/Uni.json' +import { abi as GOVERNANCE_ABI } from '@uniswap/governance/build/GovernorAlpha.json' +import { abi as UNI_ABI } from '@uniswap/governance/build/Uni.json' import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { ChainId } from '@uniswap/smart-order-router' import GOVERNOR_BRAVO_ABI from 'abis/governor-bravo.json' @@ -37,9 +37,6 @@ import { TransactionType } from '../transactions/actions' import { useTransactionAdder } from '../transactions/hooks' import { VoteOption } from './types' -const { abi: GOVERNANCE_ABI } = GovernorAlphaJson -const { abi: UNI_ABI } = UniJson - function useGovernanceV0Contract(): Contract | null { return useContract(GOVERNANCE_ALPHA_V0_ADDRESSES, GOVERNANCE_ABI, false) } diff --git a/src/state/stake/hooks.tsx b/src/state/stake/hooks.tsx index 65a7c93cce..71f532cc19 100644 --- a/src/state/stake/hooks.tsx +++ b/src/state/stake/hooks.tsx @@ -1,6 +1,6 @@ import { Interface } from '@ethersproject/abi' import { Trans } from '@lingui/macro' -import StakingRewardsJson from '@uniswap/liquidity-staker/build/StakingRewards.json' +import { abi as STAKING_REWARDS_ABI } from '@uniswap/liquidity-staker/build/StakingRewards.json' import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { Pair } from '@uniswap/v2-sdk' import { SupportedChainId } from 'constants/chains' @@ -13,7 +13,6 @@ import { ReactNode, useMemo } from 'react' import { DAI, UNI, USDC_MAINNET, USDT, WBTC, WRAPPED_NATIVE_CURRENCY } from '../../constants/tokens' -const { abi: STAKING_REWARDS_ABI } = StakingRewardsJson const STAKING_REWARDS_INTERFACE = new Interface(STAKING_REWARDS_ABI) export const STAKING_GENESIS = 1600387200