Skip to content

Commit

Permalink
fix: import of "Greeter_factory" type
Browse files Browse the repository at this point in the history
chore: use "import type" instead of "import" to import TypeScript types
chore: update description in "package.json"
docs: americanize spelling in README.md
refactor: import "artifacts", "ethers" and "waffle" objects instead of entire HRE
  • Loading branch information
PaulRBerg committed Oct 30, 2021
1 parent b3f8674 commit 5dbfc91
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Solidity Template

My favourite setup for writing Solidity smart contracts.
My favorite setup for writing Solidity smart contracts.

- [Hardhat](https://github.com/nomiclabs/hardhat): compile and run the smart contracts on a local development network
- [TypeChain](https://github.com/ethereum-ts/TypeChain): generate TypeScript types for smart contracts
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paulrberg/solidity-template",
"description": "Setup for writing Solidity smart contracts",
"description": "Template for writing Solidity smart contracts",
"version": "1.0.0",
"author": {
"name": "Paul Razvan Berg",
Expand Down
2 changes: 1 addition & 1 deletion tasks/deploy/greeter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { task } from "hardhat/config";
import { TaskArguments } from "hardhat/types";

import { Greeter } from "../../types/Greeter";
import { Greeter__factory } from "../../types/Greeter__factory";
import { Greeter__factory } from "../../types/factories/Greeter__factory";

task("deploy:Greeter")
.addParam("greeting", "Say hello, be nice")
Expand Down
16 changes: 7 additions & 9 deletions test/greeter/Greeter.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
import hre from "hardhat";
import { Artifact } from "hardhat/types";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
import { artifacts, ethers, waffle } from "hardhat";
import type { Artifact } from "hardhat/types";
import type { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";

import { Greeter } from "../../types/Greeter";
import type { Greeter } from "../../types/Greeter";
import { Signers } from "../types";
import { shouldBehaveLikeGreeter } from "./Greeter.behavior";

const { deployContract } = hre.waffle;

describe("Unit tests", function () {
before(async function () {
this.signers = {} as Signers;

const signers: SignerWithAddress[] = await hre.ethers.getSigners();
const signers: SignerWithAddress[] = await ethers.getSigners();
this.signers.admin = signers[0];
});

describe("Greeter", function () {
beforeEach(async function () {
const greeting: string = "Hello, world!";
const greeterArtifact: Artifact = await hre.artifacts.readArtifact("Greeter");
this.greeter = <Greeter>await deployContract(this.signers.admin, greeterArtifact, [greeting]);
const greeterArtifact: Artifact = await artifacts.readArtifact("Greeter");
this.greeter = <Greeter>await waffle.deployContract(this.signers.admin, greeterArtifact, [greeting]);
});

shouldBehaveLikeGreeter();
Expand Down
6 changes: 3 additions & 3 deletions test/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
import { Fixture } from "ethereum-waffle";
import type { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
import type { Fixture } from "ethereum-waffle";

import { Greeter } from "../types/Greeter";
import type { Greeter } from "../types/Greeter";

declare module "mocha" {
export interface Context {
Expand Down

0 comments on commit 5dbfc91

Please sign in to comment.