{"id":414724,"date":"2024-06-29T23:56:17","date_gmt":"2024-06-29T23:56:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=414724"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T23:56:17","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=414724","title":{"rendered":"<span>\u0418\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u0433\u0430\u0437\u0430 \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 Solidity<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0c1\/7c5\/4e0\/0c17c54e0cdcf1f7cd299e23d9462212.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0c1\/7c5\/4e0\/0c17c54e0cdcf1f7cd299e23d9462212.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0432\u044b \u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0441\u043a\u0440\u0438\u043f\u0442\u044b Web-\u0441\u0430\u0439\u0442\u043e\u0432 \u0438\u043b\u0438 Desktop-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0438\u043b\u0438 \u0434\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 \u0435\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u0438 \u0435\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u043d\u0435 \u0438\u0434\u0435\u0442 \u043e \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445, \u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u043e\u0431\u043e \u043d\u0435 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c Solidity \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u0430 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0442\u043e\u0433\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u0430\u043a\u043e\u0439 \u0438 \u043a\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>\u0414\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0441\u0442\u0435\u043d\u0434 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Hardhat.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Hardhat<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 Hardhat \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<br \/><code><br \/>$ cd ~\/sol01\/<br \/>$ mkdir solext<br \/>$ cd solext<br \/>$ npm init -yes<br \/>$ npm install --save-dev hardhat<br \/>$ npx hardhat<\/code><\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0432 \u043c\u0435\u043d\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u00abCreate an empty hardhat.config.js\u00bb, \u0442\u0430\u043a \u043a\u0430\u043a \u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/h4>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432:<\/p>\n<p><code>$ npm install --save-dev @nomiclabs\/hardhat-waffle 'ethereum-waffle@^3.0.0' @nomiclabs\/hardhat-ethers 'ethers@^5.0.0'   <\/code><\/p>\n<p><code>$ npm install --save-dev @nomiclabs\/hardhat-truffle5 @nomiclabs\/hardhat-web3 web3   <\/code><\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u043b\u0430\u0433\u0438\u043d hardhat-gas-reporter, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0430\u0437\u0430, \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430:<\/p>\n<p><code>$ npm install hardhat-gas-reporter<\/code><\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c web3 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043b\u0430\u0433\u0438\u043d hardhat-web3. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p><code>$ npm install --save-dev @nomiclabs\/hardhat-web3 web3<\/code><\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u043b\u0430\u0433\u0438\u043d hardhat-storage-layout, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435:<\/p>\n<p><code>$ npm install --save-dev hardhat-storage-layout<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 hardhat.config.js<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0444\u0430\u0439\u043b hardhat.config.js (\u043b\u0438\u0441\u0442\u0438\u043d\u0433 1).<\/p>\n<p><strong>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 1. \u0424\u0430\u0439\u043b ~\/sol01\/solext\/hardhat.config.js<br \/><\/strong><code>require(\"@nomiclabs\/hardhat-web3\");<br \/> require(\"@nomiclabs\/hardhat-truffle5\");<br \/> require(\"@nomiclabs\/hardhat-web3\");<br \/> require(\"hardhat-gas-reporter\");<br \/> require('hardhat-storage-layout');<\/code><\/p>\n<p><code>module.exports = {<br \/>   solidity: {<br \/>     version: \"0.8.4\",<br \/>     settings: {<br \/>       optimizer: {<br \/>         enabled: true,<br \/>         runs: 200,<br \/>       },<br \/>       outputSelection: {<br \/>         \"*\": {<br \/>           \"*\": [\"storageLayout\"],<br \/>         },<br \/>       },<br \/>     },<br \/>  },<\/code><\/p>\n<p>   <code>gasReporter: {<br \/>      enabled: (process.env.REPORT_GAS) ? true : false,<br \/>      noColors: true,<br \/>      showTimeSpent: true,<br \/>      showMethodSig: true,<br \/>      onlyCalledMethods: false,<br \/>      currency: 'RUB',<br \/>      coinmarketcap: '&lt;\u0432\u0430\u0448_\u043a\u043b\u044e\u0447>',<br \/>  },<br \/>}<\/code><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u0448 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 coinmarketcap. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0435\u0433\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435\u00a0<a href=\"https:\/\/coinmarketcap.com\/api\/pricing\/\" rel=\"noopener noreferrer nofollow\">https:\/\/coinmarketcap.com\/api\/pricing\/<\/a>.<\/p>\n<h4>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-gas-reporter<\/h4>\n<p>\u0412 \u0431\u043b\u043e\u043a\u0435 gasReporter \u0444\u0430\u0439\u043b\u0430 hardhat.config.js \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-gas-reporter:<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>enabled<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u0433\u0430\u0437\u0430.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p><code>$ npx hardhat test<\/code><\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043b\u0430\u0433\u0438\u043d hardhat-gas-reporter \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041a\u043e\u0433\u0434\u0430 \u0436\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0442\u0435\u0441\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b REPORT_GAS, \u0440\u0430\u0432\u043d\u043e\u0435 true:<\/p>\n<p><code>$ REPORT_GAS=true npx hardhat test<\/code><\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439. \u041e \u043d\u0435\u0439 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 enabled \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d, \u0442\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0433\u0430\u0437\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u0433\u0434\u0430.<\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <strong>noColors<\/strong> \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0432\u0438\u0434\u043e\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true, \u0432\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442\u043d\u044b\u043c \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043f\u0435\u0447\u0430\u0442\u0438 \u043d\u0430 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u043e\u043c \u043f\u0440\u0438\u043d\u0442\u0435\u0440\u0435.<\/p>\n<p>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <strong>showTimeSpent<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e \u0442\u043e\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <strong>showMethodSig<\/strong>.\u00a0 \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043c\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043d\u043e \u0438 \u0442\u0438\u043f\u044b \u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>onlyCalledMethods<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u0433\u0430\u0437. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0447\u0435\u0442 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-gas-reporter \u2014 \u043e\u043d \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0449\u0438\u0435 \u0433\u0430\u0437, \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 onlyCalledMethods \u0432\u044b \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0438\u0445 \u0432 \u043e\u0442\u0447\u0435\u0442\u0435.<\/p>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0435\u0441\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <strong>currency<\/strong> \u0438 <strong>coinmarketcap<\/strong>.<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 currency \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0444\u0438\u0430\u0442\u043d\u044b\u0435 \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0433\u0430\u0437\u0430, \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430 Ethereum \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0433\u0430\u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 Etherscan. <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0443\u0431\u043b\u0435\u0439, \u0434\u043e\u043b\u043b\u0430\u0440\u043e\u0432 \u0438\u043b\u0438 \u0435\u0432\u0440\u043e \u0432\u044b \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0442\u0435 \u0437\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u0437\u0430 \u0432\u044b\u0437\u043e\u0432 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e <strong>\u043a\u0443\u0440\u0441\u044b \u0432\u0430\u043b\u044e\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f<\/strong>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 wei, \u0430 \u043d\u0435 \u0432 \u0444\u0438\u0430\u0442\u043d\u044b\u0445 \u0432\u0430\u043b\u044e\u0442\u0430\u0445.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0444\u0438\u0430\u0442\u043d\u044b\u0445 \u0432\u0430\u043b\u044e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 currency, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/coinmarketcap.com\/api\/documentation\/v1\/#section\/Endpoint-Overview\" rel=\"noopener noreferrer nofollow\">https:\/\/coinmarketcap.com\/api\/documentation\/v1\/#section\/Endpoint-Overview<\/a>.<\/p>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-gas-reporter \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/github.com\/cgewecke\/eth-gas-reporter\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/cgewecke\/eth-gas-reporter<\/a>.<\/p>\n<h4>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-storage-layout<\/h4>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u0444\u0430\u0439\u043b hardhat.config.js \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0431\u043b\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-storage-layout:<\/p>\n<p><code>outputSelection: {<br \/>\u00a0 \"*\": {<br \/>\u00a0\u00a0\u00a0 \"*\": [\"storageLayout\"],<br \/>\u00a0 },<br \/>},<\/code><\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0431\u043b\u043e\u043a\u0430\u0445 \u043f\u0430\u043c\u044f\u0442\u0438 (\u0441\u043b\u043e\u0442\u0430\u0445), \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0438\u0445 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0438 \u0442\u0438\u043f\u0430\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u042d\u0442\u0443 \u043a\u0430\u0440\u0442\u0443 \u043f\u043b\u0430\u0433\u0438\u043d hardhat-storage-layout \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u0440\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430:<\/p>\n<p><code>$ npx hardhat run scripts\/deploy.js<\/code><\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-storage-layout \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/github.com\/aurora-is-near\/hardhat-storage-layout\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/aurora-is-near\/hardhat-storage-layout<\/a>.<\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/h4>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044c\u0442\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 deploy.js \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u043e\u043c 2.<\/p>\n<p><strong>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 2. \u0424\u0430\u0439\u043b ~\/sol01\/solext\/scripts\/deploy.js<\/strong><\/p>\n<p><code>const hre = require(\"hardhat\");<br \/>async function main() {<br \/>  const HelloSol = await hre.ethers.getContractFactory(\"HelloSol\");<br \/>  await hre.storageLayout.export();<br \/>  const cHelloSol = await HelloSol.deploy();<br \/>  await cHelloSol.deployed();<br \/>  console.log(\"HelloSol deployed to:\", cHelloSol.address);<br \/> }<br \/> main()<br \/> .then(() => process.exit(0))<br \/> .catch((error) => {<br \/>   console.error(error);<br \/>   process.exit(1);<br \/> });<\/code><\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u044b\u0437\u043e\u0432\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 hre.storageLayout.export. \u041e\u043d\u0430 \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043a\u0430\u0440\u0442\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-storage-layout.<\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p>\u041d\u0438\u0436\u0435 \u0432 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 3 \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p><strong>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 3. \u0424\u0430\u0439\u043b ~\/sol01\/solext\/contract\/HelloSol.sol<\/strong><\/p>\n<p><code>\/\/ SPDX-License-Identifier: MIT<br \/> pragma solidity ^0.8.0;<\/code><\/p>\n<p><code>contract HelloSol {<\/code><\/p>\n<p><code>  uint128 storage_value_1;<br \/>   uint128 storage_value_2;  <br \/>   uint storage_value;<br \/>   uint itValue;<\/code><\/p>\n<p><code>  function expLoop(uint iterations) public {<br \/>    for(uint i = 0; i &lt; iterations; i++) {<br \/>       itValue += 1;<br \/>    }<br \/>    storage_value = itValue;<br \/>   }<\/code><\/p>\n<p><code>  function optLoop(uint iterations) public {<br \/>   uint itValueLoc;<br \/>     for(uint iLoc = 0; iLoc &lt; iterations; iLoc++) {<br \/>       itValueLoc += 1;<br \/>     }<br \/>     storage_value = itValueLoc;<br \/>   }<\/code><\/p>\n<p><code>  function getStorageValue() public view returns(uint) {<br \/>     return storage_value;<br \/>   }<br \/>}<\/code><\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u043a\u0440\u043f\u0438\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0430\u0440\u043a\u0442\u0430 (\u043b\u0438\u0441\u0442\u0438\u043d\u0433 4).<\/p>\n<p><strong>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 4. \u0424\u0430\u0439\u043b ~\/sol01\/solext\/test\/test.js<\/strong><\/p>\n<p><code>const { expect } = require(\"chai\");<br \/> require(<span>@nomiclabs<\/span>s\/hardhat-web3\");<br \/> const { ethers } = require(\"hardhat\");<\/code><\/p>\n<p><code>describe('\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 HelloSol...', function() {<\/code><\/p>\n<p><code>let HelloSol;<br \/> let myHelloSol;<\/code><\/p>\n<p><code>beforeEach(async () => {<br \/>   HelloSol = await ethers.getContractFactory(\"HelloSol\");<br \/>   myHelloSol = await HelloSol.deploy();<br \/>   await myHelloSol.deployed();<br \/> });<\/code><\/p>\n<p><code>it(\"expLoop getStorageValue hould return 5\", async function () {<br \/>   await myHelloSol.expLoop(5);<br \/>   expect(await myHelloSol.getStorageValue()).to.equal(5);<br \/> });<\/code><\/p>\n<p><code>it(\"optLoop getStorageValue should return 5\", async function () {<br \/>   await myHelloSol.optLoop(5);<br \/>   expect(await myHelloSol.getStorageValue()).to.equal(5);<br \/> });<br \/>});<\/code><\/p>\n<h4>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u0433\u0430\u0437\u0430<\/h4>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0430\u0437\u0430, \u0438\u0437\u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443.<\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0442\u0430\u043a\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<p><code>$ REPORT_GAS=true npx hardhat test<\/code><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0442\u0435\u0441\u0442\u0430 \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b REPORT_GAS, \u0440\u0430\u0432\u043d\u043e\u0435 true. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 hardhat.config.js \u043f\u043b\u0430\u0433\u0438\u043d hardhat-gas-reporter \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0433\u0430\u0437\u0430, \u0438\u0437\u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445:<\/p>\n<p><code>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 HelloSol...<br \/> \u2713 expLoop getStorageValue hould return 5 (32ms)<br \/> \u2713 optLoop getStorageValue should return 5 (19ms)<\/code><\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0433\u0434\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u0433\u0430\u0437\u0430 \u0438 \u0446\u0435\u043d\u0430 \u0432 \u0440\u0443\u0431\u043b\u044f\u0445:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5c4\/d74\/f13\/5c4d74f13537b0a5e47d0fcac7a7f370.png\" width=\"1088\" height=\"338\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5c4\/d74\/f13\/5c4d74f13537b0a5e47d0fcac7a7f370.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432\u044b\u0437\u043e\u0432\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043c\u043e\u0433\u0443\u0442 \u0441\u0442\u043e\u0438\u0442\u044c \u043d\u0435\u0434\u0435\u0448\u0435\u0432\u043e.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 expLoop, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0446\u0438\u043a\u043b\u0435 \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u043e\u0438\u0442\u044c 67663 gas \u0438\u043b\u0438 0,002571194 ETH \u043f\u0440\u0438 \u0446\u0435\u043d\u0435 \u0433\u0430\u0437\u0430 \u0432 38 gwei, \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u043e\u0438\u0442 634.75 \u0440\u0443\u0431. (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f). \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 optLoop, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0434\u0435\u0448\u0435\u0432\u043b\u0435 \u2014 44525 gas \u0438\u043b\u0438 417.70 \u0440\u0443\u0431.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0433\u0430\u0437\u0430 gas, \u0440\u0430\u0432\u043d\u0430\u044f 38 gwei. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 expLoop \u0432 ETH, \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f:<\/p>\n<p>67663 gas * 38 =  2\u00a0571\u00a0194 gwei<br \/>2\u00a0571\u00a0194 gwei * (10 ** 9)  = 2\u00a0571\u00a0194 000 000 000 wei<br \/>2\u00a0571\u00a0194 000 000 000 wei \/ (10 ** 18) = 0,002571194 ETH<\/p>\n<p>\u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0431\u0435\u0437 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0432 wei:<\/p>\n<p>67663 gas * 38 \/ (10 ** 9) = 0,002571194 ETH<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f expLoop \u0432 \u0446\u0438\u043a\u043b\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 itValue \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443, \u043f\u0440\u0438\u0447\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e. \u0424\u0443\u043d\u043a\u0446\u0438\u044f optLoop \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e itValueLoc. \u0418 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f storage_value.<\/p>\n<p>\u0412\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 optLoop \u0442\u043e\u0436\u0435 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u0434\u0430\u0440\u043e\u043c, \u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0434\u0435\u0448\u0435\u0432\u043b\u0435. \u041f\u0440\u0438 \u043f\u044f\u0442\u0438 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u044d\u0442\u043e 44525 gas.<\/p>\n<h4>\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043a\u0430\u0440\u0442\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438<\/h4>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432 \u043f\u043b\u0430\u0433\u0438\u043d hardhat-storage-layout, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0443\u0434\u043e\u0431\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043a\u0430\u0440\u0442\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u0431\u043b\u043e\u043a\u0430\u0445 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0441\u0435\u0442\u044c Hardhat:<\/p>\n<p><code>$ npx hardhat run scripts\/deploy.js<\/code><\/p>\n<p>\u041d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043d\u0438\u0436\u0435 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/89a\/a9a\/05b\/89aa9a05b57ff0c22cabfaa62fcb3177.png\" width=\"658\" height=\"151\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/89a\/a9a\/05b\/89aa9a05b57ff0c22cabfaa62fcb3177.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 \u0431\u044b\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0442\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f:<\/p>\n<p><code>uint128 storage_value_1;<br \/> uint128 storage_value_2;<br \/> uint storage_value;<\/code><\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435 \u0434\u043b\u044f \u043d\u0438\u0445 \u0431\u044b\u043b\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 256 \u0431\u0430\u0439\u0442 \u043a\u0430\u0436\u0434\u044b\u0439. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:<\/p>\n<p><code>uint128 storage_value_1;<br \/> uint storage_value;<br \/> uint128 storage_value_2;<\/code><\/p>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0431\u044b\u043b\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0443\u0436\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0431\u043b\u043e\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e1b\/f1f\/ec0\/e1bf1fec0a17e1173874d80f1c5aba80.png\" width=\"661\" height=\"154\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e1b\/f1f\/ec0\/e1bf1fec0a17e1173874d80f1c5aba80.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u0437\u0430\u0438\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0438\u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0430\u043a\u0435\u0442\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 solc. \u041f\u043e\u043c\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u0444\u0430\u0439\u043b\u0430 ABI, \u044d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043a\u0430\u0440\u0442\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c &#8212;storage-layout:<\/p>\n<p><code>$ solc --storage-layout HelloSol.sol -o build \u2013overwrite<\/code><\/p>\n<p>\u0424\u0430\u0439\u043b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 -o, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433 build.<\/p>\n<p>\u042d\u0442\u043e\u0442 JSON-\u0444\u0430\u0439\u043b \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b jq:<\/p>\n<p><code>$ cat HelloSol_storage.json | jq<br \/>{<br \/>\u00a0 \"storage\": [<br \/>\u00a0\u00a0\u00a0 {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"astId\": 3,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"contract\": \"HelloSol.sol:HelloSol\",<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"label\": \"storage_value_1\",<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"offset\": 0,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"slot\": \"0\",<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"type\": \"t_uint128\"<br \/>\u00a0\u00a0\u00a0 },<br \/>\u00a0\u00a0\u00a0 {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"astId\": 5,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"contract\": \"HelloSol.sol:HelloSol\",<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"label\": \"storage_value\",<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"offset\": 0,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"slot\": \"1\",<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"type\": \"t_uint256\"<br \/>\u00a0\u00a0\u00a0 },<br \/>\u00a0\u00a0\u00a0 {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"astId\": 7,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"contract\": \"HelloSol.sol:HelloSol\",<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"label\": \"storage_value_2\",<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"offset\": 0,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"slot\": \"2\",<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0 \"type\": \"t_uint128\"<br \/>\u00a0\u00a0\u00a0 },<br \/>\u00a0\u00a0\u00a0 \u2026<br \/>\u00a0 ]<br \/>\u00a0 \u2026<br \/>}<\/code><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0443 jq \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p><code>$ sudo apt install jq<\/code><\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u043c hardhat-storage-layout \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0435\u0433\u0447\u0435, \u0447\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c JSON-\u0444\u0430\u0439\u043b \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u043a\u0430\u043a \u0440\u0430\u0437 JSON-\u0444\u0430\u0439\u043b.<\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 les16 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f <a href=\"https:\/\/github.com\/AlexandreFrolov\/sol01\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/AlexandreFrolov\/sol01<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/661891\/\"> https:\/\/habr.com\/ru\/articles\/661891\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0432\u044b \u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0441\u043a\u0440\u0438\u043f\u0442\u044b Web-\u0441\u0430\u0439\u0442\u043e\u0432 \u0438\u043b\u0438 Desktop-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0438\u043b\u0438 \u0434\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 \u0435\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u0438 \u0435\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u043d\u0435 \u0438\u0434\u0435\u0442 \u043e \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445, \u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u043e\u0431\u043e \u043d\u0435 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c Solidity \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u0430 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0442\u043e\u0433\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u0430\u043a\u043e\u0439 \u0438 \u043a\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>\u0414\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0441\u0442\u0435\u043d\u0434 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Hardhat.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Hardhat<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 Hardhat \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<br \/><code><br \/>$ cd ~\/sol01\/<br \/>$ mkdir solext<br \/>$ cd solext<br \/>$ npm init -yes<br \/>$ npm install --save-dev hardhat<br \/>$ npx hardhat<\/code><\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0432 \u043c\u0435\u043d\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u00abCreate an empty hardhat.config.js\u00bb, \u0442\u0430\u043a \u043a\u0430\u043a \u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/h4>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432:<\/p>\n<p><code>$ npm install --save-dev @nomiclabs\/hardhat-waffle 'ethereum-waffle@^3.0.0' @nomiclabs\/hardhat-ethers 'ethers@^5.0.0'   <\/code><\/p>\n<p><code>$ npm install --save-dev @nomiclabs\/hardhat-truffle5 @nomiclabs\/hardhat-web3 web3   <\/code><\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u043b\u0430\u0433\u0438\u043d hardhat-gas-reporter, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0430\u0437\u0430, \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430:<\/p>\n<p><code>$ npm install hardhat-gas-reporter<\/code><\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c web3 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043b\u0430\u0433\u0438\u043d hardhat-web3. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p><code>$ npm install --save-dev @nomiclabs\/hardhat-web3 web3<\/code><\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u043b\u0430\u0433\u0438\u043d hardhat-storage-layout, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435:<\/p>\n<p><code>$ npm install --save-dev hardhat-storage-layout<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 hardhat.config.js<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0444\u0430\u0439\u043b hardhat.config.js (\u043b\u0438\u0441\u0442\u0438\u043d\u0433 1).<\/p>\n<p><strong>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 1. \u0424\u0430\u0439\u043b ~\/sol01\/solext\/hardhat.config.js<br \/><\/strong><code>require(\"@nomiclabs\/hardhat-web3\");<br \/> require(\"@nomiclabs\/hardhat-truffle5\");<br \/> require(\"@nomiclabs\/hardhat-web3\");<br \/> require(\"hardhat-gas-reporter\");<br \/> require('hardhat-storage-layout');<\/code><\/p>\n<p><code>module.exports = {<br \/>   solidity: {<br \/>     version: \"0.8.4\",<br \/>     settings: {<br \/>       optimizer: {<br \/>         enabled: true,<br \/>         runs: 200,<br \/>       },<br \/>       outputSelection: {<br \/>         \"*\": {<br \/>           \"*\": [\"storageLayout\"],<br \/>         },<br \/>       },<br \/>     },<br \/>  },<\/code><\/p>\n<p>   <code>gasReporter: {<br \/>      enabled: (process.env.REPORT_GAS) ? true : false,<br \/>      noColors: true,<br \/>      showTimeSpent: true,<br \/>      showMethodSig: true,<br \/>      onlyCalledMethods: false,<br \/>      currency: 'RUB',<br \/>      coinmarketcap: '&lt;\u0432\u0430\u0448_\u043a\u043b\u044e\u0447>',<br \/>  },<br \/>}<\/code><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u0448 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 coinmarketcap. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0435\u0433\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435\u00a0<a href=\"https:\/\/coinmarketcap.com\/api\/pricing\/\" rel=\"noopener noreferrer nofollow\">https:\/\/coinmarketcap.com\/api\/pricing\/<\/a>.<\/p>\n<h4>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-gas-reporter<\/h4>\n<p>\u0412 \u0431\u043b\u043e\u043a\u0435 gasReporter \u0444\u0430\u0439\u043b\u0430 hardhat.config.js \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-gas-reporter:<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>enabled<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u0433\u0430\u0437\u0430.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p><code>$ npx hardhat test<\/code><\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043b\u0430\u0433\u0438\u043d hardhat-gas-reporter \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041a\u043e\u0433\u0434\u0430 \u0436\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0442\u0435\u0441\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b REPORT_GAS, \u0440\u0430\u0432\u043d\u043e\u0435 true:<\/p>\n<p><code>$ REPORT_GAS=true npx hardhat test<\/code><\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439. \u041e \u043d\u0435\u0439 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 enabled \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d, \u0442\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0433\u0430\u0437\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u0433\u0434\u0430.<\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <strong>noColors<\/strong> \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0432\u0438\u0434\u043e\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true, \u0432\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442\u043d\u044b\u043c \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043f\u0435\u0447\u0430\u0442\u0438 \u043d\u0430 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u043e\u043c \u043f\u0440\u0438\u043d\u0442\u0435\u0440\u0435.<\/p>\n<p>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <strong>showTimeSpent<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e \u0442\u043e\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <strong>showMethodSig<\/strong>.\u00a0 \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043c\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043d\u043e \u0438 \u0442\u0438\u043f\u044b \u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>onlyCalledMethods<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u0433\u0430\u0437. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0447\u0435\u0442 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-gas-reporter \u2014 \u043e\u043d \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0449\u0438\u0435 \u0433\u0430\u0437, \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 onlyCalledMethods \u0432\u044b \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0438\u0445 \u0432 \u043e\u0442\u0447\u0435\u0442\u0435.<\/p>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0435\u0441\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <strong>currency<\/strong> \u0438 <strong>coinmarketcap<\/strong>.<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 currency \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0444\u0438\u0430\u0442\u043d\u044b\u0435 \u0434\u0435\u043d\u0435\u0436\u043d\u044b\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0433\u0430\u0437\u0430, \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430 Ethereum \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0433\u0430\u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 Etherscan. <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0443\u0431\u043b\u0435\u0439, \u0434\u043e\u043b\u043b\u0430\u0440\u043e\u0432 \u0438\u043b\u0438 \u0435\u0432\u0440\u043e \u0432\u044b \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0442\u0435 \u0437\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u0437\u0430 \u0432\u044b\u0437\u043e\u0432 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e <strong>\u043a\u0443\u0440\u0441\u044b \u0432\u0430\u043b\u044e\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f<\/strong>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 wei, \u0430 \u043d\u0435 \u0432 \u0444\u0438\u0430\u0442\u043d\u044b\u0445 \u0432\u0430\u043b\u044e\u0442\u0430\u0445.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0444\u0438\u0430\u0442\u043d\u044b\u0445 \u0432\u0430\u043b\u044e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 currency, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/coinmarketcap.com\/api\/documentation\/v1\/#section\/Endpoint-Overview\" rel=\"noopener noreferrer nofollow\">https:\/\/coinmarketcap.com\/api\/documentation\/v1\/#section\/Endpoint-Overview<\/a>.<\/p>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-gas-reporter \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/github.com\/cgewecke\/eth-gas-reporter\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/cgewecke\/eth-gas-reporter<\/a>.<\/p>\n<h4>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-storage-layout<\/h4>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u0444\u0430\u0439\u043b hardhat.config.js \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0431\u043b\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-storage-layout:<\/p>\n<p><code>outputSelection: {<br \/>\u00a0 \"*\": {<br \/>\u00a0\u00a0\u00a0 \"*\": [\"storageLayout\"],<br \/>\u00a0 },<br \/>},<\/code><\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0431\u043b\u043e\u043a\u0430\u0445 \u043f\u0430\u043c\u044f\u0442\u0438 (\u0441\u043b\u043e\u0442\u0430\u0445), \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0438\u0445 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0438 \u0442\u0438\u043f\u0430\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u042d\u0442\u0443 \u043a\u0430\u0440\u0442\u0443 \u043f\u043b\u0430\u0433\u0438\u043d hardhat-storage-layout \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u0440\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430:<\/p>\n<p><code>$ npx hardhat run scripts\/deploy.js<\/code><\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-storage-layout \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/github.com\/aurora-is-near\/hardhat-storage-layout\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/aurora-is-near\/hardhat-storage-layout<\/a>.<\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/h4>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044c\u0442\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 deploy.js \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u043e\u043c 2.<\/p>\n<p><strong>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 2. \u0424\u0430\u0439\u043b ~\/sol01\/solext\/scripts\/deploy.js<\/strong><\/p>\n<p><code>const hre = require(\"hardhat\");<br \/>async function main() {<br \/>  const HelloSol = await hre.ethers.getContractFactory(\"HelloSol\");<br \/>  await hre.storageLayout.export();<br \/>  const cHelloSol = await HelloSol.deploy();<br \/>  await cHelloSol.deployed();<br \/>  console.log(\"HelloSol deployed to:\", cHelloSol.address);<br \/> }<br \/> main()<br \/> .then(() => process.exit(0))<br \/> .catch((error) => {<br \/>   console.error(error);<br \/>   process.exit(1);<br \/> });<\/code><\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u044b\u0437\u043e\u0432\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 hre.storageLayout.export. \u041e\u043d\u0430 \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043a\u0430\u0440\u0442\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 hardhat-storage-layout.<\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p>\u041d\u0438\u0436\u0435 \u0432 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 3 \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p><strong>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 3. \u0424\u0430\u0439\u043b ~\/sol01\/solext\/contract\/HelloSol.sol<\/strong><\/p>\n<p><code>\/\/ SPDX-License-Identifier: MIT<br \/> pragma solidity ^0.8.0;<\/code><\/p>\n<p><code>contract HelloSol {<\/code><\/p>\n<p><code>  uint128 storage_value_1;<br \/>   uint128 storage_value_2;  <br \/>   uint storage_value;<br \/>   uint itValue;<\/code><\/p>\n<p><code>  function expLoop(uint iterations) public {<br \/>    for(uint i = 0; i &lt; iterations; i++) {<br \/>       itValue += 1;<br \/>    }<br \/>    storage_value = itValue;<br \/>   }<\/code><\/p>\n<p><code>  function optLoop(uint iterations) public {<br \/>   uint itValueLoc;<br \/>     for(uint iLoc = 0; iLoc &lt; iterations; iLoc++) {<br \/>       itValueLoc += 1;<br \/>     }<br \/>     storage_value = itValueLoc;<br \/>   }<\/code><\/p>\n<p><code>  function getStorageValue() public view returns(uint) {<br \/>     return storage_value;<br \/>   }<br \/>}<\/code><\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u043a\u0440\u043f\u0438\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0430\u0440\u043a\u0442\u0430 (\u043b\u0438\u0441\u0442\u0438\u043d\u0433 4).<\/p>\n<p><strong>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 4. \u0424\u0430\u0439\u043b ~\/sol01\/solext\/test\/test.js<\/strong><\/p>\n<p><code>const { expect } = require(\"chai\");<br \/> require(<span>@nomiclabs<\/span>s\/hardhat-web3\");<br \/> const { ethers } = require(\"hardhat\");<\/code><\/p>\n<p><code>describe('\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 HelloSol...', function() {<\/code><\/p>\n<p><code>let HelloSol;<br \/> let myHelloSol;<\/code><\/p>\n<p><code>beforeEach(async () => {<br \/>   HelloSol = await ethers.getContractFactory(\"HelloSol\");<br \/>   myHelloSol = await HelloSol.deploy();<br \/>   await myHelloSol.deployed();<br \/> });<\/code><\/p>\n<p><code>it(\"expLoop getStorageValue hould return 5\", async function () {<br \/>   await myHelloSol.expLoop(5);<br \/>   expect(await myHelloSol.getStorageValue()).to.equal(5);<br \/> });<\/code><\/p>\n<p><code>it(\"optLoop getStorageValue should return 5\", async function () {<br \/>   await myHelloSol.optLoop(5);<br \/>   expect(await myHelloSol.getStorageValue()).to.equal(5);<br \/> });<br \/>});<\/code><\/p>\n<h4>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u0433\u0430\u0437\u0430<\/h4>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0430\u0437\u0430, \u0438\u0437\u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443.<\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0442\u0430\u043a\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<p><code>$ REPORT_GAS=true npx hardhat test<\/code><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0442\u0435\u0441\u0442\u0430 \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b REPORT_GAS, \u0440\u0430\u0432\u043d\u043e\u0435 true. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 hardhat.config.js \u043f\u043b\u0430\u0433\u0438\u043d hardhat-gas-reporter \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0433\u0430\u0437\u0430, \u0438\u0437\u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445:<\/p>\n<p><code>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 HelloSol...<br \/> \u2713 expLoop getStorageValue hould return 5 (32ms)<br \/> \u2713 optLoop getStorageValue should return 5 (19ms)<\/code><\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0433\u0434\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u0433\u0430\u0437\u0430 \u0438 \u0446\u0435\u043d\u0430 \u0432 \u0440\u0443\u0431\u043b\u044f\u0445:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432\u044b\u0437\u043e\u0432\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043c\u043e\u0433\u0443\u0442 \u0441\u0442\u043e\u0438\u0442\u044c \u043d\u0435\u0434\u0435\u0448\u0435\u0432\u043e.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 expLoop, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0446\u0438\u043a\u043b\u0435 \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u043e\u0438\u0442\u044c 67663 gas \u0438\u043b\u0438 0,002571194 ETH \u043f\u0440\u0438 \u0446\u0435\u043d\u0435 \u0433\u0430\u0437\u0430 \u0432 38 gwei, \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u043e\u0438\u0442 634.75 \u0440\u0443\u0431.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-414724","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/414724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=414724"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/414724\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=414724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=414724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=414724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}