dequanto 0.2.38 → 0.2.41

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 (480) hide show
  1. package/lib/cjs/abi/$abiCoder.js +1 -1
  2. package/lib/cjs/abi/$abiCoder.js.map +1 -1
  3. package/lib/cjs/abi/Logger.js +1 -1
  4. package/lib/cjs/abi/abi-coder-packed.js +3 -3
  5. package/lib/cjs/abi/abi-coder.js +16 -16
  6. package/lib/cjs/abi/coders/abstract-coder.js +31 -31
  7. package/lib/cjs/abi/coders/abstract-coder.js.map +1 -1
  8. package/lib/cjs/abi/fragments.js +90 -90
  9. package/lib/cjs/abi/fragments.js.map +1 -1
  10. package/lib/cjs/blocks/BlockDateResolver.js +9 -9
  11. package/lib/cjs/blocks/BlockDateResolver.js.map +1 -1
  12. package/lib/cjs/class/PackedRanges.js +46 -46
  13. package/lib/cjs/class/PackedRanges.js.map +1 -1
  14. package/lib/cjs/clients/ClientEventsStream.js +1 -1
  15. package/lib/cjs/clients/ClientEventsStream.js.map +1 -1
  16. package/lib/cjs/clients/ClientPool.js +23 -23
  17. package/lib/cjs/clients/ClientPool.js.map +1 -1
  18. package/lib/cjs/clients/WalletClient.js +3 -3
  19. package/lib/cjs/clients/WalletClient.js.map +1 -1
  20. package/lib/cjs/clients/Web3Client.js +14 -14
  21. package/lib/cjs/clients/Web3Client.js.map +1 -1
  22. package/lib/cjs/clients/Web3ClientFactory.js +1 -1
  23. package/lib/cjs/clients/Web3ClientFactory.js.map +1 -1
  24. package/lib/cjs/clients/compatibility/Web3.js +2 -2
  25. package/lib/cjs/clients/compatibility/Web3.js.map +1 -1
  26. package/lib/cjs/clients/handlers/RateLimitGuard.js +16 -16
  27. package/lib/cjs/clients/handlers/RateLimitGuard.js.map +1 -1
  28. package/lib/cjs/clients/model/PromiEventWrap.js +1 -1
  29. package/lib/cjs/clients/model/PromiEventWrap.js.map +1 -1
  30. package/lib/cjs/clients/utils/$web3Abi.js +2 -2
  31. package/lib/cjs/clients/utils/$web3Abi.js.map +1 -1
  32. package/lib/cjs/clients/utils/ClientErrorUtil.js +4 -0
  33. package/lib/cjs/clients/utils/ClientErrorUtil.js.map +1 -1
  34. package/lib/cjs/config/Config.js.map +1 -1
  35. package/lib/cjs/contracts/Contract.js +1 -1
  36. package/lib/cjs/contracts/Contract.js.map +1 -1
  37. package/lib/cjs/contracts/ContractAbiProvider.js +6 -6
  38. package/lib/cjs/contracts/ContractAbiProvider.js.map +1 -1
  39. package/lib/cjs/contracts/ContractBase.js +10 -10
  40. package/lib/cjs/contracts/ContractBase.js.map +1 -1
  41. package/lib/cjs/contracts/ContractProvider.js +1 -1
  42. package/lib/cjs/contracts/ContractProvider.js.map +1 -1
  43. package/lib/cjs/contracts/ContractReader.js +5 -5
  44. package/lib/cjs/contracts/ContractReader.js.map +1 -1
  45. package/lib/cjs/contracts/ContractWriter.js +4 -4
  46. package/lib/cjs/contracts/ContractWriter.js.map +1 -1
  47. package/lib/cjs/contracts/deploy/ContractDeployer.js +4 -4
  48. package/lib/cjs/contracts/deploy/ContractDeployer.js.map +1 -1
  49. package/lib/cjs/contracts/deploy/Deployments.js +36 -21
  50. package/lib/cjs/contracts/deploy/Deployments.js.map +1 -1
  51. package/lib/cjs/contracts/deploy/proxy/$proxyDeploy.js +13 -13
  52. package/lib/cjs/contracts/deploy/proxy/$proxyDeploy.js.map +1 -1
  53. package/lib/cjs/contracts/deploy/proxy/ProxyDeployment.js +22 -22
  54. package/lib/cjs/contracts/deploy/proxy/ProxyDeployment.js.map +1 -1
  55. package/lib/cjs/contracts/deploy/storage/DeploymentsStorage.js +15 -14
  56. package/lib/cjs/contracts/deploy/storage/DeploymentsStorage.js.map +1 -1
  57. package/lib/cjs/contracts/utils/AbiDeserializer.js +4 -4
  58. package/lib/cjs/contracts/utils/AbiDeserializer.js.map +1 -1
  59. package/lib/cjs/contracts/utils/ContractBaseUtils.js +3 -3
  60. package/lib/cjs/contracts/utils/ContractBaseUtils.js.map +1 -1
  61. package/lib/cjs/evm/OpcodesWalker.js +1 -1
  62. package/lib/cjs/evm/OpcodesWalker.js.map +1 -1
  63. package/lib/cjs/explorer/BlockchainExplorer.js +1 -1
  64. package/lib/cjs/explorer/BlockchainExplorer.js.map +1 -1
  65. package/lib/cjs/explorer/BlockchainExplorerFactory.js +1 -1
  66. package/lib/cjs/explorer/BlockchainExplorerStorage.js +12 -12
  67. package/lib/cjs/explorer/BlockchainExplorerStorage.js.map +1 -1
  68. package/lib/cjs/explorer/Evmscan.js +1 -1
  69. package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js +7 -7
  70. package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
  71. package/lib/cjs/flashbots/FlashbotWeb3Client.js +1 -1
  72. package/lib/cjs/flashbots/FlashbotWeb3Client.js.map +1 -1
  73. package/lib/cjs/hardhat/HardhatProvider.js +7 -7
  74. package/lib/cjs/hardhat/HardhatProvider.js.map +1 -1
  75. package/lib/cjs/indexer/BlocksTxIndexer.js +2 -2
  76. package/lib/cjs/indexer/BlocksTxIndexer.js.map +1 -1
  77. package/lib/cjs/indexer/EventsIndexer.js +11 -11
  78. package/lib/cjs/indexer/EventsIndexer.js.map +1 -1
  79. package/lib/cjs/indexer/PendingTxIndexer.js +2 -2
  80. package/lib/cjs/indexer/PendingTxIndexer.js.map +1 -1
  81. package/lib/cjs/indexer/handlers/BlocksWalker.js +9 -9
  82. package/lib/cjs/indexer/handlers/BlocksWalker.js.map +1 -1
  83. package/lib/cjs/indexer/handlers/TxQueueLoader.js +1 -1
  84. package/lib/cjs/indexer/storage/FsEventsIndexerStore.js +3 -3
  85. package/lib/cjs/indexer/storage/FsEventsIndexerStore.js.map +1 -1
  86. package/lib/cjs/indexer/storage/FsEventsStoreUtils.js +1 -1
  87. package/lib/cjs/indexer/storage/FsEventsStoreUtils.js.map +1 -1
  88. package/lib/cjs/json/JsonArrayMultiStore.js +1 -1
  89. package/lib/cjs/json/JsonArrayMultiStore.js.map +1 -1
  90. package/lib/cjs/json/JsonStoreFs.js +1 -1
  91. package/lib/cjs/json/JsonStoreFs.js.map +1 -1
  92. package/lib/cjs/rpc/$rpc.js +2 -2
  93. package/lib/cjs/rpc/$rpc.js.map +1 -1
  94. package/lib/cjs/rpc/Rpc.js +2 -2
  95. package/lib/cjs/rpc/RpcBase.js +2 -2
  96. package/lib/cjs/rpc/RpcBase.js.map +1 -1
  97. package/lib/cjs/rpc/RpcContract.js +4 -3
  98. package/lib/cjs/rpc/RpcContract.js.map +1 -1
  99. package/lib/cjs/rpc/RpcSubscription.js +1 -1
  100. package/lib/cjs/rpc/RpcSubscription.js.map +1 -1
  101. package/lib/cjs/rpc/transports/compatibility/EIP1193Transport.js +4 -4
  102. package/lib/cjs/rpc/transports/compatibility/EIP1193Transport.js.map +1 -1
  103. package/lib/cjs/rpc/transports/compatibility/Web3Transport.js +1 -1
  104. package/lib/cjs/rpc/transports/compatibility/Web3Transport.js.map +1 -1
  105. package/lib/cjs/services/TimelockService/TimelockService.js +2 -2
  106. package/lib/cjs/services/TimelockService/TimelockServiceFallbackSafe.js +2 -2
  107. package/lib/cjs/solidity/SlotsDump.js +1 -1
  108. package/lib/cjs/solidity/SlotsDump.js.map +1 -1
  109. package/lib/cjs/solidity/SlotsParser/MappingSettersResolver.js +3 -3
  110. package/lib/cjs/solidity/SlotsParser/MappingSettersResolver.js.map +1 -1
  111. package/lib/cjs/solidity/SlotsParser/SourceFile.js +3 -3
  112. package/lib/cjs/solidity/SlotsParser/SourceFile.js.map +1 -1
  113. package/lib/cjs/solidity/SolidityParser.js +1 -1
  114. package/lib/cjs/solidity/SolidityParser.js.map +1 -1
  115. package/lib/cjs/solidity/SourceCodeProvider.js +1 -1
  116. package/lib/cjs/solidity/SourceCodeProvider.js.map +1 -1
  117. package/lib/cjs/solidity/storage/Accessor.js +1 -1
  118. package/lib/cjs/solidity/storage/Accessor.js.map +1 -1
  119. package/lib/cjs/solidity/storage/SlotFixedArray.js +1 -1
  120. package/lib/cjs/solidity/storage/SlotFixedArray.js.map +1 -1
  121. package/lib/cjs/solidity/storage/SlotsStorageTransport.js +3 -3
  122. package/lib/cjs/solidity/storage/SlotsStorageTransport.js.map +1 -1
  123. package/lib/cjs/solidity/storage/handlers/SlotBytesHandler.js +1 -1
  124. package/lib/cjs/solidity/storage/handlers/SlotBytesHandler.js.map +1 -1
  125. package/lib/cjs/solidity/storage/handlers/SlotDynamicArrayHandler.js +1 -1
  126. package/lib/cjs/solidity/storage/handlers/SlotDynamicArrayHandler.js.map +1 -1
  127. package/lib/cjs/solidity/storage/handlers/SlotFixedArrayHandler.js +1 -1
  128. package/lib/cjs/solidity/storage/handlers/SlotFixedArrayHandler.js.map +1 -1
  129. package/lib/cjs/solidity/storage/handlers/SlotValueConstantHandler.js +1 -1
  130. package/lib/cjs/solidity/storage/handlers/SlotValueConstantHandler.js.map +1 -1
  131. package/lib/cjs/solidity/storage/handlers/SlotValueHandler.js +1 -1
  132. package/lib/cjs/solidity/storage/handlers/SlotValueHandler.js.map +1 -1
  133. package/lib/cjs/solidity/storage/handlers/SlotValueImmutableHandler.js +4 -4
  134. package/lib/cjs/solidity/storage/handlers/SlotValueImmutableHandler.js.map +1 -1
  135. package/lib/cjs/tokens/TokenDataProvider.js +2 -2
  136. package/lib/cjs/tokens/TokenDataProvider.js.map +1 -1
  137. package/lib/cjs/tokens/TokenExchangeService.js +1 -1
  138. package/lib/cjs/tokens/TokenExchangeService.js.map +1 -1
  139. package/lib/cjs/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js +2 -2
  140. package/lib/cjs/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js.map +1 -1
  141. package/lib/cjs/tokens/TokenExchanges/AmmV2PriceQuote.js +2 -2
  142. package/lib/cjs/tokens/TokenExchanges/AmmV2PriceQuote.js.map +1 -1
  143. package/lib/cjs/tokens/TokenOracles/amm/AmmV1Oracle.js +2 -2
  144. package/lib/cjs/tokens/TokenOracles/amm/AmmV1Oracle.js.map +1 -1
  145. package/lib/cjs/tokens/TokenTransferService.js +2 -2
  146. package/lib/cjs/tokens/TokenTransferService.js.map +1 -1
  147. package/lib/cjs/tokens/TokensService.js +1 -1
  148. package/lib/cjs/tokens/TokensService.js.map +1 -1
  149. package/lib/cjs/txs/TxNonceManager.js +1 -1
  150. package/lib/cjs/txs/TxWriter.js +9 -0
  151. package/lib/cjs/txs/TxWriter.js.map +1 -1
  152. package/lib/cjs/txs/conditional/GasWatcherTx.js +1 -1
  153. package/lib/cjs/txs/conditional/GasWatcherTx.js.map +1 -1
  154. package/lib/cjs/txs/receipt/TxLogParser.js +1 -1
  155. package/lib/cjs/utils/$crypto.js +1 -1
  156. package/lib/cjs/utils/$crypto.js.map +1 -1
  157. package/lib/cjs/utils/$date.js +1 -1
  158. package/lib/cjs/utils/$date.js.map +1 -1
  159. package/lib/cjs/utils/$hex.js +1 -1
  160. package/lib/cjs/utils/$logger.js +1 -1
  161. package/lib/cjs/utils/$logger.js.map +1 -1
  162. package/lib/cjs/utils/$machine.js +2 -2
  163. package/lib/cjs/utils/$machine.js.map +1 -1
  164. package/lib/cjs/utils/$require.js.map +1 -1
  165. package/lib/cjs/utils/$traces.js +1 -1
  166. package/lib/cjs/utils/$traces.js.map +1 -1
  167. package/lib/esm/abi/$abiCoder.js.map +1 -1
  168. package/lib/esm/abi/$abiCoder.mjs +1 -1
  169. package/lib/esm/abi/Logger.mjs +1 -1
  170. package/lib/esm/abi/abi-coder-packed.mjs +3 -3
  171. package/lib/esm/abi/abi-coder.mjs +16 -16
  172. package/lib/esm/abi/coders/abstract-coder.js.map +1 -1
  173. package/lib/esm/abi/coders/abstract-coder.mjs +31 -31
  174. package/lib/esm/abi/fragments.js.map +1 -1
  175. package/lib/esm/abi/fragments.mjs +90 -90
  176. package/lib/esm/blocks/BlockDateResolver.js.map +1 -1
  177. package/lib/esm/blocks/BlockDateResolver.mjs +9 -9
  178. package/lib/esm/class/PackedRanges.js.map +1 -1
  179. package/lib/esm/class/PackedRanges.mjs +46 -46
  180. package/lib/esm/clients/ClientEventsStream.js.map +1 -1
  181. package/lib/esm/clients/ClientEventsStream.mjs +1 -1
  182. package/lib/esm/clients/ClientPool.js.map +1 -1
  183. package/lib/esm/clients/ClientPool.mjs +23 -23
  184. package/lib/esm/clients/WalletClient.js.map +1 -1
  185. package/lib/esm/clients/WalletClient.mjs +3 -3
  186. package/lib/esm/clients/Web3Client.js.map +1 -1
  187. package/lib/esm/clients/Web3Client.mjs +14 -14
  188. package/lib/esm/clients/Web3ClientFactory.js.map +1 -1
  189. package/lib/esm/clients/Web3ClientFactory.mjs +1 -1
  190. package/lib/esm/clients/compatibility/Web3.js.map +1 -1
  191. package/lib/esm/clients/compatibility/Web3.mjs +2 -2
  192. package/lib/esm/clients/handlers/RateLimitGuard.js.map +1 -1
  193. package/lib/esm/clients/handlers/RateLimitGuard.mjs +16 -16
  194. package/lib/esm/clients/model/PromiEventWrap.js.map +1 -1
  195. package/lib/esm/clients/model/PromiEventWrap.mjs +1 -1
  196. package/lib/esm/clients/utils/$web3Abi.js.map +1 -1
  197. package/lib/esm/clients/utils/$web3Abi.mjs +2 -2
  198. package/lib/esm/clients/utils/ClientErrorUtil.js.map +1 -1
  199. package/lib/esm/clients/utils/ClientErrorUtil.mjs +4 -0
  200. package/lib/esm/config/Config.js.map +1 -1
  201. package/lib/esm/contracts/Contract.js.map +1 -1
  202. package/lib/esm/contracts/Contract.mjs +1 -1
  203. package/lib/esm/contracts/ContractAbiProvider.js.map +1 -1
  204. package/lib/esm/contracts/ContractAbiProvider.mjs +6 -6
  205. package/lib/esm/contracts/ContractBase.js.map +1 -1
  206. package/lib/esm/contracts/ContractBase.mjs +10 -10
  207. package/lib/esm/contracts/ContractProvider.js.map +1 -1
  208. package/lib/esm/contracts/ContractProvider.mjs +1 -1
  209. package/lib/esm/contracts/ContractReader.js.map +1 -1
  210. package/lib/esm/contracts/ContractReader.mjs +5 -5
  211. package/lib/esm/contracts/ContractWriter.js.map +1 -1
  212. package/lib/esm/contracts/ContractWriter.mjs +4 -4
  213. package/lib/esm/contracts/deploy/ContractDeployer.js.map +1 -1
  214. package/lib/esm/contracts/deploy/ContractDeployer.mjs +4 -4
  215. package/lib/esm/contracts/deploy/Deployments.js.map +1 -1
  216. package/lib/esm/contracts/deploy/Deployments.mjs +36 -21
  217. package/lib/esm/contracts/deploy/proxy/$proxyDeploy.js.map +1 -1
  218. package/lib/esm/contracts/deploy/proxy/$proxyDeploy.mjs +13 -13
  219. package/lib/esm/contracts/deploy/proxy/ProxyDeployment.js.map +1 -1
  220. package/lib/esm/contracts/deploy/proxy/ProxyDeployment.mjs +22 -22
  221. package/lib/esm/contracts/deploy/storage/DeploymentsStorage.js.map +1 -1
  222. package/lib/esm/contracts/deploy/storage/DeploymentsStorage.mjs +15 -14
  223. package/lib/esm/contracts/utils/AbiDeserializer.js.map +1 -1
  224. package/lib/esm/contracts/utils/AbiDeserializer.mjs +4 -4
  225. package/lib/esm/contracts/utils/ContractBaseUtils.js.map +1 -1
  226. package/lib/esm/contracts/utils/ContractBaseUtils.mjs +3 -3
  227. package/lib/esm/evm/OpcodesWalker.js.map +1 -1
  228. package/lib/esm/evm/OpcodesWalker.mjs +1 -1
  229. package/lib/esm/explorer/BlockchainExplorer.js.map +1 -1
  230. package/lib/esm/explorer/BlockchainExplorer.mjs +1 -1
  231. package/lib/esm/explorer/BlockchainExplorerFactory.mjs +1 -1
  232. package/lib/esm/explorer/BlockchainExplorerStorage.js.map +1 -1
  233. package/lib/esm/explorer/BlockchainExplorerStorage.mjs +12 -12
  234. package/lib/esm/explorer/Evmscan.mjs +1 -1
  235. package/lib/esm/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
  236. package/lib/esm/explorer/verifiers/FsHtmlVerifier.mjs +7 -7
  237. package/lib/esm/flashbots/FlashbotWeb3Client.js.map +1 -1
  238. package/lib/esm/flashbots/FlashbotWeb3Client.mjs +1 -1
  239. package/lib/esm/hardhat/HardhatProvider.js.map +1 -1
  240. package/lib/esm/hardhat/HardhatProvider.mjs +7 -7
  241. package/lib/esm/indexer/BlocksTxIndexer.js.map +1 -1
  242. package/lib/esm/indexer/BlocksTxIndexer.mjs +2 -2
  243. package/lib/esm/indexer/EventsIndexer.js.map +1 -1
  244. package/lib/esm/indexer/EventsIndexer.mjs +11 -11
  245. package/lib/esm/indexer/PendingTxIndexer.js.map +1 -1
  246. package/lib/esm/indexer/PendingTxIndexer.mjs +2 -2
  247. package/lib/esm/indexer/handlers/BlocksWalker.js.map +1 -1
  248. package/lib/esm/indexer/handlers/BlocksWalker.mjs +9 -9
  249. package/lib/esm/indexer/handlers/TxQueueLoader.mjs +1 -1
  250. package/lib/esm/indexer/storage/FsEventsIndexerStore.js.map +1 -1
  251. package/lib/esm/indexer/storage/FsEventsIndexerStore.mjs +3 -3
  252. package/lib/esm/indexer/storage/FsEventsStoreUtils.js.map +1 -1
  253. package/lib/esm/indexer/storage/FsEventsStoreUtils.mjs +1 -1
  254. package/lib/esm/json/JsonArrayMultiStore.js.map +1 -1
  255. package/lib/esm/json/JsonArrayMultiStore.mjs +1 -1
  256. package/lib/esm/json/JsonStoreFs.js.map +1 -1
  257. package/lib/esm/json/JsonStoreFs.mjs +1 -1
  258. package/lib/esm/rpc/$rpc.js.map +1 -1
  259. package/lib/esm/rpc/$rpc.mjs +2 -2
  260. package/lib/esm/rpc/Rpc.mjs +2 -2
  261. package/lib/esm/rpc/RpcBase.js.map +1 -1
  262. package/lib/esm/rpc/RpcBase.mjs +2 -2
  263. package/lib/esm/rpc/RpcContract.js.map +1 -1
  264. package/lib/esm/rpc/RpcContract.mjs +4 -3
  265. package/lib/esm/rpc/RpcSubscription.js.map +1 -1
  266. package/lib/esm/rpc/RpcSubscription.mjs +1 -1
  267. package/lib/esm/rpc/transports/compatibility/EIP1193Transport.js.map +1 -1
  268. package/lib/esm/rpc/transports/compatibility/EIP1193Transport.mjs +4 -4
  269. package/lib/esm/rpc/transports/compatibility/Web3Transport.js.map +1 -1
  270. package/lib/esm/rpc/transports/compatibility/Web3Transport.mjs +1 -1
  271. package/lib/esm/services/TimelockService/TimelockService.mjs +2 -2
  272. package/lib/esm/services/TimelockService/TimelockServiceFallbackSafe.mjs +2 -2
  273. package/lib/esm/solidity/SlotsDump.js.map +1 -1
  274. package/lib/esm/solidity/SlotsDump.mjs +1 -1
  275. package/lib/esm/solidity/SlotsParser/MappingSettersResolver.js.map +1 -1
  276. package/lib/esm/solidity/SlotsParser/MappingSettersResolver.mjs +3 -3
  277. package/lib/esm/solidity/SlotsParser/SourceFile.js.map +1 -1
  278. package/lib/esm/solidity/SlotsParser/SourceFile.mjs +3 -3
  279. package/lib/esm/solidity/SolidityParser.js.map +1 -1
  280. package/lib/esm/solidity/SolidityParser.mjs +1 -1
  281. package/lib/esm/solidity/SourceCodeProvider.js.map +1 -1
  282. package/lib/esm/solidity/SourceCodeProvider.mjs +1 -1
  283. package/lib/esm/solidity/storage/Accessor.js.map +1 -1
  284. package/lib/esm/solidity/storage/Accessor.mjs +1 -1
  285. package/lib/esm/solidity/storage/SlotFixedArray.js.map +1 -1
  286. package/lib/esm/solidity/storage/SlotFixedArray.mjs +1 -1
  287. package/lib/esm/solidity/storage/SlotsStorageTransport.js.map +1 -1
  288. package/lib/esm/solidity/storage/SlotsStorageTransport.mjs +3 -3
  289. package/lib/esm/solidity/storage/handlers/SlotBytesHandler.js.map +1 -1
  290. package/lib/esm/solidity/storage/handlers/SlotBytesHandler.mjs +1 -1
  291. package/lib/esm/solidity/storage/handlers/SlotDynamicArrayHandler.js.map +1 -1
  292. package/lib/esm/solidity/storage/handlers/SlotDynamicArrayHandler.mjs +1 -1
  293. package/lib/esm/solidity/storage/handlers/SlotFixedArrayHandler.js.map +1 -1
  294. package/lib/esm/solidity/storage/handlers/SlotFixedArrayHandler.mjs +1 -1
  295. package/lib/esm/solidity/storage/handlers/SlotValueConstantHandler.js.map +1 -1
  296. package/lib/esm/solidity/storage/handlers/SlotValueConstantHandler.mjs +1 -1
  297. package/lib/esm/solidity/storage/handlers/SlotValueHandler.js.map +1 -1
  298. package/lib/esm/solidity/storage/handlers/SlotValueHandler.mjs +1 -1
  299. package/lib/esm/solidity/storage/handlers/SlotValueImmutableHandler.js.map +1 -1
  300. package/lib/esm/solidity/storage/handlers/SlotValueImmutableHandler.mjs +4 -4
  301. package/lib/esm/tokens/TokenDataProvider.js.map +1 -1
  302. package/lib/esm/tokens/TokenDataProvider.mjs +2 -2
  303. package/lib/esm/tokens/TokenExchangeService.js.map +1 -1
  304. package/lib/esm/tokens/TokenExchangeService.mjs +1 -1
  305. package/lib/esm/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js.map +1 -1
  306. package/lib/esm/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.mjs +2 -2
  307. package/lib/esm/tokens/TokenExchanges/AmmV2PriceQuote.js.map +1 -1
  308. package/lib/esm/tokens/TokenExchanges/AmmV2PriceQuote.mjs +2 -2
  309. package/lib/esm/tokens/TokenOracles/amm/AmmV1Oracle.js.map +1 -1
  310. package/lib/esm/tokens/TokenOracles/amm/AmmV1Oracle.mjs +2 -2
  311. package/lib/esm/tokens/TokenTransferService.js.map +1 -1
  312. package/lib/esm/tokens/TokenTransferService.mjs +2 -2
  313. package/lib/esm/tokens/TokensService.js.map +1 -1
  314. package/lib/esm/tokens/TokensService.mjs +1 -1
  315. package/lib/esm/txs/TxNonceManager.mjs +1 -1
  316. package/lib/esm/txs/TxWriter.js.map +1 -1
  317. package/lib/esm/txs/TxWriter.mjs +9 -0
  318. package/lib/esm/txs/conditional/GasWatcherTx.js.map +1 -1
  319. package/lib/esm/txs/conditional/GasWatcherTx.mjs +1 -1
  320. package/lib/esm/txs/receipt/TxLogParser.mjs +1 -1
  321. package/lib/esm/utils/$crypto.js.map +1 -1
  322. package/lib/esm/utils/$crypto.mjs +1 -1
  323. package/lib/esm/utils/$date.js.map +1 -1
  324. package/lib/esm/utils/$date.mjs +1 -1
  325. package/lib/esm/utils/$hex.mjs +1 -1
  326. package/lib/esm/utils/$logger.js.map +1 -1
  327. package/lib/esm/utils/$logger.mjs +1 -1
  328. package/lib/esm/utils/$machine.js.map +1 -1
  329. package/lib/esm/utils/$machine.mjs +2 -2
  330. package/lib/esm/utils/$require.js.map +1 -1
  331. package/lib/esm/utils/$traces.js.map +1 -1
  332. package/lib/esm/utils/$traces.mjs +1 -1
  333. package/lib/types/abi/abi-coder-packed.d.ts +1 -1
  334. package/lib/types/abi/abi-coder.d.ts +13 -13
  335. package/lib/types/abi/coders/abstract-coder.d.ts +14 -14
  336. package/lib/types/abi/fragments.d.ts +95 -95
  337. package/lib/types/blocks/BlockDateResolver.d.ts +7 -7
  338. package/lib/types/class/PackedRanges.d.ts +44 -44
  339. package/lib/types/clients/ClientPool.d.ts +10 -10
  340. package/lib/types/clients/WalletClient.d.ts +2 -2
  341. package/lib/types/clients/Web3Client.d.ts +6 -6
  342. package/lib/types/clients/Web3ClientFactory.d.ts +1 -1
  343. package/lib/types/clients/handlers/RateLimitGuard.d.ts +5 -5
  344. package/lib/types/clients/model/PromiEventWrap.d.ts +1 -1
  345. package/lib/types/clients/utils/$web3Abi.d.ts +1 -1
  346. package/lib/types/clients/utils/ClientErrorUtil.d.ts +1 -0
  347. package/lib/types/config/Config.d.ts +3 -2
  348. package/lib/types/contracts/ContractBase.d.ts +4 -4
  349. package/lib/types/contracts/ContractReader.d.ts +2 -2
  350. package/lib/types/contracts/ContractWriter.d.ts +3 -3
  351. package/lib/types/contracts/deploy/Deployments.d.ts +13 -14
  352. package/lib/types/contracts/deploy/storage/DeploymentsStorage.d.ts +2 -0
  353. package/lib/types/explorer/BlockchainExplorerFactory.d.ts +1 -1
  354. package/lib/types/explorer/Evmscan.d.ts +1 -1
  355. package/lib/types/indexer/BlocksTxIndexer.d.ts +4 -4
  356. package/lib/types/indexer/EventsIndexer.d.ts +4 -4
  357. package/lib/types/indexer/PendingTxIndexer.d.ts +1 -1
  358. package/lib/types/indexer/handlers/BlocksWalker.d.ts +2 -2
  359. package/lib/types/indexer/storage/FsEventsIndexerStore.d.ts +4 -4
  360. package/lib/types/ns/providers/INsProvider.d.ts +1 -1
  361. package/lib/types/rpc/Rpc.d.ts +2 -2
  362. package/lib/types/services/TimelockService/ITimelockService.d.ts +2 -2
  363. package/lib/types/services/TimelockService/TimelockService.d.ts +2 -2
  364. package/lib/types/services/TimelockService/TimelockServiceFallbackSafe.d.ts +2 -2
  365. package/lib/types/solidity/SlotsParser/SourceFile.d.ts +1 -1
  366. package/lib/types/solidity/storage/SlotFixedArray.d.ts +1 -1
  367. package/lib/types/tokens/TokenDataProvider.d.ts +2 -2
  368. package/lib/types/tokens/TokensService.d.ts +1 -1
  369. package/lib/types/txs/ITxBuilderOptions.d.ts +1 -1
  370. package/lib/types/txs/TxNonceManager.d.ts +1 -1
  371. package/lib/types/txs/TxWriter.d.ts +4 -4
  372. package/lib/types/txs/receipt/TxLogParser.d.ts +1 -1
  373. package/lib/types/utils/$date.d.ts +1 -1
  374. package/lib/types/utils/$hex.d.ts +1 -1
  375. package/lib/types/utils/$require.d.ts +8 -8
  376. package/package.json +1 -1
  377. package/readme.md +105 -83
  378. package/src/abi/$abiCoder.ts +1 -1
  379. package/src/abi/Logger.ts +1 -1
  380. package/src/abi/abi-coder-packed.ts +3 -3
  381. package/src/abi/abi-coder.ts +16 -16
  382. package/src/abi/coders/abstract-coder.ts +36 -36
  383. package/src/abi/fragments.ts +137 -137
  384. package/src/blocks/BlockDateResolver.ts +9 -9
  385. package/src/bridges/hop/HopBridge.ts +1 -1
  386. package/src/class/PackedRanges.ts +46 -46
  387. package/src/clients/ClientEventsStream.ts +1 -1
  388. package/src/clients/ClientPool.ts +38 -38
  389. package/src/clients/WalletClient.ts +3 -3
  390. package/src/clients/Web3BatchRequests.ts +3 -3
  391. package/src/clients/Web3Client.ts +21 -21
  392. package/src/clients/Web3ClientFactory.ts +1 -1
  393. package/src/clients/compatibility/Web3.ts +2 -2
  394. package/src/clients/handlers/RateLimitGuard.ts +16 -16
  395. package/src/clients/interfaces/IWeb3Client.ts +2 -2
  396. package/src/clients/model/PromiEventWrap.ts +1 -1
  397. package/src/clients/utils/$web3Abi.ts +2 -2
  398. package/src/clients/utils/ClientErrorUtil.ts +4 -0
  399. package/src/config/Config.ts +4 -3
  400. package/src/contracts/Contract.ts +1 -1
  401. package/src/contracts/ContractAbiProvider.ts +6 -6
  402. package/src/contracts/ContractBase.ts +14 -14
  403. package/src/contracts/ContractProvider.ts +1 -1
  404. package/src/contracts/ContractReader.ts +7 -7
  405. package/src/contracts/ContractWriter.ts +4 -4
  406. package/src/contracts/deploy/ContractDeployer.ts +4 -4
  407. package/src/contracts/deploy/ContractDeployment.ts +1 -1
  408. package/src/contracts/deploy/Deployments.ts +69 -56
  409. package/src/contracts/deploy/proxy/$proxyDeploy.ts +14 -14
  410. package/src/contracts/deploy/proxy/ProxyDeployment.ts +22 -22
  411. package/src/contracts/deploy/storage/DeploymentsStorage.ts +21 -18
  412. package/src/contracts/utils/AbiDeserializer.ts +4 -4
  413. package/src/contracts/utils/ContractBaseUtils.ts +3 -3
  414. package/src/erc4337/models/UserOperation.ts +2 -2
  415. package/src/evm/OpcodesWalker.ts +1 -1
  416. package/src/explorer/BlockchainExplorer.ts +1 -1
  417. package/src/explorer/BlockchainExplorerFactory.ts +1 -1
  418. package/src/explorer/BlockchainExplorerStorage.ts +12 -12
  419. package/src/explorer/Evmscan.ts +1 -1
  420. package/src/explorer/verifiers/FsHtmlVerifier.ts +7 -7
  421. package/src/flashbots/FlashbotWeb3Client.ts +1 -1
  422. package/src/hardhat/HardhatProvider.ts +7 -7
  423. package/src/indexer/BlocksTxIndexer.ts +6 -6
  424. package/src/indexer/EventsIndexer.ts +20 -20
  425. package/src/indexer/PendingTxIndexer.ts +3 -3
  426. package/src/indexer/handlers/BlocksWalker.ts +9 -9
  427. package/src/indexer/handlers/TxQueueLoader.ts +1 -1
  428. package/src/indexer/storage/FsEventsIndexerStore.ts +9 -9
  429. package/src/indexer/storage/FsEventsMetaStore.ts +1 -1
  430. package/src/indexer/storage/FsEventsStoreUtils.ts +1 -1
  431. package/src/json/JsonArrayMultiStore.ts +1 -1
  432. package/src/json/JsonStoreFs.ts +1 -1
  433. package/src/ns/providers/INsProvider.ts +1 -1
  434. package/src/rpc/$rpc.ts +2 -2
  435. package/src/rpc/Rpc.ts +2 -2
  436. package/src/rpc/RpcBase.ts +2 -2
  437. package/src/rpc/RpcContract.ts +6 -6
  438. package/src/rpc/RpcSubscription.ts +1 -1
  439. package/src/rpc/transports/compatibility/EIP1193Transport.ts +4 -4
  440. package/src/rpc/transports/compatibility/Web3Transport.ts +1 -1
  441. package/src/services/TimelockService/ITimelockService.ts +2 -2
  442. package/src/services/TimelockService/TimelockService.ts +2 -2
  443. package/src/services/TimelockService/TimelockServiceFallbackSafe.ts +2 -2
  444. package/src/solidity/SlotsDump.ts +1 -1
  445. package/src/solidity/SlotsParser/MappingSettersResolver.ts +3 -3
  446. package/src/solidity/SlotsParser/SourceFile.ts +3 -3
  447. package/src/solidity/SolidityParser.ts +1 -1
  448. package/src/solidity/SourceCodeProvider.ts +1 -1
  449. package/src/solidity/storage/Accessor.spec.ts +1 -1
  450. package/src/solidity/storage/Accessor.ts +1 -1
  451. package/src/solidity/storage/SlotDynamicArray.ts +1 -1
  452. package/src/solidity/storage/SlotFixedArray.ts +1 -1
  453. package/src/solidity/storage/SlotsStorageTransport.ts +3 -3
  454. package/src/solidity/storage/handlers/SlotBytesHandler.ts +1 -1
  455. package/src/solidity/storage/handlers/SlotDynamicArrayHandler.ts +1 -1
  456. package/src/solidity/storage/handlers/SlotFixedArrayHandler.ts +1 -1
  457. package/src/solidity/storage/handlers/SlotValueConstantHandler.ts +1 -1
  458. package/src/solidity/storage/handlers/SlotValueHandler.ts +1 -1
  459. package/src/solidity/storage/handlers/SlotValueImmutableHandler.ts +4 -4
  460. package/src/tokens/TokenDataProvider.ts +2 -2
  461. package/src/tokens/TokenExchangeService.ts +1 -1
  462. package/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.ts +2 -2
  463. package/src/tokens/TokenExchanges/AmmV2PriceQuote.ts +2 -2
  464. package/src/tokens/TokenOracles/amm/AmmV1Oracle.ts +2 -2
  465. package/src/tokens/TokenTransferService.ts +2 -2
  466. package/src/tokens/TokensService.ts +1 -1
  467. package/src/txs/ITxBuilderOptions.ts +1 -1
  468. package/src/txs/TxNonceManager.ts +1 -1
  469. package/src/txs/TxWriter.ts +15 -4
  470. package/src/txs/agents/BatchAgent.ts +1 -1
  471. package/src/txs/conditional/GasWatcherTx.ts +1 -1
  472. package/src/txs/receipt/TxLogParser.ts +1 -1
  473. package/src/utils/$crypto.ts +1 -1
  474. package/src/utils/$date.ts +1 -1
  475. package/src/utils/$hex.ts +1 -1
  476. package/src/utils/$logger.ts +1 -1
  477. package/src/utils/$machine.ts +2 -2
  478. package/src/utils/$require.ts +10 -10
  479. package/src/utils/$traces.ts +1 -1
  480. package/src/wallets/EIP6963ProviderFactory.ts +4 -4
@@ -53,9 +53,9 @@ export class ContractWriter implements IContractWriter {
53
53
  }
54
54
 
55
55
  /**
56
- * We split Tx sending in two awaitable steps
57
- * 1. This method prepares(gas, nonce, etc) - and sends the Tx
58
- * 2. With returned writer you can subscribe to events and/or wait for Tx to be mined
56
+ * We split transaction sending into two awaitable steps:
57
+ * 1. This method prepares gas, nonce, etc., and sends the transaction.
58
+ * 2. With the returned writer, you can subscribe to events and/or wait for the transaction to be mined.
59
59
  * @param account
60
60
  * @param interfaceAbi
61
61
  * @param params
@@ -74,7 +74,7 @@ export class ContractWriter implements IContractWriter {
74
74
  ): Promise<TxWriter> {
75
75
 
76
76
  $require.notNull(account, 'Account parameter is undefined.');
77
- $require.True(typeof account === 'object' || typeof account === 'string', `ContractWriter expect Account as the first parameter, got: ${ typeof account }`)
77
+ $require.True(typeof account === 'object' || typeof account === 'string', `ContractWriter expects Account as the first parameter, got: ${ typeof account }`)
78
78
 
79
79
  let value = typeof account !== 'string'
80
80
  ? account.value
@@ -87,10 +87,10 @@ export class ContractDeployer {
87
87
  let artifacts = ctx.artifacts ?? './artifacts/';
88
88
  let files = await $require.resolved(
89
89
  Directory.readFilesAsync(artifacts, '**.json'),
90
- `Artifact files not found for ${ctx.name}`
90
+ `Artifact files were not found for ${ctx.name}`
91
91
  );
92
92
  let file = files.find(x => x.uri.file === `${ctx.name}.json`);
93
- $require.notNull(file, `File for the contract ${ctx.name} not found within: \n ${ files.map(x => x.uri.toString()).join('\n') }`);
93
+ $require.notNull(file, `File for contract ${ctx.name} was not found in: \n ${ files.map(x => x.uri.toString()).join('\n') }`);
94
94
 
95
95
  return this.fromMetaFile ({
96
96
  ...ctx,
@@ -129,7 +129,7 @@ export class ContractDeployer {
129
129
  }
130
130
 
131
131
  private async fromMetaJson (ctx: TDeploymentByMetaJson) {
132
- $require.notNull(ctx.json?.bytecode, 'Contract bytecode is expected in json');
132
+ $require.notNull(ctx.json?.bytecode, 'Contract bytecode is expected in JSON');
133
133
  return this.fromBytecode({
134
134
  ...ctx,
135
135
  bytecode: ctx.json.bytecode,
@@ -139,7 +139,7 @@ export class ContractDeployer {
139
139
  }
140
140
 
141
141
  private async fromBytecode (ctx: TDeploymentWithBytecode) {
142
- $require.True($is.Hex(ctx.bytecode), `bytecode must be a hex string: ${ctx.bytecode}`);
142
+ $require.True($is.Hex(ctx.bytecode), `Bytecode must be a hex string: ${ctx.bytecode}`);
143
143
 
144
144
  let deployment = new ContractDeployment({
145
145
  client: this.client,
@@ -19,7 +19,7 @@ export class ContractDeployment {
19
19
  abi?: TAbiItem[]
20
20
  params?: any[]
21
21
  source?: {
22
- // JSON meta file
22
+ // JSON metadata file.
23
23
  path: string
24
24
  }
25
25
  }) {
@@ -27,27 +27,33 @@ import { DeploymentsStorage, IDeployment } from './storage/DeploymentsStorage';
27
27
  type TDeploymentOptions = {
28
28
  id?: string
29
29
 
30
- /** Will deploy the contract */
30
+ // For proxy deployments: redeploys the implementation if the bytecode has not changed but the immutable arguments have changed.
31
+ immutablesKey?: string
32
+
33
+ // Older deployments did not have immutablesKey, so any proxy implementation with immutable variables would trigger redeployment.
34
+ checkImmutables?: boolean
35
+
36
+ /** Deploys the contract. */
31
37
  force?: boolean
32
- /** Will check if local bytecode has changed and will deploy */
38
+ /** Checks whether the local bytecode has changed and deploys if needed. */
33
39
  latest?: boolean
34
40
 
35
41
  verification?: boolean | 'silent'
36
42
 
37
- // Will be used for verification process
43
+ // Used for the verification process.
38
44
  proxyFor?: TAddress
39
45
 
40
46
  deployment?: {
41
- // Pending deployment transaction will be re-checked
47
+ // Pending deployment transaction will be rechecked.
42
48
  tx?: TEth.Hex
43
- // When false, the implementation won't be updated in proxy
49
+ // When false, the implementation will not be updated in the proxy.
44
50
  upgradeProxy?: boolean
45
- // Owner, if differes from deployer
51
+ // Owner, if different from the deployer.
46
52
  owner?: TEth.IAccount
47
53
  }
48
54
  }
49
55
  type TVerificationOptions = TDeploymentOptions & {
50
- // otherwise will be fetched from the deployment TX
56
+ // Otherwise, this will be fetched from the deployment transaction.
51
57
  constructorParams?: any[]
52
58
  }
53
59
 
@@ -79,7 +85,7 @@ export class Deployments {
79
85
  Proxy?: Constructor<ContractBase>,
80
86
  ProxyAdmin?: Constructor<IProxyAdmin>
81
87
  directory?: string
82
- // Will be part of the deployments filename
88
+ // Part of the deployments filename.
83
89
  name?: string
84
90
  // TPlatform of a forked network
85
91
  fork?: string
@@ -134,7 +140,7 @@ export class Deployments {
134
140
  }): Promise<T> {
135
141
  let contract = await this.getOrNull(Ctor, opts);
136
142
  if (contract == null) {
137
- throw new Error(`Deployment ${Ctor.name} ${opts?.id ?? ''} not found in ${this.client.platform} [${this.store.opts?.name ?? this.store.opts?.directory ?? ''}]`);
143
+ throw new Error(`Deployment ${Ctor.name} ${opts?.id ?? ''} was not found in ${this.client.platform} [${this.store.opts?.name ?? this.store.opts?.directory ?? ''}]`);
138
144
  }
139
145
  return contract;
140
146
  }
@@ -160,7 +166,7 @@ export class Deployments {
160
166
  }
161
167
 
162
168
  /**
163
- * Get the deployment for Ctor, but returns the CtorWrapped instance. Useful for proxies, etc.
169
+ * Gets the deployment for Ctor, but returns the CtorWrapped instance. Useful for proxies, etc.
164
170
  * e.g. deployments.getAs(SomeProxy, SomeImplementation);
165
171
  */
166
172
  async getAs<TDeployed extends ContractBase, TWrapped extends ContractBase>(Ctor: Constructor<TDeployed>, CtorWrapped: Constructor<TWrapped>, opts?: {
@@ -181,7 +187,7 @@ export class Deployments {
181
187
  let deployment = await this.store.getDeploymentInfo('', {
182
188
  id: params.id
183
189
  });
184
- $require.notNull(deployment, `Deployment for ${params.id} not found`);
190
+ $require.notNull(deployment, `Deployment for ${params.id} was not found`);
185
191
  await this.ensureVerification(params.Ctor, deployment, {
186
192
  id: params.id,
187
193
  constructorParams: params.constructorParams,
@@ -215,8 +221,14 @@ export class Deployments {
215
221
  ? (this.client.platform === 'hardhat' || this.opts?.checkBytecode !== false)
216
222
  : (opts.latest);
217
223
 
218
- if (opts.force !== true && requireLatest !== true) {
219
- // return already deployed contract
224
+ /** For backward compatibility:
225
+ * For older deployments, the deployer should set this if immutablesKey is not present in the deployed state. */
226
+ let hasNewImmutables = opts.checkImmutables === true
227
+ ? Boolean(currentDeployment.immutablesKey != opts.immutablesKey)
228
+ : Boolean(currentDeployment.immutablesKey && currentDeployment.immutablesKey != opts.immutablesKey);
229
+
230
+ if (opts.force !== true && requireLatest !== true && hasNewImmutables !== true) {
231
+ // Return the already deployed contract.
220
232
  $contract.store.register(contract as any);
221
233
  return {
222
234
  contract,
@@ -224,9 +236,9 @@ export class Deployments {
224
236
  };
225
237
  }
226
238
  if (requireLatest === true && opts.force !== true) {
227
- // was already deployed. Check new bytecode hash
239
+ // The contract was already deployed. Check the new bytecode hash.
228
240
  let isSame = await this.isSameBytecode(Ctor, currentDeployment);
229
- if (isSame) {
241
+ if (isSame && hasNewImmutables !== true) {
230
242
  $contract.store.register(contract as any);
231
243
  return {
232
244
  contract,
@@ -250,7 +262,7 @@ export class Deployments {
250
262
 
251
263
 
252
264
 
253
- // Lets deploy the contract, new, forced, or latest
265
+ // Deploy the contract: new, forced, or latest.
254
266
 
255
267
  let constructorArgs = opts.arguments ?? [];
256
268
  let id = opts.id ?? Ctor.name;
@@ -270,6 +282,7 @@ export class Deployments {
270
282
  let deployment = await this.store.saveDeployment(deployedContract, {
271
283
  id,
272
284
  name: Ctor.name,
285
+ immutablesKey: opts.immutablesKey,
273
286
  bytecodeHash: this.getBytecodeHash(deployedBytecode)
274
287
  }, receipt);
275
288
 
@@ -285,14 +298,11 @@ export class Deployments {
285
298
  };
286
299
  }
287
300
 
288
- async ensureWithProxy<
289
- T extends (TContract & TInitializers<TInit>),
290
- TInit extends TFunction
291
- >(
301
+ async ensureWithProxy<T extends TContract>(
292
302
  CtorImpl: Constructor<T>,
293
303
  opts?: TConstructorArgs<T> & TDeploymentOptions & TInitializerParams<T>
294
304
  ): Promise<{
295
- // the Implementation Contract with the address set to Proxy
305
+ // The implementation contract with the address set to the proxy.
296
306
  contract: T
297
307
  contractReceipt?: TEth.TxReceipt
298
308
  contractProxy: IProxy,
@@ -304,6 +314,7 @@ export class Deployments {
304
314
 
305
315
  let id = opts?.id ?? getImplementationId(CtorImpl);
306
316
  let proxyId = `${id}Proxy`;
317
+ let immutablesKey = getImmutablesKey(opts?.arguments);
307
318
 
308
319
  let {
309
320
  contract: contractImpl,
@@ -312,6 +323,7 @@ export class Deployments {
312
323
  } = await this.ensure(CtorImpl, {
313
324
  arguments: opts?.arguments as any,
314
325
  id: id,
326
+ immutablesKey,
315
327
  force: opts?.force,
316
328
  latest: this.opts?.checkBytecode !== false,
317
329
  verification: opts?.verification,
@@ -342,7 +354,7 @@ export class Deployments {
342
354
  })
343
355
 
344
356
  if (contractImplDeployment.implementation == null) {
345
- // Set the Proxy contract as the main Address
357
+ // Set the proxy contract as the main address.
346
358
  contractImplDeployment.implementation = contractImplDeployment.address;
347
359
  contractImplDeployment.address = contractProxy.address;
348
360
 
@@ -364,7 +376,7 @@ export class Deployments {
364
376
  }
365
377
 
366
378
  /**
367
- * Deploys the Beacon contract. Implementation is the target contract (can be a proxy or normal contract)
379
+ * Deploys the Beacon contract. The implementation is the target contract (can be a proxy or normal contract).
368
380
  * https://docs.openzeppelin.com/contracts/5.x/api/proxy#beacon
369
381
  **/
370
382
  async ensureWithBeacon<
@@ -378,7 +390,7 @@ export class Deployments {
378
390
  initialize?: ParametersFromSecond<T['initialize']>
379
391
  }
380
392
  ): Promise<{
381
- // the Implementation Contract with the address set to Beacon Proxy
393
+ // The implementation contract with the address set to the Beacon proxy.
382
394
  contract: T
383
395
  contractReceipt?: TEth.TxReceipt
384
396
  contractDeployment: IDeployment
@@ -389,7 +401,7 @@ export class Deployments {
389
401
  contractBeaconProxyDeployment: IDeployment
390
402
  }> {
391
403
 
392
- $require.notEmpty(opts?.id, `ID is required for Beacon deployment, as Implementation apparently will get multiple Beacons`);
404
+ $require.notEmpty(opts?.id, `ID is required for Beacon deployment, as the implementation can have multiple Beacons`);
393
405
 
394
406
  let beaconProxyId = opts.id;
395
407
  let implId = beaconProxyId.includes('/')
@@ -426,7 +438,7 @@ export class Deployments {
426
438
  implementation: {
427
439
  address: implementationAddress,
428
440
  initData: data,
429
- // @TODO implement migrations for Beacons
441
+ // @TODO Implement migrations for Beacons.
430
442
  migrationData: null
431
443
  }
432
444
  });
@@ -462,7 +474,7 @@ export class Deployments {
462
474
  return true;
463
475
  }
464
476
 
465
- // recheck v1
477
+ // Recheck v1.
466
478
  if (deployment.bytecodeHash != null) {
467
479
  let address = deployment.implementation ?? deployment.address;
468
480
  let bytecode = await this.client.getCode(address);
@@ -480,8 +492,8 @@ export class Deployments {
480
492
  let [ localDiff, onchainDiff ] = Str.getDifference(bytecodeLocal, bytecodeOnchain);
481
493
  if (localDiff === '' || /^0+$/.test(localDiff)) {
482
494
  this._logger.log(`${deployment.id} bytecode has only immutable data diff, assume unchanged`);
483
- // Local deployedBytecode doesn't contain the immutable data
484
- // instead the solc generates the bytecode with 0 as the placeholder
495
+ // Local deployedBytecode does not contain immutable data.
496
+ // Instead, solc generates bytecode with 0 as the placeholder.
485
497
  return true;
486
498
  }
487
499
  }
@@ -558,19 +570,19 @@ export class Deployments {
558
570
 
559
571
 
560
572
  /**
561
- * A simple method to configure the contracts state
573
+ * A simple method to configure contract state.
562
574
  */
563
575
  public async configure<T extends TContract, TValue>(Ctor: Constructor<T> | T, opts: {
564
576
  id?: string;
565
577
 
566
- // Latest value, if differs from current, the updater will be executed
578
+ // Latest value. If it differs from current, the updater will be executed.
567
579
  value?: TValue
568
580
  // Current value.
569
581
  current?: TValue | Promise<TValue> | ((x: T) => Promise<TValue>);
570
582
  shouldUpdate?: boolean | (() => boolean | Promise<boolean>)
571
583
  updater: (x: T, value: TValue) => Promise<any>
572
584
 
573
- // Will be logged with old and new value
585
+ // Logged with the old and new values.
574
586
  title?: string
575
587
  }) {
576
588
  let x: T;
@@ -612,27 +624,19 @@ export class Deployments {
612
624
  }
613
625
  }
614
626
 
615
-
616
- type TFunction = (...args: any[]) => any
617
- type TInitializerName = 'initialize' | `initializeV${number}`
618
- type TInitializers<TInit extends TFunction> = {
619
- [K in TInitializerName]?: TInit
620
- }
621
- type TInitializerParams<T extends TInitializers<TFunction>> = {
622
- initialize?: T['initialize'] extends TFunction
623
- ? ParametersFromSecond<T['initialize']>
624
- : never
625
- initializeV2?: T['initializeV2'] extends TFunction
626
- ? ParametersFromSecond<T['initializeV2']>
627
- : never
628
- initializeV3?: T['initializeV3'] extends TFunction
629
- ? ParametersFromSecond<T['initializeV3']>
630
- : never
627
+ type TFunction = (...args: any[]) => any;
628
+ type TInitializerName = 'initialize' | `initializeV${number}`;
629
+ type TInitializerParams<T> = {
630
+ initialize?: T extends { initialize: infer TInit }
631
+ ? TInit extends TFunction
632
+ ? ParametersFromSecond<TInit>
633
+ : never
634
+ : any[];
631
635
  } & {
632
- [K in Extract<keyof T, `initializeV${number}`>]?: T[K] extends TFunction
636
+ [K in Extract<keyof T, TInitializerName>]?: T[K] extends TFunction
633
637
  ? ParametersFromSecond<T[K]>
634
- : any
635
- }
638
+ : never;
639
+ };
636
640
 
637
641
  type TContract = ContractBase & { $constructor?: (...args: any[]) => any }
638
642
  type TConstructorArgs<T extends TContract> = T['$constructor'] extends Function ? {
@@ -658,7 +662,7 @@ function isEqual(a, b) {
658
662
  // Not strictly equal
659
663
  return a == b;
660
664
  }
661
- // check arrays
665
+ // Check arrays.
662
666
  if (Array.isArray(a) || Array.isArray(b)) {
663
667
  if (a.length !== b.length) {
664
668
  return false;
@@ -667,7 +671,7 @@ function isEqual(a, b) {
667
671
  return isEqual(x, b[i]);
668
672
  });
669
673
  }
670
- // check objects
674
+ // Check objects.
671
675
  for (let key in a) {
672
676
  let aValue = a[key];
673
677
  let bValue = b[key];
@@ -677,7 +681,7 @@ function isEqual(a, b) {
677
681
  }
678
682
  for (let key in b) {
679
683
  if (key in a === false && b[key] != null) {
680
- // value present in b, but was not in a
684
+ // Value is present in b, but not in a.
681
685
  return false;
682
686
  }
683
687
  }
@@ -723,8 +727,8 @@ function serializeMigrationData(id: string, contract: ContractBase, opts: any) {
723
727
 
724
728
 
725
729
  /**
726
- * Normalize the contract name by removing any versions from name
727
- * "FooV1" is actually the "Foo" contract
730
+ * Normalizes the contract name by removing any version suffix from the name.
731
+ * "FooV1" is actually the "Foo" contract.
728
732
  */
729
733
  function getImplementationId (Ctor: Constructor<TContract>) {
730
734
  let id = Ctor.name;
@@ -735,6 +739,15 @@ function getImplementationId (Ctor: Constructor<TContract>) {
735
739
  return id;
736
740
  }
737
741
 
742
+
743
+ function getImmutablesKey (args: any[]) {
744
+ if (args == null || args.length === 0) {
745
+ return null;
746
+ }
747
+ let key = args.map(arg => `${arg?.toString()}`).join('-');
748
+ return key;
749
+ }
750
+
738
751
  namespace Str {
739
752
  export function getDifference (a: TEth.Hex, b: TEth.Hex) {
740
753
  if (a === b) {
@@ -20,7 +20,7 @@ export namespace $proxyDeploy {
20
20
  variable: result.newVar,
21
21
  path: serializePath(result.newPath, result.newVar),
22
22
  conflicts: result.conflicts,
23
- message: `${result.type}: Variable ${serializePath(result.newPath, result.newVar)}(${result.newVar.type}) at slot ${result.newVar.slot} conflicts ${conflicts}`
23
+ message: `${result.type}: Variable ${serializePath(result.newPath, result.newVar)}(${result.newVar.type}) at slot ${result.newVar.slot} conflicts with ${conflicts}`
24
24
  };
25
25
  }
26
26
  return null;
@@ -34,15 +34,15 @@ export namespace $proxyDeploy {
34
34
 
35
35
  ctx ??= {};
36
36
 
37
- // When resolving state variables
38
- // we append '$' char(s) to the overriden variables to avoid name conflicts, so here we check also for __gap with possible $ sfx.
37
+ // When resolving state variables, we append '$' characters to overridden variables to avoid name conflicts.
38
+ // Also check for __gap with a possible '$' suffix.
39
39
  let rgxGap = /^_+gap\$*$/;
40
40
  let oldMemory = oldVars.map(getMemoryPosition);
41
41
  let oldLastSlot = alot(oldVars).max(x => x.slot);
42
42
  for (let i = 0; i < newVars.length; i++) {
43
43
  let newVar = newVars[i];
44
44
  if (newVar.slot > oldLastSlot) {
45
- // New variable was added after the last slot in current deployment
45
+ // A new variable was added after the last slot in the current deployment.
46
46
  if (ctx.isExtendableMemory === false) {
47
47
  return new BaseError(
48
48
  ELayoutError.MEMORY_OVERFLOW,
@@ -52,8 +52,8 @@ export namespace $proxyDeploy {
52
52
  );
53
53
  }
54
54
 
55
- // Find the new variable name in old storage
56
- // Exclude those with the same position, as they might be pushed logically down by __gap pattern
55
+ // Find the new variable name in old storage.
56
+ // Exclude variables at the same position, as they might be pushed logically down by the __gap pattern.
57
57
  let oldVarWithName = oldVars.find(x => x.name === newVar.name);
58
58
  if (oldVarWithName != null && !Variables.eqLocation(oldVarWithName, newVar) && !rgxGap.test(newVar.name)) {
59
59
  return new BaseError(
@@ -69,7 +69,7 @@ export namespace $proxyDeploy {
69
69
  let oldVarAtSamePos = oldVars.find(x => x.slot === newVar.slot && x.position === newVar.position);
70
70
  if (oldVarAtSamePos != null) {
71
71
  if (oldVarAtSamePos.type === newVar.type) {
72
- // New variable is the same
72
+ // The new variable is the same.
73
73
  if (oldVarAtSamePos.name !== newVar.name) {
74
74
  let oldVarWithName = oldVars.find(x => x.name === newVar.name);
75
75
  if (oldVarWithName != null) {
@@ -229,7 +229,7 @@ export namespace $proxyDeploy {
229
229
  newPath?: string
230
230
  oldPath?: string
231
231
 
232
- // root storage is extendable, but if we compare base array types, or structs, the memory is limited due to outer next variable slots
232
+ // Root storage is extendable, but when comparing base array types or structs, memory is limited by outer next-variable slots.
233
233
  isExtendableMemory?: boolean
234
234
 
235
235
  isLastVariable?: boolean
@@ -239,13 +239,13 @@ export namespace $proxyDeploy {
239
239
  TYPE_MISMATCH = 'TYPE_MISMATCH',
240
240
  TYPE_COLLISION = 'TYPE_COLLISION',
241
241
 
242
- /** throws error if memory is not extendable */
242
+ /** Throws an error if memory is not extendable. */
243
243
  ARRAY_LENGTH_MISMATCH = 'ARRAY_LENGTH_MISMATCH',
244
244
 
245
- /** in arrays the memory for a single item is not extendable, but in contract's root storage or mapping values is */
245
+ /** In arrays, memory for a single item is not extendable, but it is extendable in contract root storage or mapping values. */
246
246
  MEMORY_OVERFLOW = 'MEMORY_OVERFLOW',
247
247
 
248
- /** Variables on same slot with different names (rename possible) but additionally the some variable exists in old layout on different slot */
248
+ /** Variables on the same slot with different names (rename possible), while the same variable also exists in the old layout on a different slot. */
249
249
  NAME_MISMATCH = 'NAME_MISMATCH'
250
250
  }
251
251
  class BaseError {
@@ -274,7 +274,7 @@ export namespace $proxyDeploy {
274
274
 
275
275
  function getMemoryPosition ($var: ISlotVarDefinition) {
276
276
  if (isDynamicVariable($var)) {
277
- // dynamic variables occupy the single slot
277
+ // Dynamic variables occupy a single slot.
278
278
  return {
279
279
  variable: $var,
280
280
  offset: $var.slot * 256,
@@ -300,12 +300,12 @@ export namespace $proxyDeploy {
300
300
  function requireBoth (a: ISlotVarDefinition, b: ISlotVarDefinition, aCheck: boolean, bCheck: boolean) {
301
301
  if (!aCheck) {
302
302
  return {
303
- error: `Current variable is not dynamic ${a.name}(${a.type}) but the new one is: ${b.name}(${b.type})`
303
+ error: `Current variable ${a.name}(${a.type}) is not dynamic, but the new one is: ${b.name}(${b.type})`
304
304
  };
305
305
  }
306
306
  if (!bCheck) {
307
307
  return {
308
- error: `Current variable is dynamic ${a.name}(${a.type}) but the new one is not: ${b.name}(${b.type})`
308
+ error: `Current variable ${a.name}(${a.type}) is dynamic, but the new one is not: ${b.name}(${b.type})`
309
309
  };
310
310
  }
311
311
  }