dequanto 0.2.37 → 0.2.40
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.
- package/hardhat.config.js +10 -1
- package/lib/cjs/abi/$abiCoder.js +1 -1
- package/lib/cjs/abi/$abiCoder.js.map +1 -1
- package/lib/cjs/abi/Logger.js +1 -1
- package/lib/cjs/abi/abi-coder-packed.js +3 -3
- package/lib/cjs/abi/abi-coder.js +16 -16
- package/lib/cjs/abi/coders/abstract-coder.js +31 -31
- package/lib/cjs/abi/coders/abstract-coder.js.map +1 -1
- package/lib/cjs/abi/fragments.js +90 -90
- package/lib/cjs/abi/fragments.js.map +1 -1
- package/lib/cjs/blocks/BlockDateResolver.js +9 -9
- package/lib/cjs/blocks/BlockDateResolver.js.map +1 -1
- package/lib/cjs/class/PackedRanges.js +46 -46
- package/lib/cjs/class/PackedRanges.js.map +1 -1
- package/lib/cjs/clients/ClientEventsStream.js +1 -1
- package/lib/cjs/clients/ClientEventsStream.js.map +1 -1
- package/lib/cjs/clients/ClientPool.js +23 -23
- package/lib/cjs/clients/ClientPool.js.map +1 -1
- package/lib/cjs/clients/WalletClient.js +3 -3
- package/lib/cjs/clients/WalletClient.js.map +1 -1
- package/lib/cjs/clients/Web3Client.js +14 -14
- package/lib/cjs/clients/Web3Client.js.map +1 -1
- package/lib/cjs/clients/Web3ClientFactory.js +1 -1
- package/lib/cjs/clients/Web3ClientFactory.js.map +1 -1
- package/lib/cjs/clients/compatibility/Web3.js +2 -2
- package/lib/cjs/clients/compatibility/Web3.js.map +1 -1
- package/lib/cjs/clients/handlers/RateLimitGuard.js +16 -16
- package/lib/cjs/clients/handlers/RateLimitGuard.js.map +1 -1
- package/lib/cjs/clients/model/PromiEventWrap.js +1 -1
- package/lib/cjs/clients/model/PromiEventWrap.js.map +1 -1
- package/lib/cjs/clients/utils/$web3Abi.js +2 -2
- package/lib/cjs/clients/utils/$web3Abi.js.map +1 -1
- package/lib/cjs/clients/utils/ClientErrorUtil.js +4 -0
- package/lib/cjs/clients/utils/ClientErrorUtil.js.map +1 -1
- package/lib/cjs/config/Config.js.map +1 -1
- package/lib/cjs/contracts/Contract.js +1 -1
- package/lib/cjs/contracts/Contract.js.map +1 -1
- package/lib/cjs/contracts/ContractAbiProvider.js +6 -6
- package/lib/cjs/contracts/ContractAbiProvider.js.map +1 -1
- package/lib/cjs/contracts/ContractBase.js +10 -10
- package/lib/cjs/contracts/ContractBase.js.map +1 -1
- package/lib/cjs/contracts/ContractProvider.js +1 -1
- package/lib/cjs/contracts/ContractProvider.js.map +1 -1
- package/lib/cjs/contracts/ContractReader.js +5 -5
- package/lib/cjs/contracts/ContractReader.js.map +1 -1
- package/lib/cjs/contracts/ContractWriter.js +4 -4
- package/lib/cjs/contracts/ContractWriter.js.map +1 -1
- package/lib/cjs/contracts/deploy/ContractDeployer.js +4 -4
- package/lib/cjs/contracts/deploy/ContractDeployer.js.map +1 -1
- package/lib/cjs/contracts/deploy/Deployments.js +68 -26
- package/lib/cjs/contracts/deploy/Deployments.js.map +1 -1
- package/lib/cjs/contracts/deploy/proxy/$proxyDeploy.js +13 -13
- package/lib/cjs/contracts/deploy/proxy/$proxyDeploy.js.map +1 -1
- package/lib/cjs/contracts/deploy/proxy/ProxyDeployment.js +58 -25
- package/lib/cjs/contracts/deploy/proxy/ProxyDeployment.js.map +1 -1
- package/lib/cjs/contracts/deploy/storage/DeploymentsStorage.js +15 -14
- package/lib/cjs/contracts/deploy/storage/DeploymentsStorage.js.map +1 -1
- package/lib/cjs/contracts/utils/AbiDeserializer.js +4 -4
- package/lib/cjs/contracts/utils/AbiDeserializer.js.map +1 -1
- package/lib/cjs/contracts/utils/ContractBaseUtils.js +3 -3
- package/lib/cjs/contracts/utils/ContractBaseUtils.js.map +1 -1
- package/lib/cjs/evm/OpcodesWalker.js +1 -1
- package/lib/cjs/evm/OpcodesWalker.js.map +1 -1
- package/lib/cjs/explorer/BlockchainExplorer.js +1 -1
- package/lib/cjs/explorer/BlockchainExplorer.js.map +1 -1
- package/lib/cjs/explorer/BlockchainExplorerFactory.js +1 -1
- package/lib/cjs/explorer/BlockchainExplorerStorage.js +12 -12
- package/lib/cjs/explorer/BlockchainExplorerStorage.js.map +1 -1
- package/lib/cjs/explorer/Evmscan.js +1 -1
- package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js +7 -7
- package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
- package/lib/cjs/flashbots/FlashbotWeb3Client.js +1 -1
- package/lib/cjs/flashbots/FlashbotWeb3Client.js.map +1 -1
- package/lib/cjs/gen/Generator.js +15 -0
- package/lib/cjs/gen/Generator.js.map +1 -1
- package/lib/cjs/hardhat/HardhatProvider.js +7 -7
- package/lib/cjs/hardhat/HardhatProvider.js.map +1 -1
- package/lib/cjs/indexer/BlocksTxIndexer.js +2 -2
- package/lib/cjs/indexer/BlocksTxIndexer.js.map +1 -1
- package/lib/cjs/indexer/EventsIndexer.js +11 -11
- package/lib/cjs/indexer/EventsIndexer.js.map +1 -1
- package/lib/cjs/indexer/PendingTxIndexer.js +2 -2
- package/lib/cjs/indexer/PendingTxIndexer.js.map +1 -1
- package/lib/cjs/indexer/handlers/BlocksWalker.js +9 -9
- package/lib/cjs/indexer/handlers/BlocksWalker.js.map +1 -1
- package/lib/cjs/indexer/handlers/TxQueueLoader.js +1 -1
- package/lib/cjs/indexer/storage/FsEventsIndexerStore.js +3 -3
- package/lib/cjs/indexer/storage/FsEventsIndexerStore.js.map +1 -1
- package/lib/cjs/indexer/storage/FsEventsStoreUtils.js +1 -1
- package/lib/cjs/indexer/storage/FsEventsStoreUtils.js.map +1 -1
- package/lib/cjs/json/JsonArrayMultiStore.js +1 -1
- package/lib/cjs/json/JsonArrayMultiStore.js.map +1 -1
- package/lib/cjs/json/JsonStoreFs.js +1 -1
- package/lib/cjs/json/JsonStoreFs.js.map +1 -1
- package/lib/cjs/rpc/$rpc.js +2 -2
- package/lib/cjs/rpc/$rpc.js.map +1 -1
- package/lib/cjs/rpc/Rpc.js +2 -2
- package/lib/cjs/rpc/RpcBase.js +2 -2
- package/lib/cjs/rpc/RpcBase.js.map +1 -1
- package/lib/cjs/rpc/RpcContract.js +4 -3
- package/lib/cjs/rpc/RpcContract.js.map +1 -1
- package/lib/cjs/rpc/RpcSubscription.js +1 -1
- package/lib/cjs/rpc/RpcSubscription.js.map +1 -1
- package/lib/cjs/rpc/transports/compatibility/EIP1193Transport.js +4 -4
- package/lib/cjs/rpc/transports/compatibility/EIP1193Transport.js.map +1 -1
- package/lib/cjs/rpc/transports/compatibility/Web3Transport.js +1 -1
- package/lib/cjs/rpc/transports/compatibility/Web3Transport.js.map +1 -1
- package/lib/cjs/services/TimelockService/TimelockService.js +2 -2
- package/lib/cjs/services/TimelockService/TimelockServiceFallbackSafe.js +2 -2
- package/lib/cjs/solidity/SlotsDump.js +1 -1
- package/lib/cjs/solidity/SlotsDump.js.map +1 -1
- package/lib/cjs/solidity/SlotsParser/MappingSettersResolver.js +3 -3
- package/lib/cjs/solidity/SlotsParser/MappingSettersResolver.js.map +1 -1
- package/lib/cjs/solidity/SlotsParser/SourceFile.js +3 -3
- package/lib/cjs/solidity/SlotsParser/SourceFile.js.map +1 -1
- package/lib/cjs/solidity/SolidityParser.js +1 -1
- package/lib/cjs/solidity/SolidityParser.js.map +1 -1
- package/lib/cjs/solidity/SourceCodeProvider.js +1 -1
- package/lib/cjs/solidity/SourceCodeProvider.js.map +1 -1
- package/lib/cjs/solidity/storage/Accessor.js +1 -1
- package/lib/cjs/solidity/storage/Accessor.js.map +1 -1
- package/lib/cjs/solidity/storage/SlotFixedArray.js +1 -1
- package/lib/cjs/solidity/storage/SlotFixedArray.js.map +1 -1
- package/lib/cjs/solidity/storage/SlotsStorageTransport.js +3 -3
- package/lib/cjs/solidity/storage/SlotsStorageTransport.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotBytesHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotBytesHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotDynamicArrayHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotDynamicArrayHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotFixedArrayHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotFixedArrayHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueConstantHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueConstantHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueImmutableHandler.js +4 -4
- package/lib/cjs/solidity/storage/handlers/SlotValueImmutableHandler.js.map +1 -1
- package/lib/cjs/tokens/TokenDataProvider.js +2 -2
- package/lib/cjs/tokens/TokenDataProvider.js.map +1 -1
- package/lib/cjs/tokens/TokenExchangeService.js +1 -1
- package/lib/cjs/tokens/TokenExchangeService.js.map +1 -1
- package/lib/cjs/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js +2 -2
- package/lib/cjs/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js.map +1 -1
- package/lib/cjs/tokens/TokenExchanges/AmmV2PriceQuote.js +2 -2
- package/lib/cjs/tokens/TokenExchanges/AmmV2PriceQuote.js.map +1 -1
- package/lib/cjs/tokens/TokenOracles/amm/AmmV1Oracle.js +2 -2
- package/lib/cjs/tokens/TokenOracles/amm/AmmV1Oracle.js.map +1 -1
- package/lib/cjs/tokens/TokenTransferService.js +2 -2
- package/lib/cjs/tokens/TokenTransferService.js.map +1 -1
- package/lib/cjs/tokens/TokensService.js +1 -1
- package/lib/cjs/tokens/TokensService.js.map +1 -1
- package/lib/cjs/txs/TxNonceManager.js +1 -1
- package/lib/cjs/txs/TxWriter.js +9 -0
- package/lib/cjs/txs/TxWriter.js.map +1 -1
- package/lib/cjs/txs/conditional/GasWatcherTx.js +1 -1
- package/lib/cjs/txs/conditional/GasWatcherTx.js.map +1 -1
- package/lib/cjs/txs/receipt/TxLogParser.js +1 -1
- package/lib/cjs/utils/$crypto.js +1 -1
- package/lib/cjs/utils/$crypto.js.map +1 -1
- package/lib/cjs/utils/$date.js +1 -1
- package/lib/cjs/utils/$date.js.map +1 -1
- package/lib/cjs/utils/$hex.js +1 -1
- package/lib/cjs/utils/$logger.js +1 -1
- package/lib/cjs/utils/$logger.js.map +1 -1
- package/lib/cjs/utils/$machine.js +2 -2
- package/lib/cjs/utils/$machine.js.map +1 -1
- package/lib/cjs/utils/$traces.js +1 -1
- package/lib/cjs/utils/$traces.js.map +1 -1
- package/lib/esm/abi/$abiCoder.js.map +1 -1
- package/lib/esm/abi/$abiCoder.mjs +1 -1
- package/lib/esm/abi/Logger.mjs +1 -1
- package/lib/esm/abi/abi-coder-packed.mjs +3 -3
- package/lib/esm/abi/abi-coder.mjs +16 -16
- package/lib/esm/abi/coders/abstract-coder.js.map +1 -1
- package/lib/esm/abi/coders/abstract-coder.mjs +31 -31
- package/lib/esm/abi/fragments.js.map +1 -1
- package/lib/esm/abi/fragments.mjs +90 -90
- package/lib/esm/blocks/BlockDateResolver.js.map +1 -1
- package/lib/esm/blocks/BlockDateResolver.mjs +9 -9
- package/lib/esm/class/PackedRanges.js.map +1 -1
- package/lib/esm/class/PackedRanges.mjs +46 -46
- package/lib/esm/clients/ClientEventsStream.js.map +1 -1
- package/lib/esm/clients/ClientEventsStream.mjs +1 -1
- package/lib/esm/clients/ClientPool.js.map +1 -1
- package/lib/esm/clients/ClientPool.mjs +23 -23
- package/lib/esm/clients/WalletClient.js.map +1 -1
- package/lib/esm/clients/WalletClient.mjs +3 -3
- package/lib/esm/clients/Web3Client.js.map +1 -1
- package/lib/esm/clients/Web3Client.mjs +14 -14
- package/lib/esm/clients/Web3ClientFactory.js.map +1 -1
- package/lib/esm/clients/Web3ClientFactory.mjs +1 -1
- package/lib/esm/clients/compatibility/Web3.js.map +1 -1
- package/lib/esm/clients/compatibility/Web3.mjs +2 -2
- package/lib/esm/clients/handlers/RateLimitGuard.js.map +1 -1
- package/lib/esm/clients/handlers/RateLimitGuard.mjs +16 -16
- package/lib/esm/clients/model/PromiEventWrap.js.map +1 -1
- package/lib/esm/clients/model/PromiEventWrap.mjs +1 -1
- package/lib/esm/clients/utils/$web3Abi.js.map +1 -1
- package/lib/esm/clients/utils/$web3Abi.mjs +2 -2
- package/lib/esm/clients/utils/ClientErrorUtil.js.map +1 -1
- package/lib/esm/clients/utils/ClientErrorUtil.mjs +4 -0
- package/lib/esm/config/Config.js.map +1 -1
- package/lib/esm/contracts/Contract.js.map +1 -1
- package/lib/esm/contracts/Contract.mjs +1 -1
- package/lib/esm/contracts/ContractAbiProvider.js.map +1 -1
- package/lib/esm/contracts/ContractAbiProvider.mjs +6 -6
- package/lib/esm/contracts/ContractBase.js.map +1 -1
- package/lib/esm/contracts/ContractBase.mjs +10 -10
- package/lib/esm/contracts/ContractProvider.js.map +1 -1
- package/lib/esm/contracts/ContractProvider.mjs +1 -1
- package/lib/esm/contracts/ContractReader.js.map +1 -1
- package/lib/esm/contracts/ContractReader.mjs +5 -5
- package/lib/esm/contracts/ContractWriter.js.map +1 -1
- package/lib/esm/contracts/ContractWriter.mjs +4 -4
- package/lib/esm/contracts/deploy/ContractDeployer.js.map +1 -1
- package/lib/esm/contracts/deploy/ContractDeployer.mjs +4 -4
- package/lib/esm/contracts/deploy/Deployments.js.map +1 -1
- package/lib/esm/contracts/deploy/Deployments.mjs +68 -26
- package/lib/esm/contracts/deploy/proxy/$proxyDeploy.js.map +1 -1
- package/lib/esm/contracts/deploy/proxy/$proxyDeploy.mjs +13 -13
- package/lib/esm/contracts/deploy/proxy/ProxyDeployment.js.map +1 -1
- package/lib/esm/contracts/deploy/proxy/ProxyDeployment.mjs +58 -25
- package/lib/esm/contracts/deploy/storage/DeploymentsStorage.js.map +1 -1
- package/lib/esm/contracts/deploy/storage/DeploymentsStorage.mjs +15 -14
- package/lib/esm/contracts/utils/AbiDeserializer.js.map +1 -1
- package/lib/esm/contracts/utils/AbiDeserializer.mjs +4 -4
- package/lib/esm/contracts/utils/ContractBaseUtils.js.map +1 -1
- package/lib/esm/contracts/utils/ContractBaseUtils.mjs +3 -3
- package/lib/esm/evm/OpcodesWalker.js.map +1 -1
- package/lib/esm/evm/OpcodesWalker.mjs +1 -1
- package/lib/esm/explorer/BlockchainExplorer.js.map +1 -1
- package/lib/esm/explorer/BlockchainExplorer.mjs +1 -1
- package/lib/esm/explorer/BlockchainExplorerFactory.mjs +1 -1
- package/lib/esm/explorer/BlockchainExplorerStorage.js.map +1 -1
- package/lib/esm/explorer/BlockchainExplorerStorage.mjs +12 -12
- package/lib/esm/explorer/Evmscan.mjs +1 -1
- package/lib/esm/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
- package/lib/esm/explorer/verifiers/FsHtmlVerifier.mjs +7 -7
- package/lib/esm/flashbots/FlashbotWeb3Client.js.map +1 -1
- package/lib/esm/flashbots/FlashbotWeb3Client.mjs +1 -1
- package/lib/esm/gen/Generator.js.map +1 -1
- package/lib/esm/gen/Generator.mjs +15 -0
- package/lib/esm/hardhat/HardhatProvider.js.map +1 -1
- package/lib/esm/hardhat/HardhatProvider.mjs +7 -7
- package/lib/esm/indexer/BlocksTxIndexer.js.map +1 -1
- package/lib/esm/indexer/BlocksTxIndexer.mjs +2 -2
- package/lib/esm/indexer/EventsIndexer.js.map +1 -1
- package/lib/esm/indexer/EventsIndexer.mjs +11 -11
- package/lib/esm/indexer/PendingTxIndexer.js.map +1 -1
- package/lib/esm/indexer/PendingTxIndexer.mjs +2 -2
- package/lib/esm/indexer/handlers/BlocksWalker.js.map +1 -1
- package/lib/esm/indexer/handlers/BlocksWalker.mjs +9 -9
- package/lib/esm/indexer/handlers/TxQueueLoader.mjs +1 -1
- package/lib/esm/indexer/storage/FsEventsIndexerStore.js.map +1 -1
- package/lib/esm/indexer/storage/FsEventsIndexerStore.mjs +3 -3
- package/lib/esm/indexer/storage/FsEventsStoreUtils.js.map +1 -1
- package/lib/esm/indexer/storage/FsEventsStoreUtils.mjs +1 -1
- package/lib/esm/json/JsonArrayMultiStore.js.map +1 -1
- package/lib/esm/json/JsonArrayMultiStore.mjs +1 -1
- package/lib/esm/json/JsonStoreFs.js.map +1 -1
- package/lib/esm/json/JsonStoreFs.mjs +1 -1
- package/lib/esm/rpc/$rpc.js.map +1 -1
- package/lib/esm/rpc/$rpc.mjs +2 -2
- package/lib/esm/rpc/Rpc.mjs +2 -2
- package/lib/esm/rpc/RpcBase.js.map +1 -1
- package/lib/esm/rpc/RpcBase.mjs +2 -2
- package/lib/esm/rpc/RpcContract.js.map +1 -1
- package/lib/esm/rpc/RpcContract.mjs +4 -3
- package/lib/esm/rpc/RpcSubscription.js.map +1 -1
- package/lib/esm/rpc/RpcSubscription.mjs +1 -1
- package/lib/esm/rpc/transports/compatibility/EIP1193Transport.js.map +1 -1
- package/lib/esm/rpc/transports/compatibility/EIP1193Transport.mjs +4 -4
- package/lib/esm/rpc/transports/compatibility/Web3Transport.js.map +1 -1
- package/lib/esm/rpc/transports/compatibility/Web3Transport.mjs +1 -1
- package/lib/esm/services/TimelockService/TimelockService.mjs +2 -2
- package/lib/esm/services/TimelockService/TimelockServiceFallbackSafe.mjs +2 -2
- package/lib/esm/solidity/SlotsDump.js.map +1 -1
- package/lib/esm/solidity/SlotsDump.mjs +1 -1
- package/lib/esm/solidity/SlotsParser/MappingSettersResolver.js.map +1 -1
- package/lib/esm/solidity/SlotsParser/MappingSettersResolver.mjs +3 -3
- package/lib/esm/solidity/SlotsParser/SourceFile.js.map +1 -1
- package/lib/esm/solidity/SlotsParser/SourceFile.mjs +3 -3
- package/lib/esm/solidity/SolidityParser.js.map +1 -1
- package/lib/esm/solidity/SolidityParser.mjs +1 -1
- package/lib/esm/solidity/SourceCodeProvider.js.map +1 -1
- package/lib/esm/solidity/SourceCodeProvider.mjs +1 -1
- package/lib/esm/solidity/storage/Accessor.js.map +1 -1
- package/lib/esm/solidity/storage/Accessor.mjs +1 -1
- package/lib/esm/solidity/storage/SlotFixedArray.js.map +1 -1
- package/lib/esm/solidity/storage/SlotFixedArray.mjs +1 -1
- package/lib/esm/solidity/storage/SlotsStorageTransport.js.map +1 -1
- package/lib/esm/solidity/storage/SlotsStorageTransport.mjs +3 -3
- package/lib/esm/solidity/storage/handlers/SlotBytesHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotBytesHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotDynamicArrayHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotDynamicArrayHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotFixedArrayHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotFixedArrayHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueConstantHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueConstantHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueImmutableHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueImmutableHandler.mjs +4 -4
- package/lib/esm/tokens/TokenDataProvider.js.map +1 -1
- package/lib/esm/tokens/TokenDataProvider.mjs +2 -2
- package/lib/esm/tokens/TokenExchangeService.js.map +1 -1
- package/lib/esm/tokens/TokenExchangeService.mjs +1 -1
- package/lib/esm/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js.map +1 -1
- package/lib/esm/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.mjs +2 -2
- package/lib/esm/tokens/TokenExchanges/AmmV2PriceQuote.js.map +1 -1
- package/lib/esm/tokens/TokenExchanges/AmmV2PriceQuote.mjs +2 -2
- package/lib/esm/tokens/TokenOracles/amm/AmmV1Oracle.js.map +1 -1
- package/lib/esm/tokens/TokenOracles/amm/AmmV1Oracle.mjs +2 -2
- package/lib/esm/tokens/TokenTransferService.js.map +1 -1
- package/lib/esm/tokens/TokenTransferService.mjs +2 -2
- package/lib/esm/tokens/TokensService.js.map +1 -1
- package/lib/esm/tokens/TokensService.mjs +1 -1
- package/lib/esm/txs/TxNonceManager.mjs +1 -1
- package/lib/esm/txs/TxWriter.js.map +1 -1
- package/lib/esm/txs/TxWriter.mjs +9 -0
- package/lib/esm/txs/conditional/GasWatcherTx.js.map +1 -1
- package/lib/esm/txs/conditional/GasWatcherTx.mjs +1 -1
- package/lib/esm/txs/receipt/TxLogParser.mjs +1 -1
- package/lib/esm/utils/$crypto.js.map +1 -1
- package/lib/esm/utils/$crypto.mjs +1 -1
- package/lib/esm/utils/$date.js.map +1 -1
- package/lib/esm/utils/$date.mjs +1 -1
- package/lib/esm/utils/$hex.mjs +1 -1
- package/lib/esm/utils/$logger.js.map +1 -1
- package/lib/esm/utils/$logger.mjs +1 -1
- package/lib/esm/utils/$machine.js.map +1 -1
- package/lib/esm/utils/$machine.mjs +2 -2
- package/lib/esm/utils/$traces.js.map +1 -1
- package/lib/esm/utils/$traces.mjs +1 -1
- package/lib/types/abi/abi-coder-packed.d.ts +1 -1
- package/lib/types/abi/abi-coder.d.ts +13 -13
- package/lib/types/abi/coders/abstract-coder.d.ts +14 -14
- package/lib/types/abi/fragments.d.ts +95 -95
- package/lib/types/blocks/BlockDateResolver.d.ts +7 -7
- package/lib/types/class/PackedRanges.d.ts +44 -44
- package/lib/types/clients/ClientPool.d.ts +10 -10
- package/lib/types/clients/WalletClient.d.ts +2 -2
- package/lib/types/clients/Web3Client.d.ts +6 -6
- package/lib/types/clients/Web3ClientFactory.d.ts +1 -1
- package/lib/types/clients/handlers/RateLimitGuard.d.ts +5 -5
- package/lib/types/clients/model/PromiEventWrap.d.ts +1 -1
- package/lib/types/clients/utils/$web3Abi.d.ts +1 -1
- package/lib/types/clients/utils/ClientErrorUtil.d.ts +1 -0
- package/lib/types/config/Config.d.ts +3 -2
- package/lib/types/contracts/ContractBase.d.ts +4 -4
- package/lib/types/contracts/ContractReader.d.ts +2 -2
- package/lib/types/contracts/ContractWriter.d.ts +3 -3
- package/lib/types/contracts/deploy/Deployments.d.ts +20 -15
- package/lib/types/contracts/deploy/proxy/ProxyDeployment.d.ts +2 -0
- package/lib/types/contracts/deploy/storage/DeploymentsStorage.d.ts +2 -0
- package/lib/types/explorer/BlockchainExplorerFactory.d.ts +1 -1
- package/lib/types/explorer/Evmscan.d.ts +1 -1
- package/lib/types/gen/Generator.d.ts +8 -0
- package/lib/types/indexer/BlocksTxIndexer.d.ts +4 -4
- package/lib/types/indexer/EventsIndexer.d.ts +4 -4
- package/lib/types/indexer/PendingTxIndexer.d.ts +1 -1
- package/lib/types/indexer/handlers/BlocksWalker.d.ts +2 -2
- package/lib/types/indexer/storage/FsEventsIndexerStore.d.ts +4 -4
- package/lib/types/ns/providers/INsProvider.d.ts +1 -1
- package/lib/types/rpc/Rpc.d.ts +2 -2
- package/lib/types/services/TimelockService/ITimelockService.d.ts +2 -2
- package/lib/types/services/TimelockService/TimelockService.d.ts +2 -2
- package/lib/types/services/TimelockService/TimelockServiceFallbackSafe.d.ts +2 -2
- package/lib/types/solidity/SlotsParser/SourceFile.d.ts +1 -1
- package/lib/types/solidity/storage/SlotFixedArray.d.ts +1 -1
- package/lib/types/tokens/TokenDataProvider.d.ts +2 -2
- package/lib/types/tokens/TokensService.d.ts +1 -1
- package/lib/types/txs/ITxBuilderOptions.d.ts +1 -1
- package/lib/types/txs/TxNonceManager.d.ts +1 -1
- package/lib/types/txs/TxWriter.d.ts +4 -4
- package/lib/types/txs/receipt/TxLogParser.d.ts +1 -1
- package/lib/types/utils/$date.d.ts +1 -1
- package/lib/types/utils/$hex.d.ts +1 -1
- package/package.json +1 -1
- package/readme.md +105 -83
- package/src/abi/$abiCoder.ts +1 -1
- package/src/abi/Logger.ts +1 -1
- package/src/abi/abi-coder-packed.ts +3 -3
- package/src/abi/abi-coder.ts +16 -16
- package/src/abi/coders/abstract-coder.ts +36 -36
- package/src/abi/fragments.ts +137 -137
- package/src/blocks/BlockDateResolver.ts +9 -9
- package/src/bridges/hop/HopBridge.ts +1 -1
- package/src/class/PackedRanges.ts +46 -46
- package/src/clients/ClientEventsStream.ts +1 -1
- package/src/clients/ClientPool.ts +38 -38
- package/src/clients/WalletClient.ts +3 -3
- package/src/clients/Web3BatchRequests.ts +3 -3
- package/src/clients/Web3Client.ts +21 -21
- package/src/clients/Web3ClientFactory.ts +1 -1
- package/src/clients/compatibility/Web3.ts +2 -2
- package/src/clients/handlers/RateLimitGuard.ts +16 -16
- package/src/clients/interfaces/IWeb3Client.ts +2 -2
- package/src/clients/model/PromiEventWrap.ts +1 -1
- package/src/clients/utils/$web3Abi.ts +2 -2
- package/src/clients/utils/ClientErrorUtil.ts +4 -0
- package/src/config/Config.ts +4 -3
- package/src/contracts/Contract.ts +1 -1
- package/src/contracts/ContractAbiProvider.ts +6 -6
- package/src/contracts/ContractBase.ts +14 -14
- package/src/contracts/ContractProvider.ts +1 -1
- package/src/contracts/ContractReader.ts +7 -7
- package/src/contracts/ContractWriter.ts +4 -4
- package/src/contracts/deploy/ContractDeployer.ts +4 -4
- package/src/contracts/deploy/ContractDeployment.ts +1 -1
- package/src/contracts/deploy/Deployments.ts +110 -53
- package/src/contracts/deploy/proxy/$proxyDeploy.ts +14 -14
- package/src/contracts/deploy/proxy/ProxyDeployment.ts +82 -37
- package/src/contracts/deploy/storage/DeploymentsStorage.ts +21 -18
- package/src/contracts/utils/AbiDeserializer.ts +4 -4
- package/src/contracts/utils/ContractBaseUtils.ts +3 -3
- package/src/erc4337/models/UserOperation.ts +2 -2
- package/src/evm/OpcodesWalker.ts +1 -1
- package/src/explorer/BlockchainExplorer.ts +1 -1
- package/src/explorer/BlockchainExplorerFactory.ts +1 -1
- package/src/explorer/BlockchainExplorerStorage.ts +12 -12
- package/src/explorer/Evmscan.ts +1 -1
- package/src/explorer/verifiers/FsHtmlVerifier.ts +7 -7
- package/src/flashbots/FlashbotWeb3Client.ts +1 -1
- package/src/gen/Generator.ts +17 -0
- package/src/hardhat/HardhatProvider.ts +7 -7
- package/src/indexer/BlocksTxIndexer.ts +6 -6
- package/src/indexer/EventsIndexer.ts +20 -20
- package/src/indexer/PendingTxIndexer.ts +3 -3
- package/src/indexer/handlers/BlocksWalker.ts +9 -9
- package/src/indexer/handlers/TxQueueLoader.ts +1 -1
- package/src/indexer/storage/FsEventsIndexerStore.ts +9 -9
- package/src/indexer/storage/FsEventsMetaStore.ts +1 -1
- package/src/indexer/storage/FsEventsStoreUtils.ts +1 -1
- package/src/json/JsonArrayMultiStore.ts +1 -1
- package/src/json/JsonStoreFs.ts +1 -1
- package/src/ns/providers/INsProvider.ts +1 -1
- package/src/rpc/$rpc.ts +2 -2
- package/src/rpc/Rpc.ts +2 -2
- package/src/rpc/RpcBase.ts +2 -2
- package/src/rpc/RpcContract.ts +6 -6
- package/src/rpc/RpcSubscription.ts +1 -1
- package/src/rpc/transports/compatibility/EIP1193Transport.ts +4 -4
- package/src/rpc/transports/compatibility/Web3Transport.ts +1 -1
- package/src/services/TimelockService/ITimelockService.ts +2 -2
- package/src/services/TimelockService/TimelockService.ts +2 -2
- package/src/services/TimelockService/TimelockServiceFallbackSafe.ts +2 -2
- package/src/solidity/SlotsDump.ts +1 -1
- package/src/solidity/SlotsParser/MappingSettersResolver.ts +3 -3
- package/src/solidity/SlotsParser/SourceFile.ts +3 -3
- package/src/solidity/SolidityParser.ts +1 -1
- package/src/solidity/SourceCodeProvider.ts +1 -1
- package/src/solidity/storage/Accessor.spec.ts +1 -1
- package/src/solidity/storage/Accessor.ts +1 -1
- package/src/solidity/storage/SlotDynamicArray.ts +1 -1
- package/src/solidity/storage/SlotFixedArray.ts +1 -1
- package/src/solidity/storage/SlotsStorageTransport.ts +3 -3
- package/src/solidity/storage/handlers/SlotBytesHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotDynamicArrayHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotFixedArrayHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotValueConstantHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotValueHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotValueImmutableHandler.ts +4 -4
- package/src/tokens/TokenDataProvider.ts +2 -2
- package/src/tokens/TokenExchangeService.ts +1 -1
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.ts +2 -2
- package/src/tokens/TokenExchanges/AmmV2PriceQuote.ts +2 -2
- package/src/tokens/TokenOracles/amm/AmmV1Oracle.ts +2 -2
- package/src/tokens/TokenTransferService.ts +2 -2
- package/src/tokens/TokensService.ts +1 -1
- package/src/txs/ITxBuilderOptions.ts +1 -1
- package/src/txs/TxNonceManager.ts +1 -1
- package/src/txs/TxWriter.ts +15 -4
- package/src/txs/agents/BatchAgent.ts +1 -1
- package/src/txs/conditional/GasWatcherTx.ts +1 -1
- package/src/txs/receipt/TxLogParser.ts +1 -1
- package/src/utils/$crypto.ts +1 -1
- package/src/utils/$date.ts +1 -1
- package/src/utils/$hex.ts +1 -1
- package/src/utils/$logger.ts +1 -1
- package/src/utils/$machine.ts +2 -2
- package/src/utils/$traces.ts +1 -1
- 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
|
|
57
|
-
* 1. This method prepares
|
|
58
|
-
* 2. With returned writer you can subscribe to events and/or wait for
|
|
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
|
|
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
|
|
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
|
|
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), `
|
|
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,
|
|
@@ -7,8 +7,7 @@ import { TEth } from '@dequanto/models/TEth';
|
|
|
7
7
|
import { $abiUtils } from '@dequanto/utils/$abiUtils';
|
|
8
8
|
import { $contract } from '@dequanto/utils/$contract';
|
|
9
9
|
import { $require } from '@dequanto/utils/$require';
|
|
10
|
-
import { ParametersFromSecond } from '@dequanto/utils/types';
|
|
11
|
-
import { Constructor } from '@dequanto/utils/types';
|
|
10
|
+
import { Constructor, ParametersFromSecond } from '@dequanto/utils/types';
|
|
12
11
|
|
|
13
12
|
import { BlockchainExplorerFactory } from '@dequanto/explorer/BlockchainExplorerFactory';
|
|
14
13
|
import { ContractVerifier } from '@dequanto/explorer/ContractVerifier';
|
|
@@ -16,40 +15,45 @@ import { HardhatWeb3Client } from '@dequanto/hardhat/HardhatWeb3Client';
|
|
|
16
15
|
import { LoggerService } from '@dequanto/loggers/LoggerService';
|
|
17
16
|
import { $is } from '@dequanto/utils/$is';
|
|
18
17
|
|
|
19
|
-
import {
|
|
20
|
-
import { DeploymentsStorage, IDeployment } from './storage/DeploymentsStorage';
|
|
18
|
+
import { $bytecode } from '@dequanto/evm/utils/$bytecode';
|
|
21
19
|
import { TAddress } from '@dequanto/models/TAddress';
|
|
22
|
-
import { $promise } from '@dequanto/utils/$promise';
|
|
23
20
|
import { l } from '@dequanto/utils/$logger';
|
|
24
|
-
import { $
|
|
25
|
-
import {
|
|
21
|
+
import { $promise } from '@dequanto/utils/$promise';
|
|
22
|
+
import { IBeacon, IBeaconProxy, IProxy, IProxyAdmin, ProxyDeployment } from './proxy/ProxyDeployment';
|
|
23
|
+
import { DeploymentsStorage, IDeployment } from './storage/DeploymentsStorage';
|
|
26
24
|
|
|
27
25
|
|
|
28
26
|
|
|
29
27
|
type TDeploymentOptions = {
|
|
30
28
|
id?: string
|
|
31
29
|
|
|
32
|
-
|
|
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. */
|
|
33
37
|
force?: boolean
|
|
34
|
-
/**
|
|
38
|
+
/** Checks whether the local bytecode has changed and deploys if needed. */
|
|
35
39
|
latest?: boolean
|
|
36
40
|
|
|
37
41
|
verification?: boolean | 'silent'
|
|
38
42
|
|
|
39
|
-
//
|
|
43
|
+
// Used for the verification process.
|
|
40
44
|
proxyFor?: TAddress
|
|
41
45
|
|
|
42
46
|
deployment?: {
|
|
43
|
-
// Pending deployment transaction will be
|
|
47
|
+
// Pending deployment transaction will be rechecked.
|
|
44
48
|
tx?: TEth.Hex
|
|
45
|
-
// When false, the implementation
|
|
49
|
+
// When false, the implementation will not be updated in the proxy.
|
|
46
50
|
upgradeProxy?: boolean
|
|
47
|
-
// Owner, if
|
|
51
|
+
// Owner, if different from the deployer.
|
|
48
52
|
owner?: TEth.IAccount
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
type TVerificationOptions = TDeploymentOptions & {
|
|
52
|
-
//
|
|
56
|
+
// Otherwise, this will be fetched from the deployment transaction.
|
|
53
57
|
constructorParams?: any[]
|
|
54
58
|
}
|
|
55
59
|
|
|
@@ -81,7 +85,7 @@ export class Deployments {
|
|
|
81
85
|
Proxy?: Constructor<ContractBase>,
|
|
82
86
|
ProxyAdmin?: Constructor<IProxyAdmin>
|
|
83
87
|
directory?: string
|
|
84
|
-
//
|
|
88
|
+
// Part of the deployments filename.
|
|
85
89
|
name?: string
|
|
86
90
|
// TPlatform of a forked network
|
|
87
91
|
fork?: string
|
|
@@ -136,7 +140,7 @@ export class Deployments {
|
|
|
136
140
|
}): Promise<T> {
|
|
137
141
|
let contract = await this.getOrNull(Ctor, opts);
|
|
138
142
|
if (contract == null) {
|
|
139
|
-
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 ?? ''}]`);
|
|
140
144
|
}
|
|
141
145
|
return contract;
|
|
142
146
|
}
|
|
@@ -162,7 +166,7 @@ export class Deployments {
|
|
|
162
166
|
}
|
|
163
167
|
|
|
164
168
|
/**
|
|
165
|
-
*
|
|
169
|
+
* Gets the deployment for Ctor, but returns the CtorWrapped instance. Useful for proxies, etc.
|
|
166
170
|
* e.g. deployments.getAs(SomeProxy, SomeImplementation);
|
|
167
171
|
*/
|
|
168
172
|
async getAs<TDeployed extends ContractBase, TWrapped extends ContractBase>(Ctor: Constructor<TDeployed>, CtorWrapped: Constructor<TWrapped>, opts?: {
|
|
@@ -183,7 +187,7 @@ export class Deployments {
|
|
|
183
187
|
let deployment = await this.store.getDeploymentInfo('', {
|
|
184
188
|
id: params.id
|
|
185
189
|
});
|
|
186
|
-
$require.notNull(deployment, `Deployment for ${params.id} not found`);
|
|
190
|
+
$require.notNull(deployment, `Deployment for ${params.id} was not found`);
|
|
187
191
|
await this.ensureVerification(params.Ctor, deployment, {
|
|
188
192
|
id: params.id,
|
|
189
193
|
constructorParams: params.constructorParams,
|
|
@@ -217,8 +221,14 @@ export class Deployments {
|
|
|
217
221
|
? (this.client.platform === 'hardhat' || this.opts?.checkBytecode !== false)
|
|
218
222
|
: (opts.latest);
|
|
219
223
|
|
|
220
|
-
|
|
221
|
-
|
|
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.
|
|
222
232
|
$contract.store.register(contract as any);
|
|
223
233
|
return {
|
|
224
234
|
contract,
|
|
@@ -226,9 +236,9 @@ export class Deployments {
|
|
|
226
236
|
};
|
|
227
237
|
}
|
|
228
238
|
if (requireLatest === true && opts.force !== true) {
|
|
229
|
-
// was already deployed. Check new bytecode hash
|
|
239
|
+
// The contract was already deployed. Check the new bytecode hash.
|
|
230
240
|
let isSame = await this.isSameBytecode(Ctor, currentDeployment);
|
|
231
|
-
if (isSame) {
|
|
241
|
+
if (isSame && hasNewImmutables !== true) {
|
|
232
242
|
$contract.store.register(contract as any);
|
|
233
243
|
return {
|
|
234
244
|
contract,
|
|
@@ -252,7 +262,7 @@ export class Deployments {
|
|
|
252
262
|
|
|
253
263
|
|
|
254
264
|
|
|
255
|
-
//
|
|
265
|
+
// Deploy the contract: new, forced, or latest.
|
|
256
266
|
|
|
257
267
|
let constructorArgs = opts.arguments ?? [];
|
|
258
268
|
let id = opts.id ?? Ctor.name;
|
|
@@ -272,6 +282,7 @@ export class Deployments {
|
|
|
272
282
|
let deployment = await this.store.saveDeployment(deployedContract, {
|
|
273
283
|
id,
|
|
274
284
|
name: Ctor.name,
|
|
285
|
+
immutablesKey: opts.immutablesKey,
|
|
275
286
|
bytecodeHash: this.getBytecodeHash(deployedBytecode)
|
|
276
287
|
}, receipt);
|
|
277
288
|
|
|
@@ -287,16 +298,11 @@ export class Deployments {
|
|
|
287
298
|
};
|
|
288
299
|
}
|
|
289
300
|
|
|
290
|
-
async ensureWithProxy<
|
|
291
|
-
T extends (TContract & { initialize?: TInit }),
|
|
292
|
-
TInit extends TInitializer
|
|
293
|
-
>(
|
|
301
|
+
async ensureWithProxy<T extends TContract>(
|
|
294
302
|
CtorImpl: Constructor<T>,
|
|
295
|
-
opts?: TConstructorArgs<T> & TDeploymentOptions &
|
|
296
|
-
initialize?: ParametersFromSecond<T['initialize']>
|
|
297
|
-
}
|
|
303
|
+
opts?: TConstructorArgs<T> & TDeploymentOptions & TInitializerParams<T>
|
|
298
304
|
): Promise<{
|
|
299
|
-
//
|
|
305
|
+
// The implementation contract with the address set to the proxy.
|
|
300
306
|
contract: T
|
|
301
307
|
contractReceipt?: TEth.TxReceipt
|
|
302
308
|
contractProxy: IProxy,
|
|
@@ -308,6 +314,7 @@ export class Deployments {
|
|
|
308
314
|
|
|
309
315
|
let id = opts?.id ?? getImplementationId(CtorImpl);
|
|
310
316
|
let proxyId = `${id}Proxy`;
|
|
317
|
+
let immutablesKey = getImmutablesKey(opts?.arguments);
|
|
311
318
|
|
|
312
319
|
let {
|
|
313
320
|
contract: contractImpl,
|
|
@@ -316,13 +323,15 @@ export class Deployments {
|
|
|
316
323
|
} = await this.ensure(CtorImpl, {
|
|
317
324
|
arguments: opts?.arguments as any,
|
|
318
325
|
id: id,
|
|
326
|
+
immutablesKey,
|
|
319
327
|
force: opts?.force,
|
|
320
328
|
latest: this.opts?.checkBytecode !== false,
|
|
321
329
|
verification: opts?.verification,
|
|
322
330
|
deployment: opts?.deployment
|
|
323
331
|
});
|
|
324
332
|
|
|
325
|
-
let
|
|
333
|
+
let initData = serializeInitData(id, contractImpl, opts.initialize);
|
|
334
|
+
let { migrationData, migrationV } = serializeMigrationData(id, contractImpl, opts);
|
|
326
335
|
let implementationAddress = contractImplDeployment.implementation ?? contractImplDeployment.address;
|
|
327
336
|
|
|
328
337
|
let {
|
|
@@ -337,13 +346,15 @@ export class Deployments {
|
|
|
337
346
|
deployments: this,
|
|
338
347
|
implementation: {
|
|
339
348
|
address: implementationAddress,
|
|
340
|
-
initData
|
|
349
|
+
initData,
|
|
350
|
+
migrationData,
|
|
351
|
+
migrationV,
|
|
341
352
|
},
|
|
342
353
|
upgradeImplementation: opts.deployment?.upgradeProxy ?? this.opts?.whenUpgradeRequired !== 'ignore'
|
|
343
354
|
})
|
|
344
355
|
|
|
345
356
|
if (contractImplDeployment.implementation == null) {
|
|
346
|
-
// Set the
|
|
357
|
+
// Set the proxy contract as the main address.
|
|
347
358
|
contractImplDeployment.implementation = contractImplDeployment.address;
|
|
348
359
|
contractImplDeployment.address = contractProxy.address;
|
|
349
360
|
|
|
@@ -365,12 +376,12 @@ export class Deployments {
|
|
|
365
376
|
}
|
|
366
377
|
|
|
367
378
|
/**
|
|
368
|
-
* Deploys the Beacon contract.
|
|
379
|
+
* Deploys the Beacon contract. The implementation is the target contract (can be a proxy or normal contract).
|
|
369
380
|
* https://docs.openzeppelin.com/contracts/5.x/api/proxy#beacon
|
|
370
381
|
**/
|
|
371
382
|
async ensureWithBeacon<
|
|
372
383
|
T extends (TContract & { initialize?: TInit }),
|
|
373
|
-
TInit extends
|
|
384
|
+
TInit extends TFunction
|
|
374
385
|
>(
|
|
375
386
|
CtorImpl: Constructor<T>,
|
|
376
387
|
opts: TConstructorArgs<T> & TDeploymentOptions & {
|
|
@@ -379,7 +390,7 @@ export class Deployments {
|
|
|
379
390
|
initialize?: ParametersFromSecond<T['initialize']>
|
|
380
391
|
}
|
|
381
392
|
): Promise<{
|
|
382
|
-
//
|
|
393
|
+
// The implementation contract with the address set to the Beacon proxy.
|
|
383
394
|
contract: T
|
|
384
395
|
contractReceipt?: TEth.TxReceipt
|
|
385
396
|
contractDeployment: IDeployment
|
|
@@ -390,7 +401,7 @@ export class Deployments {
|
|
|
390
401
|
contractBeaconProxyDeployment: IDeployment
|
|
391
402
|
}> {
|
|
392
403
|
|
|
393
|
-
$require.notEmpty(opts?.id, `ID is required for Beacon deployment, as
|
|
404
|
+
$require.notEmpty(opts?.id, `ID is required for Beacon deployment, as the implementation can have multiple Beacons`);
|
|
394
405
|
|
|
395
406
|
let beaconProxyId = opts.id;
|
|
396
407
|
let implId = beaconProxyId.includes('/')
|
|
@@ -426,7 +437,9 @@ export class Deployments {
|
|
|
426
437
|
deployments: this,
|
|
427
438
|
implementation: {
|
|
428
439
|
address: implementationAddress,
|
|
429
|
-
initData: data
|
|
440
|
+
initData: data,
|
|
441
|
+
// @TODO Implement migrations for Beacons.
|
|
442
|
+
migrationData: null
|
|
430
443
|
}
|
|
431
444
|
});
|
|
432
445
|
|
|
@@ -461,7 +474,7 @@ export class Deployments {
|
|
|
461
474
|
return true;
|
|
462
475
|
}
|
|
463
476
|
|
|
464
|
-
//
|
|
477
|
+
// Recheck v1.
|
|
465
478
|
if (deployment.bytecodeHash != null) {
|
|
466
479
|
let address = deployment.implementation ?? deployment.address;
|
|
467
480
|
let bytecode = await this.client.getCode(address);
|
|
@@ -479,8 +492,8 @@ export class Deployments {
|
|
|
479
492
|
let [ localDiff, onchainDiff ] = Str.getDifference(bytecodeLocal, bytecodeOnchain);
|
|
480
493
|
if (localDiff === '' || /^0+$/.test(localDiff)) {
|
|
481
494
|
this._logger.log(`${deployment.id} bytecode has only immutable data diff, assume unchanged`);
|
|
482
|
-
// Local deployedBytecode
|
|
483
|
-
//
|
|
495
|
+
// Local deployedBytecode does not contain immutable data.
|
|
496
|
+
// Instead, solc generates bytecode with 0 as the placeholder.
|
|
484
497
|
return true;
|
|
485
498
|
}
|
|
486
499
|
}
|
|
@@ -557,19 +570,19 @@ export class Deployments {
|
|
|
557
570
|
|
|
558
571
|
|
|
559
572
|
/**
|
|
560
|
-
* A simple method to configure
|
|
573
|
+
* A simple method to configure contract state.
|
|
561
574
|
*/
|
|
562
575
|
public async configure<T extends TContract, TValue>(Ctor: Constructor<T> | T, opts: {
|
|
563
576
|
id?: string;
|
|
564
577
|
|
|
565
|
-
// Latest value
|
|
578
|
+
// Latest value. If it differs from current, the updater will be executed.
|
|
566
579
|
value?: TValue
|
|
567
580
|
// Current value.
|
|
568
581
|
current?: TValue | Promise<TValue> | ((x: T) => Promise<TValue>);
|
|
569
582
|
shouldUpdate?: boolean | (() => boolean | Promise<boolean>)
|
|
570
583
|
updater: (x: T, value: TValue) => Promise<any>
|
|
571
584
|
|
|
572
|
-
//
|
|
585
|
+
// Logged with the old and new values.
|
|
573
586
|
title?: string
|
|
574
587
|
}) {
|
|
575
588
|
let x: T;
|
|
@@ -611,9 +624,19 @@ export class Deployments {
|
|
|
611
624
|
}
|
|
612
625
|
}
|
|
613
626
|
|
|
614
|
-
|
|
615
|
-
type
|
|
616
|
-
|
|
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[];
|
|
635
|
+
} & {
|
|
636
|
+
[K in Extract<keyof T, TInitializerName>]?: T[K] extends TFunction
|
|
637
|
+
? ParametersFromSecond<T[K]>
|
|
638
|
+
: never;
|
|
639
|
+
};
|
|
617
640
|
|
|
618
641
|
type TContract = ContractBase & { $constructor?: (...args: any[]) => any }
|
|
619
642
|
type TConstructorArgs<T extends TContract> = T['$constructor'] extends Function ? {
|
|
@@ -639,7 +662,7 @@ function isEqual(a, b) {
|
|
|
639
662
|
// Not strictly equal
|
|
640
663
|
return a == b;
|
|
641
664
|
}
|
|
642
|
-
//
|
|
665
|
+
// Check arrays.
|
|
643
666
|
if (Array.isArray(a) || Array.isArray(b)) {
|
|
644
667
|
if (a.length !== b.length) {
|
|
645
668
|
return false;
|
|
@@ -648,7 +671,7 @@ function isEqual(a, b) {
|
|
|
648
671
|
return isEqual(x, b[i]);
|
|
649
672
|
});
|
|
650
673
|
}
|
|
651
|
-
//
|
|
674
|
+
// Check objects.
|
|
652
675
|
for (let key in a) {
|
|
653
676
|
let aValue = a[key];
|
|
654
677
|
let bValue = b[key];
|
|
@@ -658,7 +681,7 @@ function isEqual(a, b) {
|
|
|
658
681
|
}
|
|
659
682
|
for (let key in b) {
|
|
660
683
|
if (key in a === false && b[key] != null) {
|
|
661
|
-
//
|
|
684
|
+
// Value is present in b, but not in a.
|
|
662
685
|
return false;
|
|
663
686
|
}
|
|
664
687
|
}
|
|
@@ -678,9 +701,34 @@ function serializeInitData(id: string, contract: ContractBase, initializeParams:
|
|
|
678
701
|
}
|
|
679
702
|
|
|
680
703
|
|
|
704
|
+
function serializeMigrationData(id: string, contract: ContractBase, opts: any) {
|
|
705
|
+
let rgx = /^initializeV(?<version>[\d+])$/;
|
|
706
|
+
let migrations = contract
|
|
707
|
+
.abi
|
|
708
|
+
.map(x => rgx.exec(x.name))
|
|
709
|
+
.filter(x => x != null)
|
|
710
|
+
.map(match => Number(match.groups.version))
|
|
711
|
+
;
|
|
712
|
+
if (migrations.length === 0) {
|
|
713
|
+
return { migrationData: null, migrationV: 1 };
|
|
714
|
+
}
|
|
715
|
+
let v = alot(migrations).max(x => x);
|
|
716
|
+
let key = `initializeV${v}`;
|
|
717
|
+
let migrationAbi = contract.abi.find(x => x.name === key);
|
|
718
|
+
let migrationParams = opts?.[key] ?? [];
|
|
719
|
+
if (migrationParams?.length !== migrationAbi.inputs.length) {
|
|
720
|
+
throw new Error(`Wrong number of arguments (${migrationParams?.length}) for initializer method (${migrationAbi.inputs.length}) in ${id}.`);
|
|
721
|
+
}
|
|
722
|
+
return {
|
|
723
|
+
migrationData: $abiUtils.serializeMethodCallData(migrationAbi, migrationParams ?? []),
|
|
724
|
+
migrationV: v
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
|
|
681
729
|
/**
|
|
682
|
-
*
|
|
683
|
-
* "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.
|
|
684
732
|
*/
|
|
685
733
|
function getImplementationId (Ctor: Constructor<TContract>) {
|
|
686
734
|
let id = Ctor.name;
|
|
@@ -691,6 +739,15 @@ function getImplementationId (Ctor: Constructor<TContract>) {
|
|
|
691
739
|
return id;
|
|
692
740
|
}
|
|
693
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
|
+
|
|
694
751
|
namespace Str {
|
|
695
752
|
export function getDifference (a: TEth.Hex, b: TEth.Hex) {
|
|
696
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
|
-
//
|
|
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
|
-
//
|
|
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
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
/**
|
|
242
|
+
/** Throws an error if memory is not extendable. */
|
|
243
243
|
ARRAY_LENGTH_MISMATCH = 'ARRAY_LENGTH_MISMATCH',
|
|
244
244
|
|
|
245
|
-
/**
|
|
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)
|
|
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
|
-
//
|
|
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
|
|
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
|
|
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
|
}
|