Documentation ¶
Index ¶
Constants ¶
View Source
const ( STOP = OpCode(0x00) ADD = OpCode(0x01) MUL = OpCode(0x02) SUB = OpCode(0x03) DIV = OpCode(0x04) SDIV = OpCode(0x05) MOD = OpCode(0x06) SMOD = OpCode(0x07) ADDMOD = OpCode(0x08) MULMOD = OpCode(0x09) EXP = OpCode(0x0A) SIGNEXTEND = OpCode(0x0B) )
0x0 range - arithmetic ops.
View Source
const ( LT = OpCode(0x10) GT = OpCode(0x11) SLT = OpCode(0x12) SGT = OpCode(0x13) EQ = OpCode(0x14) ISZERO = OpCode(0x15) AND = OpCode(0x16) OR = OpCode(0x17) XOR = OpCode(0x18) NOT = OpCode(0x19) BYTE = OpCode(0x1A) SHL = OpCode(0x1B) SHR = OpCode(0x1C) SAR = OpCode(0x1D) SHA3 = OpCode(0x20) )
0x10 range - comparison ops.
View Source
const ( ADDRESS = OpCode(0x30) BALANCE = OpCode(0x31) ORIGIN = OpCode(0x32) CALLER = OpCode(0x33) CALLVALUE = OpCode(0x34) CALLDATALOAD = OpCode(0x35) CALLDATASIZE = OpCode(0x36) CALLDATACOPY = OpCode(0x37) CODESIZE = OpCode(0x38) CODECOPY = OpCode(0x39) GASPRICE = OpCode(0x3A) EXTCODESIZE = OpCode(0x3B) EXTCODECOPY = OpCode(0x3C) RETURNDATASIZE = OpCode(0x3D) RETURNDATACOPY = OpCode(0x3E) EXTCODEHASH = OpCode(0x3F) )
0x30 range - closure state.
View Source
const ( BLOCKHASH = OpCode(0x40) COINBASE = OpCode(0x41) TIMESTAMP = OpCode(0x42) NUMBER = OpCode(0x43) DIFFICULTY = OpCode(0x44) GASLIMIT = OpCode(0x45) CHAINID = OpCode(0x46) SELFBALANCE = OpCode(0x47) )
0x40 range - block operations.
View Source
const ( POP = OpCode(0x50) MLOAD = OpCode(0x51) MSTORE = OpCode(0x52) MSTORE8 = OpCode(0x53) SLOAD = OpCode(0x54) SSTORE = OpCode(0x55) JUMP = OpCode(0x56) JUMPI = OpCode(0x57) PC = OpCode(0x58) MSIZE = OpCode(0x59) GAS = OpCode(0x5A) JUMPDEST = OpCode(0x5B) BEGINSUB = OpCode(0x5c) RETURNSUB = OpCode(0x5d) JUMPSUB = OpCode(0x5e) )
0x50 range - 'storage' and execution.
View Source
const ( CREATE = OpCode(0xf0) CALL = OpCode(0xf1) CALLCODE = OpCode(0xf2) RETURN = OpCode(0xf3) DELEGATECALL = OpCode(0xf4) CREATE2 = OpCode(0xf5) STATICCALL = OpCode(0xfa) REVERT = OpCode(0xfd) SELFDESTRUCT = OpCode(0xff) )
0xf0 range - closures.
Variables ¶
View Source
var ValidOpcodes []OpCode
ValidOpcodes is the set of valid opcodes
Functions ¶
func InstructionCount ¶
InstructionCount counts the number of instructions
func NewInstructionIterator ¶
func NewInstructionIterator(code []byte) *instructionIterator
Create a new instruction iterator.
Types ¶
type OpCode ¶
type OpCode byte
OpCode is an EVM opcode
const ( PUSH1 OpCode = 0x60 + iota PUSH2 PUSH3 PUSH4 PUSH5 PUSH6 PUSH7 PUSH8 PUSH9 PUSH10 PUSH11 PUSH12 PUSH13 PUSH14 PUSH15 PUSH16 PUSH17 PUSH18 PUSH19 PUSH20 PUSH21 PUSH22 PUSH23 PUSH24 PUSH25 PUSH26 PUSH27 PUSH28 PUSH29 PUSH30 PUSH31 PUSH32 )
0x60 through 0x7F range.
const ( DUP1 OpCode = 0x80 + iota DUP2 DUP3 DUP4 DUP5 DUP6 DUP7 DUP8 DUP9 DUP10 DUP11 DUP12 DUP13 DUP14 DUP15 DUP16 )
0x80 range
const ( SWAP1 OpCode = 0x90 + iota SWAP2 SWAP3 SWAP4 SWAP5 SWAP6 SWAP7 SWAP8 SWAP9 SWAP10 SWAP11 SWAP12 SWAP13 SWAP14 SWAP15 SWAP16 )
0x90 range
func StringToOp ¶
StringToOp finds the opcode whose name is stored in `str`.
func (OpCode) Stackdelta ¶
Click to show internal directories.
Click to hide internal directories.