{"id":374830,"date":"2024-05-21T06:09:56","date_gmt":"2024-05-21T06:09:56","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=374830"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=374830","title":{"rendered":"<span>Yul: \u0423\u0447\u0438\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c inline assembly \u0432 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<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f<\/h4>\n<p><strong>Yul<\/strong>\u00a0\u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0431\u0430\u0439\u0442-\u043a\u043e\u0434. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f EVM (\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b Ethereum) \u043e\u043d \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u043c \u0438 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043f\u0440\u044f\u043c\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 EVM (\u043e\u043f\u043a\u043e\u0434\u0430\u043c\u0438), \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441.<\/p>\n<p><strong>\u0411\u0430\u0439\u0442-\u043a\u043e\u0434 EVM<\/strong>\u00a0&#8212; \u044d\u0442\u043e \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043e\u0439 Ethereum (EVM).<\/p>\n<h4>\u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u0435\u043d Yul<\/h4>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 Yul &#8212; \u044d\u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432 \u043f\u043e \u0433\u0430\u0437\u0443, \u043a\u0430\u043a \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u044f\u0437\u044b\u043a\u0430 \u0442\u0430\u043a \u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u0434\u0430.<\/p>\n<p>Yul \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/assembly.html\"><u>inline assembly<\/u><\/a>\u00a0(\u00ab\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438\u00bb) \u0432 \u043a\u043e\u0434\u0435 solidity, \u0430 \u043c\u043e\u0436\u043d\u043e\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/yul\/README.md#%D1%81%D0%BC%D0%B0%D1%80%D1%82-%D0%BA%D0%BE%D0%BD%D1%82%D1%80%D0%B0%D0%BA%D1%82%D1%8B-%D0%BD%D0%B0-%D1%8F%D0%B7%D1%8B%D0%BA%D0%B5-yul\"><u>\u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Yul<\/u><\/a>\u00a0\u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f solidity.<\/p>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 solc \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Yul \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/ir-breaking-changes.html\"><u>IR<\/u><\/a>\u00a0(Intermediate Representation).<\/p>\n<p>\u0414\u0438\u0437\u0430\u0439\u043d Yul \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0446\u0435\u043b\u0435\u0439:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 Yul, \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043a\u043e\u0434 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c \u0438\u0437 solidity \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0442\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438\u0437 Yul \u0432 \u0431\u0430\u0439\u0442-\u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c.<\/p>\n<\/li>\n<li>\n<p>Yul \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u044c \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u0438\u043a\u043e\u043c.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0446\u0435\u043b\u0438 Yul \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0446\u0438\u043a\u043b\u044b\u00a0<code>for<\/code>, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b\u00a0<code>if<\/code>\u00a0\u0438\u00a0<code>switch<\/code>, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438 \u0432\u044b\u0437\u043e\u0432\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u044f\u0432\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0435\u043a\u043e\u043c &#8212;\u00a0<code>SWAP<\/code>,\u00a0<code>DUP<\/code>,\u00a0<code>JUMPDEST<\/code>\u00a0<code>JUMP<\/code>\u00a0\u0438\u00a0<code>JUMPI<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u0437\u0430\u043f\u0443\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0442\u0440\u0438 \u0437\u0430\u043f\u0443\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0442\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<blockquote>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/em>\u00a0\u0412 Yul \u0432\u0441\u0435 \u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0442\u0435\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#verbatim\"><u>verbatim<\/u><\/a>.<\/p>\n<\/blockquote>\n<h4>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435?<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u00a0<a href=\"https:\/\/youtube.com\/playlist?list=PL5hld-skrdFrxGUmmEbG1LBvYVyTE9M62&amp;si=jwXH_rtSvoNfrDPg\"><u>\u0441\u0435\u0440\u0438\u044e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0432\u0438\u0434\u0435\u043e<\/u><\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u00a0<a href=\"https:\/\/medium.com\/lumos-labs\/inline-assembly-in-solidity-34d3ba2cfa7a\"><u>\u0432\u043e\u0442 \u044d\u0442\u0443<\/u><\/a>\u00a0\u0441\u0442\u0430\u0442\u044c\u044e. \u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#evm-dialect\"><u>\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/u><\/a>\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 Yul.<\/p>\n<p>\u041b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442\u00a0<a href=\"https:\/\/medium.com\/@kulman.david\/how-to-use-remix-debugger-to-learn-solidity-assembly-5a745a22bb07\"><u>Remix Debugger<\/u><\/a>, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u0434\u0435\u0431\u0430\u0433\u0433\u0438\u043d\u0433\u0430 \u043a\u043e\u0434\u0430 Solidity \u0438 Yul. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442\u00a0<a href=\"https:\/\/book.getfoundry.sh\/forge\/debugger?highlight=debugger#debugger\"><u>debugger \u043e\u0442 foundry<\/u><\/a>\u00a0\u0438\u043b\u0438\u00a0<a href=\"https:\/\/www.evm.codes\/playground\"><u>Playground \u043e\u0442 evm.codes<\/u><\/a>\u00a0(\u0434\u0430\u043b\u0435\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0432\u043c\u0435\u0441\u0442\u043e &#171;debugger&#187; \u044f \u0431\u0443\u0434\u0443 \u0443\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0441\u043b\u043e\u0432\u043e &#171;\u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a&#187;).<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0441\u0435\u0440\u0438\u044e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0442 Naveen:\u00a0<a href=\"https:\/\/mirror.xyz\/0xB38709B8198d147cc9Ff9C133838a044d78B064B\/nk40v2MJKSHXXNSlbqqhpwJf4MtZ9V2Vp8P_bSNwjYc\"><u>\u0447\u0430\u0441\u0442\u044c 0<\/u><\/a>,\u00a0<a href=\"https:\/\/mirror.xyz\/0xB38709B8198d147cc9Ff9C133838a044d78B064B\/PpA5KdQhrE_2Bf-USfKePROJ5tE-raL7_VGBR8HE39E\"><u>\u0447\u0430\u0441\u0442\u044c 1<\/u><\/a>,\u00a0<a href=\"https:\/\/mirror.xyz\/0xB38709B8198d147cc9Ff9C133838a044d78B064B\/Hh69VJWM5eiFYFINxYWrIYWcRRtPm8tw3VFjpdpx6T8\"><u>\u0447\u0430\u0441\u0442\u044c 2<\/u><\/a>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>\u00a0\u0438 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0438\u0436\u0435.<\/p>\n<h3>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u044f\u0437\u044b\u043a\u0430<\/h3>\n<p>\u041a\u043e\u0434 Yul \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u0442\u0430\u043a \u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u0438\u0437 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a solidity \u0438\u043b\u0438 vyper. \u041d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 solidity \u0432 \u043d\u0435\u043c \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e: \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, abi.encode, \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434.<\/p>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e Yul \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430 \u0432\u0430\u0441, &#8212; \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u0434\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435, \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u0442\u0443 \u0441\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0441\u043b\u043e\u0442\u044b \u0441\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0435\u0446 \u0438\u0445 \u0431\u043b\u043e\u043a\u0430.<\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u044e\u0431\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 Yul, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0443\u0436\u043d\u043e \u0447\u0435\u0442\u043a\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0431\u0430\u0439\u0442\u043e\u043c.<br \/>\u0421\u0430\u043c\u044b\u043c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 Solidity \u0441 inline assembly \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u043a\u043e\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0434\u0430 \u0433\u0430\u0437\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438\u00a0(<a href=\"https:\/\/github.com\/Arachnid\/solidity-stringutils\"><u>strings<\/u><\/a><u>)<\/u>\u00a0\u0438\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0438\u043f\u043e\u043c\u00a0<a href=\"https:\/\/github.com\/GNSPS\/solidity-bytes-utils\/blob\/master\/contracts\/BytesLib.sol\"><u>bytes<\/u><\/a>.<\/p>\n<h4>\u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e inline assembly, \u0442\u043e \u0442\u0430\u043a\u0438\u0435 \u0431\u043b\u043e\u043a\u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u00ab\u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f\u00bb \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c\u00a0<code>assembly { ... }<\/code>\u00a0\u0431\u043b\u043e\u043a\u0435, \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e\u00a0<code>assembly { ... }<\/code>\u00a0\u0431\u043b\u043e\u043a\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c Solidity \u0431\u0443\u0434\u0435\u0442 \u0443 \u0432\u0441\u0435\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 memory.<\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 assembly \u0431\u043b\u043e\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u0435\u0437\u00a0<code>{ ... }<\/code>:<\/p>\n<pre><code class=\"javascript\">  assembly {       let x := 3  \/\/ x \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438        \/\/ \u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 1       {           let y := x  \/\/ \u0442\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0438\u0434\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e       }        \/\/ \u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438  2       {           let z := y  \/\/ \u0430 \u0442\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443       }   }<\/code><\/pre>\n<p>\u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a\u00a0<code>for<\/code>\u00a0\u0438\u00a0<code>function<\/code>.<\/p>\n<blockquote>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. <\/em>\u0412 standalone assembly (\u043a\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Yul) \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#specification-of-yul-object\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>.<\/p>\n<\/blockquote>\n<h4>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h4>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 Yul \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 solidity. \u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430 &#8212; \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u0447\u043a\u0443 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439\u00a0<code>;<\/code>, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 <code>+<\/code>,\u00a0<code>-<\/code>\u00a0\u0438 \u0442.\u0434.) \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#evm-dialect\"><u>\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/u><\/a>, \u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u00a0<code>:=<\/code>. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>let<\/code>. \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438 \u043d\u0435 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u043c.<\/p>\n<p>\u0412\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 EVM \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>let<\/code>\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0442 \u0441\u0442\u0435\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u043d\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0442 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439;<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0442\u0435\u043c \u0441\u043b\u043e\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0446\u0430 \u0431\u043b\u043e\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 Solidity \u0438 \u0432 Yul:<\/p>\n<pre><code class=\"javascript\">  \/\/ Solidity   uint256 a = (3 + 3) \/ 2;    \/\/ Yul   assembly {     let b := div(add(3, 3), 2)   }<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f\u00a0<code>add<\/code>, \u0437\u0430\u0442\u0435\u043c\u00a0<code>div<\/code>, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435. \u041f\u0435\u0440\u0432\u043e\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0430\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f.<\/p>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u043e\u0436\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043e\u043d\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0447\u0430\u0441\u0442\u044c\u044e \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u0439 Solidity. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u00a0<code>-><\/code>\u00a0\u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0412\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 \u0431\u043b\u043e\u043a\u0435 inline assembly \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0432\u043d\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"javascript\">    function foo() external {         assembly {             function bar(param1, param2, ...) -> return1, return2, ... {                 \/\/ code             }              let x, y := bar(1, 2)         }     }<\/code><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>leave<\/code>\u00a0\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0442\u0435\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 assembly \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u043d\u0435\u0435. \u041e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u043f\u0443\u0441\u0442\u043e\u0439\u00a0<code>return<\/code>\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0437\u0430 \u043e\u0434\u043d\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0435\u0442 \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.<\/p>\n<pre><code class=\"javascript\">    assembly {         function increment() -> result {             let param := calldataload(4)             result := add(param, 1)             \/\/ leave \u0432\u0435\u0440\u043d\u0435\u0442 \"result\", \u043d\u043e \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430             \/\/ \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0431\u044b \u0441 return             \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 assembly \u0438\u043b\u0438 solidity \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0441\u044f             leave         }     } <\/code><\/pre>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>leave<\/code>\u00a0\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 Yul \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/blockquote>\n<p>Yul \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a Solidity, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<code>\/\/<\/code>\u00a0\u0438\u00a0<code>\/* *\/<\/code>\u00a0\u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432.<\/p>\n<h4>\u0422\u0438\u043f\u044b<\/h4>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 Yul \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0442\u0438\u043f &#8212;\u00a0<code>u256<\/code>\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u00a0<code>uint256<\/code>, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u0447\u0435 \u0435\u0433\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a\u00a0<code>bytes32<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0442\u0435\u043a\u043e\u0432\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 32-x \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u0438\u0435 256-\u0431\u0438\u0442\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u043d\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435.<\/p>\n<p>\u0412\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=ZGDQMS9GWo8&amp;list=PL5hld-skrdFrxGUmmEbG1LBvYVyTE9M62&amp;index=3\"><u>\u044d\u0442\u043e\u043c \u0432\u0438\u0434\u0435\u043e<\/u><\/a>\u00a0\u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0432 Yul. \u041b\u044e\u0431\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u00a0<code>bytes32<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 Yul \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438).<\/p>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u041d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0431\u0443\u043b\u0435\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Yul &#8212; \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u043a\u043e\u0434\u0430\u00a0<code>ISZERO<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c\u00a0<code>true<\/code>\u00a0\u0431\u0443\u0434\u0435\u0442 \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043e\u0442 0.<\/p>\n<pre><code class=\"javascript\">    function getBool() external pure returns (bool res) {         uint256 a = 42; \/\/ 42 (decimal) == 0x2a (hex)          assembly {             res := a \/\/ 0x000000000000000000000000000000000000000000000000000000000000002a         }         \/\/ res == true     }<\/code><\/pre>\n<h4>\u041b\u0438\u0442\u0435\u0440\u0430\u043b\u044b<\/h4>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0426\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u043e\u0439 \u0438\u043b\u0438 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 (<code>42<\/code>,\u00a0<code>0x2a<\/code>);<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u043e\u043a\u0438 ASCII (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ababc\u00bb), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0435 escape-\u0441\u0438\u043c\u0432\u043e\u043b\u044b\u00a0<code>\\xNN<\/code>\u00a0\u0438 escape-\u0441\u0438\u043c\u0432\u043e\u043b\u044b \u042e\u043d\u0438\u043a\u043e\u0434\u0430\u00a0<code>\\uNNNN<\/code>, \u0433\u0434\u0435 N \u2014 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0428\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440\u00a0<code>hex\"616263\"<\/code>).<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">    assembly {         let a := 0x123             \/\/ Hexadecimal         let b := 42                \/\/ Decimal         let c := \"hello world\"     \/\/ String         let d := \"very long string more than 32 bytes\" \/\/ Error     }<\/code><\/pre>\n<p>\u041f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0441\u0442\u0435\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 32-\u0445 \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u0438\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 32 \u0431\u0430\u0439\u0442 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0447\u0435\u0440\u0435\u0437\u00a0<code>let<\/code>.<\/p>\n<h4>\u041f\u043e\u0442\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041f\u043e\u0442\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 Yul \u0432\u044b\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438\u00a0<code>if<\/code>\u00a0\u0438\u00a0<code>switch<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0446\u0438\u043a\u043b\u043e\u043c\u00a0<code>for<\/code>, \u0438\u0445 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 solidity, \u043d\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u0442\u0435 \u0436\u0435.<\/p>\n<p>\u0418\u0437 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439: \u0446\u0438\u043a\u043b\u0430\u00a0<code>while<\/code>\u00a0\u0432 Yul \u043d\u0435\u0442, \u0430 \u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u00a0<code>if<\/code>\u00a0\u043d\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u00a0<code>else<\/code>\u00a0(\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0434\u0435\u043b\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<code>switch<\/code>). \u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0439\u00a0<code>if<\/code>\u00a0\u0431\u0435\u0437 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043e\u043a.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c\u00a0<code>if<\/code>:<\/p>\n<pre><code class=\"javascript\">    function ifStatement(uint256 n) external {         assembly {             if iszero(n) {                 \/\/ \u0435\u0441\u043b\u0438 true, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435             }         }     }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c\u00a0<code>switch<\/code>:<\/p>\n<pre><code class=\"javascript\">    function switchStatement(uint256 n) external {         assembly {             switch n             case 0 {                 \/\/ \u0435\u0441\u043b\u0438 n == 0 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435             }             case 1 {                 \/\/ \u0435\u0441\u043b\u0438 n == 1 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435             }             default {                 \/\/ \u0435\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b                 \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e             }         }     }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0446\u0438\u043a\u043b\u0430\u00a0<code>for<\/code>:<\/p>\n<pre><code class=\"javascript\">    function forLoop(uint256 n) external {         assembly {             for { let i := 0 } lt(i, n) { i := add(i, 1) } {                 \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435             }         }     }      function forLoopWithAnotherCondition(uint256 n) external {         assembly {             let i := 0             for {} lt(i, n) {} {                 \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435                 i := add(i, 1)             }         }     }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u0448\u0435\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/yul\/examples\/ControlFlow.sol\"><u>\u0442\u0443\u0442<\/u><\/a>.<\/p>\n<h3>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/h3>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0437\u044b\u043a\u0430 Yul. \u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#evm-dialect\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>. \u0412 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438) \u043c\u043e\u0436\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e \u0442\u0438\u043f\u0443\u00a0<code>mem[a...b]<\/code>\u00a0&#8212; \u043e\u043d\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0431\u0430\u0439\u0442\u044b \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>a<\/code>\u00a0\u0434\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>b<\/code>, \u043d\u043e \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0435\u0435, \u0430\u00a0<code>storage[p]<\/code>\u00a0\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0441\u043b\u043e\u0442\u0435\u00a0<code>p<\/code>.<\/p>\n<h4>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>eq(x, y)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e\u00a0<code>x<\/code>\u00a0\u0438\u00a0<code>y<\/code>\u00a0(<code>x == y<\/code>).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>iszero(x)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 1, \u0435\u0441\u043b\u0438\u00a0<code>x == 0<\/code>, \u0438\u043d\u0430\u0447\u0435 0.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>lt(x, y)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 1, \u0435\u0441\u043b\u0438\u00a0<code>x &lt; y<\/code>, \u0438\u043d\u0430\u0447\u0435 0.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>gt(x, y)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 1, \u0435\u0441\u043b\u0438\u00a0<code>x > y<\/code>, \u0438\u043d\u0430\u0447\u0435 0.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h4>\u0411\u0438\u0442\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>and(x, y)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 &#171;\u0418&#187; (AND) \u043c\u0435\u0436\u0434\u0443\u00a0<code>x<\/code>\u00a0\u0438\u00a0<code>y<\/code>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>or(x, y)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 &#171;\u0418\u041b\u0418&#187; (OR) \u043c\u0435\u0436\u0434\u0443\u00a0<code>x<\/code>\u00a0\u0438\u00a0<code>y<\/code>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>xor(x, y)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 &#171;\u0418\u0421\u041a\u041b\u042e\u0427\u0410\u042e\u0429\u0415\u0415 \u0418\u041b\u0418&#187; (XOR) \u043c\u0435\u0436\u0434\u0443\u00a0<code>x<\/code>\u00a0\u0438\u00a0<code>y<\/code>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>not(x)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 &#171;\u041d\u0415&#187; (NOT) \u0434\u043b\u044f\u00a0<code>x<\/code>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>byte(n, x)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u00a0<code>n<\/code>-\u0439 \u0431\u0430\u0439\u0442 \u0438\u0437 \u0447\u0438\u0441\u043b\u0430\u00a0<code>x<\/code>, \u0433\u0434\u0435 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 &#8212; \u044d\u0442\u043e 0-\u0439 \u0431\u0430\u0439\u0442.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>shl(x, y)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433\u00a0<code>y<\/code>\u00a0\u0432\u043b\u0435\u0432\u043e \u043d\u0430\u00a0<code>x<\/code>\u00a0\u0431\u0438\u0442.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>shr(x, y)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433\u00a0<code>y<\/code>\u00a0\u0432\u043f\u0440\u0430\u0432\u043e \u043d\u0430\u00a0<code>x<\/code>\u00a0\u0431\u0438\u0442.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h4>\u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>pop(x)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0434\u0430\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>x<\/code>\u00a0(\u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0439) \u0438\u0437 \u0441\u0442\u0435\u043a\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>gas()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u0433\u0430\u0437<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>address()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>caller()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e (\u0430\u043d\u0430\u043b\u043e\u0433 msg.sender)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>origin()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (\u0430\u043d\u0430\u043b\u043e\u0433 tx.origin)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>callvalue()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e wei, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>selfbalance()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0430\u043b\u0430\u043d\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>balance(a)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0430\u043b\u0430\u043d\u0441 \u0430\u0434\u0440\u0435\u0441\u0430\u00a0<code>a<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>gasprice()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0446\u0435\u043d\u0443 \u0433\u0430\u0437\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>timestamp()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043c\u0435\u0442\u043a\u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>number()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>return(p, s)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>p<\/code>\u00a0\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0435\u00a0<code>s<\/code>\u00a0\u0431\u0430\u0439\u0442\u043e\u0432. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>revert(p, s)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (state changes) \u0432 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>p<\/code>\u00a0\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0435\u00a0<code>s<\/code>\u00a0\u0431\u0430\u0439\u0442\u043e\u0432. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0437\u043e\u0432\u0430\u00a0<code>revert<\/code>\u00a0\u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>mod(x, y)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f\u00a0<code>x<\/code>\u00a0\u043d\u0430\u00a0<code>y<\/code>\u00a0(x % y). \u0415\u0441\u043b\u0438\u00a0<code>y<\/code>\u00a0\u0440\u0430\u0432\u043d\u043e 0, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f 0<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Yul \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c \u0432 EVM \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0438\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u043f\u0430\u043c\u044f\u0442\u044c. \u0412 EVM \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0438 \u0432\u0438\u0434\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 &#8212; memory, calldata \u0438 storage, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438.<\/p>\n<blockquote>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/em>\u00a0\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0435\u043a \u0432 EVM \u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u043d\u043e \u0442.\u043a. \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043d\u0438\u043c \u043a\u0440\u0430\u0439\u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b, \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0435\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c.<\/p>\n<\/blockquote>\n<h4>Storage<\/h4>\n<p>\u0412\u0438\u0434 \u043f\u0430\u043c\u044f\u0442\u0438 storage \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u043c\u0435\u0436\u0434\u0443 \u0431\u043b\u043e\u043a\u0430\u043c\u0438, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0430\u0436\u043d\u043e\u0439 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c\u00a0<a href=\"https:\/\/programtheblockchain.com\/posts\/2018\/03\/09\/understanding-ethereum-smart-contract-storage\/\"><u>\u043e\u0434\u0438\u043d \u0430\u0441\u0442\u0440\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432<\/u><\/a>\u00a0\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u043d\u0443\u043b\u044f\u043c\u0438, \u0442.\u0435. \u0443\u0436\u0435 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439. \u041a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u044d\u0442\u043e 32-\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0442. \u0412\u0441\u0435 \u0447\u0442\u043e \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>\u0412 storage \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 2 \u0432\u0438\u0434\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445: \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u043d\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Yul:<\/p>\n<ul>\n<li>\n<p>\u0437\u0430\u043f\u0438\u0441\u044c \u0432 storage \u0434\u043e\u0440\u043e\u0433\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u0440\u043e\u0447\u0435 32 \u0431\u0430\u0439\u0442 \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u0438 \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442;<\/p>\n<\/li>\n<li>\n<p>\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u043e\u0436\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u00a0<a href=\"https:\/\/noxx.substack.com\/p\/evm-deep-dives-the-path-to-shadowy-3ea?s=r\"><u>\u0442\u0443\u0442<\/u><\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/medium.com\/@hayeah\/diving-into-the-ethereum-vm-part-2-storage-layout-bc5349cb11b7\"><u>\u0442\u0443\u0442<\/u><\/a>. \u0421\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/internals\/layout_in_storage.html\"><u>\u0442\u0443\u0442<\/u><\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e storage \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>sload(p)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 storage \u043f\u043e \u043a\u043b\u044e\u0447\u0443\u00a0<code>p<\/code>\u00a0\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>sstore(p, v)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>v<\/code>\u00a0\u0432 storage \u043f\u043e \u043a\u043b\u044e\u0447\u0443\u00a0<code>p<\/code>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u043e\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>.slot<\/code>.<\/p>\n<pre><code class=\"javascript\">contract Storage {     uint256 x;      function setStorageValue(uint256 _x) public {         assembly {             sstore(x.slot, _x)         }     }      function getStorageValue() public view returns (uint256 ret) {         assembly {             ret := sload(x.slot)         }     }  }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>.offset<\/code>.<\/p>\n<blockquote>\n<p><strong>offset<\/strong> (\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435) \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043b\u043e\u0442\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f.<\/p>\n<\/blockquote>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 \u0432\u0441\u0435 \u043f\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u043e\u0442\u0435 0 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c. \u0423\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0430\u043b\u0435\u0432\u043e (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 a \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u044b\u0435 16 \u0431\u0430\u0439\u0442, \u0437\u0430\u0442\u0435\u043c b \u0437\u0430\u0439\u043c\u0435\u0442 \u0435\u0449\u0435 12, c \u2014 2 \u0431\u0430\u0439\u0442\u0430, d \u0438 e \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443). \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043e\u0434\u043d\u0443 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0431\u0430\u0439\u0442. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"javascript\">contract Storage {     uint256 x; \/\/ slot 0 - 32 bytes      uint128 a; \/\/ slot 1 - 16 bytes     uint96 b; \/\/ slot 1 - 12 bytes     uint16 c; \/\/ slot 1 - 2 bytes     uint8 d; \/\/ slot 1 - 1 bytes     uint8 e; \/\/ slot 1 - 1 bytes      function setCToPackedSlot(uint16 _c) public {         assembly {             \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u043b\u043e\u0442\u0430             let data := sload(c.slot)              \/\/ \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0431\u0430\u0439\u0442\u044b \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f.             \/\/ \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e uint16, \u043e\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 2 \u0431\u0430\u0439\u0442\u0430 (\u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0442\u0430\u043a\u043e\u043c \u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0447\u0442\u043e \u0438 \u043f\u0440\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0432 storage)             let cleared := and(data, 0xffff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff)              \/\/ \u0421\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043b\u0435\u0432\u043e \u043d\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 8 (1 \u0431\u0430\u0439\u0442 = 8 \u0431\u0438\u0442)             \/\/ \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e offset \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0432 \u0431\u0430\u0439\u0442\u0430\u0445, \u0430 \u0441\u0434\u0432\u0438\u0433 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c  \u0432 \u0431\u0438\u0442\u0430\u0445             let shifted := shl(mul(c.offset, 8), _c)              \/\/ \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u043e\u0447\u0438\u0449\u0435\u043d\u043d\u044b\u0439 \u0441\u043b\u043e\u0442 \u0438 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435             let newValue := or(shifted, cleared)              \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0441\u043b\u043e\u0442\u0435             sstore(c.slot, newValue)         }     }      function getCFromPackedSlot() public view returns (uint16 ret) {         assembly {             \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u043b\u043e\u0442\u0430             let data := sload(c.slot)              \/\/ \u0414\u0435\u043b\u0430\u0435\u043c \u0441\u0434\u0432\u0438\u0433 \u0432\u043f\u0440\u0430\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439             let shifted := shr(mul(c.offset, 8), data)              \/\/ \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043c\u0430\u0441\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439             ret := and(shifted, 0xffff)         }     } }<\/code><\/pre>\n<h3>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 storage<\/h3>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 storage \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0431\u0435\u0440\u0442\u043a\u043e\u0439, \u0430 \u0432\u0441\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u043e\u0442\u0430\u0445 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u043d\u0435 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u044b.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"javascript\">    \/\/ \u041c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438      \/\/ uint256 x; \/\/ slot 0 - 32 bytes      \/\/ uint128 a; \/\/ slot 1 - 16 bytes     \/\/ uint96 b; \/\/ slot 1 - 12 bytes     \/\/ uint16 c; \/\/ slot 1 - 2 bytes     \/\/ uint8 d; \/\/ slot 1 - 1 bytes     \/\/ uint8 e; \/\/ slot 1 - 1 bytes      \/\/ \u0410 \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0438\u0445 \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f     struct MyStruct {         uint256 x; \/\/ slot 0 - 32 bytes         uint128 a; \/\/ slot 1 - 16 bytes         uint96 b; \/\/ slot 1 - 12 bytes         uint16 c; \/\/ slot 1 - 2 bytes         uint8 d; \/\/ slot 1 - 1 bytes         uint8 e; \/\/ slot 1 - 1 bytes     }      MyStruct myStruct; \/\/ slot 0 - 62 bytes     uint256 value; \/\/ slot 2 - 32 bytes<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0441\u043b\u043e\u0442 0 \u0438 1 (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0441\u043b\u043e\u0442\u0435 1 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445)<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0442\u0435 \u0436\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443\u00a0<code>MyStruct<\/code>\u00a0\u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u043e\u043d\u0438 \u0442\u0430\u043a \u0436\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0441\u043b\u043e\u0442\u044b 0 \u0438 1.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0435\u0441\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c\u00a0<code>forge inspect<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ae4\/113\/d47\/ae4113d47e997b808d798d913497211c.png\" width=\"1708\" height=\"140\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ae4\/113\/d47\/ae4113d47e997b808d798d913497211c.png\"\/><\/figure>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f forge (\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Foundry) \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0442\u043e \u0438 \u0432 \u043a\u0430\u043a\u0438\u0445 \u0441\u043b\u043e\u0442\u0430\u0445 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435:<\/p>\n<pre><code class=\"bash\">    forge inspect &lt;contract-name> storage-layout --pretty<\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u0434\u0430\u0441\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432\u0440\u043e\u0434\u0435 \u0442\u043e\u0439, \u0447\u0442\u043e \u044f \u043f\u0440\u0438\u0432\u0435\u043b \u0432\u044b\u0448\u0435.<\/p>\n<h3>\u041c\u0430\u0441\u0441\u0438\u0432\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0432 storage<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e\u00a0<code>sload<\/code>. \u041d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u0441\u043b\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435\u00a0<code>\u0441\u043b\u043e\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 + \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/code>. \u041a\u043e\u0433\u0434\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u00a0<code>bytes32<\/code>, \u0442\u043e \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c:<\/p>\n<ul>\n<li>\n<p>slot 0: \u0441\u043b\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 0 + \u0438\u043d\u0434\u0435\u043a\u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 0 = \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0441\u043b\u043e\u0442\u0435 0;<\/p>\n<\/li>\n<li>\n<p>slot 1: 0 + 1 = 1;<\/p>\n<\/li>\n<li>\n<p>slot 2: 0 + 2 = 2;<\/p>\n<\/li>\n<li>\n<p>&#8230;<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">contract Storage {     \/\/ ...      uint256[5] arr = [11, 22, 33, 44, 55]; \/\/ slot 2 - 6     uint256 amount; \/\/ slot 7      function getValueFromArray(uint256 index) public view returns (uint256 value) {         assembly {             value := sload(add(arr.slot, index))         }     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430. \u0417\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u043d\u043e \u0447\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 5 \u0441\u043b\u043e\u0442\u043e\u0432 (\u0441\u043e 2\u0433\u043e \u043f\u043e 6 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e) \u0438 160 \u0431\u0430\u0439\u0442 \u043f\u0430\u043c\u044f\u0442\u0438 (32 * 5).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/54d\/86e\/d8e\/54d86ed8ea5e15d45b4920bf80aab9ad.png\" width=\"1466\" height=\"352\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/54d\/86e\/d8e\/54d86ed8ea5e15d45b4920bf80aab9ad.png\"\/><\/figure>\n<p>\u0414\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u0435\u043d\u0435\u0435 32 \u0431\u0430\u0439\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0434\u0438\u043d \u0441\u043b\u043e\u0442. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430\u00a0<code>packedArr<\/code>, \u043e\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 1 \u0441\u043b\u043e\u0442 (32 \u0431\u0430\u0439\u0442\u0430), \u0445\u043e\u0442\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 2 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/p>\n<pre><code class=\"javascript\">contract Storage {     \/\/ ...      uint256[5] arr = [11, 22, 33, 44, 55]; \/\/ slot 2 - 6     uint256 amount; \/\/ slot 7     uint128[2] packedArr = [21, 42]; \/\/ slot 8     uint256 amount2; \/\/ slot 9      function getPackedValueFromArray() public view returns (uint128 value) {         bytes32 packed;          assembly {             \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435             packed := sload(packedArr.slot)              \/\/ \u0414\u0435\u043b\u0430\u0435\u043c \u0441\u0434\u0432\u0438\u0433 \u0432\u043f\u0440\u0430\u0432\u043e \u043d\u0430 16 \u0431\u0430\u0439\u0442 (128 \u0431\u0438\u0442),             \/\/ \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 1             value := shr(mul(16, 8), packed)         }     } }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0436\u0435 \u0432\u0438\u0434\u043d\u043e \u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0b6\/b85\/00a\/0b6b8500a1e95d81c6ca188318458e26.png\" width=\"2092\" height=\"106\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0b6\/b85\/00a\/0b6b8500a1e95d81c6ca188318458e26.png\"\/><\/figure>\n<h3>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432 storage<\/h3>\n<p>\u0418\u0437-\u0437\u0430 \u0441\u0432\u043e\u0435\u0433\u043e \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0438\u043f\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u00ab\u043c\u0435\u0436\u0434\u0443\u00bb \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0437\u0430 \u043d\u0438\u043c\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0432\u0441\u0435\u0433\u043e 32 \u0431\u0430\u0439\u0442\u0430, \u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435\u0441\u044f \u0432 \u043d\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u043b\u043e\u0442\u0430 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0445\u0435\u0448\u0430 Keccak-256.<\/p>\n<p>\u0414\u043b\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u043e\u0442\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0438 \u0441\u0442\u0440\u043e\u043a\u0438).<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u00a0<code>keccak256(p)<\/code>\u00a0\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430: \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c. \u0414\u043b\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u0445 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0432\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/internals\/layout_in_storage.html#mappings-and-dynamic-arrays\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430:<\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u043e\u0442 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u0435\u0436\u0438\u0442 \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u0441\u043b\u043e\u0442\u0430 \u0432 memory<\/p>\n<\/li>\n<li>\n<p>\u0445\u0435\u0448\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u0441\u043b\u043e\u0442\u0430 (\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 memory \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f)<\/p>\n<\/li>\n<li>\n<p>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u0445\u0435\u0448\u0443 \u0438\u043d\u0434\u0435\u043a\u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0442\u0430 \u0432 storage<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">contract Storage {     \/\/ ...      uint256[] dynamicArr = [123, 345, 678];      function getValueFromDynamicArray(uint256 index) external view returns (uint256 value) {         uint256 slot;          assembly {             \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u043e\u0442 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u0435\u0436\u0438\u0442 \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430             slot := dynamicArr.slot              \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0445\u0435\u0448 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0436\u0435\u0442 \u043d\u0430 \u0441\u043b\u043e\u0442 \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430             \/\/ \u042d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 solidity:             \/\/ bytes32 ptr = keccak256(abi.encode(slot));             mstore(0x00, slot)             let ptr := keccak256(0x00, 0x20)              \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443             value := sload(add(ptr, index))         }     } }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c\u00a0<code>sload<\/code>\u00a0\u0434\u043b\u044f \u0441\u043b\u043e\u0442\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f:<\/p>\n<pre><code class=\"javascript\">    uint256[] dynamicArr = [123, 345, 678]; \/\/ slot 10      function getDynamicArrayLength() external view returns (uint256 length) {         assembly {             length := sload(dynamicArr.slot)         }     }<\/code><\/pre>\n<h3>\u041c\u0430\u043f\u043f\u0438\u043d\u0433\u0438<\/h3>\n<p>\u041c\u0430\u043f\u043f\u0438\u043d\u0433\u0438 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c, \u043d\u043e \u043e\u043d\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442 \u043a\u043b\u044e\u0447 \u0438 \u0441\u043b\u043e\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u043e\u0442<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 memory \u043a\u043b\u044e\u0447<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 memory \u0441\u043b\u043e\u0442<\/p>\n<\/li>\n<li>\n<p>\u0445\u0435\u0448\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u044e\u0447 \u0438 \u0441\u043b\u043e\u0442<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e \u0445\u0435\u0448\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">contract Storage {     \/\/ ...      mapping(uint256 => uint256) map;      function getValueFromMapping(uint256 key) public view returns (uint256 value) {         bytes32 slot;          assembly {             \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u043e\u0442 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430             slot := map.slot              \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0445\u0435\u0448 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0436\u0435\u0442 \u043d\u0430 \u0441\u043b\u043e\u0442 \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430             \/\/ \u042d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 solidity:             \/\/ bytes32 ptr = keccak256(abi.encode(key, uint256(slot)));             mstore(0x00, key)             mstore(0x20, slot)             let ptr := keccak256(0x00, 0x40)              \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430             value := sload(ptr)         }     } }<\/code><\/pre>\n<h3>\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0438<\/h3>\n<p>\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b, \u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0445\u0435\u0448\u0438 \u0445\u0435\u0448\u0435\u0439. \u041a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u044f \u0438 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0430\u043b\u0435\u0432\u043e.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0445\u0435\u0448 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u0445\u0435\u0448\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 + \u0445\u0435\u0448 (\u0441\u043b\u043e\u0442 + \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043b\u044e\u0447):<\/p>\n<pre><code class=\"javascript\">contract Storage {     \/\/ ...      mapping(uint256 => mapping(uint256 => uint256)) nestedMap;      function getValueFromNestedMapping(uint256 key1, uint256 key2) public view returns (uint256 value) {         bytes32 slot;         assembly {             slot := nestedMap.slot              \/\/ bytes32 ptr2 = keccak256(abi.encode(key2, keccak256(abi.encode(key1, uint256(slot)))));             mstore(0x00, key1)             mstore(0x20, slot)             let ptr1 := keccak256(0x00, 0x40)              mstore(0x00, key2)             mstore(0x20, ptr1)             let ptr2 := keccak256(0x00, 0x40)              value := sload(ptr2)         }     } }<\/code><\/pre>\n<h3>\u041c\u0430\u043f\u043f\u0438\u043d\u0433\u0438 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0441\u043b\u043e\u0442 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0445\u0435\u0448 \u043e\u0442 \u0445\u0435\u0448\u0430 (\u043a\u043b\u044e\u0447 + \u0441\u043b\u043e\u0442). \u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c.<\/p>\n<p>\u0410 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c\u00a0<code>sload<\/code>\u00a0\u0434\u043b\u044f \u0445\u0435\u0448\u0430 (\u043a\u043b\u044e\u0447 + \u0441\u043b\u043e\u0442)<\/p>\n<pre><code class=\"javascript\">contract Storage {     \/\/ ...      mapping(address => uint256[]) arrayInMap;      function getValueFromArrayNestedInMapping(address key, uint256 index) public view returns (uint256 value, uint256 length) {         bytes32 slot;          assembly {             slot := arrayInMap.slot         }          bytes32 arrSlot = keccak256(abi.encode(key, slot));         bytes32 ptr = keccak256(abi.encode(arrSlot));          assembly {             value := sload(add(ptr, index))             length := sload(arrSlot)         }     } }<\/code><\/pre>\n<h3>\u041c\u0430\u0441\u0441\u0438\u0432\u044b \u0431\u0430\u0439\u0442\u043e\u0432 \u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 storage<\/h3>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/em>\u00a0\u0414\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0442\u0438\u043b\u0438\u0442\u044b cast (Foundry):<\/p>\n<ul>\n<li>\n<p><code>--to-base &lt;number> &lt;number system><\/code>\u00a0&#8212; \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0447\u0438\u0441\u0435\u043b \u0438\u0437 \u043e\u0434\u043d\u043e\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u0443\u044e, \u043f\u0440\u0438\u043c.\u00a0<code>cast --to-base 0x20 10<\/code>\u00a0\u0434\u0430\u0441\u0442 \u0447\u0438\u0441\u043b\u043e 32 \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442\u00a0<code>--to-base 32 16<\/code>\u00a0\u0434\u0430\u0441\u0442 0x20, \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u0443\u044e (\u0438\u0437 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0439). \u041b\u0438\u0431\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b\u00a0<code>--to-hex<\/code>,\u00a0<code>--to-dec<\/code>\u00a0\u0438 \u0442.\u0434.<\/p>\n<\/li>\n<li>\n<p><code>--format-bytes32-string &lt;string><\/code>\u00a0&#8212; \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 hex<\/p>\n<\/li>\n<li>\n<p><code>--parse-bytes32-string &lt;hex><\/code>\u00a0&#8212; \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 hex \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0415\u0441\u043b\u0438 \u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 cast, \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c, \u0442\u0430\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e. \u0412\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b\u00a0<code>cast -h<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a,\u00a0<code>bytes<\/code>\u00a0\u0438\u00a0<code>string<\/code>\u00a0\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 storage \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u043d\u043e \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u0432\u0430\u0436\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043d\u044f\u0442\u043d\u0430 \u0438\u0437\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/internals\/layout_in_storage.html#bytes-and-string\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>.<\/p>\n<p>\u0412 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442 \u0434\u043b\u0438\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 31 \u0431\u0430\u0439\u0442\u0430, \u0432 \u0441\u043b\u043e\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0430 (\u043f\u0440\u0438\u0447\u0435\u043c \u043d\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435), \u0430 \u043f\u043e \u0445\u0435\u0448\u0443 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u0442\u0430 &#8212;\u00a0<code>keccak256(p)<\/code>\u00a0\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043a \u043c\u043b\u0430\u0434\u0448\u0435\u043c\u0443.<\/p>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u0412\u0437\u044f\u0432 \u0445\u0435\u0448 \u043e\u0442 \u0441\u043b\u043e\u0442\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u043b\u043e\u0442 \u0433\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u043e\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 32 \u0431\u0430\u0439\u0442\u0430 (32 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0441\u0442\u0440\u043e\u043a\u0438), \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u043b\u0438\u043d\u043d\u0435\u0435, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u043b\u043e\u0442\u0430\u0445, \u0442\u0430\u043a \u0436\u0435 \u043e\u0442 \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043a \u043c\u043b\u0430\u0434\u0448\u0435\u043c\u0443.<\/p>\n<\/blockquote>\n<p>\u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u00a0<code>bytes<\/code>\u00a0(\u0438\u043b\u0438\u00a0<code>string<\/code>) \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u0430 31 \u0431\u0430\u0439\u0442\u0443? \u0422\u0430\u043a\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d &#171;\u043d\u0430 \u043c\u0435\u0441\u0442\u0435&#187;, \u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0432 \u0442\u043e\u043c \u0441\u043b\u043e\u0442\u0435 \u0433\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c 0-\u0439 (\u043c\u043b\u0430\u0434\u0448\u0438\u0439) \u0431\u0430\u0439\u0442 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a \u0436\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438 (\u043d\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439, \u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e).<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438 (\u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0439\u0442). \u0415\u0441\u0442\u044c 2 \u0444\u043e\u0440\u043c\u0443\u043b\u044b:<\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u0430 31 \u0431\u0430\u0439\u0442\u0443 &#8212;\u00a0<code>length * 2<\/code><\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 31 \u0431\u0430\u0439\u0442\u0430 &#8212;\u00a0<code>length * 2 + 1<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u043e \u043c\u043b\u0430\u0434\u0448\u0435\u043c\u0443 \u0431\u0438\u0442\u0443 (LSB &#8212; least significant bit) \u0441 \u043a\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e. \u0415\u0441\u043b\u0438 \u0441\u0430\u043c\u044b\u0439 \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d (\u0440\u0430\u0432\u0435\u043d 0), \u0437\u043d\u0430\u0447\u0438\u0442 \u044d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u0430 \u0435\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d (\u0440\u0430\u0432\u0435\u043d 1) &#8212; \u0434\u043b\u0438\u043d\u043d\u0430\u044f.<\/p>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435: \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0443 \u043d\u0430\u0441 \u0432 storage \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430 &#171;Hello, world!&#187;, \u0434\u043b\u0438\u043d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 13 \u0431\u0430\u0439\u0442, \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u0432 hex \u043f\u043e\u043b\u0443\u0447\u0438\u043c\u00a0<code>0x48656c6c6f2c20776f726c6421<\/code>, \u0442\u0443\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0439\u0442 \u044d\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b UTF-8 (48 &#8212; \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u0430\u044f &#171;H&#187;, 65 &#8212; \u0441\u0442\u0440\u043e\u0447\u043d\u0430\u044f &#171;e&#187;, 2c &#8212; &#171;,&#187;, 20 &#8212; \u043f\u0440\u043e\u0431\u0435\u043b \u0438 \u0442.\u0434), \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e 32 \u0431\u0430\u0439\u0442, \u0430 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u0443\u044e \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435\u00a0<code>13 * 2 = 26<\/code>\u00a0(<code>0x1a<\/code>\u00a0\u0432 hex). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 32-\u0431\u0430\u0439\u0442\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u00a0<code>0x48656c6c6f2c20776f726c64210000000000000000000000000000000000001a<\/code>, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d 0 &#8212; 00000000010010000110010101101100011011000110111100101100001000000111011101101111011100100110110001100100001000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001101<strong>0<\/strong>.<\/p>\n<p>\u0415\u0449\u0435 \u0440\u0430\u0437. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u044b\u00a0<code>length * 2<\/code>\u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u044b\u043c (\u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c). \u0418 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u044b<code>length * 2 + 1<\/code>, \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 1.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Yul. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 3 \u0441\u0442\u0440\u043e\u043a\u0438 \u0440\u0430\u0437\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b &#8212; \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432 Remix \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a). \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0430 \u0434\u0432\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">contract Storage {     \/\/\/ ...      \/\/ \u0442\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0441\u043b\u043e\u0442\u0435, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0431\u0430\u0439\u0442 - \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0434\u043b\u0438\u043d\u0430 (0x1a)     \/\/ 0x48656c6c6f2c20776f726c64210000000000000000000000000000000000001a \/\/ str.slot     string str = \"Hello, world!\"; \/\/ 13 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432      \/\/ \u044d\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 31 \u0441\u0438\u043c\u0432\u043e\u043b, \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0431\u0430\u0439\u0442\u0435 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u0438\u043d\u0430 (0x3e)     \/\/ 0x48656c6c6f2c207468697320697320612074657374207068726173652030323e \/\/ str.slot     string str = \"Hello, this is a test phrase 02\"; \/\/ 31 \u0441\u0438\u043c\u0432\u043e\u043b      \/\/ \u0430 \u044d\u0442\u043e \u0434\u043b\u0438\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u0437\u0434\u0435\u0441\u044c \u0432 \u0441\u043b\u043e\u0442\u0435 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0435 \u0434\u043b\u0438\u043d\u0430 (0x4b)     \/\/ 0x000000000000000000000000000000000000000000000000000000000000004b \/\/ str.slot     \/\/ 0x48656c6c6f2c2074686973206973206120746573742070687261736520666f72 \/\/ keccak(str.slot)     \/\/ 0x2077696b69000000000000000000000000000000000000000000000000000000 \/\/ keccak(str.slot) + 1     string str = \"Hello, this is a test phrase for wiki\"; \/\/ 37 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432      function getStringInfo() external view returns (uint256 length, bytes32 lsb, bytes32 strBytes, bytes32 slot) {         assembly {             \/\/ \u041a\u0435\u0448\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u043e\u0442             slot := str.slot             \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043b\u043e\u0442\u0430             strBytes := sload(slot)             \/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442             let _arr := strBytes             \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043b\u0430\u0434\u0448\u0435\u0433\u043e \u0431\u0438\u0442\u0430             lsb := and(_arr, 0x1)              \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0440\u0430\u0432\u0435\u043d \u043b\u0438 \u043e\u043d 0             if iszero(lsb) {                 \/\/ \u0411\u0435\u0440\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \u0438 \u0434\u0435\u043b\u0438\u043c \u043d\u0430 2 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438                 length := div(byte(31, strBytes), 2)             }              \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 0             if gt(lsb, 0) {                 \/\/ \u041e\u0442\u043d\u0438\u043c\u0430\u0435\u043c 1 \u0438 \u0434\u0435\u043b\u0438\u043c \u043d\u0430 2 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438                 length := div(sub(strBytes, 1), 2)                  \/\/ \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 memory \u043d\u043e\u043c\u0435\u0440 \u0441\u043b\u043e\u0442\u0430                 mstore(0x00, slot)                 \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0445\u0435\u0448 \u0441\u043b\u043e\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0433\u0434\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u0435\u0436\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0430                 slot := keccak256(0x00, 0x20)             }         }     } }<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435:<\/p>\n<ul>\n<li>\n<p>\u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u0441\u043b\u043e\u0442\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u0435\u0436\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0430 (\u0438\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438)<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043b\u043e\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<code>sload<\/code><\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0432\u043e\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e\u00a0<code>_arr<\/code>\u00a0\u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043b\u043e\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0418 (AND) \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 lsb (\u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043b\u0430\u0434\u0448\u0435\u0433\u043e \u0431\u0438\u0442\u0430)<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u043b\u0438 lsb \u0440\u0430\u0432\u0435\u043d 0 (<code>iszero(lsb)<\/code>), \u0437\u043d\u0430\u0447\u0438\u0442 \u044d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430<\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0431\u0430\u0439\u0442 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0434\u043b\u0438\u043d\u0430 (<code>and(_arr, 0x1)<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0435\u043b\u0438\u043c \u044d\u0442\u0443 \u0434\u043b\u0438\u043d\u0443 \u043d\u0430 2 (<code>div(byte(31, strBytes), 2)<\/code>) \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438 (\u0441 \u044d\u0442\u0438\u043c \u0437\u043d\u0430\u043d\u0438\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0435\u0435 \u0432 memory \u0438 \u043e\u0442\u0434\u0430\u0442\u044c \u043d\u0430\u0440\u0443\u0436\u0443, \u043d\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 lsb \u0431\u043e\u043b\u044c\u0448\u0435 0 (<code>gt(lsb, 0)<\/code>)<\/p>\n<ul>\n<li>\n<p>\u043e\u0442\u043d\u0438\u043c\u0430\u0435\u043c \u043e\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u044b 1 (<code>sub(strBytes, 1)<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043b\u0438\u043c \u043d\u0430 2 (<code>div(sub(strBytes, 1), 2)<\/code>) \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u0441\u043b\u043e\u0442\u0430 \u0432 memory, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0435\u0433\u043e \u0445\u0435\u0448<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0445\u0435\u0448 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0441\u043b\u043e\u0442\u0430 (\u044d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0442 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0438\u043b\u0438 \u0435\u0435 \u043d\u0430\u0447\u0430\u043b\u043e)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/yul\/examples\/Storage.sol\"><u>Storage.sol<\/u><\/a>.<\/p>\n<h4>Memory<\/h4>\n<p>\u0412\u0438\u0434 \u043f\u0430\u043c\u044f\u0442\u0438 memory \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u041e\u043d\u0430 \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u041f\u0430\u043c\u044f\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<ul>\n<li>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0416\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 keccak256.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0447\u0442\u043e \u0432 memory \u043f\u0430\u043c\u044f\u0442\u044c \u0440\u0430\u0437\u0431\u0438\u0442\u0430 \u043d\u0430 32-\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0435 \u0441\u043b\u043e\u0442\u044b \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0430\u0441\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u043a\u0440\u0430\u0442\u043d\u044b\u0435 0x20 &#8212; (0x40, 0x60, 0x80, 0xa0, &#8230;), \u0442\u0430\u043a \u0432\u043e\u0442 \u043f\u0435\u0440\u0432\u044b\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u043b\u043e\u0442\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439, \u044d\u0442\u043e \u0441\u043b\u043e\u0442\u044b \u0441 0x00 \u043f\u043e 0x60 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b64\/1fa\/e8c\/b641fae8c8272e19648d2d107b877ec2.png\" width=\"720\" height=\"217\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b64\/1fa\/e8c\/b641fae8c8272e19648d2d107b877ec2.png\"\/><\/figure>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u0441\u043b\u043e\u0442\u0430 \u0438\u043b\u0438 64 \u0431\u0430\u0439\u0442\u0430 (0x00 &#8212; 0x3f) \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 32 \u0431\u0430\u0439\u0442\u0430 (0x40 &#8212; 0x5f) \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u043b\u043e\u0442 (0x60 &#8212; 0x7f), \u044d\u0442\u0438 32 \u0431\u0430\u0439\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043d\u0443\u043b\u044f\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043d\u0438\u0445 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f;<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 EVM \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0442\u0440\u0435\u0445 \u043e\u043f\u043a\u043e\u0434\u043e\u0432:\u00a0<code>PUSH1(0x80)<\/code>,\u00a0<code>PUSH1(0x40)<\/code>,<code>MSTORE<\/code>\u00a0&#8212; \u044d\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u0433\u0434\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438\u00a0<code>0x80<\/code>\u00a0(128-\u0439 \u0431\u0430\u0439\u0442) \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u043e\u0442 0x40, \u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u0441\u043b\u043e\u0442\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0443\u043b\u044f\u043c\u0438, \u0430 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 memory \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f 0x80.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ef8\/5e4\/394\/ef85e4394ca2caec8255ec68574a1678.png\" width=\"1632\" height=\"174\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ef8\/5e4\/394\/ef85e4394ca2caec8255ec68574a1678.png\"\/><\/figure>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u0441\u043b\u043e\u0442\u0435 storage, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 memory.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u0434\u0440\u0435\u0441 (\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435) \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0442\u0430,<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0443\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 storage,<\/p>\n<\/li>\n<li>\n<p>\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     uint256 value = 42; \/\/ slot 0      function getValue() external view returns (uint256) {         assembly {             \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f value, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0441\u043b\u043e\u0442\u0435             let _value := sload(value.slot)              \/\/ \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \"\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\" \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c memory             let ptr := mload(0x40)              \/\/ \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0443\u0434\u0430 \u043d\u0430\u0448\u0435 \u0447\u0438\u0441\u043b\u043e             mstore(ptr, _value)              \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e             return(ptr, 0x20)         }     } }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432 memory \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0448\u0435, \u0433\u0434\u0435\u00a0<code>value<\/code>\u00a0\u0440\u0430\u0432\u043d\u043e 42 (0x2a \u0432 hex). \u0411\u0435\u0440\u0435\u043c \u0435\u0433\u043e \u0438\u0437 storage \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u0441\u043b\u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0x80 (\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043d\u0430 128 \u0431\u0430\u0439\u0442 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cfc\/ebc\/9d6\/cfcebc9d6a627d946439f27949a7b56f.png\" width=\"1646\" height=\"584\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cfc\/ebc\/9d6\/cfcebc9d6a627d946439f27949a7b56f.png\"\/><\/figure>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 solidity, \u043d\u043e\u00a0<strong>\u041d\u0415 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f<\/strong>\u00a0assembly \u0432\u0441\u0442\u0430\u0432\u043a\u043e\u0439 (Yul), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u043a\u043e\u0434 Solidity \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430 inline assembly \u043a\u043e\u0434\u043e\u043c. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0441 Yul \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 Solidity \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0434 Solidity \u043c\u043e\u0433 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<\/blockquote>\n<p>\u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function allocateMemory() external pure {         assembly {             \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 memory \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f 3 \u0441\u043b\u043e\u0442\u0430             let freeMemoryPointer := mload(0x40)             mstore(freeMemoryPointer, 1)             mstore(add(freeMemoryPointer, 0x20), 2)             mstore(add(freeMemoryPointer, 0x40), 3)              \/\/ \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f             allocate(0x60)              \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0430\u043c\u044f\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0432\u044b\u0448\u0435             \/\/ \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c             function allocate(length) {                 let pos := mload(0x40)                 mstore(0x40, add(pos, length))             }         }     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 memory \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>mload(p)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 32-\u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>p<\/code>, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>mstore(p, v)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>v<\/code>\u00a0\u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>p<\/code>. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>v<\/code>\u00a0\u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c 32 \u0431\u0430\u0439\u0442\u0430 \u0432 \u0434\u043b\u0438\u043d\u0443.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>mstore8(p, v)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0<code>v<\/code>\u00a0(\u0442.\u0435.,\u00a0<code>v &amp; 0xff<\/code>) \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443\u00a0<code>p<\/code>. \u042d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>msize()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0430\u043c\u044f\u0442\u0438, \u0442.\u0435. \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0430\u043c\u044f\u0442\u0438, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 memory \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u0432 \u043d\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 memory<\/h3>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      struct S {         uint256 a;         uint256 b;     }      function getStructValuesAndFreeMemoryPointer()         external         pure         returns (uint256 a, uint256 b, bytes32 freeMemoryPointer)     {         \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0443\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f         S memory s = S({a: 21, b: 42});          assembly {             a := mload(0x80) \/\/ \u0432\u0435\u0440\u043d\u0435\u0442 a (21), \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0432 solidity - 0x80             b := mload(0xa0) \/\/ \u0432\u0435\u0440\u043d\u0435\u0442 b (42), \u0432\u0442\u043e\u0440\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u043e\u043c \u0437\u0430 \u043f\u0435\u0440\u0432\u044b\u043c              \/\/ \u041d\u043e\u0432\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c - 0xc0 (0x80 + 32 bytes * 2)             freeMemoryPointer := mload(0x40)         }     } }<\/code><\/pre>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 storage \u0432 memory \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 32 \u0431\u0430\u0439\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0439\u043c\u0435\u0442 62 \u0431\u0430\u0439\u0442\u0430 \u0430 \u043d\u0435 32, \u0445\u043e\u0442\u044f \u0432 storage \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0431\u044b \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u044b \u0432 32:<\/p>\n<\/blockquote>\n<pre><code class=\"javascript\">    struct S {         uint128 a; \/\/ \u0437\u0430\u0439\u043c\u0435\u0442 32 \u0431\u0430\u0439\u0442\u0430         uint128 b; \/\/ \u0437\u0430\u0439\u043c\u0435\u0442 32 \u0431\u0430\u0439\u0442\u0430     }<\/code><\/pre>\n<h3>\u041c\u0430\u0441\u0441\u0438\u0432\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0432 memory<\/h3>\n<p>\u0424\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function getFixedArrayValues() external pure returns (uint256 a, uint256 b) {         uint256[2] memory arr;         arr[0] = 21;         arr[1] = 42;          assembly {             a := mload(0x80) \/\/ \u0432\u0435\u0440\u043d\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 0             b := mload(0xa0) \/\/ \u0432\u0435\u0440\u043d\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 1         }     } }<\/code><\/pre>\n<h3>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432 memory<\/h3>\n<p>\u0414\u043b\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u043e\u0442 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0431\u044a\u0435\u043c\u043e\u043c 32 \u0431\u0430\u0439\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412 Yul \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 &#8212; \u044d\u0442\u043e \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function getDynamicArrayValues(uint256[] memory arr) external pure returns (uint256 a, uint256 b, uint256 length) {         assembly {             \/\/ \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 - \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 0x80)             let ptr := arr             \/\/ \u0432 \u043d\u0435\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430             length := mload(ptr)              a := mload(add(ptr, 0x20)) \/\/ \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 0             b := mload(add(ptr, 0x40)) \/\/ \u043f\u043e\u0441\u043b\u0435 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 1 \u0438 \u0442.\u0434.         }     } }<\/code><\/pre>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u0415\u0441\u043b\u0438 \u0432\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u043e\u0439 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 Solidity, \u043e\u043d \u043d\u0435 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 memory, \u0442\u043e\u0447\u043d\u0435\u0435 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u043b\u043e\u0442 0x60, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0443 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<\/blockquote>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function setValuesToDynamicArray() external pure returns (uint256[] memory) {         uint256[] memory arr;          \/\/ \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 memory = [42, 43]         assembly {             \/\/ \u0441\u0435\u0439\u0447\u0430\u0441 arr \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 0x60              \/\/ \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043c \u0435\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c             arr := mload(0x40)             \/\/ \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u043b\u0438\u043d\u0443 \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 - 2 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430             mstore(arr, 2)             \/\/ \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432             mstore(add(arr, 0x20), 42)             mstore(add(arr, 0x40), 43)              \/\/ \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c             mstore(0x40, add(arr, 0x60))         }          return arr;     } }<\/code><\/pre>\n<h3>\u041c\u0430\u0441\u0441\u0438\u0432\u044b \u0431\u0430\u0439\u0442\u043e\u0432 \u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 memory<\/h3>\n<p>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432 memory \u0432\u0441\u0435\u0433\u0434\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440, \u043a\u0440\u0430\u0442\u043d\u044b\u0439 32 \u0431\u0430\u0439\u0442\u0430\u043c, \u044d\u0442\u043e \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0434\u0430\u0436\u0435 \u0434\u043b\u044f\u00a0<code>bytes1[]<\/code>,\u00a0<strong>\u043d\u043e \u043d\u0435 \u0434\u043b\u044f\u00a0<\/strong><code>bytes<\/code>\u00a0\u0438\u00a0<code>string<\/code>.<\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u0430\u00a0<code>bytes<\/code>\u00a0\u0438\u00a0<code>string<\/code>\u00a0&#8212; \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b. \u0414\u043b\u0438\u043d\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u043e\u0442\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0437\u0430 \u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 memory \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435 \u0442\u0430\u043a\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0440\u0430\u0432\u043d\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u043e \u043b\u0435\u0432\u043e\u043c\u0443 \u043a\u0440\u0430\u044e 32-\u0445 \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0445 \u0441\u043b\u043e\u0442\u043e\u0432, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0432 storage, \u043d\u043e \u0442\u0443\u0442 \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043b\u043e\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 storage, \u0430 \u0432 memory \u0438 calldata \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435 &#8212; \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f.<\/p>\n<\/blockquote>\n<p>\u0422\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u00a0<code>bytes<\/code>\u00a0\u0432 memory.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function getStringInfo() external pure returns (uint256 len, bytes21 strInBytes) {         string memory str = \"Hello, this is a test\"; \/\/ 21 \u0441\u0438\u043c\u0432\u043e\u043b (0x15 \u0432 hex)          assembly {             len := mload(0x80) \/\/ \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u043e\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430             strInBytes := mload(0xa0) \/\/ \u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432         }     } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435 \u043a\u0430\u043a \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0432 memory, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443\u00a0<code>0x40<\/code>\u00a0(\u0442.\u043a.\u00a0<code>0x60<\/code>\u00a0\u044d\u0442\u043e \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u043b\u043e\u0442 \u0438 \u0432 \u043d\u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c &#8212; \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u00a0<code>0x80<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u0432\u00a0<code>0x80<\/code>\u00a0\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 &#171;Hello, this is a test&#187; &#8212; 21 \u0431\u0430\u0439\u0442 (<code>0x15<\/code>))<\/p>\n<\/li>\n<li>\n<p>\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c &#171;\u0441\u043b\u043e\u0442\u0435&#187; \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043f\u043e \u043b\u0435\u0432\u043e\u043c\u0443 \u043a\u0440\u0430\u044e \u0441\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 UTF-8 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432\u00a0<code>48 65 6c 6c 6f 2c 20 74 68 69 73 20 69 73 20 61 20 74 65 73 74<\/code><\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0432\u00a0<code>0x40<\/code>, \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u00a0<code>0xc0<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0424\u043e\u043a\u0443\u0441 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432 memory \u044d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0442\u0430\u043a\u00a0<code>15 48 65 6c 6c 6f 2c 20 74 68 69 73 20 69 73 20 61 20 74 65 73 74<\/code>. \u0427\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0445 \u0441\u043b\u043e\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b (\u0441\u0442\u0435\u043a\u043e\u0432\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 32-x \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438) \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f66\/caf\/4aa\/f66caf4aac02dcb321deb9725ffce0b3.png\" width=\"1664\" height=\"272\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f66\/caf\/4aa\/f66caf4aac02dcb321deb9725ffce0b3.png\"\/><\/figure>\n<p>\u0412\u044b\u0448\u0435 \u0431\u044b\u043b \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u0430\u043a \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 memory, \u043d\u043e \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function getString() external pure returns (string memory str) {         str = \"Hello, this is a test\";     } }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u043d\u0435 \u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u043f\u0430\u043c\u044f\u0442\u044c, \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0438 \u0437\u0430\u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0432 memory \u0441\u043d\u043e\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u043f\u0435\u0440\u0435\u0434 \u0434\u043b\u0438\u043d\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e 32 \u0431\u0430\u0439\u0442\u0430 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c\u00a0<code>0x20<\/code>\u00a0(32). \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043e\u0437\u0440\u0430\u0437\u0438\u0442\u044c \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 32 \u0431\u0430\u0439\u0442, \u0442.\u043a. \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u043c\u0435\u0441\u0442\u0430 (21 \u0431\u0430\u0439\u0442), \u043d\u043e \u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u0434\u043e\u00a0<code>0xc0<\/code>.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c7c\/9a7\/0cd\/c7c9a70cd14aaa74b818730e1f1f9700.png\" width=\"965\" height=\"208\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c7c\/9a7\/0cd\/c7c9a70cd14aaa74b818730e1f1f9700.png\"\/><\/figure>\n<p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00a0<code>0x20 <\/code>, \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0436\u0435\u043b\u0442\u043e\u0439 \u0431\u0443\u043c\u0430\u0433\u0435 \u0438\u043b\u0438 \u0433\u0434\u0435-\u0442\u043e \u0435\u0449\u0435 \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u043c\u043e\u0438\u043c \u0441\u043b\u043e\u0432\u0430\u043c, \u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0435: \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u044f\u0432\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 32 \u0431\u0430\u0439\u0442\u0430, \u0442\u043e \u0442\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u0430 \u0434\u043b\u0438\u043d\u0430 \u043a\u0430\u043a \u0431\u044b &#171;\u043e\u0442\u043a\u0443\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f&#187; \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0439\u0442\u043e\u0432. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0441\u0430\u043c\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e\u00a0<code>0x20<\/code>.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u0438\u043d\u043e\u0439 153 \u0441\u0438\u043c\u0432\u043e\u043b\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e3b\/298\/de0\/e3b298de03888061fe7df8ca7273a216.png\" width=\"845\" height=\"338\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e3b\/298\/de0\/e3b298de03888061fe7df8ca7273a216.png\"\/><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a &#171;\u0432\u0440\u0443\u0447\u043d\u0443\u044e&#187; \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Yul \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u00a0<a href=\"https:\/\/github.com\/ProjectOpenSea\/seaport\/blob\/539f0c18af85152aff9d64d90a55cf1627fd3e25\/contracts\/Seaport.sol#L102C9-L102C9\"><u>Seaport<\/u><\/a>\u00a0\u043e\u0442 OpenSea \u0438 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0<a href=\"https:\/\/github.com\/ProjectOpenSea\/seaport\/blob\/539f0c18af85152aff9d64d90a55cf1627fd3e25\/contracts\/Seaport.sol#L102C9-L102C9\"><u>_name()<\/u><\/a>\u00a0\u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0438\u0437 7-\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 &#8212; Seaport. \u0412 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0439\u0442\u043e\u0432 \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0442\u0430\u043a:\u00a0<code>07 53 65 61 70 6f 72 74<\/code>.<\/p>\n<pre><code class=\"javascript\">    function _name() internal pure override returns (string memory) {         \/\/ Return the name of the contract.         assembly {             mstore(0x20, 0x20)             mstore(0x47, 0x07536561706f7274)             return(0x20, 0x60)         }     }<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p><code>mstore(0x20, 0x20)<\/code>\u00a0&#8212; \u0431\u0435\u0440\u0435\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u00a0<code>0x20<\/code>\u00a0\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0443\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>0x20<\/code><\/p>\n<\/li>\n<li>\n<p><code>mstore(0x47, 0x07536561706f7274)<\/code>\u00a0&#8212; \u0431\u0435\u0440\u0435\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u00a0<code>0x47<\/code>\u00a0\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0443\u0434\u0430 \u043d\u0430\u0448 \u043c\u0430\u0441\u0441\u0438\u0432<\/p>\n<\/li>\n<li>\n<p><code>return(0x20, 0x60)<\/code>\u00a0&#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c\u00a0<code>0x60<\/code>\u00a0\u0431\u0430\u0439\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f\u00a0<code>0x20<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 memory:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6dc\/05d\/b5b\/6dc05db5bc2a97b6ae90cc5227114b91.png\" width=\"859\" height=\"100\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6dc\/05d\/b5b\/6dc05db5bc2a97b6ae90cc5227114b91.png\"\/><\/figure>\n<p>\u0418 \u0432\u0438\u0434\u0438\u043c \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438\u0441\u044c \u043a\u0430\u043a \u043d\u0430\u0434\u043e, \u0435\u0441\u0442\u044c\u00a0<code>0x20<\/code>, \u0437\u0430\u0442\u0435\u043c \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u00a0<code>0x07<\/code>\u00a0\u0438 \u0441\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e \u043b\u0435\u0432\u043e\u043c\u0443 \u043a\u0440\u0430\u044e. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u0435\u0441\u0442\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u00a0<code>0x47<\/code>, \u0430 \u043d\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0440\u0430\u0442\u043d\u043e\u0435 32-\u043c \u0431\u0430\u0439\u0442\u0430\u043c (<code>0x20<\/code>). \u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a.<\/p>\n<p>\u0412\u043e\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 32 \u0431\u0430\u0439\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u044c, \u043e\u043d\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u0437\u0435\u043b\u0435\u043d\u044b\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438\u00a0<code>mstore(0x47, 0x07536561706f7274)<\/code>\u00a0\u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u00a0<code>0x07536561706f7274<\/code>\u00a0\u0431\u044b\u043b \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d \u043d\u0443\u043b\u044f\u043c\u0438 \u0441\u043f\u0435\u0440\u0435\u0434\u0438 \u0434\u043e 32-x \u0431\u0430\u0439\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3ca\/6da\/1c4\/3ca6da1c4f809c69b88cc82abb096443.png\" width=\"825\" height=\"102\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ca\/6da\/1c4\/3ca6da1c4f809c69b88cc82abb096443.png\"\/><\/figure>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function getSeaport() external pure returns (string memory, uint256 len, bytes7 arr) {         assembly {             mstore(0x20, 0x20) \/\/ \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u043e\u0442 \u0432\u0437\u044f\u0442 \u0434\u043b\u044f \u0441\u0445\u043e\u0436\u0435\u0441\u0442\u0438 \u0441 \u043e\u0440\u0438\u0433. \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c             mstore(0x40, 0x07) \/\/ \u0441\u044e\u0434\u0430 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043b\u0438\u043d\u0443             mstore(0x60, 0x536561706f727400000000000000000000000000000000000000000000000000) \/\/ \u0430 \u0441\u044e\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f             return(0x20, 0x60) \/\/ \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c 96 \u0431\u0430\u0439\u0442         }     } }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0434\u0432\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 &#8212;\u00a0<code>len<\/code>\u00a0\u0438\u00a0<code>arr<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0430\u0436\u0443\u0442 \u0434\u043b\u0438\u043d\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 \u0441\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432 (\u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u044b \u0432\u043d\u0430\u0447\u0430\u043b\u0435).<\/p>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u043f\u043e\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0432 memory \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u043b\u043e\u0442\u043e\u0432. \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0<code>name<\/code>\u00a0\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 5 \u0431\u0430\u0439\u0442.<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function getSeaportSecondVariant() external pure returns (string memory, uint256 len, bytes7 arr) {         assembly {             \/\/ \u0441\u0442\u0430\u0440\u044b\u0439 \u043a\u043e\u0434 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0434 \u0433\u043b\u0430\u0437\u0430\u043c\u0438             \/\/ mstore(0x20, 0x20)             \/\/ mstore(0x47, 0x07536561706f7274)             \/\/ return(0x20, 0x60)              mstore(0x25, 0x20) \/\/ 0x20 + 5 = 0x25             mstore(0x4c, 0x07536561706f7274) \/\/ 0x47 + 5 = 0x4c             return(0x25, 0x60) \/\/ 0x20 + 5 = 0x25         }     } }<\/code><\/pre>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 memory. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u00a0<code>0x20<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4cd\/568\/4cc\/4cd5684cc7bf98c77f20c2321a2f1695.png\" width=\"813\" height=\"78\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4cd\/568\/4cc\/4cd5684cc7bf98c77f20c2321a2f1695.png\"\/><\/figure>\n<p>\u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0439\u0442\u043e\u0432:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e02\/189\/d4b\/e02189d4b9faf99cb2c71116dc99ade0.png\" width=\"820\" height=\"104\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e02\/189\/d4b\/e02189d4b9faf99cb2c71116dc99ade0.png\"\/><\/figure>\n<p>\u041c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u0442\u0438\u0440\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0434\u043e \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0430 \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442\u00a0<code>\u00af_(\u30c4)_\/\u00af<\/code><\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/018\/22a\/69c\/01822a69cc4ad6811243f925d9f0e4e7.png\" width=\"820\" height=\"101\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/018\/22a\/69c\/01822a69cc4ad6811243f925d9f0e4e7.png\"\/><\/figure>\n<p>\u0412\u0438\u0434\u043d\u043e \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0435\u0432\u0435\u0440\u043d\u043e, \u0435\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0435 32-\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0445 \u0441\u043b\u043e\u0442\u043e\u0432, \u043d\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438.<\/p>\n<h3>abi.encode<\/h3>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f abi.encode \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0430\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b. \u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 32 \u0431\u0430\u0439\u0442\u043e\u0432, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d \u0434\u043e 32 \u0431\u0430\u0439\u0442\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function abiEncode() external pure {         abi.encode(uint256(1), uint256(2));          assembly {             let length := mload(0x80) \/\/ 0x0000...000040 (64 \u0431\u0430\u0439\u0442)             let arg1 := mload(0xa0) \/\/ 0x0000...000001 (32 \u0431\u0430\u0439\u0442)             let arg2 := mload(0xc0) \/\/ 0x0000...000002 (32 \u0431\u0430\u0439\u0442)         }     } }<\/code><\/pre>\n<h3>abi.encodePacked<\/h3>\n<p>\u041f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0<code>abi.encode<\/code>\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>abi.encodePacked<\/code>\u00a0\u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0439\u0442\u044b \u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function abiEncodePacked() external pure {         abi.encodePacked(uint256(1), uint128(2));          assembly {             let length := mload(0x80) \/\/ 0x0000...000030 (48 \u0431\u0430\u0439\u0442)             let arg1 := mload(0xa0) \/\/ 0x0000...000001 (32 \u0431\u0430\u0439\u0442)             let arg2 := mload(0xc0) \/\/ 0x00...0002 (16 \u0431\u0430\u0439\u0442)         }     } }<\/code><\/pre>\n<h3>return<\/h3>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>return(p,s)<\/code>\u00a0\u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c\u00a0<code>s<\/code>, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043b\u043e\u0442\u0430\u00a0<code>p<\/code>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0431\u043e\u043b\u0435\u0435 32 \u0431\u0430\u0439\u0442.<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function returnValues() external pure returns (uint256, uint256) {         assembly {             \/\/ \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043b\u043e\u0442\u044b 0x80 \u0438 0xa0             mstore(0x80, 1)             mstore(0xa0, 2)             \/\/ \u0432\u0435\u0440\u043d\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f 0x80 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 0x40 (64 \u0431\u0430\u0439\u0442\u0435)             return(0x80, 0x40)         }     } }<\/code><\/pre>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 32 \u0431\u0430\u0439\u0442, \u043e\u043d\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0434\u043e 32 \u0431\u0430\u0439\u0442.<\/p>\n<\/blockquote>\n<h3>revert<\/h3>\n<p>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>revert(p,s)<\/code>\u00a0\u0442\u0430\u043a\u0438\u0435 \u0436\u0435, \u043a\u0430\u043a \u0438 \u0443\u00a0<code>return(p,s)<\/code>, \u0432 \u0442\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435, \u0447\u0442\u043e \u043e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c\u00a0<code>s<\/code>, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043b\u043e\u0442\u0430\u00a0<code>p<\/code>. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u00a0<code>revert<\/code>\u00a0\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function revertExecution() external {         assembly {             if iszero(eq(mul(2, 2), 5)) {                 revert(0, 0)             }         }     } }<\/code><\/pre>\n<h3>keccak256<\/h3>\n<p>\u0412\u044b\u0437\u043e\u0432\u00a0<code>keccak256(p, n)<\/code>\u00a0&#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0435\u0448 \u0434\u0430\u043d\u043d\u044b\u0445 \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0445\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>p<\/code>\u00a0\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0445\u00a0<code>n<\/code>\u00a0\u0431\u0430\u0439\u0442\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">contract Memory {     \/\/ ...      function getKeccak() external pure {         assembly {             \/\/ \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043b\u043e\u0442\u044b 0x80 \u0438 0xa0             mstore(0x80, 1)             mstore(0xa0, 2)              \/\/ \u0445\u0435\u0448\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 0x80 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 0x40 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0438\u0445 \u0432 \u0441\u043b\u043e\u0442\u0435 0xc0             mstore(0xc0, keccak256(0x80, 0x40))         }     } }<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/yul\/examples\/Memory.sol\"><u>Memory.sol<\/u><\/a>.<\/p>\n<h4>Calldata<\/h4>\n<p>\u0412\u0438\u0434 \u043f\u0430\u043c\u044f\u0442\u0438 calldata \u2014 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 EVM, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u043c \u0431\u0430\u0439\u0442\u0430\u043c, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c c \u043b\u044e\u0431\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439 \u0432\u044b\u0437\u043e\u0432\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 (\u043b\u0438\u0431\u043e \u0438\u0437 EOA, \u043b\u0438\u0431\u043e \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430) calldata \u2014 \u044d\u0442\u043e \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>calldata \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u043c \u0434\u0435\u0448\u0435\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u0432 \u0442\u0435\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u0430\u043a\u0436\u0435 \u043e\u043d\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u0442.\u043a. \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0430\u043c\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (\u043f\u043e\u043b\u0435 msg.data).<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 calldata \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0438\u0445 \u0441\u0440\u0430\u0437\u0443 \u0432 \u0441\u0442\u0435\u043a \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0445 \u0438\u043b\u0438 \u0438\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043d\u043e \u043c\u043e\u0436\u0435\u043c \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0432 memory \u0438\u043b\u0438 storage. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e calldata \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<strong>\u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0439<\/strong>\u00a0\u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a memory \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0436\u0435\u00a0<strong>\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439<\/strong>\u00a0\u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439. \u0422\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 (EOA \u0438\u043b\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442) \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439, \u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0438\u0445 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u0434\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0441 abi, \u043e\u0431 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/ABI\/readme.md\"><u>\u0442\u0443\u0442<\/u><\/a>\u00a0\u0438 \u0432\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/abi-spec.html\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 calldata \u043d\u0435\u043b\u044c\u0437\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043e\u043d\u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 (\u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0433\u0430\u0437\u0430 \u0432 \u0431\u043b\u043e\u043a\u0435);<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 4 \u0431\u0430\u0439\u0442\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u2014 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b;<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0438\u043f\u043e\u0432\u00a0<code>array<\/code>,\u00a0<code>bytes<\/code>\u00a0\u0438\u043b\u0438\u00a0<code>string<\/code>\u00a0\u043f\u0435\u0440\u0432\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0430 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u0431\u0443\u0434\u0435\u0442 \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043c\u0435\u043d\u0435\u0435 32 \u0431\u0430\u0439\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e 32 \u0431\u0430\u0439\u0442.<\/p>\n<\/li>\n<\/ul>\n<p><em>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0444\u0430\u043a\u0442!<\/em>\u00a0\u041f\u043e\u0441\u043b\u0435\u00a0<a href=\"https:\/\/eips.ethereum.org\/EIPS\/eip-2028\"><u>EIP-2028<\/u><\/a>\u00a0\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f calldata \u0431\u044b\u043b\u0430 \u0441\u043d\u0438\u0436\u0435\u043d\u0430 \u0441 68 \u0434\u043e 16 \u0433\u0430\u0437 \u0437\u0430 \u0431\u0430\u0439\u0442. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f &#171;\u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438&#187; \u0441\u0435\u0442\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e L2. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0440\u043e\u043b\u043b\u0430\u043f\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0438 \u0442\u0443\u0442 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0448\u0435\u0432\u044b\u0439 calldata \u043a\u0430\u043a \u0440\u0430\u0437 \u043a\u0441\u0442\u0430\u0442\u0438.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 calldata:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>calldataload(p)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 32-\u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>p<\/code>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>calldatasize()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>calldatacopy(t, f, s)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u00a0<code>s<\/code>\u00a0\u0431\u0430\u0439\u0442\u043e\u0432 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>f<\/code>, \u0432 memory, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>t<\/code>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 calldata, \u0442\u0443\u0442 \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c &#171;\u0441\u043b\u043e\u0442\u0430\u043c&#187; \u0438\u043b\u0438 32-\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u0430\u043c. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u0441\u0434\u0432\u0438\u0433 \u0432 4 \u0431\u0430\u0439\u0442\u0430 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 calldata \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0441\u0442\u0440\u043e\u043a\u0443. \u0412\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435\u00a0<code>offset + length + data<\/code>.<\/p>\n<pre><code class=\"javascript\">contract Calldata {      function getString(string calldata) external pure returns(string memory, uint256 len) {         assembly {             \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c 4 \u0431\u0430\u0439\u0442\u0430 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435             let strOffset := add(4, calldataload(4))             \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438             len := calldataload(strOffset)             \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c             let ptr := mload(0x40)             \/\/ \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b             let dataSize := sub(calldatasize(), 4)             \/\/ \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 memory \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0442\u0440\u043e\u043a\u0435 \u043a\u0440\u043e\u043c\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b             calldatacopy(ptr, 0x04, dataSize)              \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443             return(0x80, dataSize)         }     } }<\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0442\u0430\u043a\u043e\u0439:<\/p>\n<ul>\n<li>\n<p>\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<code>calldataload<\/code>\u00a0\u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0442\u0440\u043e\u043a\u0435. \u041f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c 4 \u0431\u0430\u0439\u0442\u0430 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 (<code>calldatasize<\/code>\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440)<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 calldata \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 5\u0433\u043e \u0431\u0430\u0439\u0442\u0430 (0x04) \u0432 memory \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c\u00a0<code>ptr<\/code><\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 (\u0442\u0443\u0442 \u0435\u0441\u043b\u0438 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/yul\/README.md#%D0%BC%D0%B0%D1%81%D1%81%D0%B8%D0%B2%D1%8B-%D0%B1%D0%B0%D0%B9%D1%82%D0%BE%D0%B2-%D0%B8-%D1%81%D1%82%D1%80%D0%BE%D0%BA%D0%B8-%D0%B2-memory\"><u>\u043f\u0440\u043e \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 memory<\/u><\/a>)<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441\u0434\u0435\u043b\u0430\u043d \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0434\u0432\u0435 \u0432\u0435\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u0435\u0440\u043e\u043b\u043e\u043c\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c:<\/p>\n<ul>\n<li>\n<p>\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 32 \u0431\u0430\u0439\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u043a\u0440\u043e\u043c\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0435\u0431\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b, \u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0441\u043b\u043e, \u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043e \u0438 \u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u0432 Remix \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0432 memory \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0441 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439\u00a0<code>foo(uint256 amount, string calldata)<\/code>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/yul\/examples\/Calldata.sol\"><u>Calldata.sol<\/u><\/a>.<\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438 \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435 Remix \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 calldata.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/860\/db2\/dfa\/860db2dfa55b5f40fbd7e6a82a76b3ac.png\" width=\"367\" height=\"123\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/860\/db2\/dfa\/860db2dfa55b5f40fbd7e6a82a76b3ac.png\"\/><\/figure>\n<h3>\u0421\u0440\u0435\u0437 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u042d\u0442\u0430 \u0442\u0435\u043c\u0430 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u043e Yul, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c (<code>data[:4]<\/code>) \u0433\u0434\u0435-\u0442\u043e &#171;\u043d\u0435\u043f\u043e\u0434\u0430\u043b\u0435\u043a\u0443&#187; \u043e\u0442 inline assembly, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0437\u043d\u0430\u0442\u044c \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442.<\/p>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 solidity 0.6.0 \u0441\u0442\u0430\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u00a0<code>data[start:end]<\/code>\u00a0(&#171;\u0441\u0440\u0435\u0437\u044b&#187;) \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445\u00a0<code>bytes<\/code>, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0441 calldata (\u0432 memory \u044d\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442).<\/p>\n<p>\u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a:<\/p>\n<ul>\n<li>\n<p><code>start<\/code>\u00a0&#8212; \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u0440\u0435\u0437<\/p>\n<\/li>\n<li>\n<p><code>end<\/code>\u00a0&#8212; \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0433\u0434\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c \u0441\u0440\u0435\u0437<\/p>\n<\/li>\n<li>\n<p>\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435\u00a0<code>:<\/code>\u00a0&#8212; \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u043a\u043e\u043d\u0435\u0446<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0436\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u043e \u0438\u043b\u0438 \u043a\u043e\u043d\u0435\u0446. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u043e, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0440\u0435\u0437 \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f 0. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u043d\u0435\u0446, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d \u0441\u0440\u0435\u0437 \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0432 calldata.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:\u00a0<code>bytes4 selector = msg.data[:4];<\/code>\u00a0\u0438\u043b\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435\u00a0<code>bytes data = msg.data[4:0]<\/code>. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a\u00a0<code>bytes data = msg.data[4:8]<\/code>.<\/p>\n<h3>\u0412\u044b\u0437\u043e\u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432<\/h3>\n<p>\u0412 Yul \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>call(g, a, v, in, insize, out, outsize)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443\u00a0<code>a<\/code>, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438\u00a0<code>[in...(in+insize))<\/code>, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f\u00a0<code>g<\/code>\u00a0\u0433\u0430\u0437\u0430 \u0438\u00a0<code>v<\/code>\u00a0\u0432\u0435\u0439. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u044c\u00a0<code>[out...(out+outsize))<\/code>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437-\u0437\u0430 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0438 \u0433\u0430\u0437\u0430) \u0438 1 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>callcode(g, a, v, in, insize, out, outsize)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0434\u043e\u0431\u043d\u043e\u00a0<code>call<\/code>, \u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443\u00a0<code>a<\/code>, \u043e\u0441\u0442\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>delegatecall(g, a, in, insize, out, outsize)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0434\u043e\u0431\u043d\u043e\u00a0<code>callcode<\/code>, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (callvalue).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>staticcall(g, a, in, insize, out, outsize)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0434\u043e\u0431\u043d\u043e\u00a0<code>call<\/code>, \u043d\u043e \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 1 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u0438.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0447\u0430\u0441\u0442\u043e \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u043d\u0438\u043c\u0438 \u0438\u0434\u0443\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>returndatasize()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (returndata).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>returndatacopy(t, f, s)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u00a0<code>s<\/code>\u00a0\u0431\u0430\u0439\u0442\u043e\u0432 \u0438\u0437 returndata, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>f<\/code>, \u0432 memory, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>t<\/code>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421\u0430\u043c\u044b\u043c \u0447\u0430\u0441\u0442\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u043a\u0441\u0438-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b, \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0<code>_delegate<\/code>\u00a0\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u00a0<a href=\"https:\/\/github.com\/OpenZeppelin\/openzeppelin-contracts\/blob\/master\/contracts\/proxy\/Proxy.sol\"><u>Proxy<\/u><\/a>\u00a0\u043e\u0442 Open Zeppelin.<\/p>\n<pre><code class=\"javascript\">    function _delegate(address implementation) internal virtual {         assembly {             \/\/ Copy msg.data. We take full control of memory in this inline assembly             \/\/ block because it will not return to Solidity code. We overwrite the             \/\/ Solidity scratch pad at memory position 0.             calldatacopy(0, 0, calldatasize())              \/\/ Call the implementation.             \/\/ out and outsize are 0 because we don't know the size yet.             let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)              \/\/ Copy the returned data.             returndatacopy(0, 0, returndatasize())              switch result             \/\/ delegatecall returns 0 on error.             case 0 {                 revert(0, returndatasize())             }             default {                 return(0, returndatasize())             }         }     }<\/code><\/pre>\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439\u00a0<code>fallback()<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 Proxy, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u0430\u043b\u044c\u0448\u0435:<\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432 memory \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 calldata (\u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c \u0442\u0438\u043f \u043f\u0430\u043c\u044f\u0442\u0438 calldata \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0442\u0443\u0434\u0430 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442, \u0432\u0441\u0435 \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u0441 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439 \u0432 msg.data \u0442\u0430\u043a\u0438\u043c \u0438 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f)<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c delegatecall \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0442\u0443\u0434\u0430 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\n<p>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0433\u0430\u0437\u0430<\/p>\n<\/li>\n<li>\n<p>\u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 memory \u043a\u0443\u0434\u0430 \u043c\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438 calldata, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 0<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u0438\u0437 memory \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 (calldata size)<\/p>\n<\/li>\n<li>\n<p>\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 memory \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u043e\u0436\u0435 \u0431\u0435\u0437 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u044b \u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 0<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 memory (\u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043a\u0430\u043a \u0438 \u0441\u00a0<code>calldatacopy<\/code>), \u0442.\u043a. \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u0432\u00a0<code>delegatecall<\/code>\u00a0\u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u00a0<code>result<\/code>, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u043e\u0442\u0434\u0430\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0443\u043f\u0430\u043b\u0430, \u043e\u0442\u0434\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0435\u0440\u043d\u0443\u043b \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u00a0<code>call<\/code>\u00a0\u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 &#8212;\u00a0<code>value<\/code>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442\u00a0<code>call<\/code>\u00a0\u0438\u00a0<code>delegatecall<\/code>\u00a0\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u00a0<a href=\"https:\/\/noxx.substack.com\/p\/evm-deep-dives-the-path-to-shadowy-a5f\"><u>\u0442\u0443\u0442<\/u><\/a>.<\/p>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u0415\u0441\u043b\u0438 \u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043a\u0430\u043a \u043f\u043e\u0434\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043a\u043e\u0434\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 EOA), \u0442\u043e \u0432\u044b\u0437\u043e\u0432 call \u0432\u0435\u0440\u043d\u0435\u0442 true (1). \u0418 \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f (\u0432\u043e\u0437\u0432\u0440\u0430\u0442 false &#8212; 0) \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442 \u0433\u0430\u0437\u0430 \u0438\u043b\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u043e \u0432 \u0441\u0442\u0435\u043a\u0435.<\/p>\n<\/blockquote>\n<p>\u0412\u043e\u0442\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/yul\/examples\/Delegatecall.sol\"><u>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442<\/u><\/a>\u00a0\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043d \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u0440\u043e\u043a\u0441\u0438-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 low level iterations \u0432 Remix. \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e cast, \u043d\u0443 \u043b\u0438\u0431\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f\u00a0<code>abi.encode<\/code>. \u0427\u0435\u0440\u0435\u0437 cast \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">    cast calldata \"increment(uint256)\" 42      >> 0x7cf5dab0000000000000000000000000000000000000000000000000000000000000002a<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d74\/dbb\/df2\/d74dbbdf2bace1867874a5335710fd68.png\" width=\"692\" height=\"350\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d74\/dbb\/df2\/d74dbbdf2bace1867874a5335710fd68.png\"\/><\/figure>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u041f\u043e\u0441\u043b\u0435 \u0445\u0430\u0440\u0434\u0444\u043e\u0440\u043a\u0430 Byzantium \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432\u00a0<code>call<\/code>,\u00a0<code>delegatecall<\/code>,\u00a0<code>callcode<\/code>\u00a0\u0438\u00a0<code>staticcall<\/code>) \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<code>returndatacopy<\/code>\u00a0\u0438\u00a0<code>returndatasize<\/code>.<\/p>\n<\/blockquote>\n<h3>Events<\/h3>\n<p>\u0414\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 Yul \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 5 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u043a\u0430\u043a \u0432 EVM \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0434\u043b\u044f \u0432\u0430\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e.<\/p>\n<p>\u0412 \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u0435\u043c\u044b (\u0442\u043e\u043f\u0438\u043a\u0430) \u0438 \u043d\u0435\u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u0435\u0440\u0432\u044b\u0439 \u0442\u043e\u043f\u0438\u043a \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0445\u0435\u0448 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0430 \u0442\u0440\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 &#8212; \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u0414\u043b\u044f \u043d\u0435\u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>log0(p, s)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 (event) \u0431\u0435\u0437 \u0442\u0435\u043c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c\u00a0<code>s<\/code>, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438\u00a0<code>p<\/code>. \u0422\u0430\u043a\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0435\u0449\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u043c\u0438.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>log1(p, s, t1)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 (event) \u0441 \u043e\u0434\u043d\u043e\u0439 \u0442\u0435\u043c\u043e\u0439 (topic)\u00a0<code>t1<\/code>\u00a0\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c\u00a0<code>s<\/code>, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438\u00a0<code>p<\/code>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>log2(p, s, t1, t2)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 (event) \u0441 \u0434\u0432\u0443\u043c\u044f \u0442\u0435\u043c\u0430\u043c\u0438\u00a0<code>t1<\/code>\u00a0\u0438\u00a0<code>t2<\/code>\u00a0\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c\u00a0<code>s<\/code>, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438\u00a0<code>p<\/code>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>log3(p, s, t1, t2, t3)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 (event) \u0441 \u0442\u0440\u0435\u043c\u044f \u0442\u0435\u043c\u0430\u043c\u0438\u00a0<code>t1<\/code>,\u00a0<code>t2<\/code>\u00a0\u0438\u00a0<code>t3<\/code>\u00a0\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c\u00a0<code>s<\/code>, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438\u00a0<code>p<\/code>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>log4(p, s, t1, t2, t3, t4)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 (event) \u0441 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u0442\u0435\u043c\u0430\u043c\u0438\u00a0<code>t1<\/code>,\u00a0<code>t2<\/code>,\u00a0<code>t3<\/code>\u00a0\u0438\u00a0<code>t4<\/code>\u00a0\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c\u00a0<code>s<\/code>, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438\u00a0<code>p<\/code>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>t1 \u2014 \u044d\u0442\u043e \u0445\u0435\u0448 keccak256 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u044f, t2 \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, t3 \u2014 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u00a0<code>log3<\/code>\u00a0\u0435\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u00a0<code>SomeLog(2, 3, true)<\/code>:<\/p>\n<pre><code class=\"javascript\">contract EmitEvent {     event SomeLog(uint256 indexed a, uint256 indexed b, bool c);      function emitEvent() external {         assembly {             \/\/ \u0425\u0435\u0448 \u0441\u043e\u0431\u0442\u0438\u044f - keccak256(\"SomeLog(uint256,uint256,bool)\")             let signature := 0x39cf0823186c1f89c8975545aebaa16813bfc9511610e72d8cff59da81b23c72              \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c             let ptr := mload(0x40)              \/\/ \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e 1 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 (0x80)             mstore(ptr, 1)              \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 SomeLog(2, 3, true)             log3(0x80, 0x20, signature, 2, 3)         }     } }<\/code><\/pre>\n<ul>\n<li>\n<p><code>log3<\/code>\u00a0\u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f\u00a0<code>topic 1<\/code>, \u0442.\u0435. \u0445\u0435\u0448 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 memory<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0443\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>1<\/code>\u00a0(<code>true<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u00a0<code>log3<\/code>\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b<\/p>\n<\/li>\n<\/ul>\n<p>\u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 stack \u0438 memory:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/59a\/332\/555\/59a33255528d5e27249d9ee7a7045e03.png\" width=\"1652\" height=\"814\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/59a\/332\/555\/59a33255528d5e27249d9ee7a7045e03.png\"\/><\/figure>\n<ul>\n<li>\n<p>\u0432 memory \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p>\u0432 stack \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (0x80)<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u043c\u0435\u0440 \u043d\u0435\u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (0x20 &#8212; 32 \u0431\u0430\u0439\u0442\u0430)<\/p>\n<\/li>\n<li>\n<p>\u0445\u0435\u0448 keccak256 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u00a0<code>SomeLog(uint256,uint256,bool)<\/code><\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442<\/p>\n<\/li>\n<li>\n<p>\u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u043a\u043e\u0434\u00a0<code>LOG3<\/code>\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 5 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 stack<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 EmitEvent\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/yul\/examples\/EmitEvent.sol\"><u>\u0442\u0443\u0442<\/u><\/a>.<\/p>\n<h3>\u0421\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Yul<\/h3>\n<p>\u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Standalone Assembly &#8212; \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Yul \u0432 \u0444\u0430\u0439\u043b\u0435\u00a0<code>.yul<\/code>, \u043d\u043e \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u044d\u043a\u0437\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0442\u0435\u043c\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 Solidity \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c.<\/p>\n<p>\u041e\u0431\u0449\u0438\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043d\u043e \u043a\u0430\u043a \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441 Yul &#8212; \u0432 \u043d\u0435\u043c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e &#171;\u0440\u0443\u0447\u043d\u043e\u0439&#187; \u0440\u0430\u0431\u043e\u0442\u044b, \u0430 \u0432\u0441\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0442\u0430\u043a\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437\u00a0<code>msg.data<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0435\u00a0<code>calldata<\/code>\u00a0\u0438 low level interactions \u0432 Remix (\u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u044d\u0442\u043e \u0432 Remix).<\/p>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u0444\u0430\u0439\u043b\u0430\u00a0<code>.yul<\/code>\u00a0\u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445. \u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u2014 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 Yul, \u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u00a0<code>code<\/code>\u00a0\u2014 \u044d\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u0434.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>datasize<\/code>,\u00a0<code>dataoffset<\/code>\u00a0\u0438\u00a0<code>datacopy<\/code>\u00a0\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u043c \u043a\u043e\u0434\u0430. \u0428\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435, \u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u2014 \u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435. \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f\u00a0<code>code<\/code>\u00a0&#8212;\u00a0<code>datacopy<\/code>\u00a0\u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0435\u0433\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>datasize(x)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>datasize(x)<\/code>\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Yul\u00a0<code>x<\/code>\u00a0\u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0<code>x<\/code>\u00a0\u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u043c, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c \u0438\u043c\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>dataoffset(x)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>dataoffset(x)<\/code>\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Yul\u00a0<code>x<\/code>\u00a0\u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0<code>x<\/code>\u00a0\u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u043c, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c \u0438\u043c\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>datacopy(t, f, l)<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>datacopy(t, f, l)<\/code>\u00a0\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u00a0<code>l<\/code>\u00a0\u0431\u0430\u0439\u0442\u043e\u0432 \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>f<\/code>, \u0432 \u043f\u0430\u043c\u044f\u0442\u044c, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438\u00a0<code>t<\/code>. \u0414\u043b\u044f EVM \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>datacopy<\/code>\u00a0\u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>codecopy<\/code>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0427\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#specification-of-yul-object\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>, \u043d\u043e \u044f \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c\u00a0<a href=\"https:\/\/remix.ethereum.org\/?#language=yul&amp;version=0.8.22&amp;code=b2JqZWN0ICJUb2tlbiIgewogICAgY29kZSB7CiAgICAgICAgLy8gU3RvcmUgdGhlIGNyZWF0b3IgaW4gc2xvdCB6ZXJvLgogICAgICAgIHNzdG9yZSgwLCBjYWxsZXIoKSkKCiAgICAgICAgLy8gRGVwbG95IHRoZSBjb250cmFjdAogICAgICAgIGRhdGFjb3B5KDAsIGRhdGFvZmZzZXQoInJ1bnRpbWUiKSwgZGF0YXNpemUoInJ1bnRpbWUiKSkKICAgICAgICByZXR1cm4oMCwgZGF0YXNpemUoInJ1bnRpbWUiKSkKICAgIH0KICAgIG9iamVjdCAicnVudGltZSIgewogICAgICAgIGNvZGUgewogICAgICAgICAgICAvLyBQcm90ZWN0aW9uIGFnYWluc3Qgc2VuZGluZyBFdGhlcgogICAgICAgICAgICByZXF1aXJlKGlzemVybyhjYWxsdmFsdWUoKSkpCgogICAgICAgICAgICAvLyBEaXNwYXRjaGVyCiAgICAgICAgICAgIHN3aXRjaCBzZWxlY3RvcigpCiAgICAgICAgICAgIGNhc2UgMHg3MGEwODIzMSAvKiAiYmFsYW5jZU9mKGFkZHJlc3MpIiAqLyB7CiAgICAgICAgICAgICAgICByZXR1cm5VaW50KGJhbGFuY2VPZihkZWNvZGVBc0FkZHJlc3MoMCkpKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGNhc2UgMHgxODE2MGRkZCAvKiAidG90YWxTdXBwbHkoKSIgKi8gewogICAgICAgICAgICAgICAgcmV0dXJuVWludCh0b3RhbFN1cHBseSgpKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGNhc2UgMHhhOTA1OWNiYiAvKiAidHJhbnNmZXIoYWRkcmVzcyx1aW50MjU2KSIgKi8gewogICAgICAgICAgICAgICAgdHJhbnNmZXIoZGVjb2RlQXNBZGRyZXNzKDApLCBkZWNvZGVBc1VpbnQoMSkpCiAgICAgICAgICAgICAgICByZXR1cm5UcnVlKCkKICAgICAgICAgICAgfQogICAgICAgICAgICBjYXNlIDB4MjNiODcyZGQgLyogInRyYW5zZmVyRnJvbShhZGRyZXNzLGFkZHJlc3MsdWludDI1NikiICovIHsKICAgICAgICAgICAgICAgIHRyYW5zZmVyRnJvbShkZWNvZGVBc0FkZHJlc3MoMCksIGRlY29kZUFzQWRkcmVzcygxKSwgZGVjb2RlQXNVaW50KDIpKQogICAgICAgICAgICAgICAgcmV0dXJuVHJ1ZSgpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2FzZSAweDA5NWVhN2IzIC8qICJhcHByb3ZlKGFkZHJlc3MsdWludDI1NikiICovIHsKICAgICAgICAgICAgICAgIGFwcHJvdmUoZGVjb2RlQXNBZGRyZXNzKDApLCBkZWNvZGVBc1VpbnQoMSkpCiAgICAgICAgICAgICAgICByZXR1cm5UcnVlKCkKICAgICAgICAgICAgfQogICAgICAgICAgICBjYXNlIDB4ZGQ2MmVkM2UgLyogImFsbG93YW5jZShhZGRyZXNzLGFkZHJlc3MpIiAqLyB7CiAgICAgICAgICAgICAgICByZXR1cm5VaW50KGFsbG93YW5jZShkZWNvZGVBc0FkZHJlc3MoMCksIGRlY29kZUFzQWRkcmVzcygxKSkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2FzZSAweDQwYzEwZjE5IC8qICJtaW50KGFkZHJlc3MsdWludDI1NikiICovIHsKICAgICAgICAgICAgICAgIG1pbnQoZGVjb2RlQXNBZGRyZXNzKDApLCBkZWNvZGVBc1VpbnQoMSkpCiAgICAgICAgICAgICAgICByZXR1cm5UcnVlKCkKICAgICAgICAgICAgfQogICAgICAgICAgICBkZWZhdWx0IHsKICAgICAgICAgICAgICAgIHJldmVydCgwLCAwKQogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBtaW50KGFjY291bnQsIGFtb3VudCkgewogICAgICAgICAgICAgICAgcmVxdWlyZShjYWxsZWRCeU93bmVyKCkpCgogICAgICAgICAgICAgICAgbWludFRva2VucyhhbW91bnQpCiAgICAgICAgICAgICAgICBhZGRUb0JhbGFuY2UoYWNjb3VudCwgYW1vdW50KQogICAgICAgICAgICAgICAgZW1pdFRyYW5zZmVyKDAsIGFjY291bnQsIGFtb3VudCkKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB0cmFuc2Zlcih0bywgYW1vdW50KSB7CiAgICAgICAgICAgICAgICBleGVjdXRlVHJhbnNmZXIoY2FsbGVyKCksIHRvLCBhbW91bnQpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYXBwcm92ZShzcGVuZGVyLCBhbW91bnQpIHsKICAgICAgICAgICAgICAgIHJldmVydElmWmVyb0FkZHJlc3Moc3BlbmRlcikKICAgICAgICAgICAgICAgIHNldEFsbG93YW5jZShjYWxsZXIoKSwgc3BlbmRlciwgYW1vdW50KQogICAgICAgICAgICAgICAgZW1pdEFwcHJvdmFsKGNhbGxlcigpLCBzcGVuZGVyLCBhbW91bnQpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gdHJhbnNmZXJGcm9tKGZyb20sIHRvLCBhbW91bnQpIHsKICAgICAgICAgICAgICAgIGRlY3JlYXNlQWxsb3dhbmNlQnkoZnJvbSwgY2FsbGVyKCksIGFtb3VudCkKICAgICAgICAgICAgICAgIGV4ZWN1dGVUcmFuc2Zlcihmcm9tLCB0bywgYW1vdW50KQogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBleGVjdXRlVHJhbnNmZXIoZnJvbSwgdG8sIGFtb3VudCkgewogICAgICAgICAgICAgICAgcmV2ZXJ0SWZaZXJvQWRkcmVzcyh0bykKICAgICAgICAgICAgICAgIGRlZHVjdEZyb21CYWxhbmNlKGZyb20sIGFtb3VudCkKICAgICAgICAgICAgICAgIGFkZFRvQmFsYW5jZSh0bywgYW1vdW50KQogICAgICAgICAgICAgICAgZW1pdFRyYW5zZmVyKGZyb20sIHRvLCBhbW91bnQpCiAgICAgICAgICAgIH0KCgogICAgICAgICAgICAvKiAtLS0tLS0tLS0tIGNhbGxkYXRhIGRlY29kaW5nIGZ1bmN0aW9ucyAtLS0tLS0tLS0tLSAqLwogICAgICAgICAgICBmdW5jdGlvbiBzZWxlY3RvcigpIC0+IHMgewogICAgICAgICAgICAgICAgcyA6PSBkaXYoY2FsbGRhdGFsb2FkKDApLCAweDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCkKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gZGVjb2RlQXNBZGRyZXNzKG9mZnNldCkgLT4gdiB7CiAgICAgICAgICAgICAgICB2IDo9IGRlY29kZUFzVWludChvZmZzZXQpCiAgICAgICAgICAgICAgICBpZiBpc3plcm8oaXN6ZXJvKGFuZCh2LCBub3QoMHhmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmKSkpKSB7CiAgICAgICAgICAgICAgICAgICAgcmV2ZXJ0KDAsIDApCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gZGVjb2RlQXNVaW50KG9mZnNldCkgLT4gdiB7CiAgICAgICAgICAgICAgICBsZXQgcG9zIDo9IGFkZCg0LCBtdWwob2Zmc2V0LCAweDIwKSkKICAgICAgICAgICAgICAgIGlmIGx0KGNhbGxkYXRhc2l6ZSgpLCBhZGQocG9zLCAweDIwKSkgewogICAgICAgICAgICAgICAgICAgIHJldmVydCgwLCAwKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdiA6PSBjYWxsZGF0YWxvYWQocG9zKQogICAgICAgICAgICB9CiAgICAgICAgICAgIC8qIC0tLS0tLS0tLS0gY2FsbGRhdGEgZW5jb2RpbmcgZnVuY3Rpb25zIC0tLS0tLS0tLS0gKi8KICAgICAgICAgICAgZnVuY3Rpb24gcmV0dXJuVWludCh2KSB7CiAgICAgICAgICAgICAgICBtc3RvcmUoMCwgdikKICAgICAgICAgICAgICAgIHJldHVybigwLCAweDIwKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHJldHVyblRydWUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm5VaW50KDEpCiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIC8qIC0tLS0tLS0tIGV2ZW50cyAtLS0tLS0tLS0tICovCiAgICAgICAgICAgIGZ1bmN0aW9uIGVtaXRUcmFuc2Zlcihmcm9tLCB0bywgYW1vdW50KSB7CiAgICAgICAgICAgICAgICBsZXQgc2lnbmF0dXJlSGFzaCA6PSAweGRkZjI1MmFkMWJlMmM4OWI2OWMyYjA2OGZjMzc4ZGFhOTUyYmE3ZjE2M2M0YTExNjI4ZjU1YTRkZjUyM2IzZWYKICAgICAgICAgICAgICAgIGVtaXRFdmVudChzaWduYXR1cmVIYXNoLCBmcm9tLCB0bywgYW1vdW50KQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGVtaXRBcHByb3ZhbChmcm9tLCBzcGVuZGVyLCBhbW91bnQpIHsKICAgICAgICAgICAgICAgIGxldCBzaWduYXR1cmVIYXNoIDo9IDB4OGM1YmUxZTVlYmVjN2Q1YmQxNGY3MTQyN2QxZTg0ZjNkZDAzMTRjMGY3YjIyOTFlNWIyMDBhYzhjN2MzYjkyNQogICAgICAgICAgICAgICAgZW1pdEV2ZW50KHNpZ25hdHVyZUhhc2gsIGZyb20sIHNwZW5kZXIsIGFtb3VudCkKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBlbWl0RXZlbnQoc2lnbmF0dXJlSGFzaCwgaW5kZXhlZDEsIGluZGV4ZWQyLCBub25JbmRleGVkKSB7CiAgICAgICAgICAgICAgICBtc3RvcmUoMCwgbm9uSW5kZXhlZCkKICAgICAgICAgICAgICAgIGxvZzMoMCwgMHgyMCwgc2lnbmF0dXJlSGFzaCwgaW5kZXhlZDEsIGluZGV4ZWQyKQogICAgICAgICAgICB9CgogICAgICAgICAgICAvKiAtLS0tLS0tLSBzdG9yYWdlIGxheW91dCAtLS0tLS0tLS0tICovCiAgICAgICAgICAgIGZ1bmN0aW9uIG93bmVyUG9zKCkgLT4gcCB7IHAgOj0gMCB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHRvdGFsU3VwcGx5UG9zKCkgLT4gcCB7IHAgOj0gMSB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGFjY291bnRUb1N0b3JhZ2VPZmZzZXQoYWNjb3VudCkgLT4gb2Zmc2V0IHsKICAgICAgICAgICAgICAgIG9mZnNldCA6PSBhZGQoMHgxMDAwLCBhY2NvdW50KQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGFsbG93YW5jZVN0b3JhZ2VPZmZzZXQoYWNjb3VudCwgc3BlbmRlcikgLT4gb2Zmc2V0IHsKICAgICAgICAgICAgICAgIG9mZnNldCA6PSBhY2NvdW50VG9TdG9yYWdlT2Zmc2V0KGFjY291bnQpCiAgICAgICAgICAgICAgICBtc3RvcmUoMCwgb2Zmc2V0KQogICAgICAgICAgICAgICAgbXN0b3JlKDB4MjAsIHNwZW5kZXIpCiAgICAgICAgICAgICAgICBvZmZzZXQgOj0ga2VjY2FrMjU2KDAsIDB4NDApCiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIC8qIC0tLS0tLS0tIHN0b3JhZ2UgYWNjZXNzIC0tLS0tLS0tLS0gKi8KICAgICAgICAgICAgZnVuY3Rpb24gb3duZXIoKSAtPiBvIHsKICAgICAgICAgICAgICAgIG8gOj0gc2xvYWQob3duZXJQb3MoKSkKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB0b3RhbFN1cHBseSgpIC0+IHN1cHBseSB7CiAgICAgICAgICAgICAgICBzdXBwbHkgOj0gc2xvYWQodG90YWxTdXBwbHlQb3MoKSkKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBtaW50VG9rZW5zKGFtb3VudCkgewogICAgICAgICAgICAgICAgc3N0b3JlKHRvdGFsU3VwcGx5UG9zKCksIHNhZmVBZGQodG90YWxTdXBwbHkoKSwgYW1vdW50KSkKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBiYWxhbmNlT2YoYWNjb3VudCkgLT4gYmFsIHsKICAgICAgICAgICAgICAgIGJhbCA6PSBzbG9hZChhY2NvdW50VG9TdG9yYWdlT2Zmc2V0KGFjY291bnQpKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGFkZFRvQmFsYW5jZShhY2NvdW50LCBhbW91bnQpIHsKICAgICAgICAgICAgICAgIGxldCBvZmZzZXQgOj0gYWNjb3VudFRvU3RvcmFnZU9mZnNldChhY2NvdW50KQogICAgICAgICAgICAgICAgc3N0b3JlKG9mZnNldCwgc2FmZUFkZChzbG9hZChvZmZzZXQpLCBhbW91bnQpKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGRlZHVjdEZyb21CYWxhbmNlKGFjY291bnQsIGFtb3VudCkgewogICAgICAgICAgICAgICAgbGV0IG9mZnNldCA6PSBhY2NvdW50VG9TdG9yYWdlT2Zmc2V0KGFjY291bnQpCiAgICAgICAgICAgICAgICBsZXQgYmFsIDo9IHNsb2FkKG9mZnNldCkKICAgICAgICAgICAgICAgIHJlcXVpcmUobHRlKGFtb3VudCwgYmFsKSkKICAgICAgICAgICAgICAgIHNzdG9yZShvZmZzZXQsIHN1YihiYWwsIGFtb3VudCkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYWxsb3dhbmNlKGFjY291bnQsIHNwZW5kZXIpIC0+IGFtb3VudCB7CiAgICAgICAgICAgICAgICBhbW91bnQgOj0gc2xvYWQoYWxsb3dhbmNlU3RvcmFnZU9mZnNldChhY2NvdW50LCBzcGVuZGVyKSkKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBzZXRBbGxvd2FuY2UoYWNjb3VudCwgc3BlbmRlciwgYW1vdW50KSB7CiAgICAgICAgICAgICAgICBzc3RvcmUoYWxsb3dhbmNlU3RvcmFnZU9mZnNldChhY2NvdW50LCBzcGVuZGVyKSwgYW1vdW50KQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGRlY3JlYXNlQWxsb3dhbmNlQnkoYWNjb3VudCwgc3BlbmRlciwgYW1vdW50KSB7CiAgICAgICAgICAgICAgICBsZXQgb2Zmc2V0IDo9IGFsbG93YW5jZVN0b3JhZ2VPZmZzZXQoYWNjb3VudCwgc3BlbmRlcikKICAgICAgICAgICAgICAgIGxldCBjdXJyZW50QWxsb3dhbmNlIDo9IHNsb2FkKG9mZnNldCkKICAgICAgICAgICAgICAgIHJlcXVpcmUobHRlKGFtb3VudCwgY3VycmVudEFsbG93YW5jZSkpCiAgICAgICAgICAgICAgICBzc3RvcmUob2Zmc2V0LCBzdWIoY3VycmVudEFsbG93YW5jZSwgYW1vdW50KSkKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLyogLS0tLS0tLS0tLSB1dGlsaXR5IGZ1bmN0aW9ucyAtLS0tLS0tLS0tICovCiAgICAgICAgICAgIGZ1bmN0aW9uIGx0ZShhLCBiKSAtPiByIHsKICAgICAgICAgICAgICAgIHIgOj0gaXN6ZXJvKGd0KGEsIGIpKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGd0ZShhLCBiKSAtPiByIHsKICAgICAgICAgICAgICAgIHIgOj0gaXN6ZXJvKGx0KGEsIGIpKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHNhZmVBZGQoYSwgYikgLT4gciB7CiAgICAgICAgICAgICAgICByIDo9IGFkZChhLCBiKQogICAgICAgICAgICAgICAgaWYgb3IobHQociwgYSksIGx0KHIsIGIpKSB7IHJldmVydCgwLCAwKSB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gY2FsbGVkQnlPd25lcigpIC0+IGNibyB7CiAgICAgICAgICAgICAgICBjYm8gOj0gZXEob3duZXIoKSwgY2FsbGVyKCkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcmV2ZXJ0SWZaZXJvQWRkcmVzcyhhZGRyKSB7CiAgICAgICAgICAgICAgICByZXF1aXJlKGFkZHIpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcmVxdWlyZShjb25kaXRpb24pIHsKICAgICAgICAgICAgICAgIGlmIGlzemVybyhjb25kaXRpb24pIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQ&amp;lang=en&amp;optimize=false&amp;runs=200&amp;evmVersion=null\"><u>ERC20-\u0442\u043e\u043a\u0435\u043d\u0430<\/u><\/a>\u00a0\u0432 Remix, \u043f\u043e\u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u0446\u0438\u0438 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435 \u043a\u0430\u043a \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0442 \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c\u00a0<code>mint(0x5B38Da6a701c568545dCfcB03FcB875f56beddC4, 42)<\/code>:<\/p>\n<pre><code class=\"javascript\">0x40c10f190000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc4000000000000000000000000000000000000000000000000000000000000002a<\/code><\/pre>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435!<\/em>\u00a0\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u00a0<code>.yul<\/code>, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 Solidity.<\/p>\n<h3>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0435 Yul \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043c \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 EVM, \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0442\u0435\u043c\u0443 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u0441\u043e \u0432\u0441\u0442\u0430\u0432\u043a\u0430\u043c\u0438 \u043d\u0430 inline assembly, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435\u00a0<a href=\"https:\/\/github.com\/Vectorized\/solady\"><u>Solady<\/u><\/a>\u00a0\u0438\u043b\u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0434\u043b\u044f \u041d\u0424\u0422 &#8212;\u00a0<a href=\"https:\/\/github.com\/chiru-labs\/ERC721A\/blob\/main\/contracts\/ERC721A.sol\"><u>ERC721A<\/u><\/a>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u0440\u043e\u0446\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e: &#171;Inline assembly &#8212; \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043e\u0439 Ethereum \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 Solidity \u0432 Yul \u043d\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 Yul \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e <strong>\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438 \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0442\u043e\u0447\u043d\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u043e.<\/strong>&#171;<\/p>\n<p>P.S. \u042d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u043c\u043e\u0433\u0443\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e <a href=\"https:\/\/habr.com\/ru\/companies\/metalamp\/articles\/809111\/\">\u043e\u043f\u043a\u043e\u0434\u044b<\/a> \u0438 \u043f\u0440\u043e <a href=\"https:\/\/habr.com\/ru\/companies\/metalamp\/articles\/809549\/\">\u043f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<h3>\u0421\u0441\u044b\u043b\u043a\u0438:<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html\"><u>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f: Yul<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/internals\/layout_in_memory.html\"><u>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f: Layout of memory<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/youtube.com\/playlist?list=PL5hld-skrdFrxGUmmEbG1LBvYVyTE9M62&amp;si=jwXH_rtSvoNfrDPg\"><u>\u041f\u043b\u0435\u0439\u043b\u0438\u0441\u0442: Mastering Solidity Assembly (YUL)<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/medium.com\/lumos-labs\/inline-assembly-in-solidity-34d3ba2cfa7a\"><u>\u0421\u0442\u0430\u0442\u044c\u044f: Inline Assembly in Solidity: A Practical Starter\u2019s Guide<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=ew3pfnb2_V8\"><u>\u0412\u0438\u0434\u0435\u043e: The Dark Arts of Yul<\/u><\/a><\/p>\n<\/li>\n<\/ul>\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\/810785\/\"> https:\/\/habr.com\/ru\/articles\/810785\/<\/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<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f<\/h4>\n<p><strong>Yul<\/strong>\u00a0\u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0431\u0430\u0439\u0442-\u043a\u043e\u0434. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f EVM (\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b Ethereum) \u043e\u043d \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u043c \u0438 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043f\u0440\u044f\u043c\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 EVM (\u043e\u043f\u043a\u043e\u0434\u0430\u043c\u0438), \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441.<\/p>\n<p><strong>\u0411\u0430\u0439\u0442-\u043a\u043e\u0434 EVM<\/strong>\u00a0&#8212; \u044d\u0442\u043e \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043e\u0439 Ethereum (EVM).<\/p>\n<h4>\u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u0435\u043d Yul<\/h4>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 Yul &#8212; \u044d\u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432 \u043f\u043e \u0433\u0430\u0437\u0443, \u043a\u0430\u043a \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u044f\u0437\u044b\u043a\u0430 \u0442\u0430\u043a \u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u0434\u0430.<\/p>\n<p>Yul \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/assembly.html\"><u>inline assembly<\/u><\/a>\u00a0(\u00ab\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438\u00bb) \u0432 \u043a\u043e\u0434\u0435 solidity, \u0430 \u043c\u043e\u0436\u043d\u043e\u00a0<a href=\"https:\/\/github.com\/fullstack-development\/blockchain-wiki\/blob\/main\/solidity\/yul\/README.md#%D1%81%D0%BC%D0%B0%D1%80%D1%82-%D0%BA%D0%BE%D0%BD%D1%82%D1%80%D0%B0%D0%BA%D1%82%D1%8B-%D0%BD%D0%B0-%D1%8F%D0%B7%D1%8B%D0%BA%D0%B5-yul\"><u>\u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Yul<\/u><\/a>\u00a0\u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f solidity.<\/p>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 solc \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Yul \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/ir-breaking-changes.html\"><u>IR<\/u><\/a>\u00a0(Intermediate Representation).<\/p>\n<p>\u0414\u0438\u0437\u0430\u0439\u043d Yul \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0446\u0435\u043b\u0435\u0439:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 Yul, \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043a\u043e\u0434 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c \u0438\u0437 solidity \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0442\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438\u0437 Yul \u0432 \u0431\u0430\u0439\u0442-\u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c.<\/p>\n<\/li>\n<li>\n<p>Yul \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u044c \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u0438\u043a\u043e\u043c.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0446\u0435\u043b\u0438 Yul \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0446\u0438\u043a\u043b\u044b\u00a0<code>for<\/code>, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b\u00a0<code>if<\/code>\u00a0\u0438\u00a0<code>switch<\/code>, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438 \u0432\u044b\u0437\u043e\u0432\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u044f\u0432\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0435\u043a\u043e\u043c &#8212;\u00a0<code>SWAP<\/code>,\u00a0<code>DUP<\/code>,\u00a0<code>JUMPDEST<\/code>\u00a0<code>JUMP<\/code>\u00a0\u0438\u00a0<code>JUMPI<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u0437\u0430\u043f\u0443\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0442\u0440\u0438 \u0437\u0430\u043f\u0443\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0442\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<blockquote>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/em>\u00a0\u0412 Yul \u0432\u0441\u0435 \u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0442\u0435\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#verbatim\"><u>verbatim<\/u><\/a>.<\/p>\n<\/blockquote>\n<h4>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435?<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u00a0<a href=\"https:\/\/youtube.com\/playlist?list=PL5hld-skrdFrxGUmmEbG1LBvYVyTE9M62&amp;si=jwXH_rtSvoNfrDPg\"><u>\u0441\u0435\u0440\u0438\u044e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0432\u0438\u0434\u0435\u043e<\/u><\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u00a0<a href=\"https:\/\/medium.com\/lumos-labs\/inline-assembly-in-solidity-34d3ba2cfa7a\"><u>\u0432\u043e\u0442 \u044d\u0442\u0443<\/u><\/a>\u00a0\u0441\u0442\u0430\u0442\u044c\u044e. \u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#evm-dialect\"><u>\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/u><\/a>\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 Yul.<\/p>\n<p>\u041b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442\u00a0<a href=\"https:\/\/medium.com\/@kulman.david\/how-to-use-remix-debugger-to-learn-solidity-assembly-5a745a22bb07\"><u>Remix Debugger<\/u><\/a>, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u0434\u0435\u0431\u0430\u0433\u0433\u0438\u043d\u0433\u0430 \u043a\u043e\u0434\u0430 Solidity \u0438 Yul. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442\u00a0<a href=\"https:\/\/book.getfoundry.sh\/forge\/debugger?highlight=debugger#debugger\"><u>debugger \u043e\u0442 foundry<\/u><\/a>\u00a0\u0438\u043b\u0438\u00a0<a href=\"https:\/\/www.evm.codes\/playground\"><u>Playground \u043e\u0442 evm.codes<\/u><\/a>\u00a0(\u0434\u0430\u043b\u0435\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0432\u043c\u0435\u0441\u0442\u043e &#171;debugger&#187; \u044f \u0431\u0443\u0434\u0443 \u0443\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0441\u043b\u043e\u0432\u043e &#171;\u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a&#187;).<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0441\u0435\u0440\u0438\u044e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0442 Naveen:\u00a0<a href=\"https:\/\/mirror.xyz\/0xB38709B8198d147cc9Ff9C133838a044d78B064B\/nk40v2MJKSHXXNSlbqqhpwJf4MtZ9V2Vp8P_bSNwjYc\"><u>\u0447\u0430\u0441\u0442\u044c 0<\/u><\/a>,\u00a0<a href=\"https:\/\/mirror.xyz\/0xB38709B8198d147cc9Ff9C133838a044d78B064B\/PpA5KdQhrE_2Bf-USfKePROJ5tE-raL7_VGBR8HE39E\"><u>\u0447\u0430\u0441\u0442\u044c 1<\/u><\/a>,\u00a0<a href=\"https:\/\/mirror.xyz\/0xB38709B8198d147cc9Ff9C133838a044d78B064B\/Hh69VJWM5eiFYFINxYWrIYWcRRtPm8tw3VFjpdpx6T8\"><u>\u0447\u0430\u0441\u0442\u044c 2<\/u><\/a>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>\u00a0\u0438 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0438\u0436\u0435.<\/p>\n<h3>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u044f\u0437\u044b\u043a\u0430<\/h3>\n<p>\u041a\u043e\u0434 Yul \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u0442\u0430\u043a \u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u0438\u0437 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a solidity \u0438\u043b\u0438 vyper. \u041d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 solidity \u0432 \u043d\u0435\u043c \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e: \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, abi.encode, \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434.<\/p>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e Yul \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430 \u0432\u0430\u0441, &#8212; \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u0434\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435, \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u0442\u0443 \u0441\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0441\u043b\u043e\u0442\u044b \u0441\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0435\u0446 \u0438\u0445 \u0431\u043b\u043e\u043a\u0430.<\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u044e\u0431\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 Yul, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0443\u0436\u043d\u043e \u0447\u0435\u0442\u043a\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0431\u0430\u0439\u0442\u043e\u043c.<br \/>\u0421\u0430\u043c\u044b\u043c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 Solidity \u0441 inline assembly \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u043a\u043e\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0434\u0430 \u0433\u0430\u0437\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438\u00a0(<a href=\"https:\/\/github.com\/Arachnid\/solidity-stringutils\"><u>strings<\/u><\/a><u>)<\/u>\u00a0\u0438\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0438\u043f\u043e\u043c\u00a0<a href=\"https:\/\/github.com\/GNSPS\/solidity-bytes-utils\/blob\/master\/contracts\/BytesLib.sol\"><u>bytes<\/u><\/a>.<\/p>\n<h4>\u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e inline assembly, \u0442\u043e \u0442\u0430\u043a\u0438\u0435 \u0431\u043b\u043e\u043a\u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u00ab\u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f\u00bb \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c\u00a0<code>assembly { ... }<\/code>\u00a0\u0431\u043b\u043e\u043a\u0435, \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e\u00a0<code>assembly { ... }<\/code>\u00a0\u0431\u043b\u043e\u043a\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c Solidity \u0431\u0443\u0434\u0435\u0442 \u0443 \u0432\u0441\u0435\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 memory.<\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 assembly \u0431\u043b\u043e\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u0435\u0437\u00a0<code>{ ... }<\/code>:<\/p>\n<pre><code class=\"javascript\">  assembly {       let x := 3  \/\/ x \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438        \/\/ \u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 1       {           let y := x  \/\/ \u0442\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0438\u0434\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e       }        \/\/ \u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438  2       {           let z := y  \/\/ \u0430 \u0442\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443       }   }<\/code><\/pre>\n<p>\u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a\u00a0<code>for<\/code>\u00a0\u0438\u00a0<code>function<\/code>.<\/p>\n<blockquote>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. <\/em>\u0412 standalone assembly (\u043a\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Yul) \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#specification-of-yul-object\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>.<\/p>\n<\/blockquote>\n<h4>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h4>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 Yul \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 solidity. \u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430 &#8212; \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u0447\u043a\u0443 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439\u00a0<code>;<\/code>, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 <code>+<\/code>,\u00a0<code>-<\/code>\u00a0\u0438 \u0442.\u0434.) \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435\u00a0<a href=\"https:\/\/docs.soliditylang.org\/en\/latest\/yul.html#evm-dialect\"><u>\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/u><\/a>, \u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u00a0<code>:=<\/code>. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>let<\/code>. \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438 \u043d\u0435 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u043c.<\/p>\n<p>\u0412\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 EVM \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>let<\/code>\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0442 \u0441\u0442\u0435\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u043d\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0442 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439;<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0442\u0435\u043c \u0441\u043b\u043e\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0446\u0430 \u0431\u043b\u043e\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 Solidity \u0438 \u0432 Yul:<\/p>\n<pre><code class=\"javascript\">  \/\/ Solidity   uint256 a = (3 + 3) \/ 2;    \/\/ Yul   assembly {     let b := div(add(3, 3), 2)   }<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f\u00a0<code>add<\/code>, \u0437\u0430\u0442\u0435\u043c\u00a0<code>div<\/code>, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435. \u041f\u0435\u0440\u0432\u043e\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0430\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f.<\/p>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u043e\u0436\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043e\u043d\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0447\u0430\u0441\u0442\u044c\u044e \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u0439 Solidity. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u00a0<code>-><\/code>\u00a0\u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0412\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 \u0431\u043b\u043e\u043a\u0435 inline assembly \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0432\u043d\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"javascript\">    function foo() external {         assembly {             function bar(param1, param2, ...) -> return1, return2, ... {                 \/\/ code             }              let x, y := bar(1, 2)         }     }<\/code><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>leave<\/code>\u00a0\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0442\u0435\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 assembly \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u043d\u0435\u0435. \u041e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u043f\u0443\u0441\u0442\u043e\u0439\u00a0<code>return<\/code>\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0437\u0430 \u043e\u0434\u043d\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0435\u0442 \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.<\/p>\n<pre><code class=\"javascript\">    assembly {         function increment() -> result {             let param := calldataload(4)             result := add(param, 1)             \/\/ leave \u0432\u0435\u0440\u043d\u0435\u0442 \"result\", \u043d\u043e \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430             \/\/ \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0431\u044b \u0441 return             \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 assembly \u0438\u043b\u0438 solidity \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0441\u044f             leave         }     } <\/code><\/pre>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<code>leave<\/code>\u00a0\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 Yul \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/blockquote>\n<p>Yul \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a Solidity, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<code>\/\/<\/code>\u00a0\u0438\u00a0<code>\/* *\/<\/code>\u00a0\u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432.<\/p>\n<h4>\u0422\u0438\u043f\u044b<\/h4>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 Yul \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0442\u0438\u043f &#8212;\u00a0<code>u256<\/code>\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u00a0<code>uint256<\/code>, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u0447\u0435 \u0435\u0433\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a\u00a0<code>bytes32<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0442\u0435\u043a\u043e\u0432\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 32-x \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u0438\u0435 256-\u0431\u0438\u0442\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u043d\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435.<\/p>\n<p>\u0412\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=ZGDQMS9GWo8&amp;list=PL5hld-skrdFrxGUmmEbG1LBvYVyTE9M62&amp;index=3\"><u>\u044d\u0442\u043e\u043c \u0432\u0438\u0434\u0435\u043e<\/u><\/a>\u00a0\u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0432 Yul. \u041b\u044e\u0431\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u00a0<code>bytes32<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 Yul \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438).<\/p>\n<p><em>\u0412\u0430\u0436\u043d\u043e!<\/em>\u00a0\u041d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0431\u0443\u043b\u0435\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Yul &#8212; \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u043a\u043e\u0434\u0430\u00a0<code>ISZERO<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c\u00a0<code>true<\/code>\u00a0\u0431\u0443\u0434\u0435\u0442 \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043e\u0442 0.<\/p>\n<pre><code class=\"javascript\">    function getBool() external pure returns (bool res) {         uint256 a = 42; \/\/ 42 (decimal) == 0x2a (hex)          assembly {             res := a \/\/ 0x000000000000000000000000000000000000000000000000000000000000002a         }         \/\/ res == true     }<\/code><\/pre>\n<h4>\u041b\u0438\u0442\u0435\u0440\u0430\u043b\u044b<\/h4>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0426\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u043e\u0439 \u0438\u043b\u0438 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 (<code>42<\/code>,\u00a0<code>0x2a<\/code>);<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u043e\u043a\u0438 ASCII (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ababc\u00bb), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0435 escape-\u0441\u0438\u043c\u0432\u043e\u043b\u044b\u00a0<code>\\xNN<\/code>\u00a0\u0438 escape-\u0441\u0438\u043c\u0432\u043e\u043b\u044b \u042e\u043d\u0438\u043a\u043e\u0434\u0430\u00a0<code>\\uNNNN<\/code>, \u0433\u0434\u0435 N \u2014 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0428\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440\u00a0<code>hex\"616263\"<\/code>).<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">    assembly {         let a := 0x123             \/\/ Hexadecimal         let b := 42                \/\/ Decimal         let c := \"hello world\"     \/\/ String         let d := \"very long string more than 32 bytes\" \/\/ Error     }<\/code><\/pre>\n<p>\u041f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0441\u0442\u0435\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 32-\u0445 \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u0438\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 32 \u0431\u0430\u0439\u0442 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0447\u0435\u0440\u0435\u0437\u00a0<code>let<\/code>.<\/p>\n<h4>\u041f\u043e\u0442\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041f\u043e\u0442\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 Yul \u0432\u044b\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438\u00a0<code>if<\/code>\u00a0\u0438\u00a0<code>switch<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0446\u0438\u043a\u043b\u043e\u043c\u00a0<code>for<\/code>, \u0438\u0445 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 solidity, \u043d\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u0442\u0435 \u0436\u0435.<\/p>\n<p>\u0418\u0437 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439: \u0446\u0438\u043a\u043b\u0430\u00a0<code>while<\/code>\u00a0\u0432 Yul \u043d\u0435\u0442, \u0430 \u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u00a0<code>if<\/code>\u00a0\u043d\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u00a0<code>else<\/code>\u00a0(\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0434\u0435\u043b\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<code>switch<\/code>). \u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0439\u00a0<code>if<\/code>\u00a0\u0431\u0435\u0437 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043e\u043a.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c\u00a0<code>if<\/code>:<\/p>\n<pre><code class=\"javascript\">    function ifStatement(uint256 n) external {         assembly {             if iszero(n) {                 \/\/ \u0435\u0441\u043b\u0438 true, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435             }         }     }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c\u00a0<code>switch<\/code>:<\/p>\n<pre><code class=\"javascript\">    function switchStatement(uint256 n) external {         assembly {             switch n             case 0 {                 \/\/ \u0435\u0441\u043b\u0438 n == 0 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435             }             case 1 {                 \/\/ \u0435\u0441\u043b\u0438 n == 1 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435             }             default {                 \/\/ \u0435\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b                 \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e             }         }     }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0446\u0438\u043a\u043b\u0430\u00a0<code>for<\/code>:<\/p>\n<pre><code class=\"javascript\">    function forLoop(uint256 n) external {         assembly {             for { let i := 0 } lt(i, n) { i := add(i, 1) } {                 \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435             }         }     }      function forLoopWithAnotherCondition(uint256 n) external {         assembly {             let i := 0             for {} lt(i, n) {} {  <\/code><\/pre>\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-374830","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/374830","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=374830"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/374830\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=374830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=374830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=374830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}