#[repr(u8)]pub enum Opcode {
Show 87 variants
ADD,
AND,
DIV,
EQ,
EXP,
GT,
LT,
MLOG,
MROO,
MOD,
MOVE,
MUL,
NOT,
OR,
SLL,
SRL,
SUB,
XOR,
RET,
RETD,
ALOC,
MCL,
MCP,
MEQ,
BHSH,
BHEI,
BURN,
CALL,
CCP,
CROO,
CSIZ,
CB,
LDC,
LOG,
LOGD,
MINT,
RVRT,
SCWQ,
SRW,
SRWQ,
SWW,
SWWQ,
TR,
TRO,
ECR,
K256,
S256,
TIME,
NOOP,
FLAG,
BAL,
JMP,
JNE,
SMO,
ADDI,
ANDI,
DIVI,
EXPI,
MODI,
MULI,
ORI,
SLLI,
SRLI,
SUBI,
XORI,
JNEI,
LB,
LW,
SB,
SW,
MCPI,
GTF,
MCLI,
GM,
MOVI,
JNZI,
JMPF,
JMPB,
JNZF,
JNZB,
JNEF,
JNEB,
JI,
CFEI,
CFSI,
CFE,
CFS,
}
Expand description
Solely the opcode portion of an instruction represented as a single byte.
Variants§
ADD
Adds two registers.
AND
Bitwise ANDs two registers.
DIV
Divides two registers.
EQ
Compares two registers for equality.
EXP
Raises one register to the power of another.
GT
Compares two registers for greater-than.
LT
Compares two registers for less-than.
MLOG
The integer logarithm of a register.
MROO
The integer root of a register.
MOD
Modulo remainder of two registers.
MOVE
Copy from one register to another.
MUL
Multiplies two registers.
NOT
Bitwise NOT a register.
OR
Bitwise ORs two registers.
SLL
Left shifts a register by a register.
SRL
Right shifts a register by a register.
SUB
Subtracts two registers.
XOR
Bitwise XORs two registers.
RET
Return from context.
RETD
Return from context with data.
ALOC
Allocate a number of bytes from the heap.
MCL
Clear a variable number of bytes in memory.
MCP
Copy a variable number of bytes in memory.
MEQ
Compare bytes in memory.
BHSH
Get block header hash for height.
BHEI
Get current block height.
BURN
Burn coins of the current contract’s asset ID.
CALL
Call a contract.
CCP
Copy contract code for a contract.
CROO
Get code root of a contract.
CSIZ
Get code size of a contract.
CB
Get current block proposer’s address.
LDC
Load a contract’s code as executable.
LOG
Log an event.
LOGD
Log data.
MINT
Mint coins of the current contract’s asset ID.
RVRT
Halt execution, reverting state changes and returning a value.
SCWQ
Clear a series of slots from contract storage.
SRW
Load a word from contract storage.
SRWQ
Load a series of 32 byte slots from contract storage.
SWW
Store a word in contract storage.
SWWQ
Store a series of 32 byte slots in contract storage.
TR
Transfer coins to a contract unconditionally.
TRO
Transfer coins to a variable output.
ECR
The 64-byte public key (x, y) recovered from 64-byte signature on 32-byte message.
K256
The keccak-256 hash of a slice.
S256
The SHA-2-256 hash of a slice.
TIME
Get timestamp of block at given height.
NOOP
Performs no operation.
FLAG
Set flag register to a register.
BAL
Get the balance of contract of an asset ID.
JMP
Dynamic jump.
JNE
Conditional dynamic jump.
SMO
Send a message to recipient address with call abi, coins, and output.
ADDI
Adds a register and an immediate value.
ANDI
Bitwise ANDs a register and an immediate value.
DIVI
Divides a register and an immediate value.
EXPI
Raises one register to the power of an immediate value.
MODI
Modulo remainder of a register and an immediate value.
MULI
Multiplies a register and an immediate value.
ORI
Bitwise ORs a register and an immediate value.
SLLI
Left shifts a register by an immediate value.
SRLI
Right shifts a register by an immediate value.
SUBI
Subtracts a register and an immediate value.
XORI
Bitwise XORs a register and an immediate value.
JNEI
Conditional jump.
LB
A byte is loaded from the specified address offset by an immediate value.
LW
A word is loaded from the specified address offset by an immediate value.
SB
Write the least significant byte of a register to memory.
SW
Write a register to memory.
MCPI
Copy an immediate number of bytes in memory.
GTF
Get transaction fields.
MCLI
Clear an immediate number of bytes in memory.
GM
Get metadata from memory.
MOVI
Copy immediate value into a register
JNZI
Conditional jump against zero.
JMPF
Unconditional dynamic relative jump forwards, with a constant offset.
JMPB
Unconditional dynamic relative jump backwards, with a constant offset.
JNZF
Dynamic relative jump forwards, conditional against zero, with a constant offset.
JNZB
Dynamic relative jump backwards, conditional against zero, with a constant offset.
JNEF
Dynamic relative jump forwards, conditional on comparsion, with a constant offset.
JNEB
Dynamic relative jump backwards, conditional on comparsion, with a constant offset.
JI
Jump.
CFEI
Extend the current call frame’s stack by an immediate value.
CFSI
Shrink the current call frame’s stack by an immediate value.
CFE
Extend the current call frame’s stack
CFS
Shrink the current call frame’s stack
Implementations§
source§impl Opcode
impl Opcode
sourcepub fn is_predicate_allowed(&self) -> bool
pub fn is_predicate_allowed(&self) -> bool
Check if the opcode is allowed for predicates.
https://github.com/FuelLabs/fuel-specs/blob/master/specs/vm/main.md#predicate-verification https://github.com/FuelLabs/fuel-specs/blob/master/specs/vm/opcodes.md#contract-opcodes