diff --git a/core/test/Acre.test.ts b/core/test/Acre.test.ts index 369f80704..66308ad2a 100644 --- a/core/test/Acre.test.ts +++ b/core/test/Acre.test.ts @@ -1,28 +1,29 @@ import { - SnapshotRestorer, - loadFixture, takeSnapshot, + loadFixture, } from "@nomicfoundation/hardhat-toolbox/network-helpers" -import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers" -import { ethers } from "hardhat" import { expect } from "chai" import { ContractTransactionResponse, ZeroAddress } from "ethers" -import type { TestERC20, Acre } from "../typechain" + +import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers" +import type { SnapshotRestorer } from "@nomicfoundation/hardhat-toolbox/network-helpers" +import { deployment } from "./helpers/context" +import { getUnnamedSigner } from "./helpers/signer" + import { to1e18 } from "./utils" -async function acreFixture() { - const [staker, staker2] = await ethers.getSigners() - const Token = await ethers.getContractFactory("TestERC20") - const tbtc = await Token.deploy() +import type { Acre, TestERC20 } from "../typechain" + +async function fixture() { + const { tbtc, acre } = await deployment() + + const [staker, staker2] = await getUnnamedSigner() const amountToMint = to1e18(100000) tbtc.mint(staker, amountToMint) tbtc.mint(staker2, amountToMint) - const Acre = await ethers.getContractFactory("Acre") - const acre = await Acre.deploy(await tbtc.getAddress()) - return { acre, tbtc, staker, staker2 } } @@ -33,7 +34,7 @@ describe("Acre", () => { let staker2: HardhatEthersSigner before(async () => { - ;({ acre, tbtc, staker, staker2 } = await loadFixture(acreFixture)) + ;({ acre, tbtc, staker, staker2 } = await loadFixture(fixture)) }) describe("Staking", () => {