{"modulePath":"github.com/unpackdev/solgo","version":"v0.3.7","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package opcode\n\nPackage opcode offers tools for constructing and visualizing opcode execution trees, representing sequences of instructions. It provides structures and methods to format, print, and analyze opcode instructions and their hierarchical relationships.\n\n## Constants\n\n```go\nconst (\n\t// DUP1 duplicates the 1st item from the top of the stack.\n\tDUP1 = 0x80 + iota\n\t// DUP2 duplicates the 2nd item from the top of the stack.\n\tDUP2\n\t// DUP3 duplicates the 3rd item from the top of the stack.\n\tDUP3\n\t// DUP4 duplicates the 4th item from the top of the stack.\n\tDUP4\n\t// DUP5 duplicates the 5th item from the top of the stack.\n\tDUP5\n\t// DUP6 duplicates the 6th item from the top of the stack.\n\tDUP6\n\t// DUP7 duplicates the 7th item from the top of the stack.\n\tDUP7\n\t// DUP8 duplicates the 8th item from the top of the stack.\n\tDUP8\n\t// DUP9 duplicates the 9th item from the top of the stack.\n\tDUP9\n\t// DUP10 duplicates the 10th item from the top of the stack.\n\tDUP10\n\t// DUP11 duplicates the 11th item from the top of the stack.\n\tDUP11\n\t// DUP12 duplicates the 12th item from the top of the stack.\n\tDUP12\n\t// DUP13 duplicates the 13th item from the top of the stack.\n\tDUP13\n\t// DUP14 duplicates the 14th item from the top of the stack.\n\tDUP14\n\t// DUP15 duplicates the 15th item from the top of the stack.\n\tDUP15\n\t// DUP16 duplicates the 16th item from the top of the stack.\n\tDUP16\n)\n```\nDuplication operations (0x80)\n\n```go\nconst (\n\t// SWAP1 swaps the top two items on the stack.\n\tSWAP1 = 0x90 + iota\n\t// SWAP2 swaps the top item with the 2nd item below it.\n\tSWAP2\n\t// SWAP3 swaps the top item with the 3rd item below it.\n\tSWAP3\n\t// SWAP4 swaps the top item with the 4th item below it.\n\tSWAP4\n\t// SWAP5 swaps the top item with the 5th item below it.\n\tSWAP5\n\t// SWAP6 swaps the top item with the 6th item below it.\n\tSWAP6\n\t// SWAP7 swaps the top item with the 7th item below it.\n\tSWAP7\n\t// SWAP8 swaps the top item with the 8th item below it.\n\tSWAP8\n\t// SWAP9 swaps the top item with the 9th item below it.\n\tSWAP9\n\t// SWAP10 swaps the top item with the 10th item below it.\n\tSWAP10\n\t// SWAP11 swaps the top item with the 11th item below it.\n\tSWAP11\n\t// SWAP12 swaps the top item with the 12th item below it.\n\tSWAP12\n\t// SWAP13 swaps the top item with the 13th item below it.\n\tSWAP13\n\t// SWAP14 swaps the top item with the 14th item below it.\n\tSWAP14\n\t// SWAP15 swaps the top item with the 15th item below it.\n\tSWAP15\n\t// SWAP16 swaps the top item with the 16th item below it.\n\tSWAP16\n)\n```\nSwap operations (0x90)\n\n## Variables\n\n```go\nvar (\n\tErrEmptyBytecode = errors.New(\"bytecode is not set or empty bytecode provided\")\n)\n```\n\n## Types\n\n```go\ntype Decompiler struct {\n\t// contains filtered or unexported fields\n}\n```\nDecompiler is responsible for decompiling Ethereum bytecode into a set of instructions.\n\n```go\nfunc NewDecompiler(ctx context.Context, b []byte) (*Decompiler, error)\n```\nNewDecompiler initializes a new Decompiler with the given bytecode.\n\n```go\nfunc (d *Decompiler) DecodeLOG1() []Instruction\n```\nDecodeLOG1 returns all instructions with the LOG1 OpCode and decodes their arguments.\n\n```go\nfunc (d *Decompiler) DecodeLOG2() []Instruction\n```\nDecodeLOG2 returns all instructions with the LOG2 OpCode and decodes their arguments.\n\n```go\nfunc (d *Decompiler) DecodeLOG3() []Instruction\n```\nDecodeLOG3 returns all instructions with the LOG3 OpCode and decodes their arguments.\n\n```go\nfunc (d *Decompiler) DecodeLOG4() []Instruction\n```\nDecodeLOG4 returns all instructions with the LOG4 OpCode and decodes their arguments.\n\n```go\nfunc (d *Decompiler) Decompile() error\n```\nDecompile processes the bytecode, populates the instructions slice, and identifies function entry points.\n\n```go\nfunc (d *Decompiler) GetBytecode() []byte\n```\nGetBytecode returns the bytecode associated with the Decompiler.\n\n```go\nfunc (d *Decompiler) GetBytecodeSize() uint64\n```\nGetBytecodeSize returns the size of the bytecode.\n\n```go\nfunc (d *Decompiler) GetChildrenByOffset(offset int) []Instruction\n```\nGetChildrenByOffset retrieves a slice of Instructions that are immediate children (subsequent instructions) of the instruction at the provided offset.\n\n```go\nfunc (d *Decompiler) GetEvents() []*EventTreeNode\n```\nGetEvents iterates through LOG1 to LOG4 instructions, decodes their arguments, and collects them into EventTreeNode structures.\n\n```go\nfunc (d *Decompiler) GetFunctions() []*FunctionTreeNode\n```\nGetFunctions extracts all functions from the opcode execution tree and returns them as a slice of FunctionTreeNode pointers.\n\n```go\nfunc (d *Decompiler) GetInstructionTreeFormatted(instruction Instruction, indent string) string\n```\nGetInstructionTreeFormatted returns a formatted string representation of the opcode execution tree starting from the provided instruction. The output is indented based on the provided indent string.\n\n```go\nfunc (d *Decompiler) GetInstructions() []Instruction\n```\nGetInstructions returns all decompiled instructions.\n\n```go\nfunc (d *Decompiler) GetInstructionsByOpCode(op OpCode) []Instruction\n```\nGetInstructionsByOpCode returns all instructions that match the given OpCode.\n\n```go\nfunc (d *Decompiler) GetStateVariables() ([]*InstructionTree, error)\n```\nGetStateVariables returns the instruction trees for all state variables declared in the bytecode.\n\n```go\nfunc (d *Decompiler) GetTree() *TreeNode\n```\nGetTree constructs and returns the root of the opcode execution tree based on the instructions present in the Decompiler. If there are no instructions, it returns nil.\n\n```go\nfunc (d *Decompiler) IsOpCode(instruction Instruction, op OpCode) bool\n```\nIsOpCode checks if the given instruction matches the provided OpCode.\n\n```go\nfunc (d *Decompiler) MatchFunctionSignature(signature string) bool\n```\nMatchFunctionSignature checks if a given function signature matches any of the decompiled instructions.\n\n```go\nfunc (d *Decompiler) MatchInstruction(instruction Instruction) bool\n```\n\n```go\nfunc (d *Decompiler) OpCodeFound(op OpCode) bool\n```\nOpCodeFound checks if the given OpCode exists in the decompiled instructions.\n\n```go\nfunc (d *Decompiler) String() string\n```\nString provides a string representation of the decompiled instructions.\n\n```go\nfunc (d *Decompiler) StringArray() []string\n```\nStringArray returns a string representation of the decompiled instructions as an array of strings.\n\n```go\nfunc (d *Decompiler) ToProto() *opcode_pb.Root\n```\nToProto converts the decompiled instructions to a protobuf representation.\n\n```go\ntype EventTreeNode struct {\n\tEventSignatureHex string `json:\"eventSignatureHex\"`\n\tEventSignature    string `json:\"event_signature\"`\n\tEventBytesHex     string `json:\"event_bytes_hex\"`\n\tEventBytes        []byte `json:\"event_bytes\"`\n\tHasEventSignature bool   `json:\"has_event_signature\"`\n\t*TreeNode\n}\n```\nEventTreeNode represents a node in the opcode execution tree that represents an event.\n\n```go\ntype FunctionTreeNode struct {\n\tFunctionSignatureHex string `json:\"functionSignatureHex\"`\n\tFunctionSignature    string `json:\"function_signature\"`\n\tFunctionBytesHex     string `json:\"function_bytes_hex\"`\n\tFunctionBytes        []byte `json:\"function_bytes\"`\n\tHasFunctionSignature bool   `json:\"has_function_signature\"`\n\t*TreeNode\n}\n```\nFunctionTreeNode represents a node in the opcode execution tree that represents a function.\n\n```go\ntype Instruction struct {\n\tOffset      int    `json:\"offset\"`\n\tOpCode      OpCode `json:\"opcode\"`\n\tArgs        []byte `json:\"args\"`\n\tDescription string `json:\"description\"`\n\tData        []byte `json:\"data\"`\n}\n```\nInstruction represents an optcode instruction.\n\n```go\nfunc (i Instruction) GetArgs() []byte\n```\nGetArgs returns the arguments of the instruction.\n\n```go\nfunc (i Instruction) GetCode() OpCode\n```\nGetCode returns the opcode of the instruction.\n\n```go\nfunc (i Instruction) GetDescription() string\n```\nGetDescription returns the description of the instruction.\n\n```go\nfunc (i Instruction) GetOffset() int\n```\nGetOffset returns the offset of the instruction.\n\n```go\nfunc (i Instruction) String() string\n```\nString returns the string representation of the instruction.\n\n```go\nfunc (i Instruction) ToProto() *opcode_pb.Instruction\n```\nToProto converts the instruction to a protobuf message.\n\n```go\ntype InstructionTree struct {\n\tInstruction Instruction\n\tChildren    []*InstructionTree\n}\n```\n\n```go\nfunc NewInstructionTree(instruction Instruction) *InstructionTree\n```\n\n```go\ntype OpCode byte\n```\nOpCode represents an Ethereum operation code (opcode). Opcodes are single byte values that represent a specific operation in the EVM. The OpCode type provides methods to retrieve the string representation of the opcode, and to determine if an opcode corresponds to specific operations like PUSH or JUMP.\n\n```go\nconst (\n\t// STOP halts execution.\n\tSTOP OpCode = 0x0\n\t// ADD performs addition operation.\n\tADD OpCode = 0x1\n\t// MUL performs multiplication operation.\n\tMUL OpCode = 0x2\n\t// SUB performs subtraction operation.\n\tSUB OpCode = 0x3\n\t// DIV performs division operation.\n\tDIV OpCode = 0x4\n\t// SDIV performs signed division operation.\n\tSDIV OpCode = 0x5\n\t// MOD returns the remainder after division.\n\tMOD OpCode = 0x6\n\t// SMOD returns the signed remainder after division.\n\tSMOD OpCode = 0x7\n\t// ADDMOD performs addition followed by modulo operation.\n\tADDMOD OpCode = 0x8\n\t// MULMOD performs multiplication followed by modulo operation.\n\tMULMOD OpCode = 0x9\n\t// EXP performs exponential operation.\n\tEXP OpCode = 0xa\n\t// SIGNEXTEND extends the sign bit to the left.\n\tSIGNEXTEND OpCode = 0xb\n)\n```\nArithmetic operations (0x0 range).\n\n```go\nconst (\n\t// LT checks if one value is less than another.\n\tLT OpCode = 0x10\n\t// GT checks if one value is greater than another.\n\tGT OpCode = 0x11\n\t// SLT checks if one signed value is less than another.\n\tSLT OpCode = 0x12\n\t// SGT checks if one signed value is greater than another.\n\tSGT OpCode = 0x13\n\t// EQ checks if two values are equal.\n\tEQ OpCode = 0x14\n\t// ISZERO checks if a value is zero.\n\tISZERO OpCode = 0x15\n\t// AND performs a bitwise AND operation.\n\tAND OpCode = 0x16\n\t// OR performs a bitwise OR operation.\n\tOR OpCode = 0x17\n\t// XOR performs a bitwise XOR operation.\n\tXOR OpCode = 0x18\n\t// NOT performs a bitwise NOT operation.\n\tNOT OpCode = 0x19\n\t// BYTE retrieves a specific byte from a value.\n\tBYTE OpCode = 0x1a\n\t// SHL shifts a value to the left.\n\tSHL OpCode = 0x1b\n\t// SHR shifts a value to the right.\n\tSHR OpCode = 0x1c\n\t// SAR performs an arithmetic right shift.\n\tSAR OpCode = 0x1d\n)\n```\nComparison operations (0x10 range).\n\n```go\nconst (\n\t// ADDRESS retrieves the address of the current contract.\n\tADDRESS OpCode = 0x30\n\t// BALANCE retrieves the balance of a given address.\n\tBALANCE OpCode = 0x31\n\t// ORIGIN retrieves the address that originated the current call.\n\tORIGIN OpCode = 0x32\n\t// CALLER retrieves the address of the caller.\n\tCALLER OpCode = 0x33\n\t// CALLVALUE retrieves the value sent with the call.\n\tCALLVALUE OpCode = 0x34\n\t// CALLDATALOAD loads data from the call payload.\n\tCALLDATALOAD OpCode = 0x35\n\t// CALLDATASIZE retrieves the size of the call data.\n\tCALLDATASIZE OpCode = 0x36\n\t// CALLDATACOPY copies call data to memory.\n\tCALLDATACOPY OpCode = 0x37\n\t// CODESIZE retrieves the size of the code.\n\tCODESIZE OpCode = 0x38\n\t// CODECOPY copies code to memory.\n\tCODECOPY OpCode = 0x39\n\t// GASPRICE retrieves the price of gas.\n\tGASPRICE OpCode = 0x3a\n\t// EXTCODESIZE retrieves the size of an external contract's code.\n\tEXTCODESIZE OpCode = 0x3b\n\t// EXTCODECOPY copies external contract code to memory.\n\tEXTCODECOPY OpCode = 0x3c\n\t// RETURNDATASIZE retrieves the size of the return data.\n\tRETURNDATASIZE OpCode = 0x3d\n\t// RETURNDATACOPY copies return data to memory.\n\tRETURNDATACOPY OpCode = 0x3e\n\t// EXTCODEHASH retrieves the hash of an external contract's code.\n\tEXTCODEHASH OpCode = 0x3f\n)\n```\nClosure state operations (0x30 range).\n\n```go\nconst (\n\t// BLOCKHASH retrieves the hash of a block.\n\tBLOCKHASH OpCode = 0x40\n\t// COINBASE retrieves the address of the block miner.\n\tCOINBASE OpCode = 0x41\n\t// TIMESTAMP retrieves the timestamp of the block.\n\tTIMESTAMP OpCode = 0x42\n\t// NUMBER retrieves the block number.\n\tNUMBER OpCode = 0x43\n\t// DIFFICULTY retrieves the difficulty of the block.\n\tDIFFICULTY OpCode = 0x44\n\t// RANDOM retrieves a random value. Note: It has the same opcode as DIFFICULTY.\n\tRANDOM OpCode = 0x44 // Same as DIFFICULTY\n\t// PREVRANDAO retrieves the previous RANDAO value. Note: It has the same opcode as DIFFICULTY.\n\tPREVRANDAO OpCode = 0x44 // Same as DIFFICULTY\n\t// GASLIMIT retrieves the gas limit for the block.\n\tGASLIMIT OpCode = 0x45\n\t// CHAINID retrieves the chain ID.\n\tCHAINID OpCode = 0x46\n\t// SELFBALANCE retrieves the balance of the contract itself.\n\tSELFBALANCE OpCode = 0x47\n\t// BASEFEE retrieves the base fee for the block.\n\tBASEFEE OpCode = 0x48\n\t// BLOBHASH retrieves the blob hash.\n\tBLOBHASH OpCode = 0x49\n)\n```\nBlock operations (0x40).\n\n```go\nconst (\n\t// POP removes the top item from the stack.\n\tPOP OpCode = 0x50\n\t// MLOAD loads a word from memory at a specific address.\n\tMLOAD OpCode = 0x51\n\t// MSTORE stores a word to memory at a specific address.\n\tMSTORE OpCode = 0x52\n\t// MSTORE8 stores a byte to memory at a specific address.\n\tMSTORE8 OpCode = 0x53\n\t// SLOAD loads a word from storage at a specific address.\n\tSLOAD OpCode = 0x54\n\t// SSTORE stores a word to storage at a specific address.\n\tSSTORE OpCode = 0x55\n\t// JUMP sets the program counter to a specific address.\n\tJUMP OpCode = 0x56\n\t// JUMPI conditionally sets the program counter to a specific address.\n\tJUMPI OpCode = 0x57\n\t// PC retrieves the value of the program counter.\n\tPC OpCode = 0x58\n\t// MSIZE retrieves the size of active memory.\n\tMSIZE OpCode = 0x59\n\t// GAS retrieves the amount of gas remaining.\n\tGAS OpCode = 0x5a\n\t// JUMPDEST marks a valid destination for jumps.\n\tJUMPDEST OpCode = 0x5b\n\t// PUSH0 pushes a zero byte onto the stack.\n\tPUSH0 OpCode = 0x5f\n)\n```\nStorage and execution operations (0x50).\n\n```go\nconst (\n\t// PUSH1 pushes a 1-byte item onto the stack.\n\tPUSH1 OpCode = 0x60 + iota\n\t// PUSH2 pushes a 2-byte item onto the stack.\n\tPUSH2\n\t// PUSH3 pushes a 3-byte item onto the stack.\n\tPUSH3\n\t// PUSH4 pushes a 4-byte item onto the stack.\n\tPUSH4\n\t// PUSH5 pushes a 5-byte item onto the stack.\n\tPUSH5\n\t// PUSH6 pushes a 6-byte item onto the stack.\n\tPUSH6\n\t// PUSH7 pushes a 7-byte item onto the stack.\n\tPUSH7\n\t// PUSH8 pushes an 8-byte item onto the stack.\n\tPUSH8\n\t// PUSH9 pushes a 9-byte item onto the stack.\n\tPUSH9\n\t// PUSH10 pushes a 10-byte item onto the stack.\n\tPUSH10\n\t// PUSH11 pushes an 11-byte item onto the stack.\n\tPUSH11\n\t// PUSH12 pushes a 12-byte item onto the stack.\n\tPUSH12\n\t// PUSH13 pushes a 13-byte item onto the stack.\n\tPUSH13\n\t// PUSH14 pushes a 14-byte item onto the stack.\n\tPUSH14\n\t// PUSH15 pushes a 15-byte item onto the stack.\n\tPUSH15\n\t// PUSH16 pushes a 16-byte item onto the stack.\n\tPUSH16\n\t// PUSH17 pushes a 17-byte item onto the stack.\n\tPUSH17\n\t// PUSH18 pushes an 18-byte item onto the stack.\n\tPUSH18\n\t// PUSH19 pushes a 19-byte item onto the stack.\n\tPUSH19\n\t// PUSH20 pushes a 20-byte item onto the stack.\n\tPUSH20\n\t// PUSH21 pushes a 21-byte item onto the stack.\n\tPUSH21\n\t// PUSH22 pushes a 22-byte item onto the stack.\n\tPUSH22\n\t// PUSH23 pushes a 23-byte item onto the stack.\n\tPUSH23\n\t// PUSH24 pushes a 24-byte item onto the stack.\n\tPUSH24\n\t// PUSH25 pushes a 25-byte item onto the stack.\n\tPUSH25\n\t// PUSH26 pushes a 26-byte item onto the stack.\n\tPUSH26\n\t// PUSH27 pushes a 27-byte item onto the stack.\n\tPUSH27\n\t// PUSH28 pushes a 28-byte item onto the stack.\n\tPUSH28\n\t// PUSH29 pushes a 29-byte item onto the stack.\n\tPUSH29\n\t// PUSH30 pushes a 30-byte item onto the stack.\n\tPUSH30\n\t// PUSH31 pushes a 31-byte item onto the stack.\n\tPUSH31\n\t// PUSH32 pushes a 32-byte item onto the stack.\n\tPUSH32\n)\n```\nPush operations (0x60)\n\n```go\nconst (\n\t// LOG0 logs a message with 0 indexed topics.\n\tLOG0 OpCode = 0xa0 + iota\n\t// LOG1 logs a message with 1 indexed topic.\n\tLOG1\n\t// LOG2 logs a message with 2 indexed topics.\n\tLOG2\n\t// LOG3 logs a message with 3 indexed topics.\n\tLOG3\n\t// LOG4 logs a message with 4 indexed topics.\n\tLOG4\n)\n```\nLogging operations (0xa0)\n\n```go\nconst (\n\t// TLOAD loads from transactional storage.\n\tTLOAD OpCode = 0xb3\n\t// TSTORE stores to transactional storage.\n\tTSTORE OpCode = 0xb4\n)\n```\n0xb0 range.\n\n```go\nconst (\n\t// CREATE creates a new contract.\n\tCREATE OpCode = 0xf0\n\t// CALL initiates a new message call.\n\tCALL OpCode = 0xf1\n\t// CALLCODE calls a contract with a different code.\n\tCALLCODE OpCode = 0xf2\n\t// RETURN halts execution and returns output data.\n\tRETURN OpCode = 0xf3\n\t// DELEGATECALL calls a contract as a delegate.\n\tDELEGATECALL OpCode = 0xf4\n\t// CREATE2 creates a new contract with a deterministic address.\n\tCREATE2 OpCode = 0xf5\n\n\t// STATICCALL calls a contract without state modification.\n\tSTATICCALL OpCode = 0xfa\n\t// REVERT stops execution and reverts state changes.\n\tREVERT OpCode = 0xfd\n\t// INVALID represents an invalid opcode.\n\tINVALID OpCode = 0xfe\n\t// SELFDESTRUCT destroys the current contract.\n\tSELFDESTRUCT OpCode = 0xff\n)\n```\nClosure operations (0xf0)\n\n```go\nconst (\n\t// KECCAK256 computes the Keccak-256 hash.\n\tKECCAK256 OpCode = 0x20\n)\n```\nCryptographic operations (0x20 range).\n\n```go\nfunc StringToOp(str string) OpCode\n```\nStringToOp finds the opcode whose name is stored in \\`str\\`.\n\n```go\nfunc (op OpCode) GetDescription() string\n```\nGetDescription retrieves the description of the OpCode. If the opcode is not found in the descriptions map, it returns an empty string.\n\n```go\nfunc (op OpCode) IsArithmetic() bool\n```\nIsArithmetic checks if the given opcode corresponds to an arithmetic operation. Arithmetic operations in the EVM include addition, multiplication, subtraction, etc.\n\n```go\nfunc (op OpCode) IsBitwise() bool\n```\nIsBitwise checks if the given opcode corresponds to a bitwise operation. Bitwise operations in the EVM include AND, OR, XOR, NOT, etc.\n\n```go\nfunc (op OpCode) IsBlockInformation() bool\n```\nIsBlockInformation checks if the given opcode provides information about the current block. These opcodes provide details like the current block's hash, coinbase, timestamp, etc.\n\n```go\nfunc (op OpCode) IsComparison() bool\n```\nIsComparison checks if the given opcode corresponds to a comparison operation. Comparison operations in the EVM include less than, greater than, equal to, etc.\n\n```go\nfunc (op OpCode) IsEvent() bool\n```\nIsEvent checks if the given opcode corresponds to an event logging operation. The LOG0 to LOG4 opcodes are used to log events in the EVM.\n\n```go\nfunc (op OpCode) IsFlowControl() bool\n```\nIsFlowControl checks if the given opcode is related to flow control operations. Flow control operations in the EVM include operations that alter the sequence of execution.\n\n```go\nfunc (op OpCode) IsFunctionEnd() bool\n```\nIsFunctionEnd checks if the opcode represents the end of a function.\n\n```go\nfunc (op OpCode) IsFunctionStart() bool\n```\nIsFunctionStart checks if the opcode represents the start of a function.\n\n```go\nfunc (op OpCode) IsJump() bool\n```\nIsJump determines if an opcode corresponds to a jump operation. Jump operations in the EVM allow for altering the sequence of execution. This method checks for three specific jump-related opcodes: JUMP, JUMPI, and JUMPDEST.\n\n```go\nfunc (op OpCode) IsLog() bool\n```\n\n```go\nfunc (op OpCode) IsMemory() bool\n```\nIsMemory checks if the given opcode is related to memory operations. Memory operations in the EVM include operations that interact with the memory segment.\n\n```go\nfunc (op OpCode) IsPush() bool\n```\nIsPush checks if the given opcode is a PUSH opcode. In the Ethereum instruction set, there are several PUSH opcodes ranging from PUSH1 to PUSH32. These opcodes are used to place a series of bytes onto the stack.\n\n```go\nfunc (op OpCode) IsPush32() bool\n```\nOpCode extensions for identifying PUSH32 and LOG opcodes\n\n```go\nfunc (op OpCode) IsSelfDestruct() bool\n```\nIsSelfDestruct checks if the given opcode corresponds to the SELFDESTRUCT operation. The SELFDESTRUCT opcode is used in the EVM to destroy the current contract, sending its funds to the provided address.\n\n```go\nfunc (op OpCode) IsStack() bool\n```\nIsStack checks if the given opcode is related to stack operations. Stack operations in the EVM include operations that interact with the main stack.\n\n```go\nfunc (op OpCode) IsStorage() bool\n```\nIsStorage checks if the given opcode is related to storage operations. Storage operations in the EVM include operations that interact with the contract's storage.\n\n```go\nfunc (op OpCode) IsSystem() bool\n```\nIsSystem checks if the given opcode is a system operation. System operations in the EVM include operations like contract creation, external calls, etc.\n\n```go\nfunc (op OpCode) String() string\n```\nString returns the string representation of the OpCode. This method tries to fetch the human-readable name of the opcode from the opCodeToString map. If the opcode is not found in the map, it returns a formatted string indicating the undefined opcode.\n\n```go\nfunc (op OpCode) ToProto() opcode_pb.OpCode\n```\nToProto converts the opcode to a protobuf message.\n\n```go\ntype TreeNode struct {\n\t// Instruction represents the opcode instruction associated with this tree node.\n\tInstruction Instruction `json:\"instruction\"`\n\t// Children is a slice of TreeNode pointers, representing the child instructions of this node.\n\tChildren []*TreeNode `json:\"children\"`\n}\n```\nTreeNode represents a node in the opcode execution tree. Each node contains an instruction and potentially has multiple children, representing subsequent instructions.\n\n```go\nfunc (t *TreeNode) Print()\n```\nPrint outputs the structured representation of the opcode execution tree starting from the calling TreeNode. The output is indented for better readability.\n\n","path":"github.com/unpackdev/solgo/opcode","name":"opcode","synopsis":"Package opcode offers tools for constructing and visualizing opcode execution trees, representing sequences of instructions.","isRedistributable":true}
