Skip to content

Commit

Permalink
Improve test fixture used in Acre test
Browse files Browse the repository at this point in the history
- use Acre and TBTC contracts deployed with hardhat dpeloyment scripts
- use unnamed signers as stakers, to not overlap with named signers
  (deployer and governance)
  • Loading branch information
nkuba committed Dec 7, 2023
1 parent 4bf5442 commit 16676e9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions core/test/Acre.test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
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 [staker1, staker2] = await ethers.getSigners()
import type { Acre, TestERC20 } from "../typechain"

const TestERC20 = await ethers.getContractFactory("TestERC20")
const tbtc = await TestERC20.deploy()
async function fixture() {
const { tbtc, acre } = await deployment()

const Acre = await ethers.getContractFactory("Acre")
const acre = await Acre.deploy(await tbtc.getAddress())
const [staker1, staker2] = await getUnnamedSigner()

const amountToMint = to1e18(100000)
tbtc.mint(staker1, amountToMint)
Expand All @@ -33,7 +33,7 @@ describe("Acre", () => {
let staker2: HardhatEthersSigner

before(async () => {
;({ acre, tbtc, staker1, staker2 } = await loadFixture(acreFixture))
;({ acre, tbtc, staker1, staker2 } = await loadFixture(fixture))
})

describe("stake", () => {
Expand Down

0 comments on commit 16676e9

Please sign in to comment.