@bananapus/suckers-v6 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +422 -0
  3. package/SECURITY.md +55 -0
  4. package/SKILLS.md +163 -0
  5. package/deployments/nana-suckers-v5/arbitrum/JBArbitrumSucker.json +1425 -0
  6. package/deployments/nana-suckers-v5/arbitrum/JBArbitrumSuckerDeployer.json +391 -0
  7. package/deployments/nana-suckers-v5/arbitrum/JBCCIPSucker.json +1479 -0
  8. package/deployments/nana-suckers-v5/arbitrum/JBCCIPSuckerDeployer.json +433 -0
  9. package/deployments/nana-suckers-v5/arbitrum/JBCCIPSuckerDeployer_1.json +433 -0
  10. package/deployments/nana-suckers-v5/arbitrum/JBCCIPSuckerDeployer_2.json +433 -0
  11. package/deployments/nana-suckers-v5/arbitrum/JBCCIPSucker_1.json +1479 -0
  12. package/deployments/nana-suckers-v5/arbitrum/JBCCIPSucker_2.json +1479 -0
  13. package/deployments/nana-suckers-v5/arbitrum/JBSuckerRegistry.json +690 -0
  14. package/deployments/nana-suckers-v5/arbitrum_sepolia/JBArbitrumSucker.json +1425 -0
  15. package/deployments/nana-suckers-v5/arbitrum_sepolia/JBArbitrumSuckerDeployer.json +391 -0
  16. package/deployments/nana-suckers-v5/arbitrum_sepolia/JBCCIPSucker.json +1479 -0
  17. package/deployments/nana-suckers-v5/arbitrum_sepolia/JBCCIPSuckerDeployer.json +433 -0
  18. package/deployments/nana-suckers-v5/arbitrum_sepolia/JBCCIPSuckerDeployer_1.json +433 -0
  19. package/deployments/nana-suckers-v5/arbitrum_sepolia/JBCCIPSuckerDeployer_2.json +433 -0
  20. package/deployments/nana-suckers-v5/arbitrum_sepolia/JBCCIPSucker_1.json +1479 -0
  21. package/deployments/nana-suckers-v5/arbitrum_sepolia/JBCCIPSucker_2.json +1479 -0
  22. package/deployments/nana-suckers-v5/arbitrum_sepolia/JBSuckerRegistry.json +690 -0
  23. package/deployments/nana-suckers-v5/base/JBBaseSucker.json +1389 -0
  24. package/deployments/nana-suckers-v5/base/JBBaseSuckerDeployer.json +376 -0
  25. package/deployments/nana-suckers-v5/base/JBCCIPSucker.json +1483 -0
  26. package/deployments/nana-suckers-v5/base/JBCCIPSuckerDeployer.json +436 -0
  27. package/deployments/nana-suckers-v5/base/JBCCIPSuckerDeployer_1.json +436 -0
  28. package/deployments/nana-suckers-v5/base/JBCCIPSuckerDeployer_2.json +436 -0
  29. package/deployments/nana-suckers-v5/base/JBCCIPSucker_1.json +1483 -0
  30. package/deployments/nana-suckers-v5/base/JBCCIPSucker_2.json +1483 -0
  31. package/deployments/nana-suckers-v5/base/JBSuckerRegistry.json +694 -0
  32. package/deployments/nana-suckers-v5/base_sepolia/JBBaseSucker.json +1389 -0
  33. package/deployments/nana-suckers-v5/base_sepolia/JBBaseSuckerDeployer.json +376 -0
  34. package/deployments/nana-suckers-v5/base_sepolia/JBCCIPSucker.json +1483 -0
  35. package/deployments/nana-suckers-v5/base_sepolia/JBCCIPSuckerDeployer.json +436 -0
  36. package/deployments/nana-suckers-v5/base_sepolia/JBCCIPSuckerDeployer_1.json +436 -0
  37. package/deployments/nana-suckers-v5/base_sepolia/JBCCIPSuckerDeployer_2.json +436 -0
  38. package/deployments/nana-suckers-v5/base_sepolia/JBCCIPSucker_1.json +1483 -0
  39. package/deployments/nana-suckers-v5/base_sepolia/JBCCIPSucker_2.json +1483 -0
  40. package/deployments/nana-suckers-v5/base_sepolia/JBSuckerRegistry.json +694 -0
  41. package/deployments/nana-suckers-v5/ethereum/JBArbitrumSucker.json +1429 -0
  42. package/deployments/nana-suckers-v5/ethereum/JBArbitrumSuckerDeployer.json +394 -0
  43. package/deployments/nana-suckers-v5/ethereum/JBBaseSucker.json +1389 -0
  44. package/deployments/nana-suckers-v5/ethereum/JBBaseSuckerDeployer.json +376 -0
  45. package/deployments/nana-suckers-v5/ethereum/JBCCIPSucker.json +1483 -0
  46. package/deployments/nana-suckers-v5/ethereum/JBCCIPSuckerDeployer.json +436 -0
  47. package/deployments/nana-suckers-v5/ethereum/JBCCIPSuckerDeployer_1.json +436 -0
  48. package/deployments/nana-suckers-v5/ethereum/JBCCIPSuckerDeployer_2.json +436 -0
  49. package/deployments/nana-suckers-v5/ethereum/JBCCIPSucker_1.json +1483 -0
  50. package/deployments/nana-suckers-v5/ethereum/JBCCIPSucker_2.json +1483 -0
  51. package/deployments/nana-suckers-v5/ethereum/JBOptimismSucker.json +1389 -0
  52. package/deployments/nana-suckers-v5/ethereum/JBOptimismSuckerDeployer.json +376 -0
  53. package/deployments/nana-suckers-v5/ethereum/JBSuckerRegistry.json +694 -0
  54. package/deployments/nana-suckers-v5/optimism/JBCCIPSucker.json +1479 -0
  55. package/deployments/nana-suckers-v5/optimism/JBCCIPSuckerDeployer.json +433 -0
  56. package/deployments/nana-suckers-v5/optimism/JBCCIPSuckerDeployer_1.json +433 -0
  57. package/deployments/nana-suckers-v5/optimism/JBCCIPSuckerDeployer_2.json +433 -0
  58. package/deployments/nana-suckers-v5/optimism/JBCCIPSucker_1.json +1479 -0
  59. package/deployments/nana-suckers-v5/optimism/JBCCIPSucker_2.json +1479 -0
  60. package/deployments/nana-suckers-v5/optimism/JBOptimismSucker.json +1385 -0
  61. package/deployments/nana-suckers-v5/optimism/JBOptimismSuckerDeployer.json +373 -0
  62. package/deployments/nana-suckers-v5/optimism/JBSuckerRegistry.json +690 -0
  63. package/deployments/nana-suckers-v5/optimism_sepolia/JBCCIPSucker.json +1483 -0
  64. package/deployments/nana-suckers-v5/optimism_sepolia/JBCCIPSuckerDeployer.json +436 -0
  65. package/deployments/nana-suckers-v5/optimism_sepolia/JBCCIPSuckerDeployer_1.json +436 -0
  66. package/deployments/nana-suckers-v5/optimism_sepolia/JBCCIPSuckerDeployer_2.json +436 -0
  67. package/deployments/nana-suckers-v5/optimism_sepolia/JBCCIPSucker_1.json +1483 -0
  68. package/deployments/nana-suckers-v5/optimism_sepolia/JBCCIPSucker_2.json +1483 -0
  69. package/deployments/nana-suckers-v5/optimism_sepolia/JBOptimismSucker.json +1389 -0
  70. package/deployments/nana-suckers-v5/optimism_sepolia/JBOptimismSuckerDeployer.json +376 -0
  71. package/deployments/nana-suckers-v5/optimism_sepolia/JBSuckerRegistry.json +694 -0
  72. package/deployments/nana-suckers-v5/sepolia/JBArbitrumSucker.json +1429 -0
  73. package/deployments/nana-suckers-v5/sepolia/JBArbitrumSuckerDeployer.json +394 -0
  74. package/deployments/nana-suckers-v5/sepolia/JBBaseSucker.json +1389 -0
  75. package/deployments/nana-suckers-v5/sepolia/JBBaseSuckerDeployer.json +376 -0
  76. package/deployments/nana-suckers-v5/sepolia/JBCCIPSucker.json +1483 -0
  77. package/deployments/nana-suckers-v5/sepolia/JBCCIPSuckerDeployer.json +436 -0
  78. package/deployments/nana-suckers-v5/sepolia/JBCCIPSuckerDeployer_1.json +436 -0
  79. package/deployments/nana-suckers-v5/sepolia/JBCCIPSuckerDeployer_2.json +436 -0
  80. package/deployments/nana-suckers-v5/sepolia/JBCCIPSucker_1.json +1483 -0
  81. package/deployments/nana-suckers-v5/sepolia/JBCCIPSucker_2.json +1483 -0
  82. package/deployments/nana-suckers-v5/sepolia/JBOptimismSucker.json +1389 -0
  83. package/deployments/nana-suckers-v5/sepolia/JBOptimismSuckerDeployer.json +376 -0
  84. package/deployments/nana-suckers-v5/sepolia/JBSuckerRegistry.json +694 -0
  85. package/foundry.lock +11 -0
  86. package/foundry.toml +22 -0
  87. package/package.json +33 -0
  88. package/remappings.txt +1 -0
  89. package/script/Deploy.s.sol +506 -0
  90. package/script/helpers/SuckerDeploymentLib.sol +97 -0
  91. package/slither-ci.config.json +10 -0
  92. package/sphinx.lock +476 -0
  93. package/src/JBArbitrumSucker.sol +311 -0
  94. package/src/JBBaseSucker.sol +41 -0
  95. package/src/JBCCIPSucker.sol +303 -0
  96. package/src/JBOptimismSucker.sol +143 -0
  97. package/src/JBSucker.sol +1159 -0
  98. package/src/JBSuckerRegistry.sol +262 -0
  99. package/src/deployers/JBArbitrumSuckerDeployer.sol +86 -0
  100. package/src/deployers/JBBaseSuckerDeployer.sol +26 -0
  101. package/src/deployers/JBCCIPSuckerDeployer.sol +88 -0
  102. package/src/deployers/JBOptimismSuckerDeployer.sol +82 -0
  103. package/src/deployers/JBSuckerDeployer.sol +147 -0
  104. package/src/enums/JBAddToBalanceMode.sol +11 -0
  105. package/src/enums/JBLayer.sol +8 -0
  106. package/src/enums/JBSuckerState.sol +14 -0
  107. package/src/interfaces/IArbGatewayRouter.sol +11 -0
  108. package/src/interfaces/IArbL1GatewayRouter.sol +17 -0
  109. package/src/interfaces/IArbL2GatewayRouter.sol +14 -0
  110. package/src/interfaces/ICCIPRouter.sol +11 -0
  111. package/src/interfaces/IJBArbitrumSucker.sol +13 -0
  112. package/src/interfaces/IJBArbitrumSuckerDeployer.sol +12 -0
  113. package/src/interfaces/IJBCCIPSuckerDeployer.sol +15 -0
  114. package/src/interfaces/IJBOpSuckerDeployer.sol +11 -0
  115. package/src/interfaces/IJBOptimismSucker.sol +10 -0
  116. package/src/interfaces/IJBSucker.sol +144 -0
  117. package/src/interfaces/IJBSuckerDeployer.sol +40 -0
  118. package/src/interfaces/IJBSuckerExtended.sol +22 -0
  119. package/src/interfaces/IJBSuckerRegistry.sol +75 -0
  120. package/src/interfaces/IOPMessenger.sol +18 -0
  121. package/src/interfaces/IOPStandardBridge.sol +29 -0
  122. package/src/interfaces/IWrappedNativeToken.sol +13 -0
  123. package/src/libraries/ARBAddresses.sol +17 -0
  124. package/src/libraries/ARBChains.sol +11 -0
  125. package/src/libraries/CCIPHelper.sol +136 -0
  126. package/src/structs/JBClaim.sol +13 -0
  127. package/src/structs/JBInboxTreeRoot.sol +12 -0
  128. package/src/structs/JBLeaf.sol +14 -0
  129. package/src/structs/JBMessageRoot.sol +16 -0
  130. package/src/structs/JBOutboxTree.sol +18 -0
  131. package/src/structs/JBRemoteToken.sol +17 -0
  132. package/src/structs/JBSuckerDeployerConfig.sol +12 -0
  133. package/src/structs/JBSuckersPair.sol +11 -0
  134. package/src/structs/JBTokenMapping.sol +13 -0
  135. package/src/utils/MerkleLib.sol +1020 -0
  136. package/test/Fork.t.sol +514 -0
  137. package/test/InteropCompat.t.sol +676 -0
  138. package/test/SuckerAttacks.t.sol +509 -0
  139. package/test/SuckerDeepAttacks.t.sol +1563 -0
  140. package/test/mocks/ERC20Mock.sol +36 -0
  141. package/test/mocks/MockMessenger.sol +42 -0
  142. package/test/unit/arb.t.sol +28 -0
  143. package/test/unit/ccip_native_interop.t.sol +719 -0
  144. package/test/unit/ccip_refund.t.sol +234 -0
  145. package/test/unit/deployer.t.sol +475 -0
  146. package/test/unit/emergency.t.sol +305 -0
  147. package/test/unit/merkle.t.sol +212 -0
  148. package/test/unit/multi_chain_evolution.t.sol +622 -0
  149. package/test/unit/registry.t.sol +26 -0
@@ -0,0 +1,1020 @@
1
+ // SPDX-License-Identifier: MIT OR Apache-2.0
2
+ pragma solidity 0.8.23;
3
+
4
+ /**
5
+ * @title MerkleLib
6
+ * @author Illusory Systems Inc.
7
+ * @notice An incremental merkle tree modeled on the eth2 deposit contract.
8
+ *
9
+ */
10
+ library MerkleLib {
11
+ // ========== Custom Errors ===========
12
+
13
+ error MerkleLib_InsertTreeIsFull();
14
+
15
+ // ============ Constants =============
16
+
17
+ uint256 internal constant TREE_DEPTH = 32;
18
+ uint256 internal constant MAX_LEAVES = 2 ** TREE_DEPTH - 1;
19
+
20
+ /**
21
+ * @dev Z_i represent the hash values at different heights for a binary tree with leaf values equal to `0`.
22
+ * (e.g. Z_1 is the keccak256 hash of (0x0, 0x0), Z_2 is the keccak256 hash of (Z_1, Z_1), etc...)
23
+ * Z_0 is the bottom of the 33-layer tree, Z_32 is the top (i.e. root).
24
+ * Used to shortcut calculation in root calculation methods below.
25
+ */
26
+ bytes32 internal constant Z_0 = hex"0000000000000000000000000000000000000000000000000000000000000000";
27
+ bytes32 internal constant Z_1 = hex"ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5";
28
+ bytes32 internal constant Z_2 = hex"b4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30";
29
+ bytes32 internal constant Z_3 = hex"21ddb9a356815c3fac1026b6dec5df3124afbadb485c9ba5a3e3398a04b7ba85";
30
+ bytes32 internal constant Z_4 = hex"e58769b32a1beaf1ea27375a44095a0d1fb664ce2dd358e7fcbfb78c26a19344";
31
+ bytes32 internal constant Z_5 = hex"0eb01ebfc9ed27500cd4dfc979272d1f0913cc9f66540d7e8005811109e1cf2d";
32
+ bytes32 internal constant Z_6 = hex"887c22bd8750d34016ac3c66b5ff102dacdd73f6b014e710b51e8022af9a1968";
33
+ bytes32 internal constant Z_7 = hex"ffd70157e48063fc33c97a050f7f640233bf646cc98d9524c6b92bcf3ab56f83";
34
+ bytes32 internal constant Z_8 = hex"9867cc5f7f196b93bae1e27e6320742445d290f2263827498b54fec539f756af";
35
+ bytes32 internal constant Z_9 = hex"cefad4e508c098b9a7e1d8feb19955fb02ba9675585078710969d3440f5054e0";
36
+ bytes32 internal constant Z_10 = hex"f9dc3e7fe016e050eff260334f18a5d4fe391d82092319f5964f2e2eb7c1c3a5";
37
+ bytes32 internal constant Z_11 = hex"f8b13a49e282f609c317a833fb8d976d11517c571d1221a265d25af778ecf892";
38
+ bytes32 internal constant Z_12 = hex"3490c6ceeb450aecdc82e28293031d10c7d73bf85e57bf041a97360aa2c5d99c";
39
+ bytes32 internal constant Z_13 = hex"c1df82d9c4b87413eae2ef048f94b4d3554cea73d92b0f7af96e0271c691e2bb";
40
+ bytes32 internal constant Z_14 = hex"5c67add7c6caf302256adedf7ab114da0acfe870d449a3a489f781d659e8becc";
41
+ bytes32 internal constant Z_15 = hex"da7bce9f4e8618b6bd2f4132ce798cdc7a60e7e1460a7299e3c6342a579626d2";
42
+ bytes32 internal constant Z_16 = hex"2733e50f526ec2fa19a22b31e8ed50f23cd1fdf94c9154ed3a7609a2f1ff981f";
43
+ bytes32 internal constant Z_17 = hex"e1d3b5c807b281e4683cc6d6315cf95b9ade8641defcb32372f1c126e398ef7a";
44
+ bytes32 internal constant Z_18 = hex"5a2dce0a8a7f68bb74560f8f71837c2c2ebbcbf7fffb42ae1896f13f7c7479a0";
45
+ bytes32 internal constant Z_19 = hex"b46a28b6f55540f89444f63de0378e3d121be09e06cc9ded1c20e65876d36aa0";
46
+ bytes32 internal constant Z_20 = hex"c65e9645644786b620e2dd2ad648ddfcbf4a7e5b1a3a4ecfe7f64667a3f0b7e2";
47
+ bytes32 internal constant Z_21 = hex"f4418588ed35a2458cffeb39b93d26f18d2ab13bdce6aee58e7b99359ec2dfd9";
48
+ bytes32 internal constant Z_22 = hex"5a9c16dc00d6ef18b7933a6f8dc65ccb55667138776f7dea101070dc8796e377";
49
+ bytes32 internal constant Z_23 = hex"4df84f40ae0c8229d0d6069e5c8f39a7c299677a09d367fc7b05e3bc380ee652";
50
+ bytes32 internal constant Z_24 = hex"cdc72595f74c7b1043d0e1ffbab734648c838dfb0527d971b602bc216c9619ef";
51
+ bytes32 internal constant Z_25 = hex"0abf5ac974a1ed57f4050aa510dd9c74f508277b39d7973bb2dfccc5eeb0618d";
52
+ bytes32 internal constant Z_26 = hex"b8cd74046ff337f0a7bf2c8e03e10f642c1886798d71806ab1e888d9e5ee87d0";
53
+ bytes32 internal constant Z_27 = hex"838c5655cb21c6cb83313b5a631175dff4963772cce9108188b34ac87c81c41e";
54
+ bytes32 internal constant Z_28 = hex"662ee4dd2dd7b2bc707961b1e646c4047669dcb6584f0d8d770daf5d7e7deb2e";
55
+ bytes32 internal constant Z_29 = hex"388ab20e2573d171a88108e79d820e98f26c0b84aa8b2f4aa4968dbb818ea322";
56
+ bytes32 internal constant Z_30 = hex"93237c50ba75ee485f4c22adf2f741400bdf8d6a9cc7df7ecae576221665d735";
57
+ bytes32 internal constant Z_31 = hex"8448818bb4ae4562849e949e17ac16e0be16688e156b5cf15e098c627c0056a9";
58
+ bytes32 internal constant Z_32 = hex"27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757";
59
+
60
+ // ============= Structs ==============
61
+
62
+ /**
63
+ * @notice Struct representing incremental merkle tree. Contains current
64
+ * branch and the number of inserted leaves in the tree.
65
+ *
66
+ */
67
+ struct Tree {
68
+ bytes32[TREE_DEPTH] branch;
69
+ uint256 count;
70
+ }
71
+
72
+ // ========= Write Methods =========
73
+
74
+ /**
75
+ * @notice Inserts a given node (leaf) into merkle tree. Operates on an in-memory tree and
76
+ * returns an updated version of that tree.
77
+ * @dev Reverts if the tree is already full.
78
+ * @param node Element to insert into tree.
79
+ * @return Tree Updated tree.
80
+ *
81
+ */
82
+ function insert(Tree memory tree, bytes32 node) internal pure returns (Tree memory) {
83
+ // Update tree.count to increase the current count by 1 since we'll be including a new node.
84
+ uint256 size = ++tree.count;
85
+ if (size > MAX_LEAVES) revert MerkleLib_InsertTreeIsFull();
86
+
87
+ // Loop starting at 0, ending when we've finished inserting the node (i.e. hashing it) into
88
+ // the active branch. Each loop we cut size in half, hashing the inserted node up the active
89
+ // branch along the way.
90
+ for (uint256 i; i < TREE_DEPTH;) {
91
+ // Check if the current size is odd; if so, we set this index in the branch to be the node.
92
+ if ((size & 1) == 1) {
93
+ // If i > 0, then this node will be a hash of the original node with every layer up
94
+ // until layer `i`.
95
+ tree.branch[i] = node;
96
+ return tree;
97
+ }
98
+ // If the size is not yet odd, we hash the current index in the tree branch with the node.
99
+ node = keccak256(abi.encodePacked(tree.branch[i], node));
100
+ size >>= 1; // Cut size in half (statement equivalent to: `size /= 2`).
101
+
102
+ unchecked {
103
+ ++i;
104
+ }
105
+ }
106
+ // As the loop should always end prematurely with the `return` statement, this code should
107
+ // be unreachable. We revert here just to be safe.
108
+ revert MerkleLib_InsertTreeIsFull();
109
+ }
110
+
111
+ // ========= Read Methods =========
112
+
113
+ /**
114
+ * @notice Calculates and returns tree's current root.
115
+ * @return _current bytes32 root.
116
+ *
117
+ */
118
+ function root(Tree storage tree) internal view returns (bytes32 _current) {
119
+ uint256 _index = tree.count;
120
+
121
+ if (_index == 0) {
122
+ return Z_32;
123
+ }
124
+
125
+ uint256 i;
126
+ assembly {
127
+ let TREE_SLOT := tree.slot
128
+
129
+ for {} true {} {
130
+ for {} true {} {
131
+ if and(_index, 1) {
132
+ mstore(0, sload(TREE_SLOT))
133
+ mstore(0x20, Z_0)
134
+ _current := keccak256(0, 0x40)
135
+ break
136
+ }
137
+
138
+ if and(_index, shl(1, 1)) {
139
+ mstore(0, sload(add(TREE_SLOT, 1)))
140
+ mstore(0x20, Z_1)
141
+ _current := keccak256(0, 0x40)
142
+ i := 1
143
+ break
144
+ }
145
+
146
+ if and(_index, shl(2, 1)) {
147
+ mstore(0, sload(add(TREE_SLOT, 2)))
148
+ mstore(0x20, Z_2)
149
+ _current := keccak256(0, 0x40)
150
+ i := 2
151
+ break
152
+ }
153
+
154
+ if and(_index, shl(3, 1)) {
155
+ mstore(0, sload(add(TREE_SLOT, 3)))
156
+ mstore(0x20, Z_3)
157
+ _current := keccak256(0, 0x40)
158
+ i := 3
159
+ break
160
+ }
161
+
162
+ if and(_index, shl(4, 1)) {
163
+ mstore(0, sload(add(TREE_SLOT, 4)))
164
+ mstore(0x20, Z_4)
165
+ _current := keccak256(0, 0x40)
166
+ i := 4
167
+ break
168
+ }
169
+
170
+ if and(_index, shl(5, 1)) {
171
+ mstore(0, sload(add(TREE_SLOT, 5)))
172
+ mstore(0x20, Z_5)
173
+ _current := keccak256(0, 0x40)
174
+ i := 5
175
+ break
176
+ }
177
+
178
+ if and(_index, shl(6, 1)) {
179
+ mstore(0, sload(add(TREE_SLOT, 6)))
180
+ mstore(0x20, Z_6)
181
+ _current := keccak256(0, 0x40)
182
+ i := 6
183
+ break
184
+ }
185
+
186
+ if and(_index, shl(7, 1)) {
187
+ mstore(0, sload(add(TREE_SLOT, 7)))
188
+ mstore(0x20, Z_7)
189
+ _current := keccak256(0, 0x40)
190
+ i := 7
191
+ break
192
+ }
193
+
194
+ if and(_index, shl(8, 1)) {
195
+ mstore(0, sload(add(TREE_SLOT, 8)))
196
+ mstore(0x20, Z_8)
197
+ _current := keccak256(0, 0x40)
198
+ i := 8
199
+ break
200
+ }
201
+
202
+ if and(_index, shl(9, 1)) {
203
+ mstore(0, sload(add(TREE_SLOT, 9)))
204
+ mstore(0x20, Z_9)
205
+ _current := keccak256(0, 0x40)
206
+ i := 9
207
+ break
208
+ }
209
+
210
+ if and(_index, shl(10, 1)) {
211
+ mstore(0, sload(add(TREE_SLOT, 10)))
212
+ mstore(0x20, Z_10)
213
+ _current := keccak256(0, 0x40)
214
+ i := 10
215
+ break
216
+ }
217
+
218
+ if and(_index, shl(11, 1)) {
219
+ mstore(0, sload(add(TREE_SLOT, 11)))
220
+ mstore(0x20, Z_11)
221
+ _current := keccak256(0, 0x40)
222
+ i := 11
223
+ break
224
+ }
225
+
226
+ if and(_index, shl(12, 1)) {
227
+ mstore(0, sload(add(TREE_SLOT, 12)))
228
+ mstore(0x20, Z_12)
229
+ _current := keccak256(0, 0x40)
230
+ i := 12
231
+ break
232
+ }
233
+
234
+ if and(_index, shl(13, 1)) {
235
+ mstore(0, sload(add(TREE_SLOT, 13)))
236
+ mstore(0x20, Z_13)
237
+ _current := keccak256(0, 0x40)
238
+ i := 13
239
+ break
240
+ }
241
+
242
+ if and(_index, shl(14, 1)) {
243
+ mstore(0, sload(add(TREE_SLOT, 14)))
244
+ mstore(0x20, Z_14)
245
+ _current := keccak256(0, 0x40)
246
+ i := 14
247
+ break
248
+ }
249
+
250
+ if and(_index, shl(15, 1)) {
251
+ mstore(0, sload(add(TREE_SLOT, 15)))
252
+ mstore(0x20, Z_15)
253
+ _current := keccak256(0, 0x40)
254
+ i := 15
255
+ break
256
+ }
257
+
258
+ if and(_index, shl(16, 1)) {
259
+ mstore(0, sload(add(TREE_SLOT, 16)))
260
+ mstore(0x20, Z_16)
261
+ _current := keccak256(0, 0x40)
262
+ i := 16
263
+ break
264
+ }
265
+
266
+ if and(_index, shl(17, 1)) {
267
+ mstore(0, sload(add(TREE_SLOT, 17)))
268
+ mstore(0x20, Z_17)
269
+ _current := keccak256(0, 0x40)
270
+ i := 17
271
+ break
272
+ }
273
+
274
+ if and(_index, shl(18, 1)) {
275
+ mstore(0, sload(add(TREE_SLOT, 18)))
276
+ mstore(0x20, Z_18)
277
+ _current := keccak256(0, 0x40)
278
+ i := 18
279
+ break
280
+ }
281
+
282
+ if and(_index, shl(19, 1)) {
283
+ mstore(0, sload(add(TREE_SLOT, 19)))
284
+ mstore(0x20, Z_19)
285
+ _current := keccak256(0, 0x40)
286
+ i := 19
287
+ break
288
+ }
289
+
290
+ if and(_index, shl(20, 1)) {
291
+ mstore(0, sload(add(TREE_SLOT, 20)))
292
+ mstore(0x20, Z_20)
293
+ _current := keccak256(0, 0x40)
294
+ i := 20
295
+ break
296
+ }
297
+
298
+ if and(_index, shl(21, 1)) {
299
+ mstore(0, sload(add(TREE_SLOT, 21)))
300
+ mstore(0x20, Z_21)
301
+ _current := keccak256(0, 0x40)
302
+ i := 21
303
+ break
304
+ }
305
+
306
+ if and(_index, shl(22, 1)) {
307
+ mstore(0, sload(add(TREE_SLOT, 22)))
308
+ mstore(0x20, Z_22)
309
+ _current := keccak256(0, 0x40)
310
+ i := 22
311
+ break
312
+ }
313
+
314
+ if and(_index, shl(23, 1)) {
315
+ mstore(0, sload(add(TREE_SLOT, 23)))
316
+ mstore(0x20, Z_23)
317
+ _current := keccak256(0, 0x40)
318
+ i := 23
319
+ break
320
+ }
321
+
322
+ if and(_index, shl(24, 1)) {
323
+ mstore(0, sload(add(TREE_SLOT, 24)))
324
+ mstore(0x20, Z_24)
325
+ _current := keccak256(0, 0x40)
326
+ i := 24
327
+ break
328
+ }
329
+
330
+ if and(_index, shl(25, 1)) {
331
+ mstore(0, sload(add(TREE_SLOT, 25)))
332
+ mstore(0x20, Z_25)
333
+ _current := keccak256(0, 0x40)
334
+ i := 25
335
+ break
336
+ }
337
+
338
+ if and(_index, shl(26, 1)) {
339
+ mstore(0, sload(add(TREE_SLOT, 26)))
340
+ mstore(0x20, Z_26)
341
+ _current := keccak256(0, 0x40)
342
+ i := 26
343
+ break
344
+ }
345
+
346
+ if and(_index, shl(27, 1)) {
347
+ mstore(0, sload(add(TREE_SLOT, 27)))
348
+ mstore(0x20, Z_27)
349
+ _current := keccak256(0, 0x40)
350
+ i := 27
351
+ break
352
+ }
353
+
354
+ if and(_index, shl(28, 1)) {
355
+ mstore(0, sload(add(TREE_SLOT, 28)))
356
+ mstore(0x20, Z_28)
357
+ _current := keccak256(0, 0x40)
358
+ i := 28
359
+ break
360
+ }
361
+
362
+ if and(_index, shl(29, 1)) {
363
+ mstore(0, sload(add(TREE_SLOT, 29)))
364
+ mstore(0x20, Z_29)
365
+ _current := keccak256(0, 0x40)
366
+ i := 29
367
+ break
368
+ }
369
+
370
+ if and(_index, shl(30, 1)) {
371
+ mstore(0, sload(add(TREE_SLOT, 30)))
372
+ mstore(0x20, Z_30)
373
+ _current := keccak256(0, 0x40)
374
+ i := 30
375
+ break
376
+ }
377
+
378
+ if and(_index, shl(31, 1)) {
379
+ mstore(0, sload(add(TREE_SLOT, 31)))
380
+ mstore(0x20, Z_31)
381
+ _current := keccak256(0, 0x40)
382
+ // slither-disable-next-line write-after-write
383
+ i := 31
384
+ break
385
+ }
386
+
387
+ // slither-disable-next-line write-after-write
388
+ _current := Z_32
389
+ i := 32
390
+ break
391
+ }
392
+
393
+ if gt(i, 30) { break }
394
+
395
+ {
396
+ if lt(i, 1) {
397
+ switch and(_index, shl(1, 1))
398
+ case 0 {
399
+ mstore(0, _current)
400
+ mstore(0x20, Z_1)
401
+ }
402
+ default {
403
+ mstore(0, sload(add(TREE_SLOT, 1)))
404
+ mstore(0x20, _current)
405
+ }
406
+
407
+ _current := keccak256(0, 0x40)
408
+ }
409
+
410
+ if lt(i, 2) {
411
+ switch and(_index, shl(2, 1))
412
+ case 0 {
413
+ mstore(0, _current)
414
+ mstore(0x20, Z_2)
415
+ }
416
+ default {
417
+ mstore(0, sload(add(TREE_SLOT, 2)))
418
+ mstore(0x20, _current)
419
+ }
420
+
421
+ _current := keccak256(0, 0x40)
422
+ }
423
+
424
+ if lt(i, 3) {
425
+ switch and(_index, shl(3, 1))
426
+ case 0 {
427
+ mstore(0, _current)
428
+ mstore(0x20, Z_3)
429
+ }
430
+ default {
431
+ mstore(0, sload(add(TREE_SLOT, 3)))
432
+ mstore(0x20, _current)
433
+ }
434
+
435
+ _current := keccak256(0, 0x40)
436
+ }
437
+
438
+ if lt(i, 4) {
439
+ switch and(_index, shl(4, 1))
440
+ case 0 {
441
+ mstore(0, _current)
442
+ mstore(0x20, Z_4)
443
+ }
444
+ default {
445
+ mstore(0, sload(add(TREE_SLOT, 4)))
446
+ mstore(0x20, _current)
447
+ }
448
+
449
+ _current := keccak256(0, 0x40)
450
+ }
451
+
452
+ if lt(i, 5) {
453
+ switch and(_index, shl(5, 1))
454
+ case 0 {
455
+ mstore(0, _current)
456
+ mstore(0x20, Z_5)
457
+ }
458
+ default {
459
+ mstore(0, sload(add(TREE_SLOT, 5)))
460
+ mstore(0x20, _current)
461
+ }
462
+
463
+ _current := keccak256(0, 0x40)
464
+ }
465
+
466
+ if lt(i, 6) {
467
+ switch and(_index, shl(6, 1))
468
+ case 0 {
469
+ mstore(0, _current)
470
+ mstore(0x20, Z_6)
471
+ }
472
+ default {
473
+ mstore(0, sload(add(TREE_SLOT, 6)))
474
+ mstore(0x20, _current)
475
+ }
476
+
477
+ _current := keccak256(0, 0x40)
478
+ }
479
+
480
+ if lt(i, 7) {
481
+ switch and(_index, shl(7, 1))
482
+ case 0 {
483
+ mstore(0, _current)
484
+ mstore(0x20, Z_7)
485
+ }
486
+ default {
487
+ mstore(0, sload(add(TREE_SLOT, 7)))
488
+ mstore(0x20, _current)
489
+ }
490
+
491
+ _current := keccak256(0, 0x40)
492
+ }
493
+
494
+ if lt(i, 8) {
495
+ switch and(_index, shl(8, 1))
496
+ case 0 {
497
+ mstore(0, _current)
498
+ mstore(0x20, Z_8)
499
+ }
500
+ default {
501
+ mstore(0, sload(add(TREE_SLOT, 8)))
502
+ mstore(0x20, _current)
503
+ }
504
+
505
+ _current := keccak256(0, 0x40)
506
+ }
507
+
508
+ if lt(i, 9) {
509
+ switch and(_index, shl(9, 1))
510
+ case 0 {
511
+ mstore(0, _current)
512
+ mstore(0x20, Z_9)
513
+ }
514
+ default {
515
+ mstore(0, sload(add(TREE_SLOT, 9)))
516
+ mstore(0x20, _current)
517
+ }
518
+
519
+ _current := keccak256(0, 0x40)
520
+ }
521
+
522
+ if lt(i, 10) {
523
+ switch and(_index, shl(10, 1))
524
+ case 0 {
525
+ mstore(0, _current)
526
+ mstore(0x20, Z_10)
527
+ }
528
+ default {
529
+ mstore(0, sload(add(TREE_SLOT, 10)))
530
+ mstore(0x20, _current)
531
+ }
532
+
533
+ _current := keccak256(0, 0x40)
534
+ }
535
+
536
+ if lt(i, 11) {
537
+ switch and(_index, shl(11, 1))
538
+ case 0 {
539
+ mstore(0, _current)
540
+ mstore(0x20, Z_11)
541
+ }
542
+ default {
543
+ mstore(0, sload(add(TREE_SLOT, 11)))
544
+ mstore(0x20, _current)
545
+ }
546
+
547
+ _current := keccak256(0, 0x40)
548
+ }
549
+
550
+ if lt(i, 12) {
551
+ switch and(_index, shl(12, 1))
552
+ case 0 {
553
+ mstore(0, _current)
554
+ mstore(0x20, Z_12)
555
+ }
556
+ default {
557
+ mstore(0, sload(add(TREE_SLOT, 12)))
558
+ mstore(0x20, _current)
559
+ }
560
+
561
+ _current := keccak256(0, 0x40)
562
+ }
563
+
564
+ if lt(i, 13) {
565
+ switch and(_index, shl(13, 1))
566
+ case 0 {
567
+ mstore(0, _current)
568
+ mstore(0x20, Z_13)
569
+ }
570
+ default {
571
+ mstore(0, sload(add(TREE_SLOT, 13)))
572
+ mstore(0x20, _current)
573
+ }
574
+
575
+ _current := keccak256(0, 0x40)
576
+ }
577
+
578
+ if lt(i, 14) {
579
+ switch and(_index, shl(14, 1))
580
+ case 0 {
581
+ mstore(0, _current)
582
+ mstore(0x20, Z_14)
583
+ }
584
+ default {
585
+ mstore(0, sload(add(TREE_SLOT, 14)))
586
+ mstore(0x20, _current)
587
+ }
588
+
589
+ _current := keccak256(0, 0x40)
590
+ }
591
+
592
+ if lt(i, 15) {
593
+ switch and(_index, shl(15, 1))
594
+ case 0 {
595
+ mstore(0, _current)
596
+ mstore(0x20, Z_15)
597
+ }
598
+ default {
599
+ mstore(0, sload(add(TREE_SLOT, 15)))
600
+ mstore(0x20, _current)
601
+ }
602
+
603
+ _current := keccak256(0, 0x40)
604
+ }
605
+
606
+ if lt(i, 16) {
607
+ switch and(_index, shl(16, 1))
608
+ case 0 {
609
+ mstore(0, _current)
610
+ mstore(0x20, Z_16)
611
+ }
612
+ default {
613
+ mstore(0, sload(add(TREE_SLOT, 16)))
614
+ mstore(0x20, _current)
615
+ }
616
+
617
+ _current := keccak256(0, 0x40)
618
+ }
619
+
620
+ if lt(i, 17) {
621
+ switch and(_index, shl(17, 1))
622
+ case 0 {
623
+ mstore(0, _current)
624
+ mstore(0x20, Z_17)
625
+ }
626
+ default {
627
+ mstore(0, sload(add(TREE_SLOT, 17)))
628
+ mstore(0x20, _current)
629
+ }
630
+
631
+ _current := keccak256(0, 0x40)
632
+ }
633
+
634
+ if lt(i, 18) {
635
+ switch and(_index, shl(18, 1))
636
+ case 0 {
637
+ mstore(0, _current)
638
+ mstore(0x20, Z_18)
639
+ }
640
+ default {
641
+ mstore(0, sload(add(TREE_SLOT, 18)))
642
+ mstore(0x20, _current)
643
+ }
644
+
645
+ _current := keccak256(0, 0x40)
646
+ }
647
+
648
+ if lt(i, 19) {
649
+ switch and(_index, shl(19, 1))
650
+ case 0 {
651
+ mstore(0, _current)
652
+ mstore(0x20, Z_19)
653
+ }
654
+ default {
655
+ mstore(0, sload(add(TREE_SLOT, 19)))
656
+ mstore(0x20, _current)
657
+ }
658
+
659
+ _current := keccak256(0, 0x40)
660
+ }
661
+
662
+ if lt(i, 20) {
663
+ switch and(_index, shl(20, 1))
664
+ case 0 {
665
+ mstore(0, _current)
666
+ mstore(0x20, Z_20)
667
+ }
668
+ default {
669
+ mstore(0, sload(add(TREE_SLOT, 20)))
670
+ mstore(0x20, _current)
671
+ }
672
+
673
+ _current := keccak256(0, 0x40)
674
+ }
675
+
676
+ if lt(i, 21) {
677
+ switch and(_index, shl(21, 1))
678
+ case 0 {
679
+ mstore(0, _current)
680
+ mstore(0x20, Z_21)
681
+ }
682
+ default {
683
+ mstore(0, sload(add(TREE_SLOT, 21)))
684
+ mstore(0x20, _current)
685
+ }
686
+
687
+ _current := keccak256(0, 0x40)
688
+ }
689
+
690
+ if lt(i, 22) {
691
+ switch and(_index, shl(22, 1))
692
+ case 0 {
693
+ mstore(0, _current)
694
+ mstore(0x20, Z_22)
695
+ }
696
+ default {
697
+ mstore(0, sload(add(TREE_SLOT, 22)))
698
+ mstore(0x20, _current)
699
+ }
700
+
701
+ _current := keccak256(0, 0x40)
702
+ }
703
+
704
+ if lt(i, 23) {
705
+ switch and(_index, shl(23, 1))
706
+ case 0 {
707
+ mstore(0, _current)
708
+ mstore(0x20, Z_23)
709
+ }
710
+ default {
711
+ mstore(0, sload(add(TREE_SLOT, 23)))
712
+ mstore(0x20, _current)
713
+ }
714
+
715
+ _current := keccak256(0, 0x40)
716
+ }
717
+
718
+ if lt(i, 24) {
719
+ switch and(_index, shl(24, 1))
720
+ case 0 {
721
+ mstore(0, _current)
722
+ mstore(0x20, Z_24)
723
+ }
724
+ default {
725
+ mstore(0, sload(add(TREE_SLOT, 24)))
726
+ mstore(0x20, _current)
727
+ }
728
+
729
+ _current := keccak256(0, 0x40)
730
+ }
731
+
732
+ if lt(i, 25) {
733
+ switch and(_index, shl(25, 1))
734
+ case 0 {
735
+ mstore(0, _current)
736
+ mstore(0x20, Z_25)
737
+ }
738
+ default {
739
+ mstore(0, sload(add(TREE_SLOT, 25)))
740
+ mstore(0x20, _current)
741
+ }
742
+
743
+ _current := keccak256(0, 0x40)
744
+ }
745
+
746
+ if lt(i, 26) {
747
+ switch and(_index, shl(26, 1))
748
+ case 0 {
749
+ mstore(0, _current)
750
+ mstore(0x20, Z_26)
751
+ }
752
+ default {
753
+ mstore(0, sload(add(TREE_SLOT, 26)))
754
+ mstore(0x20, _current)
755
+ }
756
+
757
+ _current := keccak256(0, 0x40)
758
+ }
759
+
760
+ if lt(i, 27) {
761
+ switch and(_index, shl(27, 1))
762
+ case 0 {
763
+ mstore(0, _current)
764
+ mstore(0x20, Z_27)
765
+ }
766
+ default {
767
+ mstore(0, sload(add(TREE_SLOT, 27)))
768
+ mstore(0x20, _current)
769
+ }
770
+
771
+ _current := keccak256(0, 0x40)
772
+ }
773
+
774
+ if lt(i, 28) {
775
+ switch and(_index, shl(28, 1))
776
+ case 0 {
777
+ mstore(0, _current)
778
+ mstore(0x20, Z_28)
779
+ }
780
+ default {
781
+ mstore(0, sload(add(TREE_SLOT, 28)))
782
+ mstore(0x20, _current)
783
+ }
784
+
785
+ _current := keccak256(0, 0x40)
786
+ }
787
+
788
+ if lt(i, 29) {
789
+ switch and(_index, shl(29, 1))
790
+ case 0 {
791
+ mstore(0, _current)
792
+ mstore(0x20, Z_29)
793
+ }
794
+ default {
795
+ mstore(0, sload(add(TREE_SLOT, 29)))
796
+ mstore(0x20, _current)
797
+ }
798
+
799
+ _current := keccak256(0, 0x40)
800
+ }
801
+
802
+ if lt(i, 30) {
803
+ switch and(_index, shl(30, 1))
804
+ case 0 {
805
+ mstore(0, _current)
806
+ mstore(0x20, Z_30)
807
+ }
808
+ default {
809
+ mstore(0, sload(add(TREE_SLOT, 30)))
810
+ mstore(0x20, _current)
811
+ }
812
+
813
+ _current := keccak256(0, 0x40)
814
+ }
815
+
816
+ if lt(i, 31) {
817
+ switch and(_index, shl(31, 1))
818
+ case 0 {
819
+ mstore(0, _current)
820
+ mstore(0x20, Z_31)
821
+ }
822
+ default {
823
+ mstore(0, sload(add(TREE_SLOT, 31)))
824
+ mstore(0x20, _current)
825
+ }
826
+
827
+ _current := keccak256(0, 0x40)
828
+ }
829
+ }
830
+
831
+ break
832
+ }
833
+ }
834
+ }
835
+
836
+ /**
837
+ * @notice Calculates and returns the merkle root for the given leaf `_item`,
838
+ * a merkle branch, and the index of `_item` in the tree.
839
+ * @param _item Merkle leaf
840
+ * @param _branch Merkle proof
841
+ * @param _index Index of `_item` in tree
842
+ * @return _current Calculated merkle root
843
+ *
844
+ */
845
+ function branchRoot(
846
+ bytes32 _item,
847
+ bytes32[TREE_DEPTH] memory _branch,
848
+ uint256 _index
849
+ )
850
+ internal
851
+ pure
852
+ returns (bytes32 _current)
853
+ {
854
+ assembly {
855
+ _current := _item
856
+ let BRANCH_DATA_OFFSET := _branch
857
+ let f
858
+
859
+ f := shl(5, and(_index, 1))
860
+ mstore(f, _current)
861
+ mstore(sub(0x20, f), mload(BRANCH_DATA_OFFSET))
862
+ _current := keccak256(0, 0x40)
863
+
864
+ f := shl(5, iszero(and(_index, shl(1, 1))))
865
+ mstore(sub(0x20, f), _current)
866
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 1))))
867
+ _current := keccak256(0, 0x40)
868
+
869
+ f := shl(5, iszero(and(_index, shl(2, 1))))
870
+ mstore(sub(0x20, f), _current)
871
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 2))))
872
+ _current := keccak256(0, 0x40)
873
+
874
+ f := shl(5, iszero(and(_index, shl(3, 1))))
875
+ mstore(sub(0x20, f), _current)
876
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 3))))
877
+ _current := keccak256(0, 0x40)
878
+
879
+ f := shl(5, iszero(and(_index, shl(4, 1))))
880
+ mstore(sub(0x20, f), _current)
881
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 4))))
882
+ _current := keccak256(0, 0x40)
883
+
884
+ f := shl(5, iszero(and(_index, shl(5, 1))))
885
+ mstore(sub(0x20, f), _current)
886
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 5))))
887
+ _current := keccak256(0, 0x40)
888
+
889
+ f := shl(5, iszero(and(_index, shl(6, 1))))
890
+ mstore(sub(0x20, f), _current)
891
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 6))))
892
+ _current := keccak256(0, 0x40)
893
+
894
+ f := shl(5, iszero(and(_index, shl(7, 1))))
895
+ mstore(sub(0x20, f), _current)
896
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 7))))
897
+ _current := keccak256(0, 0x40)
898
+
899
+ f := shl(5, iszero(and(_index, shl(8, 1))))
900
+ mstore(sub(0x20, f), _current)
901
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 8))))
902
+ _current := keccak256(0, 0x40)
903
+
904
+ f := shl(5, iszero(and(_index, shl(9, 1))))
905
+ mstore(sub(0x20, f), _current)
906
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 9))))
907
+ _current := keccak256(0, 0x40)
908
+
909
+ f := shl(5, iszero(and(_index, shl(10, 1))))
910
+ mstore(sub(0x20, f), _current)
911
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 10))))
912
+ _current := keccak256(0, 0x40)
913
+
914
+ f := shl(5, iszero(and(_index, shl(11, 1))))
915
+ mstore(sub(0x20, f), _current)
916
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 11))))
917
+ _current := keccak256(0, 0x40)
918
+
919
+ f := shl(5, iszero(and(_index, shl(12, 1))))
920
+ mstore(sub(0x20, f), _current)
921
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 12))))
922
+ _current := keccak256(0, 0x40)
923
+
924
+ f := shl(5, iszero(and(_index, shl(13, 1))))
925
+ mstore(sub(0x20, f), _current)
926
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 13))))
927
+ _current := keccak256(0, 0x40)
928
+
929
+ f := shl(5, iszero(and(_index, shl(14, 1))))
930
+ mstore(sub(0x20, f), _current)
931
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 14))))
932
+ _current := keccak256(0, 0x40)
933
+
934
+ f := shl(5, iszero(and(_index, shl(15, 1))))
935
+ mstore(sub(0x20, f), _current)
936
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 15))))
937
+ _current := keccak256(0, 0x40)
938
+
939
+ f := shl(5, iszero(and(_index, shl(16, 1))))
940
+ mstore(sub(0x20, f), _current)
941
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 16))))
942
+ _current := keccak256(0, 0x40)
943
+
944
+ f := shl(5, iszero(and(_index, shl(17, 1))))
945
+ mstore(sub(0x20, f), _current)
946
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 17))))
947
+ _current := keccak256(0, 0x40)
948
+
949
+ f := shl(5, iszero(and(_index, shl(18, 1))))
950
+ mstore(sub(0x20, f), _current)
951
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 18))))
952
+ _current := keccak256(0, 0x40)
953
+
954
+ f := shl(5, iszero(and(_index, shl(19, 1))))
955
+ mstore(sub(0x20, f), _current)
956
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 19))))
957
+ _current := keccak256(0, 0x40)
958
+
959
+ f := shl(5, iszero(and(_index, shl(20, 1))))
960
+ mstore(sub(0x20, f), _current)
961
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 20))))
962
+ _current := keccak256(0, 0x40)
963
+
964
+ f := shl(5, iszero(and(_index, shl(21, 1))))
965
+ mstore(sub(0x20, f), _current)
966
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 21))))
967
+ _current := keccak256(0, 0x40)
968
+
969
+ f := shl(5, iszero(and(_index, shl(22, 1))))
970
+ mstore(sub(0x20, f), _current)
971
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 22))))
972
+ _current := keccak256(0, 0x40)
973
+
974
+ f := shl(5, iszero(and(_index, shl(23, 1))))
975
+ mstore(sub(0x20, f), _current)
976
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 23))))
977
+ _current := keccak256(0, 0x40)
978
+
979
+ f := shl(5, iszero(and(_index, shl(24, 1))))
980
+ mstore(sub(0x20, f), _current)
981
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 24))))
982
+ _current := keccak256(0, 0x40)
983
+
984
+ f := shl(5, iszero(and(_index, shl(25, 1))))
985
+ mstore(sub(0x20, f), _current)
986
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 25))))
987
+ _current := keccak256(0, 0x40)
988
+
989
+ f := shl(5, iszero(and(_index, shl(26, 1))))
990
+ mstore(sub(0x20, f), _current)
991
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 26))))
992
+ _current := keccak256(0, 0x40)
993
+
994
+ f := shl(5, iszero(and(_index, shl(27, 1))))
995
+ mstore(sub(0x20, f), _current)
996
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 27))))
997
+ _current := keccak256(0, 0x40)
998
+
999
+ f := shl(5, iszero(and(_index, shl(28, 1))))
1000
+ mstore(sub(0x20, f), _current)
1001
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 28))))
1002
+ _current := keccak256(0, 0x40)
1003
+
1004
+ f := shl(5, iszero(and(_index, shl(29, 1))))
1005
+ mstore(sub(0x20, f), _current)
1006
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 29))))
1007
+ _current := keccak256(0, 0x40)
1008
+
1009
+ f := shl(5, iszero(and(_index, shl(30, 1))))
1010
+ mstore(sub(0x20, f), _current)
1011
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 30))))
1012
+ _current := keccak256(0, 0x40)
1013
+
1014
+ f := shl(5, iszero(and(_index, shl(31, 1))))
1015
+ mstore(sub(0x20, f), _current)
1016
+ mstore(f, mload(add(BRANCH_DATA_OFFSET, shl(5, 31))))
1017
+ _current := keccak256(0, 0x40)
1018
+ }
1019
+ }
1020
+ }