import { Contract } from 'ethers' import { waffle, ethers } from 'hardhat' import { Fixture } from 'ethereum-waffle' import { PeripheryImmutableStateTest, IWETH9 } from '../typechain' import { expect } from './shared/expect' import { v3RouterFixture } from './shared/externalFixtures' describe('PeripheryImmutableState', () => { const nonfungiblePositionManagerFixture: Fixture<{ weth9: IWETH9 factory: Contract state: PeripheryImmutableStateTest }> = async (wallets, provider) => { const { weth9, factory } = await v3RouterFixture(wallets, provider) const stateFactory = await ethers.getContractFactory('PeripheryImmutableStateTest') const state = (await stateFactory.deploy(factory.address, weth9.address)) as PeripheryImmutableStateTest return { weth9, factory, state, } } let factory: Contract let weth9: IWETH9 let state: PeripheryImmutableStateTest let loadFixture: ReturnType before('create fixture loader', async () => { loadFixture = waffle.createFixtureLoader(await (ethers as any).getSigners()) }) beforeEach('load fixture', async () => { ;({ state, weth9, factory } = await loadFixture(nonfungiblePositionManagerFixture)) }) it('bytecode size', async () => { expect(((await state.provider.getCode(state.address)).length - 2) / 2).to.matchSnapshot() }) describe('#WETH9', () => { it('points to WETH9', async () => { expect(await state.WETH9()).to.eq(weth9.address) }) }) describe('#factory', () => { it('points to v3 core factory', async () => { expect(await state.factory()).to.eq(factory.address) }) }) })