diff --git a/package.json b/package.json index 3b384b72e9..71cc2eece5 100644 --- a/package.json +++ b/package.json @@ -178,7 +178,7 @@ "@uniswap/smart-order-router": "^2.5.10", "@uniswap/token-lists": "^1.0.0-beta.27", "@uniswap/v2-sdk": "^3.0.1", - "@uniswap/v3-sdk": "^3.7.1", + "@uniswap/v3-sdk": "^3.8.2", "@web3-react/core": "^6.0.9", "ajv": "^6.12.3", "cids": "^1.0.0", diff --git a/src/hooks/useContract.ts b/src/hooks/useContract.ts index fc25337f17..2ae4d9d20b 100644 --- a/src/hooks/useContract.ts +++ b/src/hooks/useContract.ts @@ -1,15 +1,15 @@ import { Contract } from '@ethersproject/contracts' -import { abi as GOVERNANCE_ABI } from '@uniswap/governance/build/GovernorAlpha.json' -import { abi as UNI_ABI } from '@uniswap/governance/build/Uni.json' -import { abi as STAKING_REWARDS_ABI } from '@uniswap/liquidity-staker/build/StakingRewards.json' -import { abi as MERKLE_DISTRIBUTOR_ABI } from '@uniswap/merkle-distributor/build/MerkleDistributor.json' -import { abi as IUniswapV2PairABI } from '@uniswap/v2-core/build/IUniswapV2Pair.json' -import { abi as IUniswapV2Router02ABI } from '@uniswap/v2-periphery/build/IUniswapV2Router02.json' -import { abi as QuoterABI } from '@uniswap/v3-periphery/artifacts/contracts/lens/Quoter.sol/Quoter.json' -import { abi as TickLensABI } from '@uniswap/v3-periphery/artifacts/contracts/lens/TickLens.sol/TickLens.json' -import { abi as MulticallABI } from '@uniswap/v3-periphery/artifacts/contracts/lens/UniswapInterfaceMulticall.sol/UniswapInterfaceMulticall.json' -import { abi as NFTPositionManagerABI } from '@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json' -import { abi as V2MigratorABI } from '@uniswap/v3-periphery/artifacts/contracts/V3Migrator.sol/V3Migrator.json' +import GovernorAlphaJson from '@uniswap/governance/build/GovernorAlpha.json' +import UniJson from '@uniswap/governance/build/Uni.json' +import StakingRewardsJson from '@uniswap/liquidity-staker/build/StakingRewards.json' +import MerkleDistributorJson from '@uniswap/merkle-distributor/build/MerkleDistributor.json' +import IUniswapV2PairJson from '@uniswap/v2-core/build/IUniswapV2Pair.json' +import IUniswapV2Router02Json from '@uniswap/v2-periphery/build/IUniswapV2Router02.json' +import QuoterJson from '@uniswap/v3-periphery/artifacts/contracts/lens/Quoter.sol/Quoter.json' +import TickLensJson from '@uniswap/v3-periphery/artifacts/contracts/lens/TickLens.sol/TickLens.json' +import UniswapInterfaceMulticallJson from '@uniswap/v3-periphery/artifacts/contracts/lens/UniswapInterfaceMulticall.sol/UniswapInterfaceMulticall.json' +import NonfungiblePositionManagerJson from '@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json' +import V3MigratorJson from '@uniswap/v3-periphery/artifacts/contracts/V3Migrator.sol/V3Migrator.json' import ARGENT_WALLET_DETECTOR_ABI from 'abis/argent-wallet-detector.json' import EIP_2612 from 'abis/eip_2612.json' import ENS_PUBLIC_RESOLVER_ABI from 'abis/ens-public-resolver.json' @@ -43,6 +43,18 @@ import { V3Migrator } from 'types/v3/V3Migrator' import { getContract } from '../utils' +const { abi: GOVERNANCE_ABI } = GovernorAlphaJson +const { abi: UNI_ABI } = UniJson +const { abi: STAKING_REWARDS_ABI } = StakingRewardsJson +const { abi: MERKLE_DISTRIBUTOR_ABI } = MerkleDistributorJson +const { abi: IUniswapV2PairABI } = IUniswapV2PairJson +const { abi: IUniswapV2Router02ABI } = IUniswapV2Router02Json +const { abi: QuoterABI } = QuoterJson +const { abi: TickLensABI } = TickLensJson +const { abi: MulticallABI } = UniswapInterfaceMulticallJson +const { abi: NFTPositionManagerABI } = NonfungiblePositionManagerJson +const { abi: V2MigratorABI } = V3MigratorJson + // returns null on errors export function useContract( addressOrAddressMap: string | { [chainId: number]: string } | undefined, diff --git a/src/hooks/usePools.ts b/src/hooks/usePools.ts index f48ed10418..1b338a2ac7 100644 --- a/src/hooks/usePools.ts +++ b/src/hooks/usePools.ts @@ -1,6 +1,6 @@ import { Interface } from '@ethersproject/abi' import { Currency, Token } from '@uniswap/sdk-core' -import { abi as IUniswapV3PoolStateABI } from '@uniswap/v3-core/artifacts/contracts/interfaces/pool/IUniswapV3PoolState.sol/IUniswapV3PoolState.json' +import IUniswapV3PoolStateJson 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' @@ -10,6 +10,8 @@ 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 export enum PoolState { diff --git a/src/hooks/useV2Pairs.ts b/src/hooks/useV2Pairs.ts index 78b7d892f5..253c153a77 100644 --- a/src/hooks/useV2Pairs.ts +++ b/src/hooks/useV2Pairs.ts @@ -1,12 +1,14 @@ import { Interface } from '@ethersproject/abi' import { Currency, CurrencyAmount } from '@uniswap/sdk-core' -import { abi as IUniswapV2PairABI } from '@uniswap/v2-core/build/IUniswapV2Pair.json' +import IUniswapV2PairJson 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/governance/hooks.ts b/src/state/governance/hooks.ts index 9197f2ee5f..037829c5e0 100644 --- a/src/state/governance/hooks.ts +++ b/src/state/governance/hooks.ts @@ -6,7 +6,7 @@ import { toUtf8String, Utf8ErrorFuncs, Utf8ErrorReason } from '@ethersproject/st import { formatUnits } from '@ethersproject/units' // eslint-disable-next-line no-restricted-imports import { t } from '@lingui/macro' -import { abi as GOV_ABI } from '@uniswap/governance/build/GovernorAlpha.json' +import GovernorAlphaJson from '@uniswap/governance/build/GovernorAlpha.json' import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { POLYGON_PROPOSAL_TITLE } from 'constants/proposals/polygon_proposal_title' import { UNISWAP_GRANTS_PROPOSAL_DESCRIPTION } from 'constants/proposals/uniswap_grants_proposal_description' @@ -35,6 +35,8 @@ import { TransactionType } from '../transactions/actions' import { useTransactionAdder } from '../transactions/hooks' import { VoteOption } from './types' +const { abi: GOV_ABI } = GovernorAlphaJson + interface ProposalDetail { target: string functionSig: string diff --git a/src/state/stake/hooks.tsx b/src/state/stake/hooks.tsx index 0b89e70cd0..fd96779648 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 { abi as STAKING_REWARDS_ABI } from '@uniswap/liquidity-staker/build/StakingRewards.json' +import StakingRewardsJson from '@uniswap/liquidity-staker/build/StakingRewards.json' import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { Pair } from '@uniswap/v2-sdk' import useActiveWeb3React from 'hooks/useActiveWeb3React' @@ -12,6 +12,7 @@ import { ReactNode, useMemo } from 'react' import { DAI, UNI, USDC, 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 diff --git a/yarn.lock b/yarn.lock index fac4045cb6..a60ac62670 100644 --- a/yarn.lock +++ b/yarn.lock @@ -133,10 +133,10 @@ "@babel/helper-annotate-as-pure" "^7.16.7" regexpu-core "^4.7.1" -"@babel/helper-define-polyfill-provider@^0.2.2": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.2.3.tgz#0525edec5094653a282688d34d846e4c75e9c0b6" - integrity sha512-RH3QDAfRMzj7+0Nqu5oqgO5q9mFtQEVvCRsi8qCEfzLR9p2BHfn5FzhSB2oj1fF7I2+DcTORkYaQ6aTR9Cofew== +"@babel/helper-define-polyfill-provider@^0.2.2", "@babel/helper-define-polyfill-provider@^0.2.4": + version "0.2.4" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.2.4.tgz#8867aed79d3ea6cade40f801efb7ac5c66916b10" + integrity sha512-OrpPZ97s+aPi6h2n1OXzdhVis1SGSsMU2aMHgLcOKfsp4/v1NWpx3CWT3lBj5eeBq9cDkPkh+YCfdF7O12uNDQ== dependencies: "@babel/helper-compilation-targets" "^7.13.0" "@babel/helper-module-imports" "^7.12.13" @@ -5259,10 +5259,10 @@ base64-sol "1.0.1" hardhat-watcher "^2.1.1" -"@uniswap/v3-sdk@^3.7.0", "@uniswap/v3-sdk@^3.7.1": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@uniswap/v3-sdk/-/v3-sdk-3.7.1.tgz#8a3740ff6302d8069e7ce4a38b7588721398048b" - integrity sha512-/0FBsrRijfAEOVO0ejCQX36MwaKzjKCaInUA1dNqFyDNZ5dthvv6jUhMADYuNXZnhN6NcSdIj6xhlc/cpgPm9Q== +"@uniswap/v3-sdk@^3.7.0", "@uniswap/v3-sdk@^3.7.1", "@uniswap/v3-sdk@^3.8.2": + version "3.8.2" + resolved "https://registry.yarnpkg.com/@uniswap/v3-sdk/-/v3-sdk-3.8.2.tgz#6e10eebe0da851a4f6a5036a1e70a896a5c239d4" + integrity sha512-JVrs1ZuWKP8JmYi5hxFliOnCFAEREwMpE7qB6rKPCo155/pIRyQ90lJfQZCJO7pP/webx5t5JFxCOytmDIp29Q== dependencies: "@ethersproject/abi" "^5.0.12" "@ethersproject/solidity" "^5.0.9" @@ -6680,12 +6680,12 @@ babel-plugin-named-asset-import@^0.3.7: integrity sha512-squySRkf+6JGnvjoUtDEjSREJEBirnXi9NqP6rjSYsylxQxqBTz+pkmf395i9E2zsvmYUaI40BHo6SqZUdydlw== babel-plugin-polyfill-corejs2@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.2.2.tgz#e9124785e6fd94f94b618a7954e5693053bf5327" - integrity sha512-kISrENsJ0z5dNPq5eRvcctITNHYXWOA4DUZRFYCz3jYCcvTb/A546LIddmoGNMVYg2U38OyFeNosQwI9ENTqIQ== + version "0.2.3" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.2.3.tgz#6ed8e30981b062f8fe6aca8873a37ebcc8cc1c0f" + integrity sha512-NDZ0auNRzmAfE1oDDPW2JhzIMXUk+FFe2ICejmt5T4ocKgiQx3e0VCRx9NCAidcMtL2RUZaWtXnmjTCkx0tcbA== dependencies: "@babel/compat-data" "^7.13.11" - "@babel/helper-define-polyfill-provider" "^0.2.2" + "@babel/helper-define-polyfill-provider" "^0.2.4" semver "^6.1.1" babel-plugin-polyfill-corejs2@^0.3.0: @@ -6698,12 +6698,12 @@ babel-plugin-polyfill-corejs2@^0.3.0: semver "^6.1.1" babel-plugin-polyfill-corejs3@^0.2.0: - version "0.2.3" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.2.3.tgz#72add68cf08a8bf139ba6e6dfc0b1d504098e57b" - integrity sha512-rCOFzEIJpJEAU14XCcV/erIf/wZQMmMT5l5vXOpL5uoznyOGfDIjPj6FVytMvtzaKSTSVKouOCTPJ5OMUZH30g== + version "0.2.5" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.2.5.tgz#2779846a16a1652244ae268b1e906ada107faf92" + integrity sha512-ninF5MQNwAX9Z7c9ED+H2pGt1mXdP4TqzlHKyPIYmJIYz0N+++uwdM7RnJukklhzJ54Q84vA4ZJkgs7lu5vqcw== dependencies: "@babel/helper-define-polyfill-provider" "^0.2.2" - core-js-compat "^3.14.0" + core-js-compat "^3.16.2" babel-plugin-polyfill-corejs3@^0.5.0: version "0.5.0" @@ -6714,11 +6714,11 @@ babel-plugin-polyfill-corejs3@^0.5.0: core-js-compat "^3.20.0" babel-plugin-polyfill-regenerator@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.2.2.tgz#b310c8d642acada348c1fa3b3e6ce0e851bee077" - integrity sha512-Goy5ghsc21HgPDFtzRkSirpZVW35meGoTmTOb2bxqdl60ghub4xOidgNTHaZfQ2FaxQsKmwvXtOAkcIS4SMBWg== + version "0.2.3" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.2.3.tgz#2e9808f5027c4336c994992b48a4262580cb8d6d" + integrity sha512-JVE78oRZPKFIeUqFGrSORNzQnrDwZR16oiWeGM8ZyjBn2XAT5OjP+wXx5ESuo33nUsFUEJYjtklnsKbxW5L+7g== dependencies: - "@babel/helper-define-polyfill-provider" "^0.2.2" + "@babel/helper-define-polyfill-provider" "^0.2.4" babel-plugin-polyfill-regenerator@^0.3.0: version "0.3.0" @@ -8614,7 +8614,15 @@ copy-to-clipboard@^3.2.0, copy-to-clipboard@^3.3.1: dependencies: toggle-selection "^1.0.6" -core-js-compat@^3.14.0, core-js-compat@^3.20.0, core-js-compat@^3.20.2, core-js-compat@^3.6.2: +core-js-compat@^3.16.2: + version "3.21.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.21.0.tgz#bcc86aa5a589cee358e7a7fa0a4979d5a76c3885" + integrity sha512-OSXseNPSK2OPJa6GdtkMz/XxeXx8/CJvfhQWTqd6neuUraujcL4jVsjkLQz1OWnax8xVQJnRPe0V2jqNWORA+A== + dependencies: + browserslist "^4.19.1" + semver "7.0.0" + +core-js-compat@^3.20.0, core-js-compat@^3.20.2, core-js-compat@^3.6.2: version "3.20.2" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.20.2.tgz#d1ff6936c7330959b46b2e08b122a8b14e26140b" integrity sha512-qZEzVQ+5Qh6cROaTPFLNS4lkvQ6mBzE3R6A6EEpssj7Zr2egMHgsy4XapdifqJDGC9CBiNv7s+ejI96rLNQFdg==