mirror of
https://github.com/Instadapp/infinite-proxy.git
synced 2024-07-29 21:47:49 +00:00
basic hardhat setup
This commit is contained in:
parent
6623b62ad3
commit
39dcf2f359
3
.env.example
Normal file
3
.env.example
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
|
||||||
|
ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
|
||||||
|
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
|
4
.eslintignore
Normal file
4
.eslintignore
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
node_modules
|
||||||
|
artifacts
|
||||||
|
cache
|
||||||
|
coverage
|
24
.eslintrc.js
Normal file
24
.eslintrc.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
browser: false,
|
||||||
|
es2021: true,
|
||||||
|
mocha: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
plugins: ["@typescript-eslint"],
|
||||||
|
extends: [
|
||||||
|
"standard",
|
||||||
|
"plugin:prettier/recommended",
|
||||||
|
"plugin:node/recommended",
|
||||||
|
],
|
||||||
|
parser: "@typescript-eslint/parser",
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 12,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"node/no-unsupported-features/es-syntax": [
|
||||||
|
"error",
|
||||||
|
{ ignores: ["modules"] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
node_modules
|
||||||
|
.env
|
||||||
|
coverage
|
||||||
|
coverage.json
|
||||||
|
typechain
|
||||||
|
|
||||||
|
#Hardhat files
|
||||||
|
cache
|
||||||
|
artifacts
|
3
.npmignore
Normal file
3
.npmignore
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
hardhat.config.ts
|
||||||
|
scripts
|
||||||
|
test
|
5
.prettierignore
Normal file
5
.prettierignore
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
node_modules
|
||||||
|
artifacts
|
||||||
|
cache
|
||||||
|
coverage*
|
||||||
|
gasReporterOutput.json
|
1
.prettierrc
Normal file
1
.prettierrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{}
|
7
.solhint.json
Normal file
7
.solhint.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"extends": "solhint:recommended",
|
||||||
|
"rules": {
|
||||||
|
"compiler-version": ["error", "^0.8.0"],
|
||||||
|
"func-visibility": ["warn", { "ignoreConstructors": true }]
|
||||||
|
}
|
||||||
|
}
|
1
.solhintignore
Normal file
1
.solhintignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
|
@ -12,4 +12,4 @@ contract Events {
|
||||||
event setImplementationLog(address implementation_, bytes4[] sigs_);
|
event setImplementationLog(address implementation_, bytes4[] sigs_);
|
||||||
|
|
||||||
event removeImplementationLog(address implementation_);
|
event removeImplementationLog(address implementation_);
|
||||||
}
|
}
|
43
hardhat.config.ts
Normal file
43
hardhat.config.ts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import * as dotenv from "dotenv";
|
||||||
|
|
||||||
|
import { HardhatUserConfig, task } from "hardhat/config";
|
||||||
|
import "@nomiclabs/hardhat-etherscan";
|
||||||
|
import "@nomiclabs/hardhat-waffle";
|
||||||
|
import "@typechain/hardhat";
|
||||||
|
import "hardhat-gas-reporter";
|
||||||
|
import "solidity-coverage";
|
||||||
|
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
// This is a sample Hardhat task. To learn how to create your own go to
|
||||||
|
// https://hardhat.org/guides/create-task.html
|
||||||
|
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
|
||||||
|
const accounts = await hre.ethers.getSigners();
|
||||||
|
|
||||||
|
for (const account of accounts) {
|
||||||
|
console.log(account.address);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// You need to export an object to set up your config
|
||||||
|
// Go to https://hardhat.org/config/ to learn more
|
||||||
|
|
||||||
|
const config: HardhatUserConfig = {
|
||||||
|
solidity: "0.8.4",
|
||||||
|
networks: {
|
||||||
|
ropsten: {
|
||||||
|
url: process.env.ROPSTEN_URL || "",
|
||||||
|
accounts:
|
||||||
|
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
gasReporter: {
|
||||||
|
enabled: process.env.REPORT_GAS !== undefined,
|
||||||
|
currency: "USD",
|
||||||
|
},
|
||||||
|
etherscan: {
|
||||||
|
apiKey: process.env.ETHERSCAN_API_KEY,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
40994
package-lock.json
generated
Normal file
40994
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
51
package.json
Normal file
51
package.json
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"name": "infinite-proxy",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Upgradable proxy with infinite implementations enabled at once.",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/Instadapp/infinite-proxy.git"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Instadapp/infinite-proxy/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/Instadapp/infinite-proxy#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"@nomiclabs/hardhat-ethers": "^2.0.5",
|
||||||
|
"@nomiclabs/hardhat-etherscan": "^3.0.3",
|
||||||
|
"@nomiclabs/hardhat-waffle": "^2.0.3",
|
||||||
|
"@typechain/ethers-v5": "^7.2.0",
|
||||||
|
"@typechain/hardhat": "^2.3.1",
|
||||||
|
"@types/chai": "^4.3.1",
|
||||||
|
"@types/mocha": "^9.1.0",
|
||||||
|
"@types/node": "^12.20.48",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
||||||
|
"@typescript-eslint/parser": "^4.33.0",
|
||||||
|
"chai": "^4.3.6",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"eslint": "^7.32.0",
|
||||||
|
"eslint-config-prettier": "^8.5.0",
|
||||||
|
"eslint-config-standard": "^16.0.3",
|
||||||
|
"eslint-plugin-import": "^2.26.0",
|
||||||
|
"eslint-plugin-node": "^11.1.0",
|
||||||
|
"eslint-plugin-prettier": "^3.4.1",
|
||||||
|
"eslint-plugin-promise": "^5.2.0",
|
||||||
|
"ethereum-waffle": "^3.4.4",
|
||||||
|
"ethers": "^5.6.4",
|
||||||
|
"hardhat": "^2.9.3",
|
||||||
|
"hardhat-gas-reporter": "^1.0.8",
|
||||||
|
"prettier": "^2.6.2",
|
||||||
|
"prettier-plugin-solidity": "^1.0.0-beta.13",
|
||||||
|
"solhint": "^3.3.7",
|
||||||
|
"solidity-coverage": "^0.7.20",
|
||||||
|
"ts-node": "^10.7.0",
|
||||||
|
"typechain": "^5.2.0",
|
||||||
|
"typescript": "^4.6.3"
|
||||||
|
}
|
||||||
|
}
|
30
scripts/deploy.ts
Normal file
30
scripts/deploy.ts
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
// We require the Hardhat Runtime Environment explicitly here. This is optional
|
||||||
|
// but useful for running the script in a standalone fashion through `node <script>`.
|
||||||
|
//
|
||||||
|
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
|
||||||
|
// Runtime Environment's members available in the global scope.
|
||||||
|
import { ethers } from "hardhat";
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
// Hardhat always runs the compile task when running scripts with its command
|
||||||
|
// line interface.
|
||||||
|
//
|
||||||
|
// If this script is run directly using `node` you may want to call compile
|
||||||
|
// manually to make sure everything is compiled
|
||||||
|
// await hre.run('compile');
|
||||||
|
|
||||||
|
// We get the contract to deploy
|
||||||
|
const Greeter = await ethers.getContractFactory("Greeter");
|
||||||
|
const greeter = await Greeter.deploy("Hello, Hardhat!");
|
||||||
|
|
||||||
|
await greeter.deployed();
|
||||||
|
|
||||||
|
console.log("Greeter deployed to:", greeter.address);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We recommend this pattern to be able to use async/await everywhere
|
||||||
|
// and properly handle errors.
|
||||||
|
main().catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
process.exitCode = 1;
|
||||||
|
});
|
19
test/index.ts
Normal file
19
test/index.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { expect } from "chai";
|
||||||
|
import { ethers } from "hardhat";
|
||||||
|
|
||||||
|
describe("Greeter", function () {
|
||||||
|
it("Should return the new greeting once it's changed", async function () {
|
||||||
|
const Greeter = await ethers.getContractFactory("Greeter");
|
||||||
|
const greeter = await Greeter.deploy("Hello, world!");
|
||||||
|
await greeter.deployed();
|
||||||
|
|
||||||
|
expect(await greeter.greet()).to.equal("Hello, world!");
|
||||||
|
|
||||||
|
const setGreetingTx = await greeter.setGreeting("Hola, mundo!");
|
||||||
|
|
||||||
|
// wait until the transaction is mined
|
||||||
|
await setGreetingTx.wait();
|
||||||
|
|
||||||
|
expect(await greeter.greet()).to.equal("Hola, mundo!");
|
||||||
|
});
|
||||||
|
});
|
12
tsconfig.json
Normal file
12
tsconfig.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es2018",
|
||||||
|
"module": "commonjs",
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"outDir": "dist",
|
||||||
|
"declaration": true
|
||||||
|
},
|
||||||
|
"include": ["./scripts", "./test", "./typechain"],
|
||||||
|
"files": ["./hardhat.config.ts"]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user