From 9bee89a16aaebe0d86d3df5b5a3320e43d3508fd Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Tue, 13 Jul 2021 18:20:48 +0200 Subject: [PATCH 1/2] feat: storage layout for EvmErc20.sol --- etc/eth-contracts/hardhat.config.js | 8 ++++++++ etc/eth-contracts/package.json | 1 + etc/eth-contracts/tasks/storage.js | 6 ++++++ etc/eth-contracts/yarn.lock | 19 +++++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 etc/eth-contracts/tasks/storage.js diff --git a/etc/eth-contracts/hardhat.config.js b/etc/eth-contracts/hardhat.config.js index be67c79a9..c05d28180 100644 --- a/etc/eth-contracts/hardhat.config.js +++ b/etc/eth-contracts/hardhat.config.js @@ -1,10 +1,13 @@ require('@nomiclabs/hardhat-waffle'); require('solidity-coverage'); +require('hardhat-storage-layout'); +require("./tasks/storage"); /** * @type import('hardhat/config').HardhatUserConfig */ module.exports = { + newStorageLayoutPath: "./storageLayout", solidity: { version: '0.8.3', settings: { @@ -12,6 +15,11 @@ module.exports = { enabled: true, runs: 1000, }, + outputSelection: { + "*": { + "*": ["storageLayout"], + }, + }, }, }, }; diff --git a/etc/eth-contracts/package.json b/etc/eth-contracts/package.json index 6d36ab4dd..f0fb06ed2 100644 --- a/etc/eth-contracts/package.json +++ b/etc/eth-contracts/package.json @@ -8,6 +8,7 @@ "devDependencies": { "@nomiclabs/hardhat-ethers": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1", + "hardhat-storage-layout": "^0.1.6", "chai": "^4.3.3", "eslint": "^6.3.0", "eslint-config-standard": "^14.1.0", diff --git a/etc/eth-contracts/tasks/storage.js b/etc/eth-contracts/tasks/storage.js new file mode 100644 index 000000000..2b6965723 --- /dev/null +++ b/etc/eth-contracts/tasks/storage.js @@ -0,0 +1,6 @@ +task("storageLayout", "automatically generates the contract storage layout") + .setAction(async () => { + await hre.storageLayout.export(); + }); + +module.exports = {}; \ No newline at end of file diff --git a/etc/eth-contracts/yarn.lock b/etc/eth-contracts/yarn.lock index 7155e5457..a8ab03d78 100644 --- a/etc/eth-contracts/yarn.lock +++ b/etc/eth-contracts/yarn.lock @@ -2995,6 +2995,13 @@ configstore@^5.0.1: write-file-atomic "^3.0.0" xdg-basedir "^4.0.0" +console-table-printer@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/console-table-printer/-/console-table-printer-2.9.0.tgz#5d75374bc94ae57048587604829cb914b282a088" + integrity sha512-20o73riqnclLYJt5ggNqP2ZjtgL5OxJPWzTVi3LyVFVtubMH0XN+oOn9outL1XI5ldJgPcjdMAWc92vRscHAKA== + dependencies: + simple-wcswidth "^1.0.1" + constant-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/constant-case/-/constant-case-3.0.4.tgz#3b84a9aeaf4cf31ec45e6bf5de91bdfb0589faf1" @@ -5424,6 +5431,13 @@ har-validator@~5.1.3: ajv "^6.12.3" har-schema "^2.0.0" +hardhat-storage-layout@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/hardhat-storage-layout/-/hardhat-storage-layout-0.1.6.tgz#b6ae33d4c00f385dbc1ff67c86d67b0198cfbd91" + integrity sha512-urp9PUDJmRrFaTnMkyYGAlU0OF7Q+inWMWKHvuGRyvBDwVQKXfj5WoerTax4bBpXukJ4fBYyUTjAr0x+j2LcKQ== + dependencies: + console-table-printer "^2.9.0" + hardhat@^2.1.1: version "2.2.1" resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.2.1.tgz#bef0031b994e3f60a88d428f2097195c58cf9ed2" @@ -9022,6 +9036,11 @@ simple-get@^2.7.0: once "^1.3.1" simple-concat "^1.0.0" +simple-wcswidth@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/simple-wcswidth/-/simple-wcswidth-1.0.1.tgz#8ab18ac0ae342f9d9b629604e54d2aa1ecb018b2" + integrity sha512-xMO/8eNREtaROt7tJvWJqHBDTMFN4eiQ5I4JRMuilwfnFcV5W9u7RUkueNkdw0jPqGMX36iCywelS5yilTuOxg== + slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" From 46dda9466a3300b626faf9f46d7663f6fdc4fe7f Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Tue, 13 Jul 2021 18:49:32 +0200 Subject: [PATCH 2/2] fix: lint errors --- etc/eth-contracts/hardhat.config.js | 9 ++++----- etc/eth-contracts/tasks/storage.js | 13 ++++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/etc/eth-contracts/hardhat.config.js b/etc/eth-contracts/hardhat.config.js index c05d28180..fde0d36a5 100644 --- a/etc/eth-contracts/hardhat.config.js +++ b/etc/eth-contracts/hardhat.config.js @@ -1,13 +1,12 @@ require('@nomiclabs/hardhat-waffle'); require('solidity-coverage'); -require('hardhat-storage-layout'); -require("./tasks/storage"); +require('./tasks/storage'); /** * @type import('hardhat/config').HardhatUserConfig */ module.exports = { - newStorageLayoutPath: "./storageLayout", + newStorageLayoutPath: './storageLayout', solidity: { version: '0.8.3', settings: { @@ -16,8 +15,8 @@ module.exports = { runs: 1000, }, outputSelection: { - "*": { - "*": ["storageLayout"], + '*': { + '*': ['storageLayout'], }, }, }, diff --git a/etc/eth-contracts/tasks/storage.js b/etc/eth-contracts/tasks/storage.js index 2b6965723..879bb01a5 100644 --- a/etc/eth-contracts/tasks/storage.js +++ b/etc/eth-contracts/tasks/storage.js @@ -1,6 +1,9 @@ -task("storageLayout", "automatically generates the contract storage layout") - .setAction(async () => { - await hre.storageLayout.export(); - }); +require('hardhat-storage-layout'); +// eslint-disable-next-line no-undef +task('storageLayout', 'automatically generates the contract storage layout') + .setAction(async () => { + // eslint-disable-next-line no-undef + await hre.storageLayout.export(); + }); -module.exports = {}; \ No newline at end of file +module.exports = {};