Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gas inspection plugin #1936

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,15 @@ yarn test:fork:coverage
```

The CI will upload the coverage reports to Codecov if they complete successfully.

# Utils

## Transaction gas inspector

To measure the gas usage of any transaction wrap it into `GetGas` globally defined function. Example:
```
const gas = await GetGas(await cEvilContract.connect(daniel).approveAllTokens());
console.log('Gas used: ' + gas);
```


1 change: 1 addition & 0 deletions contracts/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require("hardhat-deploy-ethers");
require("hardhat-gas-reporter");
require("solidity-coverage");
require("@openzeppelin/hardhat-upgrades");
require("hardhat-gas-trackooor");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this plugin hasn't been updated in about 18 months. The GitHub repo has no activity either. Would be better if we can use something that's being actively maintained


require("./tasks/tasks");
const { accounts } = require("./tasks/account");
Expand Down
1 change: 1 addition & 0 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"hardhat-deploy": "^0.11.30",
"hardhat-deploy-ethers": "^0.3.0-beta.13",
"hardhat-gas-reporter": "^1.0.9",
"hardhat-gas-trackooor": "^1.0.2",
"hardhat-tracer": "^2.3.2",
"husky": "^7.0.2",
"lodash": "^4.17.21",
Expand Down
9 changes: 8 additions & 1 deletion contracts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2957,7 +2957,7 @@ ethers@^4.0.40:
uuid "2.0.1"
xmlhttprequest "1.8.0"

ethers@^5.4.6, ethers@^5.5.3, ethers@^5.6.1, ethers@^5.7.1:
ethers@^5.0.0, ethers@^5.4.6, ethers@^5.5.3, ethers@^5.6.1, ethers@^5.7.1:
version "5.7.2"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e"
integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==
Expand Down Expand Up @@ -3624,6 +3624,13 @@ hardhat-gas-reporter@^1.0.9:
eth-gas-reporter "^0.2.25"
sha1 "^1.1.1"

hardhat-gas-trackooor@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/hardhat-gas-trackooor/-/hardhat-gas-trackooor-1.0.2.tgz#8490bebf2a33242a0bcc210edb1a84ca358a6c1d"
integrity sha512-k8qvLBB0+vG/XET8ArgYBoBOB9C9SyonFew9vHmJ8qxVqAv4UL9bSB1SuSQt9dbTPWbZI9mmhbUmoTshJF13cQ==
dependencies:
ethers "^5.0.0"

hardhat-tracer@^2.3.2:
version "2.4.0"
resolved "https://registry.yarnpkg.com/hardhat-tracer/-/hardhat-tracer-2.4.0.tgz#c650251cc504e68e890edf3675b132bcd7cc2322"
Expand Down
Loading