Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #123 from beehive-innovation/2021-11-10-bump-typec…
Browse files Browse the repository at this point in the history
…hain-develop

bump TypeChain for `develop`, add Contract type intersection
  • Loading branch information
marcusnewton authored Nov 10, 2021
2 parents fbe60f9 + facd068 commit cb1aec3
Show file tree
Hide file tree
Showing 28 changed files with 538 additions and 486 deletions.
5 changes: 4 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import type { HardhatUserConfig } from "hardhat/types";
import "@nomiclabs/hardhat-waffle";
import "hardhat-typechain";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "@nomiclabs/hardhat-ethers";

const config: HardhatUserConfig = {
typechain: {
outDir: "typechain", // overrides upstream 'fix' for another issue which changed this to 'typechain-types'
},
networks: {
hardhat: {
blockGasLimit: 100000000,
Expand Down
51 changes: 30 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"@rollup/plugin-typescript": "^6.0.0",
"@truffle/hdwallet-provider": "^1.2.1",
"@tsconfig/svelte": "^1.0.0",
"@typechain/ethers-v5": "^5.0.0",
"@typechain/hardhat": "^2.3.0",
"@typechain/ethers-v5": "^8.0.2",
"@typechain/hardhat": "^3.0.0",
"@types/mocha": "^8.2.0",
"@types/node": "^14.14.22",
"autoprefixer": "^10.1.0",
Expand All @@ -51,7 +51,6 @@
"hardhat": "^2.0.8",
"hardhat-gas-reporter": "^1.0.4",
"hardhat-preprocessor": "^0.1.3",
"hardhat-typechain": "^0.3.4",
"husky": "^7.0.1",
"mnemonics": "^1.1.3",
"node-fetch": "^2.6.1",
Expand Down Expand Up @@ -80,7 +79,7 @@
"ts-generator": "^0.1.1",
"ts-node": "^9.1.1",
"tslib": "^2.0.0",
"typechain": "^4.0.1",
"typechain": "^6.0.2",
"typescript": "^3.9.3",
"ansi-regex": ">=5.0.1",
"nth-check": ">=2.0.1",
Expand Down
6 changes: 1 addition & 5 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ let
'';

ci-test = pkgs.writeShellScriptBin "ci-test" ''
hardhat compile --force
hardhat test
'';

Expand Down Expand Up @@ -113,11 +114,6 @@ let
rm -rf artifacts/*Reentrant*
rm -rf artifacts/*ForceSendEther*
rm -rf artifacts/*Mock*
rm -rf typechain/**/*Test*
rm -rf typechain/**/*Reentrant*
rm -rf typechain/**/*ForceSendEther*
rm -rf typechain/**/*Mock*
'';

prepublish = pkgs.writeShellScriptBin "prepublish" ''
Expand Down
39 changes: 25 additions & 14 deletions test/Phased/Phased.sol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ethers } from "hardhat";
import type { PhasedTest } from "../../typechain/PhasedTest";
import type { PhasedScheduleTest } from "../../typechain/PhasedScheduleTest";
import type { ReserveToken } from "../../typechain/ReserveToken";
import type { Contract } from "ethers";

chai.use(solidity);
const { expect, assert } = chai;
Expand Down Expand Up @@ -39,7 +40,8 @@ describe("Phased", async function () {
it("should return highest attained phase even if several phases have the same block number", async function () {
this.timeout(0);

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

const highestPhase = await phased.phaseAtBlockNumber(
[0, 1, 2, 3, 3, 4, 5, 5],
Expand All @@ -52,7 +54,8 @@ describe("Phased", async function () {
it("if every phase block is after the block number then phase zero is returned", async function () {
this.timeout(0);

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

const highestPhase = await phased.phaseAtBlockNumber(
[100, 110, 120, 130, 140, 150, 160, 170],
Expand All @@ -65,7 +68,8 @@ describe("Phased", async function () {
it("if every phase block is before the block number then phase EIGHT is returned", async function () {
this.timeout(0);

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

const highestPhase = await phased.phaseAtBlockNumber(
[100, 110, 120, 130, 140, 150, 160, 170],
Expand All @@ -83,7 +87,7 @@ describe("Phased", async function () {
const phasedScheduleTest = (await Util.basicDeploy(
"PhasedScheduleTest",
{}
)) as PhasedScheduleTest;
)) as PhasedScheduleTest & Contract;

assert(
(await phasedScheduleTest.currentPhase()) === 0,
Expand All @@ -108,9 +112,10 @@ describe("Phased", async function () {
const reserve = (await Util.basicDeploy(
"ReserveToken",
{}
)) as ReserveToken;
)) as ReserveToken & Contract;

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

const pastBlock = await ethers.provider.getBlockNumber();

Expand All @@ -127,7 +132,8 @@ describe("Phased", async function () {
it("cannot schedule the next phase if it is already scheduled", async function () {
this.timeout(0);

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

const firstBlock = await ethers.provider.getBlockNumber();

Expand All @@ -143,7 +149,8 @@ describe("Phased", async function () {
it("the next phase block must not be uninitialized", async function () {
this.timeout(0);

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

const firstBlock = await ethers.provider.getBlockNumber();

Expand All @@ -162,7 +169,8 @@ describe("Phased", async function () {
it("is not possible to skip a phase", async function () {
this.timeout(0);

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

const firstBlock = await ethers.provider.getBlockNumber();

Expand All @@ -178,7 +186,8 @@ describe("Phased", async function () {
it("_beforeScheduleNextPhase hook can be used to impose conditions on phase changes", async function () {
this.timeout(0);

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

const firstBlock = await ethers.provider.getBlockNumber();

Expand All @@ -202,9 +211,10 @@ describe("Phased", async function () {
const reserve = (await Util.basicDeploy(
"ReserveToken",
{}
)) as ReserveToken;
)) as ReserveToken & Contract;

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

// check constants

Expand Down Expand Up @@ -313,9 +323,10 @@ describe("Phased", async function () {
const reserve = (await Util.basicDeploy(
"ReserveToken",
{}
)) as ReserveToken;
)) as ReserveToken & Contract;

const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest;
const phased = (await Util.basicDeploy("PhasedTest", {})) as PhasedTest &
Contract;

// onlyPhase
assert(await phased.runsOnlyPhase(Phase.ZERO));
Expand Down
Loading

0 comments on commit cb1aec3

Please sign in to comment.