608060405234801561001057600080fd5b50610217806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063569c5f6d14610046578063a1c5191514610064578063d46300fd14610082575b600080fd5b61004e6100a0565b60405161005b9190610105565b60405180910390f35b61006c6100c5565b604051610079919061015b565b60405180910390f35b61008a6100d6565b6040516100979190610105565b60405180910390f35b600065aabbccddeeff60d01b60d01c651122334455666100c091906101a5565b905090565b600065aabbccddeeff60d01b905090565b600065112233445566905090565b600065ffffffffffff82169050919050565b6100ff816100e4565b82525050565b600060208201905061011a60008301846100f6565b92915050565b60007fffffffffffff000000000000000000000000000000000000000000000000000082169050919050565b61015581610120565b82525050565b6000602082019050610170600083018461014c565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006101b0826100e4565b91506101bb836100e4565b92508265ffffffffffff038211156101d6576101d5610176565b5b82
This file contains hidden or 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: GPL-3.0 | |
| pragma solidity ^0.8.0; | |
| contract Code { | |
| uint48 private constant A = 0x112233445566; | |
| bytes6 private immutable B; | |
| constructor() { | |
| B = 0xaabbccddeeff; |
6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220c8b048d9b24b9ef80deaef07bc4ef7b656be161b9dba5ceded1b7e6d169de65364736f6c634300080f0033
This file contains hidden or 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
| PUSH1 00 | |
| DUP1 | |
| PUSH1 01 ; uint256 a = 1 | |
| SWAP1 | |
| POP | |
| PUSH1 02 ; let b := 2 (first line of assembly block) | |
| DUP2 ; duplicate value of `a` to get it on top of the stack | |
| DUP2 ; duplicate value of `b` to get it on top of the stack | |
| ADD ; add the values together | |
| SWAP2 |
This file contains hidden or 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: GPL-3.0 | |
| pragma solidity ^0.8.0; | |
| contract Stack { | |
| function exampleStackAssembly() public pure returns (uint256) { | |
| uint256 a = 1; | |
| assembly { | |
| let b := 2 |
This file contains hidden or 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
| ; without block scope | |
| ; ---------- | |
| 080 PUSH1 00 | |
| 082 PUSH1 10 | |
| 084 SWAP1 | |
| 085 POP | |
| 086 PUSH1 00 | |
| 088 PUSH1 0f | |
| 090 SWAP1 |
This file contains hidden or 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: GPL-3.0 | |
| pragma solidity ^0.8.0; | |
| contract BlockScope { | |
| function withoutBrackets() public pure { | |
| uint256 _16 = 16; | |
| uint256 _15 = 15; | |
| uint256 _14 = 14; |
This file contains hidden or 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
| function callWithLiteralString() public { | |
| bytes memory calldataPayload = "0x1003e2d20000000000000000000000000000000000000000000000000000000000000005"; | |
| (bool success, ) = address(deployed_contract).call(calldataPayload); | |
| } |
This file contains hidden or 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: UNLICENSED | |
| pragma solidity ^0.8.0; | |
| contract DeployedContract { | |
| uint public result = 0; | |
| function add(uint256 input) public { | |
| result = result + input; | |
| } | |
| } |
This file contains hidden or 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
| // We require the Hardhat Runtime Environment explicitly here. This is optional | |
| // but useful for running the script in a standalone fashion through `node <script>`. | |
| // | |
| // When running the script with `npx hardhat run <script>` you'll find the Hardhat | |
| // Runtime Environment's members available in the global scope. | |
| const hre = require("hardhat"); | |
| const SampleProfile = require("./SampleProfile.json"); | |
| async function main() { | |
| // Hardhat always runs the compile task when running scripts with its command |