add bridge deploy test

add typechain
This commit is contained in:
Barry G 2021-01-22 15:47:32 -05:00
parent a15f137247
commit 700ae42c9f
5 changed files with 40 additions and 14 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@ node_modules
cache
artifacts
frontend/src/hardhat
types
lib-cov
*.seed

View File

@ -3,7 +3,6 @@ import {DeployFunction} from 'hardhat-deploy/types';
const {deployments, getNamedAccounts} = require('hardhat');
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// code here
const { deploy, execute, read, log } = deployments;
const { deployer } = await getNamedAccounts();
@ -14,16 +13,3 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
});
};
export default func;
// module.exports = async ({
// getNamedAccounts,
// deployments,
// getChainId,
// getUnnamedAccounts,
// }) => {
// const { deploy } = deployments;
// const { deployer } = await getNamedAccounts();
// // the following will only deploy "GenericMetaTxProcessor" if the contract was never deployed or if the code changed since last deployment
// };

View File

@ -94,5 +94,9 @@ const config: HardhatUserConfig = {
},
],
},
typechain: {
outDir: "types",
target: "ethers-v5",
}
};
export default config;

24
test/Bridge.ts Normal file
View File

@ -0,0 +1,24 @@
import { ethers } from "hardhat";
import { Signer } from "ethers";
import { expect } from "chai";
import { Bridge } from "../types/Bridge"
describe("Bridge", function () {
let accounts: Signer[];
let bridge: Bridge;
beforeEach(async function () {
accounts = await ethers.getSigners();
});
it("should deploy bridge contract", async function () {
let deployerAddress = accounts[0].getAddress();
const bridgeFactory = await ethers.getContractFactory(
"Bridge"
);
const _bridge = await bridgeFactory.deploy("1", [], "1", "0", "0") as Bridge;
expect(_bridge).to.have.property('deployTransaction');
bridge = _bridge;
});
});

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"outDir": "dist",
"resolveJsonModule": true
},
"include": ["./scripts", "./test", "./deploy"]
}