Skip to content

Commit

Permalink
Fix: when testing on OVM, use pre-deployed WETH instead of deploying it
Browse files Browse the repository at this point in the history
  • Loading branch information
mds1 authored and elenadimitrova committed May 25, 2021
1 parent c1d96ba commit b6b57c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/shared/externalFixtures.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { abi as FACTORY_V2_ABI, bytecode as FACTORY_V2_BYTECODE } from '@uniswap/v2-core/build/UniswapV2Factory.json'
import { Fixture } from 'ethereum-waffle'
import { ethers, waffle } from 'hardhat'
import { ethers, network, waffle } from 'hardhat'
import { IUniswapV3Factory, IWETH9, MockTimeSwapRouter } from '../../typechain'

import WETH9 from '../contracts/WETH9.json'
Expand All @@ -9,6 +9,12 @@ import { constants } from 'ethers'
import { v3CoreFactoryFixtureSetup } from './setup'

const wethFixture: Fixture<{ weth9: IWETH9 }> = async ([wallet]) => {
// If testing on OVM, get the pre-deployed WETH contract
if (network.name === 'optimism') {
const weth9 = (await ethers.getContractAt(WETH9.abi, '0x4200000000000000000000000000000000000006')) as IWETH9
return { weth9 }
}
// Otherwise deploy WETH9
const weth9 = (await waffle.deployContract(wallet, {
bytecode: WETH9.bytecode,
abi: WETH9.abi,
Expand Down

0 comments on commit b6b57c7

Please sign in to comment.