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
#!/bin/bash | |
# TODO add opcodes that are not allowed | |
# and translate them to "invalid" | |
# and then check that it is not present | |
# in the optimized code. | |
# "ovmCREATE(bytes)": "14aa2ff7", | |
# "ovmCREATE2(bytes,bytes32)": "99ccd98b", | |
# "ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)": "741a33eb", |
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
// Adapted from https://github.com/omgnetwork/plasma-contracts | |
// Licensed under Apache License 2.0 | |
// SPDX-License-Identifier: Apache-2.0 | |
export { Queue, insert, pop, min, defaultLessThanMemory, defaultLessThanStorage } | |
struct Queue<T> { | |
T[] heap; | |
function(T memory, T storage) internal view returns (bool) lessThanMemory; | |
function(T storage, T storage) internal view returns (bool) lessThanStorage; |
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
struct Query | |
{ | |
uint id; | |
function(uint, bytes memory) external callback; | |
} | |
contract Oracle | |
{ | |
event Queried(bytes,function(uint, bytes memory) 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
// unmodified | |
contract Token { | |
uint8 public decimals = 18; | |
string public name; | |
uint256 public lastTouched; | |
address public hub; | |
address public owner; |
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
[ | |
{ | |
"entryPoint": 399, | |
"id": 42, | |
"paramStackSlots": 2, | |
"returnStackSlots": 0 | |
}, | |
{ | |
"entryPoint": 408, | |
"id": 35, |
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
#include <iostream> | |
#include <vector> | |
#include <optional> | |
#include <assert.h> | |
using namespace std; | |
uint8_t constexpr PUSH = 0x60; | |
uint8_t constexpr JUMPDEST = 0x5b; | |
uint8_t constexpr BEGINSUB = 0xb5; |
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
Solidity code: | |
contract c { | |
function f(uint x) internal returns (uint) { | |
while (x > 0) | |
return 2 * f(x - 1); | |
} | |
} | |
Yul IR: |
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
/******************************************************* | |
* WARNING * | |
* Solidity to Yul compilation is still EXPERIMENTAL * | |
* It can result in LOSS OF FUNDS or worse * | |
* !USE AT YOUR OWN RISK! * | |
*******************************************************/ | |
object "ERC20_396" { | |
code { | |
{ |
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
contract C { | |
function f() public pure returns (uint x) { x = 7; } | |
} |
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
uint salt = 0x123; | |
bool success; | |
// order matters! | |
bytes memory p = abi.encode(param1, ..., paramn); | |
bytes memory c = type(C).creationCode; | |
assembly { | |
function memCopyPadded(from, to, length) { | |
for { let i := 0 } lt(i, length) { i := add(i, 0x20) } { | |
mstore(to, mload(from)) | |
to := add(to, 0x20) |
NewerOlder