LCOV - code coverage report
Current view: top level - crypto/utxo/entities - op_codes.dart (source / functions) Coverage Total Hit
Test: lcov.info Lines: 75.0 % 4 3
Test Date: 2025-01-30 01:10:00 Functions: - 0 0

            Line data    Source code
       1              : // ignore_for_file: constant_identifier_names
       2              : 
       3              : // TODO: Refactor this class to be more readable
       4              : 
       5              : enum OPCODE {
       6              :   /// Constants
       7              :   OP_0(0x00),
       8              :   OP_FALSE(0x00),
       9              :   OP_PUSHDATA1(0x4c),
      10              :   OP_PUSHDATA2(0x4d),
      11              :   OP_PUSHDATA4(0x4e),
      12              :   OP_1NEGATE(0x4f),
      13              :   OP_RESERVED(0x50),
      14              :   OP_1(0x51),
      15              :   OP_TRUE(0x51),
      16              :   OP_2(0x52),
      17              :   OP_3(0x53),
      18              :   OP_4(0x54),
      19              :   OP_5(0x55),
      20              :   OP_6(0x56),
      21              :   OP_7(0x57),
      22              :   OP_8(0x58),
      23              :   OP_9(0x59),
      24              :   OP_10(0x5a),
      25              :   OP_11(0x5b),
      26              :   OP_12(0x5c),
      27              :   OP_13(0x5d),
      28              :   OP_14(0x5e),
      29              :   OP_15(0x5f),
      30              :   OP_16(0x60),
      31              : 
      32              :   /// Flow control
      33              :   OP_NOP(0x61),
      34              :   OP_VER(0x62),
      35              :   OP_IF(0x63),
      36              :   OP_NOTIF(0x64),
      37              :   OP_VERIF(0x65),
      38              :   OP_VERNOTIF(0x66),
      39              :   OP_ELSE(0x67),
      40              :   OP_ENDIF(0x68),
      41              :   OP_VERIFY(0x69),
      42              :   OP_RETURN(0x6a),
      43              : 
      44              :   /// Stack
      45              :   OP_TOALTSTACK(0x6b),
      46              :   OP_FROMALTSTACK(0x6c),
      47              :   OP_2DROP(0x6d),
      48              :   OP_2DUP(0x6e),
      49              :   OP_3DUP(0x6f),
      50              :   OP_2OVER(0x70),
      51              :   OP_2ROT(0x71),
      52              :   OP_2SWAP(0x72),
      53              : 
      54              :   /// Splice
      55              :   OP_IFDUP(0x73),
      56              :   OP_DEPTH(0x74),
      57              :   OP_DROP(0x75),
      58              :   OP_DUP(0x76),
      59              :   OP_NIP(0x77),
      60              :   OP_OVER(0x78),
      61              :   OP_PICK(0x79),
      62              :   OP_ROLL(0x7a),
      63              :   OP_ROT(0x7b),
      64              :   OP_SWAP(0x7c),
      65              :   OP_TUCK(0x7d),
      66              :   OP_CAT(0x7e),
      67              :   OP_SUBSTR(0x7f),
      68              :   OP_LEFT(0x80),
      69              :   OP_RIGHT(0x81),
      70              :   OP_SIZE(0x82),
      71              : 
      72              :   /// Bitwise logic
      73              :   OP_INVERT(0x83),
      74              :   OP_AND(0x84),
      75              :   OP_OR(0x85),
      76              :   OP_XOR(0x86),
      77              :   OP_EQUAL(0x87),
      78              :   OP_EQUALVERIFY(0x88),
      79              : 
      80              :   /// Arithmetic
      81              :   OP_RESERVED1(0x89),
      82              :   OP_RESERVED2(0x8a),
      83              :   OP_1ADD(0x8b),
      84              :   OP_1SUB(0x8c),
      85              :   OP_2MUL(0x8d),
      86              :   OP_2DIV(0x8e),
      87              :   OP_NEGATE(0x8f),
      88              :   OP_ABS(0x90),
      89              :   OP_NOT(0x91),
      90              :   OP_0NOTEQUAL(0x92),
      91              :   OP_ADD(0x93),
      92              :   OP_SUB(0x94),
      93              :   OP_MUL(0x95),
      94              :   OP_DIV(0x96),
      95              :   OP_MOD(0x97),
      96              :   OP_LSHIFT(0x98),
      97              :   OP_RSHIFT(0x99),
      98              :   OP_BOOLAND(0x9a),
      99              :   OP_BOOLOR(0x9b),
     100              :   OP_NUMEQUAL(0x9c),
     101              :   OP_NUMEQUALVERIFY(0x9d),
     102              :   OP_NUMNOTEQUAL(0x9e),
     103              :   OP_LESSTHAN(0x9f),
     104              :   OP_GREATERTHAN(0xa0),
     105              :   OP_LESSTHANOREQUAL(0xa1),
     106              :   OP_GREATERTHANOREQUAL(0xa2),
     107              :   OP_MIN(0xa3),
     108              :   OP_MAX(0xa4),
     109              :   OP_WITHIN(0xa5),
     110              : 
     111              :   /// Crypto
     112              :   OP_RIPEMD160(0xa6),
     113              :   OP_SHA1(0xa7),
     114              :   OP_SHA256(0xa8),
     115              :   OP_HASH160(0xa9),
     116              :   OP_HASH256(0xaa),
     117              :   OP_CODESEPARATOR(0xab),
     118              :   OP_CHECKSIG(0xac),
     119              :   OP_CHECKSIGVERIFY(0xad),
     120              :   OP_CHECKMULTISIG(0xae),
     121              :   OP_CHECKMULTISIGVERIFY(0xaf),
     122              : 
     123              :   /// Expansion
     124              :   OP_NOP1(0xb0),
     125              :   OP_NOP2(0xb1),
     126              :   OP_CHECKLOCKTIMEVERIFY(0xb1),
     127              :   OP_NOP3(0xb2),
     128              :   OP_CHECKSEQUENCEVERIFY(0xb2),
     129              :   OP_NOP4(0xb3),
     130              :   OP_NOP5(0xb4),
     131              :   OP_NOP6(0xb5),
     132              :   OP_NOP7(0xb6),
     133              :   OP_NOP8(0xb7),
     134              :   OP_NOP9(0xb8),
     135              :   OP_NOP10(0xb9),
     136              :   OP_UNKNOWN(0xff);
     137              : 
     138              :   final int hex;
     139              : 
     140              :   const OPCODE(this.hex);
     141              : 
     142            0 :   String get string => toString().split('.').last;
     143              : 
     144           11 :   @override
     145              :   String toString() {
     146           11 :     if (this == OPCODE.OP_0) return '00';
     147              : 
     148           20 :     return hex.toRadixString(16);
     149              :   }
     150              : }
     151              : 
     152              : /// Constants
     153              : const int OP_0 = 0x00;
     154              : const int OP_FALSE = 0x00;
     155              : const int OP_PUSHDATA1 = 0x4c;
     156              : const int OP_PUSHDATA2 = 0x4d;
     157              : const int OP_PUSHDATA4 = 0x4e;
     158              : const int OP_1NEGATE = 0x4f;
     159              : const int OP_RESERVED = 0x50;
     160              : const int OP_1 = 0x51;
     161              : const int OP_TRUE = 0x51;
     162              : const int OP_2 = 0x52;
     163              : const int OP_3 = 0x53;
     164              : const int OP_4 = 0x54;
     165              : const int OP_5 = 0x55;
     166              : const int OP_6 = 0x56;
     167              : const int OP_7 = 0x57;
     168              : const int OP_8 = 0x58;
     169              : const int OP_9 = 0x59;
     170              : const int OP_10 = 0x5a;
     171              : const int OP_11 = 0x5b;
     172              : const int OP_12 = 0x5c;
     173              : const int OP_13 = 0x5d;
     174              : const int OP_14 = 0x5e;
     175              : const int OP_15 = 0x5f;
     176              : const int OP_16 = 0x60;
     177              : 
     178              : /// Flow control
     179              : const int OP_NOP = 0x61;
     180              : const int OP_VER = 0x62;
     181              : const int OP_IF = 0x63;
     182              : const int OP_NOTIF = 0x64;
     183              : const int OP_VERIF = 0x65;
     184              : const int OP_VERNOTIF = 0x66;
     185              : const int OP_ELSE = 0x67;
     186              : const int OP_ENDIF = 0x68;
     187              : const int OP_VERIFY = 0x69;
     188              : const int OP_RETURN = 0x6a;
     189              : 
     190              : /// Stack
     191              : const int OP_TOALTSTACK = 0x6b;
     192              : const int OP_FROMALTSTACK = 0x6c;
     193              : const int OP_2DROP = 0x6d;
     194              : const int OP_2DUP = 0x6e;
     195              : const int OP_3DUP = 0x6f;
     196              : const int OP_2OVER = 0x70;
     197              : const int OP_2ROT = 0x71;
     198              : const int OP_2SWAP = 0x72;
     199              : 
     200              : /// Splice
     201              : const int OP_IFDUP = 0x73;
     202              : const int OP_DEPTH = 0x74;
     203              : const int OP_DROP = 0x75;
     204              : const int OP_DUP = 0x76;
     205              : const int OP_NIP = 0x77;
     206              : const int OP_OVER = 0x78;
     207              : const int OP_PICK = 0x79;
     208              : const int OP_ROLL = 0x7a;
     209              : const int OP_ROT = 0x7b;
     210              : const int OP_SWAP = 0x7c;
     211              : const int OP_TUCK = 0x7d;
     212              : const int OP_CAT = 0x7e;
     213              : const int OP_SUBSTR = 0x7f;
     214              : const int OP_LEFT = 0x80;
     215              : const int OP_RIGHT = 0x81;
     216              : const int OP_SIZE = 0x82;
     217              : 
     218              : /// Bitwise logic
     219              : const int OP_INVERT = 0x83;
     220              : const int OP_AND = 0x84;
     221              : const int OP_OR = 0x85;
     222              : const int OP_XOR = 0x86;
     223              : const int OP_EQUAL = 0x87;
     224              : const int OP_EQUALVERIFY = 0x88;
     225              : 
     226              : /// Arithmetic
     227              : const int OP_RESERVED1 = 0x89;
     228              : const int OP_RESERVED2 = 0x8a;
     229              : const int OP_1ADD = 0x8b;
     230              : const int OP_1SUB = 0x8c;
     231              : const int OP_2MUL = 0x8d;
     232              : const int OP_2DIV = 0x8e;
     233              : const int OP_NEGATE = 0x8f;
     234              : const int OP_ABS = 0x90;
     235              : const int OP_NOT = 0x91;
     236              : const int OP_0NOTEQUAL = 0x92;
     237              : const int OP_ADD = 0x93;
     238              : const int OP_SUB = 0x94;
     239              : const int OP_MUL = 0x95;
     240              : const int OP_DIV = 0x96;
     241              : const int OP_MOD = 0x97;
     242              : const int OP_LSHIFT = 0x98;
     243              : const int OP_RSHIFT = 0x99;
     244              : const int OP_BOOLAND = 0x9a;
     245              : const int OP_BOOLOR = 0x9b;
     246              : const int OP_NUMEQUAL = 0x9c;
     247              : const int OP_NUMEQUALVERIFY = 0x9d;
     248              : const int OP_NUMNOTEQUAL = 0x9e;
     249              : const int OP_LESSTHAN = 0x9f;
     250              : const int OP_GREATERTHAN = 0xa0;
     251              : const int OP_LESSTHANOREQUAL = 0xa1;
     252              : const int OP_GREATERTHANOREQUAL = 0xa2;
     253              : const int OP_MIN = 0xa3;
     254              : const int OP_MAX = 0xa4;
     255              : const int OP_WITHIN = 0xa5;
     256              : 
     257              : /// Crypto
     258              : const int OP_RIPEMD160 = 0xa6;
     259              : const int OP_SHA1 = 0xa7;
     260              : const int OP_SHA256 = 0xa8;
     261              : const int OP_HASH160 = 0xa9;
     262              : const int OP_HASH256 = 0xaa;
     263              : const int OP_CODESEPARATOR = 0xab;
     264              : const int OP_CHECKSIG = 0xac;
     265              : const int OP_CHECKSIGVERIFY = 0xad;
     266              : const int OP_CHECKMULTISIG = 0xae;
     267              : const int OP_CHECKMULTISIGVERIFY = 0xaf;
     268              : 
     269              : /// Expansion
     270              : const int OP_NOP1 = 0xb0;
     271              : const int OP_NOP2 = 0xb1;
     272              : const int OP_CHECKLOCKTIMEVERIFY = 0xb1;
     273              : const int OP_NOP3 = 0xb2;
     274              : const int OP_CHECKSEQUENCEVERIFY = 0xb2;
     275              : const int OP_NOP4 = 0xb3;
     276              : const int OP_NOP5 = 0xb4;
     277              : const int OP_NOP6 = 0xb5;
     278              : const int OP_NOP7 = 0xb6;
     279              : const int OP_NOP8 = 0xb7;
     280              : const int OP_NOP9 = 0xb8;
     281              : const int OP_NOP10 = 0xb9;
     282              : const int OP_UNKNOWN = 0xff;
        

Generated by: LCOV version 2.0-1