Created
March 29, 2023 10:50
-
-
Save sodexx7/bd8fc673e249e8a1cf64b5922850b314 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
repositoryformatversion = 0 | |
filemode = false | |
bare = false | |
logallrefupdates = true | |
symlinks = false | |
ignorecase = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ref: refs/heads/main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIRC d$[���d$[��� g �� ��lS�H�|٦�=���� | |
.gitignore d$�,*�@d$�,*�@ Q �� ���E���}+��z�J�l� MagicNumSolver.sol �5����o؝������>J�� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x�+)JMU0` | |
, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x���K | |
�0@]��2If� �x�|�0��=�E���o�����6��p���̖j�hK��cB�'�>Z�)�`Tϴ�<tp&a��� H�(p�C��H�!D��㾬��Tٶ��?��zj�SY�E� �#�>®�|����6��>Xj?� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x���M | |
�0@a�9����d2������v��R���o�xe��&O����l}-�l�$9&$��̕�e�����L��s,��*������S{]��7���B`8�NS��ʟ�i��s�3L |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x����O"1��y���q1 | |
C����.�hrx0�ɤ�l��@.��vW���n�����7�ia��L~��t0^?��1)W���2����>w�(Z8=/5�-Lfd�'j_��W���S�@�Mz�,Ƕxa�r^�2��V��\N�M86g �{��0%gL7©��0u%Mp����b����D>�o�P�,�>G�)��נ��-��y��3N:�� �>��Z�%��m��ވ�U��Ix��x�wtsJvf�cY� | |
=�*�v�O������.at3y��C��}釒R:!�vT�f=�Ws�C�4���W5VF��C�\ae]v��51:W�1���ԁ���b;�y� �&5L}��KټXL���ew��1�s���=�������� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x�K��OR06dH,*�LKL.)��K�,��+(J-)�L-*J��*�� � |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5393164245d240a83e5388fbbf925d3e3dfa4dd0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
artifacts | |
.git | |
.prettierrc.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"overrides": [ | |
{ | |
"files": "*.sol", | |
"options": { | |
"printWidth": 80, | |
"tabWidth": 4, | |
"useTabs": false, | |
"singleQuote": false, | |
"bracketSpacing": false | |
} | |
}, | |
{ | |
"files": "*.yml", | |
"options": {} | |
}, | |
{ | |
"files": "*.yaml", | |
"options": {} | |
}, | |
{ | |
"files": "*.toml", | |
"options": {} | |
}, | |
{ | |
"files": "*.json", | |
"options": {} | |
}, | |
{ | |
"files": "*.js", | |
"options": {} | |
}, | |
{ | |
"files": "*.ts", | |
"options": {} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "e1b3f9dbea820dab2075404e178932f4", | |
"_format": "hh-sol-build-info-1", | |
"solcVersion": "0.8.18", | |
"solcLongVersion": "0.8.18+commit.87f61d96", | |
"input": { | |
"language": "Solidity", | |
"sources": { | |
"MagicNumSolver.sol": { | |
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ncontract MagicNumSolver {\n constructor() {\n assembly {\n\n // This is the bytecode we want the program to have:\n // 00 PUSH1 2a /* push dec 42 (hex 0x2a) onto the stack */\n // 03 PUSH1 0 /* store 42 at memory position 0 */\n // 05 MSTORE\n // 06 PUSH1 20 /* return 32 bytes in memory */\n // 08 PUSH1 0\n // 10 RETURN\n // Bytecode: 0x602a60005260206000f3 (length 0x0a or 10)\n // Bytecode within a 32 byte word:\n // 0x00000000000000000000000000000000000000000000604260005260206000f3 (length 0x20 or 32)\n // ^ (offset 0x16 or 22)\n \n mstore(0, 0x602a60005260206000f3)\n return(0x16, 0x0a)\n }\n }\n}" | |
} | |
}, | |
"settings": { | |
"optimizer": { | |
"enabled": false, | |
"runs": 200 | |
}, | |
"outputSelection": { | |
"*": { | |
"": [ | |
"ast" | |
], | |
"*": [ | |
"abi", | |
"metadata", | |
"devdoc", | |
"userdoc", | |
"storageLayout", | |
"evm.legacyAssembly", | |
"evm.bytecode", | |
"evm.deployedBytecode", | |
"evm.methodIdentifiers", | |
"evm.gasEstimates", | |
"evm.assembly" | |
] | |
} | |
} | |
} | |
}, | |
"output": { | |
"contracts": { | |
"MagicNumSolver.sol": { | |
"MagicNumSolver": { | |
"abi": [ | |
{ | |
"inputs": [], | |
"stateMutability": "nonpayable", | |
"type": "constructor" | |
} | |
], | |
"devdoc": { | |
"kind": "dev", | |
"methods": {}, | |
"version": 1 | |
}, | |
"evm": { | |
"assembly": " /* \"MagicNumSolver.sol\":58:769 contract MagicNumSolver {... */\n mstore(0x40, 0x80)\n /* \"MagicNumSolver.sol\":86:767 constructor() {... */\n callvalue\n dup1\n iszero\n tag_1\n jumpi\n 0x00\n dup1\n revert\ntag_1:\n pop\n /* \"MagicNumSolver.sol\":709:731 0x602a60005260206000f3 */\n 0x602a60005260206000f3\n /* \"MagicNumSolver.sol\":706:707 0 */\n 0x00\n /* \"MagicNumSolver.sol\":699:732 mstore(0, 0x602a60005260206000f3) */\n mstore\n /* \"MagicNumSolver.sol\":752:756 0x0a */\n 0x0a\n /* \"MagicNumSolver.sol\":746:750 0x16 */\n 0x16\n /* \"MagicNumSolver.sol\":739:757 return(0x16, 0x0a) */\n return\nstop\n\nsub_0: assembly {\n /* \"MagicNumSolver.sol\":58:769 contract MagicNumSolver {... */\n mstore(0x40, 0x80)\n 0x00\n dup1\n revert\n\n auxdata: 0xa2646970667358221220040d6043236a4e8926e3dd6c91df1abfae45c7ee560e669bba7557c79184c49364736f6c63430008120033\n}\n", | |
"bytecode": { | |
"functionDebugData": { | |
"@_6": { | |
"entryPoint": null, | |
"id": 6, | |
"parameterSlots": 0, | |
"returnSlots": 0 | |
} | |
}, | |
"generatedSources": [], | |
"linkReferences": {}, | |
"object": "6080604052348015600f57600080fd5b5069602a60005260206000f3600052600a6016f3fe", | |
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH10 0x602A60005260206000F3 PUSH1 0x0 MSTORE PUSH1 0xA PUSH1 0x16 RETURN INVALID ", | |
"sourceMap": "58:711:0:-:0;;;86:681;;;;;;;;;;709:22;706:1;699:33;752:4;746;739:18" | |
}, | |
"deployedBytecode": { | |
"functionDebugData": {}, | |
"generatedSources": [], | |
"immutableReferences": {}, | |
"linkReferences": {}, | |
"object": "6080604052600080fdfea2646970667358221220040d6043236a4e8926e3dd6c91df1abfae45c7ee560e669bba7557c79184c49364736f6c63430008120033", | |
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DIV 0xD PUSH1 0x43 0x23 PUSH11 0x4E8926E3DD6C91DF1ABFAE GASLIMIT 0xC7 0xEE JUMP 0xE PUSH7 0x9BBA7557C79184 0xC4 SWAP4 PUSH5 0x736F6C6343 STOP ADDMOD SLT STOP CALLER ", | |
"sourceMap": "58:711:0:-:0;;;;;" | |
}, | |
"gasEstimates": { | |
"creation": { | |
"codeDepositCost": "12600", | |
"executionCost": "57", | |
"totalCost": "12657" | |
} | |
}, | |
"legacyAssembly": { | |
".code": [ | |
{ | |
"begin": 58, | |
"end": 769, | |
"name": "PUSH", | |
"source": 0, | |
"value": "80" | |
}, | |
{ | |
"begin": 58, | |
"end": 769, | |
"name": "PUSH", | |
"source": 0, | |
"value": "40" | |
}, | |
{ | |
"begin": 58, | |
"end": 769, | |
"name": "MSTORE", | |
"source": 0 | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "CALLVALUE", | |
"source": 0 | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "DUP1", | |
"source": 0 | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "ISZERO", | |
"source": 0 | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "PUSH [tag]", | |
"source": 0, | |
"value": "1" | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "JUMPI", | |
"source": 0 | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "PUSH", | |
"source": 0, | |
"value": "0" | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "DUP1", | |
"source": 0 | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "REVERT", | |
"source": 0 | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "tag", | |
"source": 0, | |
"value": "1" | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "JUMPDEST", | |
"source": 0 | |
}, | |
{ | |
"begin": 86, | |
"end": 767, | |
"name": "POP", | |
"source": 0 | |
}, | |
{ | |
"begin": 709, | |
"end": 731, | |
"name": "PUSH", | |
"source": 0, | |
"value": "602A60005260206000F3" | |
}, | |
{ | |
"begin": 706, | |
"end": 707, | |
"name": "PUSH", | |
"source": 0, | |
"value": "0" | |
}, | |
{ | |
"begin": 699, | |
"end": 732, | |
"name": "MSTORE", | |
"source": 0 | |
}, | |
{ | |
"begin": 752, | |
"end": 756, | |
"name": "PUSH", | |
"source": 0, | |
"value": "A" | |
}, | |
{ | |
"begin": 746, | |
"end": 750, | |
"name": "PUSH", | |
"source": 0, | |
"value": "16" | |
}, | |
{ | |
"begin": 739, | |
"end": 757, | |
"name": "RETURN", | |
"source": 0 | |
} | |
], | |
".data": { | |
"0": { | |
".auxdata": "a2646970667358221220040d6043236a4e8926e3dd6c91df1abfae45c7ee560e669bba7557c79184c49364736f6c63430008120033", | |
".code": [ | |
{ | |
"begin": 58, | |
"end": 769, | |
"name": "PUSH", | |
"source": 0, | |
"value": "80" | |
}, | |
{ | |
"begin": 58, | |
"end": 769, | |
"name": "PUSH", | |
"source": 0, | |
"value": "40" | |
}, | |
{ | |
"begin": 58, | |
"end": 769, | |
"name": "MSTORE", | |
"source": 0 | |
}, | |
{ | |
"begin": 58, | |
"end": 769, | |
"name": "PUSH", | |
"source": 0, | |
"value": "0" | |
}, | |
{ | |
"begin": 58, | |
"end": 769, | |
"name": "DUP1", | |
"source": 0 | |
}, | |
{ | |
"begin": 58, | |
"end": 769, | |
"name": "REVERT", | |
"source": 0 | |
} | |
] | |
} | |
}, | |
"sourceList": [ | |
"MagicNumSolver.sol", | |
"#utility.yul" | |
] | |
}, | |
"methodIdentifiers": {} | |
}, | |
"metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"MagicNumSolver.sol\":\"MagicNumSolver\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"MagicNumSolver.sol\":{\"keccak256\":\"0xd810d6659970c9a5ba5e096ee16feff19132bb6dd9676038e4372df447ce3e5d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9a905ff3ac903219f2130564cb5e25e5c7817b9b88192574cfc7380fe0ad31af\",\"dweb:/ipfs/QmSE7iR9M4e2joEx53Y1vzQbtvp43dkbT6rsLJ7a2Tu7pM\"]}},\"version\":1}", | |
"storageLayout": { | |
"storage": [], | |
"types": null | |
}, | |
"userdoc": { | |
"kind": "user", | |
"methods": {}, | |
"version": 1 | |
} | |
} | |
} | |
}, | |
"sources": { | |
"MagicNumSolver.sol": { | |
"ast": { | |
"absolutePath": "MagicNumSolver.sol", | |
"exportedSymbols": { | |
"MagicNumSolver": [ | |
7 | |
] | |
}, | |
"id": 8, | |
"license": "MIT", | |
"nodeType": "SourceUnit", | |
"nodes": [ | |
{ | |
"id": 1, | |
"literals": [ | |
"solidity", | |
"^", | |
"0.8", | |
".0" | |
], | |
"nodeType": "PragmaDirective", | |
"src": "33:23:0" | |
}, | |
{ | |
"abstract": false, | |
"baseContracts": [], | |
"canonicalName": "MagicNumSolver", | |
"contractDependencies": [], | |
"contractKind": "contract", | |
"fullyImplemented": true, | |
"id": 7, | |
"linearizedBaseContracts": [ | |
7 | |
], | |
"name": "MagicNumSolver", | |
"nameLocation": "67:14:0", | |
"nodeType": "ContractDefinition", | |
"nodes": [ | |
{ | |
"body": { | |
"id": 5, | |
"nodeType": "Block", | |
"src": "100:667:0", | |
"statements": [ | |
{ | |
"AST": { | |
"nodeType": "YulBlock", | |
"src": "115:648:0", | |
"statements": [ | |
{ | |
"expression": { | |
"arguments": [ | |
{ | |
"kind": "number", | |
"nodeType": "YulLiteral", | |
"src": "706:1:0", | |
"type": "", | |
"value": "0" | |
}, | |
{ | |
"kind": "number", | |
"nodeType": "YulLiteral", | |
"src": "709:22:0", | |
"type": "", | |
"value": "0x602a60005260206000f3" | |
} | |
], | |
"functionName": { | |
"name": "mstore", | |
"nodeType": "YulIdentifier", | |
"src": "699:6:0" | |
}, | |
"nodeType": "YulFunctionCall", | |
"src": "699:33:0" | |
}, | |
"nodeType": "YulExpressionStatement", | |
"src": "699:33:0" | |
}, | |
{ | |
"expression": { | |
"arguments": [ | |
{ | |
"kind": "number", | |
"nodeType": "YulLiteral", | |
"src": "746:4:0", | |
"type": "", | |
"value": "0x16" | |
}, | |
{ | |
"kind": "number", | |
"nodeType": "YulLiteral", | |
"src": "752:4:0", | |
"type": "", | |
"value": "0x0a" | |
} | |
], | |
"functionName": { | |
"name": "return", | |
"nodeType": "YulIdentifier", | |
"src": "739:6:0" | |
}, | |
"nodeType": "YulFunctionCall", | |
"src": "739:18:0" | |
}, | |
"nodeType": "YulExpressionStatement", | |
"src": "739:18:0" | |
} | |
] | |
}, | |
"evmVersion": "paris", | |
"externalReferences": [], | |
"id": 4, | |
"nodeType": "InlineAssembly", | |
"src": "106:657:0" | |
} | |
] | |
}, | |
"id": 6, | |
"implemented": true, | |
"kind": "constructor", | |
"modifiers": [], | |
"name": "", | |
"nameLocation": "-1:-1:-1", | |
"nodeType": "FunctionDefinition", | |
"parameters": { | |
"id": 2, | |
"nodeType": "ParameterList", | |
"parameters": [], | |
"src": "97:2:0" | |
}, | |
"returnParameters": { | |
"id": 3, | |
"nodeType": "ParameterList", | |
"parameters": [], | |
"src": "100:0:0" | |
}, | |
"scope": 7, | |
"src": "86:681:0", | |
"stateMutability": "nonpayable", | |
"virtual": false, | |
"visibility": "public" | |
} | |
], | |
"scope": 8, | |
"src": "58:711:0", | |
"usedErrors": [] | |
} | |
], | |
"src": "33:736:0" | |
}, | |
"id": 0 | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"deploy": { | |
"VM:-": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"main:1": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"ropsten:3": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"rinkeby:4": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"kovan:42": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"goerli:5": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"Custom": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
} | |
}, | |
"data": { | |
"bytecode": { | |
"functionDebugData": { | |
"@_6": { | |
"entryPoint": null, | |
"id": 6, | |
"parameterSlots": 0, | |
"returnSlots": 0 | |
} | |
}, | |
"generatedSources": [], | |
"linkReferences": {}, | |
"object": "6080604052348015600f57600080fd5b5069602a60005260206000f3600052600a6016f3fe", | |
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH10 0x602A60005260206000F3 PUSH1 0x0 MSTORE PUSH1 0xA PUSH1 0x16 RETURN INVALID ", | |
"sourceMap": "58:711:0:-:0;;;86:681;;;;;;;;;;709:22;706:1;699:33;752:4;746;739:18" | |
}, | |
"deployedBytecode": { | |
"functionDebugData": {}, | |
"generatedSources": [], | |
"immutableReferences": {}, | |
"linkReferences": {}, | |
"object": "6080604052600080fdfea2646970667358221220040d6043236a4e8926e3dd6c91df1abfae45c7ee560e669bba7557c79184c49364736f6c63430008120033", | |
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DIV 0xD PUSH1 0x43 0x23 PUSH11 0x4E8926E3DD6C91DF1ABFAE GASLIMIT 0xC7 0xEE JUMP 0xE PUSH7 0x9BBA7557C79184 0xC4 SWAP4 PUSH5 0x736F6C6343 STOP ADDMOD SLT STOP CALLER ", | |
"sourceMap": "58:711:0:-:0;;;;;" | |
}, | |
"gasEstimates": { | |
"creation": { | |
"codeDepositCost": "12600", | |
"executionCost": "57", | |
"totalCost": "12657" | |
} | |
}, | |
"methodIdentifiers": {} | |
}, | |
"abi": [ | |
{ | |
"inputs": [], | |
"stateMutability": "nonpayable", | |
"type": "constructor" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compiler": { | |
"version": "0.8.18+commit.87f61d96" | |
}, | |
"language": "Solidity", | |
"output": { | |
"abi": [ | |
{ | |
"inputs": [], | |
"stateMutability": "nonpayable", | |
"type": "constructor" | |
} | |
], | |
"devdoc": { | |
"kind": "dev", | |
"methods": {}, | |
"version": 1 | |
}, | |
"userdoc": { | |
"kind": "user", | |
"methods": {}, | |
"version": 1 | |
} | |
}, | |
"settings": { | |
"compilationTarget": { | |
"MagicNumSolver.sol": "MagicNumSolver" | |
}, | |
"evmVersion": "paris", | |
"libraries": {}, | |
"metadata": { | |
"bytecodeHash": "ipfs" | |
}, | |
"optimizer": { | |
"enabled": false, | |
"runs": 200 | |
}, | |
"remappings": [] | |
}, | |
"sources": { | |
"MagicNumSolver.sol": { | |
"keccak256": "0xd810d6659970c9a5ba5e096ee16feff19132bb6dd9676038e4372df447ce3e5d", | |
"license": "MIT", | |
"urls": [ | |
"bzz-raw://9a905ff3ac903219f2130564cb5e25e5c7817b9b88192574cfc7380fe0ad31af", | |
"dweb:/ipfs/QmSE7iR9M4e2joEx53Y1vzQbtvp43dkbT6rsLJ7a2Tu7pM" | |
] | |
} | |
}, | |
"version": 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract MagicNumSolver { | |
constructor() { | |
assembly { | |
// This is the bytecode we want the program to have: | |
// 00 PUSH1 2a /* push dec 42 (hex 0x2a) onto the stack */ | |
// 03 PUSH1 0 /* store 42 at memory position 0 */ | |
// 05 MSTORE | |
// 06 PUSH1 20 /* return 32 bytes in memory */ | |
// 08 PUSH1 0 | |
// 10 RETURN | |
// Bytecode: 0x602a60005260206000f3 (length 0x0a or 10) | |
// Bytecode within a 32 byte word: | |
// 0x00000000000000000000000000000000000000000000604260005260206000f3 (length 0x20 or 32) | |
// ^ (offset 0x16 or 22) | |
mstore(0, 0x602a60005260206000f3) | |
return(0x16, 0x0a) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment