OpCode

Enum OpCode 

Source
pub enum OpCode {
Show 144 variants STOP, ADD, MUL, SUB, DIV, SDIV, MOD, SMOD, ADDMOD, MULMOD, EXP, SIGNEXTEND, LT, GT, SLT, SGT, EQ, ISZERO, AND, OR, XOR, NOT, BYTE, SHL, SHR, SAR, SHA3, ADDRESS, BALANCE, ORIGIN, CALLER, CALLVALUE, CALLDATALOAD, CALLDATASIZE, CALLDATACOPY, CODESIZE, CODECOPY, GASPRICE, EXTCODESIZE, EXTCODECOPY, RETURNDATASIZE, RETURNDATACOPY, EXTCODEHASH, BLOCKHASH, COINBASE, TIMESTAMP, NUMBER, DIFFICULTY, GASLIMIT, CHAINID, SELFBALANCE, BASEFEE, POP, MLOAD, MSTORE, MSTORE8, SLOAD, SSTORE, JUMP, JUMPI, PC, MSIZE, GAS, JUMPDEST, PUSH0, PUSH1, 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, DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16, SWAP1, SWAP2, SWAP3, SWAP4, SWAP5, SWAP6, SWAP7, SWAP8, SWAP9, SWAP10, SWAP11, SWAP12, SWAP13, SWAP14, SWAP15, SWAP16, LOG0, LOG1, LOG2, LOG3, LOG4, CREATE, CALL, CALLCODE, RETURN, DELEGATECALL, CREATE2, STATICCALL, REVERT, INVALID, SELFDESTRUCT,
}
Expand description

Ethereum virtual machine opcode.

Variants§

§

STOP

Halts execution.

§

ADD

Addition operation.

§

MUL

Multiplication operation.

§

SUB

Subtraction operation.

§

DIV

Integer division operation.

§

SDIV

Signed integer division operation (truncated).

§

MOD

Modulo remainder operation.

§

SMOD

Signed modulo remainder operation.

§

ADDMOD

Modulo addition operation.

§

MULMOD

Modulo multiplication operation.

§

EXP

Exponential operation.

§

SIGNEXTEND

Extend length of signed integer.

§

LT

Less-than comparision.

§

GT

Greater-than comparision.

§

SLT

Signed less-than comparision.

§

SGT

Signed greater-than comparision.

§

EQ

Equality comparision.

§

ISZERO

Simple not operator.

§

AND

Bitwise AND operation.

§

OR

Bitwise OR operation.

§

XOR

Bitwise XOR operation.

§

NOT

Bitwise NOT operation.

§

BYTE

Retrieve single byte from word.

§

SHL

Shift left operation.

§

SHR

Logical shift right operation.

§

SAR

Arithmetic shift right operation.

§

SHA3

Compute Keccak-256 hash.

§

ADDRESS

Get address of currently executing account.

§

BALANCE

Get balance of the given account.

§

ORIGIN

Get execution origination address.

§

CALLER

Get caller address.

§

CALLVALUE

Get deposited value by the instruction/transaction responsible for this execution.

§

CALLDATALOAD

Get input data of current environment.

§

CALLDATASIZE

Get size of input data in current environment.

§

CALLDATACOPY

Copy input data in current environment to memory.

§

CODESIZE

Get size of code running in current environment.

§

CODECOPY

Copy code running in current environment to memory.

§

GASPRICE

Get price of gas in current environment.

§

EXTCODESIZE

Get external code size.

§

EXTCODECOPY

Copy external code to memory.

§

RETURNDATASIZE

Get size of available gas.

§

RETURNDATACOPY

Copy output data to memory.

§

EXTCODEHASH

Get size of code running in current environment.

§

BLOCKHASH

Get hash of most recent complete block.

§

COINBASE

Get the block’s coinbase address.

§

TIMESTAMP

Get the block’s timestamp.

§

NUMBER

Get the block’s number.

§

DIFFICULTY

Get the block’s difficulty.

§

GASLIMIT

Get the block’s gas limit.

§

CHAINID

Get the chain ID.

§

SELFBALANCE

Get balance of currently executing account.

§

BASEFEE

Get the base fee.

§

POP

Remove item from stack.

§

MLOAD

Load word from memory.

§

MSTORE

Save word to memory.

§

MSTORE8

Save byte to memory.

§

SLOAD

Load word from storage.

§

SSTORE

Save word to storage.

§

JUMP

Alter the program counter.

§

JUMPI

Conditionally alter the program counter.

§

PC

Get the program counter.

§

MSIZE

Get the size of active memory.

§

GAS

Get the amount of available gas.

§

JUMPDEST

Set a potential jump destination.

§

PUSH0

Place value 0 on stack.

§

PUSH1

Place 1 byte item on stack.

§

PUSH2

Place 2 byte item on stack.

§

PUSH3

Place 3 byte item on stack.

§

PUSH4

Place 4 byte item on stack.

§

PUSH5

Place 5 byte item on stack.

§

PUSH6

Place 6 byte item on stack.

§

PUSH7

Place 7 byte item on stack.

§

PUSH8

Place 8 byte item on stack.

§

PUSH9

Place 9 byte item on stack.

§

PUSH10

Place 10 byte item on stack.

§

PUSH11

Place 11 byte item on stack.

§

PUSH12

Place 12 byte item on stack.

§

PUSH13

Place 13 byte item on stack.

§

PUSH14

Place 14 byte item on stack.

§

PUSH15

Place 15 byte item on stack.

§

PUSH16

Place 16 byte item on stack.

§

PUSH17

Place 17 byte item on stack.

§

PUSH18

Place 18 byte item on stack.

§

PUSH19

Place 19 byte item on stack.

§

PUSH20

Place 20 byte item on stack.

§

PUSH21

Place 21 byte item on stack.

§

PUSH22

Place 22 byte item on stack.

§

PUSH23

Place 23 byte item on stack.

§

PUSH24

Place 24 byte item on stack.

§

PUSH25

Place 25 byte item on stack.

§

PUSH26

Place 26 byte item on stack.

§

PUSH27

Place 27 byte item on stack.

§

PUSH28

Place 28 byte item on stack.

§

PUSH29

Place 29 byte item on stack.

§

PUSH30

Place 30 byte item on stack.

§

PUSH31

Place 31 byte item on stack.

§

PUSH32

Place 32 byte item on stack.

§

DUP1

Duplicate 1st stack item.

§

DUP2

Duplicate 2nd stack item.

§

DUP3

Duplicate 3rd stack item.

§

DUP4

Duplicate 4th stack item.

§

DUP5

Duplicate 5th stack item.

§

DUP6

Duplicate 6th stack item.

§

DUP7

Duplicate 7th stack item.

§

DUP8

Duplicate 8th stack item.

§

DUP9

Duplicate 9th stack item.

§

DUP10

Duplicate 10th stack item.

§

DUP11

Duplicate 11th stack item.

§

DUP12

Duplicate 12th stack item.

§

DUP13

Duplicate 13th stack item.

§

DUP14

Duplicate 14th stack item.

§

DUP15

Duplicate 15th stack item.

§

DUP16

Duplicate 16th stack item.

§

SWAP1

Exchange 1st and 2nd stack items.

§

SWAP2

Exchange 1st and 3rd stack items.

§

SWAP3

Exchange 1st and 4th stack items.

§

SWAP4

Exchange 1st and 5th stack items.

§

SWAP5

Exchange 1st and 6th stack items.

§

SWAP6

Exchange 1st and 7th stack items.

§

SWAP7

Exchange 1st and 8th stack items.

§

SWAP8

Exchange 1st and 9th stack items.

§

SWAP9

Exchange 1st and 10th stack items.

§

SWAP10

Exchange 1st and 11th stack items.

§

SWAP11

Exchange 1st and 12th stack items.

§

SWAP12

Exchange 1st and 13th stack items.

§

SWAP13

Exchange 1st and 14th stack items.

§

SWAP14

Exchange 1st and 15th stack items.

§

SWAP15

Exchange 1st and 16th stack items.

§

SWAP16

Exchange 1st and 17th stack items.

§

LOG0

Append log record with no topics.

§

LOG1

Append log record with one topic.

§

LOG2

Append log record with two topics.

§

LOG3

Append log record with three topics.

§

LOG4

Append log record with four topics.

§

CREATE

Create a new account with associated code.

§

CALL

Message-call into an account.

§

CALLCODE

Message-call into this account with an alternative account’s code.

§

RETURN

Halts execution returning output data.

§

DELEGATECALL

Message-call into this account with an alternative account’s code, but with persistent state and code not being modified.

§

CREATE2

Create a new account without associated code.

§

STATICCALL

Static message-call into an account.

§

REVERT

Halt execution and register account for later deletion.

§

INVALID

Designated invalid instruction.

§

SELFDESTRUCT

Halt execution and register account for later deletion, unless already scheduled.

Implementations§

Source§

impl OpCode

Source

pub fn gas<T>(&self) -> T
where T: From<u16>,

Returns the minimal gas cost of the opcode.

Trait Implementations§

Source§

impl Clone for OpCode

Source§

fn clone(&self) -> OpCode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OpCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<OpCode> for u16

Source§

fn from(opcode: OpCode) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for OpCode

Source§

fn from(code: u8) -> Self

Converts to this type from the input type.
Source§

impl Copy for OpCode

Auto Trait Implementations§

§

impl Freeze for OpCode

§

impl RefUnwindSafe for OpCode

§

impl Send for OpCode

§

impl Sync for OpCode

§

impl Unpin for OpCode

§

impl UnwindSafe for OpCode

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.