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
/// @notice These functions are part of a contract that | |
/// wraps a user's Uniswap V3 liquidity positions in an ERC20 token, `wrappedToken`. | |
// *** wrappedToken is a standard ERC20 token. *** | |
uint256 public protocolFee = 5; | |
function deposit( | |
IUniswapV3Pool pool, | |
int24 tickLower, | |
int24 tickUpper, |
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: GPL-3.0 | |
pragma solidity 0.8.15; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "hardhat/console.sol"; | |
// You may not modify this contract | |
contract NotRareToken is ERC721 { | |
mapping(address => bool) private alreadyMinted; |
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.17; | |
import "forge-std/Test.sol"; | |
contract TestDeleteMappingInStruct is Test { | |
/// @param enabled Whether the token is enabled or not | |
/// @param balances Mapping of user address to balance | |
struct Token { | |
bool enabled; |
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.17; | |
import "forge-std/Test.sol"; | |
contract Test67 is Test { | |
struct S2 { | |
uint256 a2; | |
uint256 b2; | |
} |
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
# This is a bash function that will copy a vscode settings.json file into the current directory and randomly select a color scheme. | |
# Step 1: Create a settting.json file somewhere which at least contains this section. Feel free to add your favorite settings to this. | |
{ | |
"workbench.colorCustomizations": { | |
"titleBar.activeForeground": "FOREGROUND", | |
"titleBar.inactiveForeground": "FOREGROUND", | |
"titleBar.activeBackground": "BACKGROUND", | |
"titleBar.inactiveBackground": "BACKGROUND" |
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.15; | |
import "forge-std/Test.sol"; | |
contract Pool { | |
uint256 public immutable var1; | |
uint256 public var2; | |
constructor(uint256 var1_) { | |
var1 = var1_; |
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
Goal: | |
0x00: 0000000000000000000000000000000000000000000000000000000000000020 (offset) | |
0x20: 0000000000000000000000000000000000000000000000000000000000000003 (length) | |
0x40: 544b4e0000000000000000000000000000000000000000000000000000000000 (“TKN”) | |
Normal way: | |
Step 1) | |
0x20 0x00 MSTORE | |
Memory layout: |
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
// This is the main file that will be compiled | |
/* Imports */ | |
#include "./ERC20.huff" | |
#include "./utils/Ownable.huff" | |
#define macro CONSTRUCTOR() = takes (0) returns (0) { | |
OWNABLE_CONSTRUCTOR() | |
ERC20_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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.3; | |
/* | |
Pasting this code into evm.codes playground and stepping through will show that starting on instruction 1d, the | |
JUMPDEST of the target function (which is 36) is pushed onto the stack. Then there is a SHL(20) performed on it. | |
Then it's ORed with 00b4 so 36 becomes 36000000b4. | |
Then later in step 47, when myFunc() calls targetFunc(), it does a SHR(20) to convert 36000000b4 back to 36 which | |
it then uses for the JUMPDEST to targetFunc(). Nothing is ever done with the 000000b4 part. A copy of the full |
NewerOlder