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 | |
// no optimization | |
pragma solidity 0.8.19; | |
contract A { | |
event Log(string bleh); | |
// Pass an arbitrary bytecode offset, then make it a fn pointer and call it | |
function callme(bytes32 _offset) external { |
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
pragma solidity 0.8.16; | |
// optim 200 runs | |
contract Test { //27038 | |
struct StructA { | |
uint128 _a; | |
uint128 _b; | |
} | |
StructA structA; |
I hereby claim:
- I am drgorillamd on github.
- I am drgorilla_md (https://keybase.io/drgorilla_md) on keybase.
- I have a public key ASDSuXEe25NwE38lIIjbDUrB4KvUupKF6LcnYkEcqyCoWQo
To claim this, I am signing this object:
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
pragma solidity 0.8.7; | |
interface IE { | |
function setN() external; | |
} | |
contract D { | |
uint public n; | |
uint private temp; |
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
const ethers = require('ethers'); | |
const { Interface } = require('ethers/lib/utils'); | |
const contractAddress = ''; | |
const key = ''; | |
const RPC_SERVER = ''; | |
async function main () { | |
try { | |
const provider = new ethers.providers.JsonRpcProvider(RPC_SERVER); |
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.7.0 <0.9.0; | |
contract Caller { | |
uint256 flag = 0; | |
event InsideBeforeDelegate(); | |
event InsideAfterDelegate(); | |
event OutsideAfterAllWtf(); |
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
pragma solidity ^0.8.0; | |
contract Test { | |
function a(bytes32 c, bytes32 d, bytes16 e) external view returns(address[4] memory res) { | |
assembly { | |
//address will take the right-end 20 bytes -> starting at 0, need to add 8 bytes of padding (already 4 from the function sig) => shift right 64bits | |
mstore(res, shr(64, calldataload(0))) //res[0] res==keccak256(0)==0 here (slot0) | |
mstore(add(res, 32), calldataload(12)) // we want to have the offset 12 bytes before the begining of the address -> 4+20 are just before, then -12 = 12 | |
mstore(add(res, 64), calldataload(32)) |
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
pragma solidity "0.8.7"; | |
contract CallMeAndIRevert { | |
error ErrorA(); // 0x5283ed77 | |
error ErrorB(); // 0x8a25c831 | |
function triggerErrorAorB() external { | |
if(block.timestamp % 2 == 0) revert ErrorA(); | |
else revert ErrorB(); | |
} | |
} |