From abdbd9408150294923a3e1af041bfa338f624b87 Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Fri, 8 Dec 2023 15:05:51 +0100 Subject: [PATCH 1/3] Enable hardhat contract sizer plugin The plugin outputs contract sizes after hardhat contracts compilation. --- core/hardhat.config.ts | 7 +++++++ core/package.json | 1 + pnpm-lock.yaml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/core/hardhat.config.ts b/core/hardhat.config.ts index 9d8131afe..5c5b0e0b3 100644 --- a/core/hardhat.config.ts +++ b/core/hardhat.config.ts @@ -1,6 +1,7 @@ import type { HardhatUserConfig } from "hardhat/config" import "@nomicfoundation/hardhat-toolbox" +import "hardhat-contract-sizer" import "hardhat-deploy" const config: HardhatUserConfig = { @@ -71,6 +72,12 @@ const config: HardhatUserConfig = { }, }, + contractSizer: { + alphaSort: true, + runOnCompile: true, + strict: true, + }, + typechain: { outDir: "typechain", }, diff --git a/core/package.json b/core/package.json index 603cb8643..ff7aa5197 100644 --- a/core/package.json +++ b/core/package.json @@ -45,6 +45,7 @@ "eslint": "^8.54.0", "ethers": "^6.8.1", "hardhat": "^2.19.1", + "hardhat-contract-sizer": "^2.10.0", "hardhat-deploy": "^0.11.43", "hardhat-gas-reporter": "^1.0.9", "prettier": "^3.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 257a3a017..2ef71f0cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,6 +75,9 @@ importers: hardhat: specifier: ^2.19.1 version: 2.19.1(ts-node@10.9.1)(typescript@5.3.2) + hardhat-contract-sizer: + specifier: ^2.10.0 + version: 2.10.0(hardhat@2.19.1) hardhat-deploy: specifier: ^0.11.43 version: 0.11.43 @@ -2704,6 +2707,13 @@ packages: react: 18.2.0 dev: false + /@colors/colors@1.5.0: + resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} + engines: {node: '>=0.1.90'} + requiresBuild: true + dev: true + optional: true + /@cspotcode/source-map-support@0.8.1: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} @@ -7187,6 +7197,15 @@ packages: colors: 1.4.0 dev: true + /cli-table3@0.6.3: + resolution: {integrity: sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==} + engines: {node: 10.* || >= 12.*} + dependencies: + string-width: 4.2.3 + optionalDependencies: + '@colors/colors': 1.5.0 + dev: true + /cli-width@3.0.0: resolution: {integrity: sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==} engines: {node: '>= 10'} @@ -10283,6 +10302,17 @@ packages: uglify-js: 3.17.4 dev: true + /hardhat-contract-sizer@2.10.0(hardhat@2.19.1): + resolution: {integrity: sha512-QiinUgBD5MqJZJh1hl1jc9dNnpJg7eE/w4/4GEnrcmZJJTDbVFNe3+/3Ep24XqISSkYxRz36czcPHKHd/a0dwA==} + peerDependencies: + hardhat: ^2.0.0 + dependencies: + chalk: 4.1.2 + cli-table3: 0.6.3 + hardhat: 2.19.1(ts-node@10.9.1)(typescript@5.3.2) + strip-ansi: 6.0.1 + dev: true + /hardhat-deploy@0.11.43: resolution: {integrity: sha512-D760CjDtinwjOCpKOvdyRtIJYLQIYXmhfgkFe+AkxlYM9bPZ/T4tZ/xIB2tR89ZT+z0hF1YuZFBXIL3/G/9T5g==} dependencies: From 1d2f2860f9aa7909408e912472f04eb31411e65b Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Fri, 8 Dec 2023 15:10:07 +0100 Subject: [PATCH 2/3] Enable hardhat gas reporter plugin The plugin outputs gas usage stats after tests execution. --- core/hardhat.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/hardhat.config.ts b/core/hardhat.config.ts index 5c5b0e0b3..264e9fcbd 100644 --- a/core/hardhat.config.ts +++ b/core/hardhat.config.ts @@ -78,6 +78,11 @@ const config: HardhatUserConfig = { strict: true, }, + gasReporter: { + enabled: true, + coinmarketcap: process.env.COINMARKETCAP_API_KEY, + }, + typechain: { outDir: "typechain", }, From 012354b2e485c5f13fe7446d864c060c2d86d08e Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Fri, 8 Dec 2023 15:10:52 +0100 Subject: [PATCH 3/3] Add .envrc file to .gitignore The file can define local environment variables. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 668256290..a35cf7045 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ pnpm-debug.log* # Temporary directory tmp/ + +# Environment configuration files +.envrc