MCPcopy Create free account
hub / github.com/argotorg/solidity / hasOpcode

Method hasOpcode

liblangutil/EVMVersion.cpp:29–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27using namespace solidity::langutil;
28
29bool EVMVersion::hasOpcode(Instruction _opcode, std::optional<uint8_t> _eofVersion) const
30{
31 // EOF version can be only defined since osaka
32 assert(!_eofVersion.has_value() || *this >= EVMVersion::firstWithEOF());
33
34 switch (_opcode)
35 {
36 case Instruction::RETURNDATACOPY:
37 case Instruction::RETURNDATASIZE:
38 return supportsReturndata();
39 case Instruction::STATICCALL:
40 return !_eofVersion.has_value() && hasStaticCall();
41 case Instruction::SHL:
42 case Instruction::SHR:
43 case Instruction::SAR:
44 return hasBitwiseShifting();
45 case Instruction::CLZ:
46 return hasCLZ();
47 case Instruction::CREATE2:
48 return !_eofVersion.has_value() && hasCreate2();
49 case Instruction::EXTCODEHASH:
50 return !_eofVersion.has_value() && hasExtCodeHash();
51 case Instruction::CHAINID:
52 return hasChainID();
53 case Instruction::SELFBALANCE:
54 return hasSelfBalance();
55 case Instruction::BASEFEE:
56 return hasBaseFee();
57 case Instruction::BLOBHASH:
58 return hasBlobHash();
59 case Instruction::BLOBBASEFEE:
60 return hasBlobBaseFee();
61 case Instruction::MCOPY:
62 return hasMcopy();
63 case Instruction::TSTORE:
64 case Instruction::TLOAD:
65 return supportsTransientStorage();
66 // Instructions below are deprecated in EOF
67 case Instruction::CALL:
68 case Instruction::CALLCODE:
69 case Instruction::DELEGATECALL:
70 case Instruction::SELFDESTRUCT:
71 case Instruction::JUMP:
72 case Instruction::JUMPI:
73 case Instruction::PC:
74 case Instruction::CREATE:
75 case Instruction::CODESIZE:
76 case Instruction::CODECOPY:
77 case Instruction::EXTCODESIZE:
78 case Instruction::EXTCODECOPY:
79 case Instruction::GAS:
80 return !_eofVersion.has_value();
81 // Instructions below available only in EOF
82 case Instruction::EOFCREATE:
83 case Instruction::RETURNCONTRACT:
84 case Instruction::DATALOADN:
85 case Instruction::RJUMP:
86 case Instruction::RJUMPI:

Callers 3

validateInstructionsMethod · 0.80
createDialectBuiltinsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected