chore: destructure json imports (#3622)

This commit is contained in:
Zach Pomerantz 2022-03-29 12:00:42 -07:00 committed by GitHub
parent 56bd9b68d7
commit ec831f8433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 16 deletions

@ -1,6 +1,6 @@
import { Interface } from '@ethersproject/abi' import { Interface } from '@ethersproject/abi'
import { BigintIsh, Currency, Token } from '@uniswap/sdk-core' 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 { computePoolAddress } from '@uniswap/v3-sdk'
import { FeeAmount, Pool } from '@uniswap/v3-sdk' import { FeeAmount, Pool } from '@uniswap/v3-sdk'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import useActiveWeb3React from 'hooks/useActiveWeb3React'
@ -11,8 +11,6 @@ import { useMemo } from 'react'
import { V3_CORE_FACTORY_ADDRESSES } from '../constants/addresses' import { V3_CORE_FACTORY_ADDRESSES } from '../constants/addresses'
import { IUniswapV3PoolStateInterface } from '../types/v3/IUniswapV3PoolState' import { IUniswapV3PoolStateInterface } from '../types/v3/IUniswapV3PoolState'
const { abi: IUniswapV3PoolStateABI } = IUniswapV3PoolStateJson
const POOL_STATE_INTERFACE = new Interface(IUniswapV3PoolStateABI) as IUniswapV3PoolStateInterface const POOL_STATE_INTERFACE = new Interface(IUniswapV3PoolStateABI) as IUniswapV3PoolStateInterface
// Classes are expensive to instantiate, so this caches the recently instantiated pools. // Classes are expensive to instantiate, so this caches the recently instantiated pools.

@ -1,14 +1,12 @@
import { Interface } from '@ethersproject/abi' import { Interface } from '@ethersproject/abi'
import { Currency, CurrencyAmount } from '@uniswap/sdk-core' 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 { computePairAddress, Pair } from '@uniswap/v2-sdk'
import { useMultipleContractSingleData } from 'lib/hooks/multicall' import { useMultipleContractSingleData } from 'lib/hooks/multicall'
import { useMemo } from 'react' import { useMemo } from 'react'
import { V2_FACTORY_ADDRESSES } from '../constants/addresses' import { V2_FACTORY_ADDRESSES } from '../constants/addresses'
const { abi: IUniswapV2PairABI } = IUniswapV2PairJson
const PAIR_INTERFACE = new Interface(IUniswapV2PairABI) const PAIR_INTERFACE = new Interface(IUniswapV2PairABI)
export enum PairState { export enum PairState {

@ -1,5 +1,5 @@
import { TransactionResponse } from '@ethersproject/providers' 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 { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { MERKLE_DISTRIBUTOR_ADDRESS } from 'constants/addresses' import { MERKLE_DISTRIBUTOR_ADDRESS } from 'constants/addresses'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import useActiveWeb3React from 'hooks/useActiveWeb3React'
@ -14,8 +14,6 @@ import { calculateGasMargin } from '../../utils/calculateGasMargin'
import { TransactionType } from '../transactions/actions' import { TransactionType } from '../transactions/actions'
import { useTransactionAdder } from '../transactions/hooks' import { useTransactionAdder } from '../transactions/hooks'
const { abi: MERKLE_DISTRIBUTOR_ABI } = MerkleDistributorJson
function useMerkleDistributorContract() { function useMerkleDistributorContract() {
return useContract(MERKLE_DISTRIBUTOR_ADDRESS, MERKLE_DISTRIBUTOR_ABI, true) return useContract(MERKLE_DISTRIBUTOR_ADDRESS, MERKLE_DISTRIBUTOR_ABI, true)
} }

@ -5,8 +5,8 @@ import { TransactionResponse } from '@ethersproject/providers'
import { toUtf8String, Utf8ErrorFuncs, Utf8ErrorReason } from '@ethersproject/strings' import { toUtf8String, Utf8ErrorFuncs, Utf8ErrorReason } from '@ethersproject/strings'
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { t } from '@lingui/macro' import { t } from '@lingui/macro'
import GovernorAlphaJson from '@uniswap/governance/build/GovernorAlpha.json' import { abi as GOVERNANCE_ABI } from '@uniswap/governance/build/GovernorAlpha.json'
import UniJson from '@uniswap/governance/build/Uni.json' import { abi as UNI_ABI } from '@uniswap/governance/build/Uni.json'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { ChainId } from '@uniswap/smart-order-router' import { ChainId } from '@uniswap/smart-order-router'
import GOVERNOR_BRAVO_ABI from 'abis/governor-bravo.json' import GOVERNOR_BRAVO_ABI from 'abis/governor-bravo.json'
@ -37,9 +37,6 @@ import { TransactionType } from '../transactions/actions'
import { useTransactionAdder } from '../transactions/hooks' import { useTransactionAdder } from '../transactions/hooks'
import { VoteOption } from './types' import { VoteOption } from './types'
const { abi: GOVERNANCE_ABI } = GovernorAlphaJson
const { abi: UNI_ABI } = UniJson
function useGovernanceV0Contract(): Contract | null { function useGovernanceV0Contract(): Contract | null {
return useContract(GOVERNANCE_ALPHA_V0_ADDRESSES, GOVERNANCE_ABI, false) return useContract(GOVERNANCE_ALPHA_V0_ADDRESSES, GOVERNANCE_ABI, false)
} }

@ -1,6 +1,6 @@
import { Interface } from '@ethersproject/abi' import { Interface } from '@ethersproject/abi'
import { Trans } from '@lingui/macro' 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 { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import { SupportedChainId } from 'constants/chains' 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' 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) const STAKING_REWARDS_INTERFACE = new Interface(STAKING_REWARDS_ABI)
export const STAKING_GENESIS = 1600387200 export const STAKING_GENESIS = 1600387200