Skip to main content

EvmOpcode

Enum EvmOpcode 

Source
pub enum EvmOpcode {
Show 147 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, Prevrandao, Gaslimit, Chainid, Selfbalance, Basefee, Blobbasefee, Pop, Mload, Mstore, Mstore8, Sload, Sstore, Jump, Jumpi, Pc, Msize, Gas, Jumpdest, Tload, Tstore, Mcopy, 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

All EVM opcodes as defined in the Yellow Paper and subsequent EIPs.

Variants§

§

Stop

Halts execution.

§

Add

Integer addition.

§

Mul

Integer multiplication.

§

Sub

Integer subtraction.

§

Div

Integer division (unsigned).

§

Sdiv

Signed integer division.

§

Mod

Modulo remainder (unsigned).

§

Smod

Modulo remainder (signed).

§

Addmod

Addition modulo N.

§

Mulmod

Multiplication modulo N.

§

Exp

Exponentiation.

§

Signextend

Sign extend.

§

Lt

Less-than comparison (unsigned).

§

Gt

Greater-than comparison (unsigned).

§

Slt

Less-than comparison (signed).

§

Sgt

Greater-than comparison (signed).

§

Eq

Equality comparison.

§

Iszero

Is-zero check.

§

And

Bitwise AND.

§

Or

Bitwise OR.

§

Xor

Bitwise XOR.

§

Not

Bitwise NOT.

§

Byte

Retrieve single byte from word.

§

Shl

Left shift.

§

Shr

Logical right shift.

§

Sar

Arithmetic right shift.

§

Sha3

Compute Keccak-256 hash.

§

Address

Address of currently executing account.

§

Balance

Balance of given account.

§

Origin

Address of execution originator.

§

Caller

Address of caller.

§

Callvalue

Value deposited by caller.

§

Calldataload

Input data of current environment.

§

Calldatasize

Size of input data.

§

Calldatacopy

Copy input data to memory.

§

Codesize

Size of code at given address.

§

Codecopy

Copy code to memory.

§

Gasprice

Current gas price.

§

Extcodesize

Size of external code at given address.

§

Extcodecopy

Copy external code to memory.

§

Returndatasize

Size of return data from last call.

§

Returndatacopy

Copy return data to memory.

§

Extcodehash

Hash of external code at given address.

§

Blockhash

Hash of a recent block.

§

Coinbase

Current block’s beneficiary (coinbase).

§

Timestamp

Current block’s timestamp.

§

Number

Current block number.

§

Prevrandao

Difficulty / prevrandao of current block.

§

Gaslimit

Gas limit of current block.

§

Chainid

Chain ID.

§

Selfbalance

Balance of currently executing account.

§

Basefee

Base fee of current block.

§

Blobbasefee

Blob base fee (EIP-7516).

§

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 program counter.

§

Jumpi

Conditionally alter program counter.

§

Pc

Value of program counter before current instruction.

§

Msize

Size of active memory in bytes.

§

Gas

Amount of available gas.

§

Jumpdest

Mark a valid jump destination.

§

Tload

Load word from transient storage.

§

Tstore

Save word to transient storage.

§

Mcopy

Copy memory areas.

§

Push1

Push 1 byte onto stack.

§

Push2

Push 2 bytes onto stack.

§

Push3

Push 3 bytes onto stack.

§

Push4

Push 4 bytes onto stack.

§

Push5

Push 5 bytes onto stack.

§

Push6

Push 6 bytes onto stack.

§

Push7

Push 7 bytes onto stack.

§

Push8

Push 8 bytes onto stack.

§

Push9

Push 9 bytes onto stack.

§

Push10

Push 10 bytes onto stack.

§

Push11

Push 11 bytes onto stack.

§

Push12

Push 12 bytes onto stack.

§

Push13

Push 13 bytes onto stack.

§

Push14

Push 14 bytes onto stack.

§

Push15

Push 15 bytes onto stack.

§

Push16

Push 16 bytes onto stack.

§

Push17

Push 17 bytes onto stack.

§

Push18

Push 18 bytes onto stack.

§

Push19

Push 19 bytes onto stack.

§

Push20

Push 20 bytes onto stack.

§

Push21

Push 21 bytes onto stack.

§

Push22

Push 22 bytes onto stack.

§

Push23

Push 23 bytes onto stack.

§

Push24

Push 24 bytes onto stack.

§

Push25

Push 25 bytes onto stack.

§

Push26

Push 26 bytes onto stack.

§

Push27

Push 27 bytes onto stack.

§

Push28

Push 28 bytes onto stack.

§

Push29

Push 29 bytes onto stack.

§

Push30

Push 30 bytes onto stack.

§

Push31

Push 31 bytes onto stack.

§

Push32

Push 32 bytes onto 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 1 topic.

§

Log2

Append log record with 2 topics.

§

Log3

Append log record with 3 topics.

§

Log4

Append log record with 4 topics.

§

Create

Create a new account with associated code.

§

Call

Message-call into an account.

§

Callcode

Message-call with another account’s code.

§

Return

Halt, returning output data.

§

Delegatecall

Message-call into this account with caller’s code.

§

Create2

Create a new account with deterministic address.

§

Staticcall

Static message-call into an account.

§

Revert

Halt execution reverting state changes.

§

Invalid

Designated invalid instruction.

§

Selfdestruct

Halt execution and register account for deletion.

Implementations§

Source§

impl EvmOpcode

Source

pub fn byte(&self) -> u8

Returns the byte value of this opcode.

Source

pub fn mnemonic(&self) -> &'static str

Returns the mnemonic string for assembly output.

Source

pub fn immediate_size(&self) -> usize

Returns the number of immediate data bytes following this opcode (for PUSH).

Source

pub fn push_for_size(n: usize) -> Option<EvmOpcode>

Returns the appropriate PUSH opcode for a given number of bytes.

Trait Implementations§

Source§

impl Clone for EvmOpcode

Source§

fn clone(&self) -> EvmOpcode

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 EvmOpcode

Source§

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

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

impl Display for EvmOpcode

Source§

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

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

impl Hash for EvmOpcode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EvmOpcode

Source§

fn eq(&self, other: &EvmOpcode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for EvmOpcode

Source§

impl Eq for EvmOpcode

Source§

impl StructuralPartialEq for EvmOpcode

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.