dequanto 0.0.1 → 0.0.7
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/.circleci/config.yml +28 -0
- package/actions/contracts.act.ts +50 -0
- package/actions/logs.act.ts +7 -0
- package/actions/safe.act.ts +7 -0
- package/actions/tokens.act.ts +20 -2
- package/configs/defi.yml +24 -0
- package/configs/dequanto.yml +49 -2
- package/contracts/abi/gnosis/GnosisSafe.json +979 -0
- package/contracts/gen/base/{ERC20Base.ts → ERC20Base/ERC20Base.ts} +136 -90
- package/contracts/gen/eth/WETHBase.ts +35 -35
- package/contracts/gnosis/GnosisSafe.ts +750 -0
- package/contracts/openzeppelin/AccessControl.json +206 -0
- package/contracts/openzeppelin/AccessControl.ts +236 -0
- package/contracts/openzeppelin/AccessControlCrossChain.json +219 -0
- package/contracts/openzeppelin/AccessControlCrossChain.ts +247 -0
- package/contracts/openzeppelin/AccessControlEnumerable.json +249 -0
- package/contracts/openzeppelin/AccessControlEnumerable.ts +258 -0
- package/contracts/openzeppelin/Address.json +1 -0
- package/contracts/openzeppelin/Address.ts +83 -0
- package/contracts/openzeppelin/Arrays.json +1 -0
- package/contracts/openzeppelin/Arrays.ts +83 -0
- package/contracts/openzeppelin/Base64.json +1 -0
- package/contracts/openzeppelin/Base64.ts +83 -0
- package/contracts/openzeppelin/BeaconProxy.json +71 -0
- package/contracts/openzeppelin/BeaconProxy.ts +163 -0
- package/contracts/openzeppelin/BitMaps.json +1 -0
- package/contracts/openzeppelin/BitMaps.ts +83 -0
- package/contracts/openzeppelin/Checkpoints.json +1 -0
- package/contracts/openzeppelin/Checkpoints.ts +83 -0
- package/contracts/openzeppelin/Clones.json +1 -0
- package/contracts/openzeppelin/Clones.ts +83 -0
- package/contracts/openzeppelin/ConditionalEscrow.json +156 -0
- package/contracts/openzeppelin/ConditionalEscrow.ts +236 -0
- package/contracts/openzeppelin/Context.json +1 -0
- package/contracts/openzeppelin/Context.ts +83 -0
- package/contracts/openzeppelin/Counters.json +1 -0
- package/contracts/openzeppelin/Counters.ts +83 -0
- package/contracts/openzeppelin/Create2.json +1 -0
- package/contracts/openzeppelin/Create2.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabled.json +1 -0
- package/contracts/openzeppelin/CrossChainEnabled.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledAMB.json +13 -0
- package/contracts/openzeppelin/CrossChainEnabledAMB.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledArbitrumL1.json +1 -0
- package/contracts/openzeppelin/CrossChainEnabledArbitrumL1.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledArbitrumL2.json +1 -0
- package/contracts/openzeppelin/CrossChainEnabledArbitrumL2.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledOptimism.json +1 -0
- package/contracts/openzeppelin/CrossChainEnabledOptimism.ts +83 -0
- package/contracts/openzeppelin/CrossChainEnabledPolygonChild.json +30 -0
- package/contracts/openzeppelin/CrossChainEnabledPolygonChild.ts +90 -0
- package/contracts/openzeppelin/DoubleEndedQueue.json +12 -0
- package/contracts/openzeppelin/DoubleEndedQueue.ts +83 -0
- package/contracts/openzeppelin/ECDSA.json +1 -0
- package/contracts/openzeppelin/ECDSA.ts +83 -0
- package/contracts/openzeppelin/EIP712.json +1 -0
- package/contracts/openzeppelin/EIP712.ts +83 -0
- package/contracts/openzeppelin/ERC1155.json +325 -0
- package/contracts/openzeppelin/ERC1155.ts +276 -0
- package/contracts/openzeppelin/ERC1155Burnable.json +360 -0
- package/contracts/openzeppelin/ERC1155Burnable.ts +298 -0
- package/contracts/openzeppelin/ERC1155Holder.json +99 -0
- package/contracts/openzeppelin/ERC1155Holder.ts +112 -0
- package/contracts/openzeppelin/ERC1155Pausable.json +353 -0
- package/contracts/openzeppelin/ERC1155Pausable.ts +345 -0
- package/contracts/openzeppelin/ERC1155PresetMinterPauser.json +734 -0
- package/contracts/openzeppelin/ERC1155PresetMinterPauser.ts +608 -0
- package/contracts/openzeppelin/ERC1155Receiver.json +99 -0
- package/contracts/openzeppelin/ERC1155Receiver.ts +112 -0
- package/contracts/openzeppelin/ERC1155Supply.json +352 -0
- package/contracts/openzeppelin/ERC1155Supply.ts +298 -0
- package/contracts/openzeppelin/ERC1155URIStorage.json +314 -0
- package/contracts/openzeppelin/ERC1155URIStorage.ts +276 -0
- package/contracts/openzeppelin/ERC165.json +21 -0
- package/contracts/openzeppelin/ERC165.ts +90 -0
- package/contracts/openzeppelin/ERC165Checker.json +1 -0
- package/contracts/openzeppelin/ERC165Checker.ts +83 -0
- package/contracts/openzeppelin/ERC165Storage.json +21 -0
- package/contracts/openzeppelin/ERC165Storage.ts +90 -0
- package/contracts/openzeppelin/ERC1820Implementer.json +26 -0
- package/contracts/openzeppelin/ERC1820Implementer.ts +90 -0
- package/contracts/openzeppelin/ERC1967Proxy.json +71 -0
- package/contracts/openzeppelin/ERC1967Proxy.ts +163 -0
- package/contracts/openzeppelin/ERC1967Upgrade.json +47 -0
- package/contracts/openzeppelin/ERC1967Upgrade.ts +163 -0
- package/contracts/openzeppelin/ERC20.json +288 -0
- package/contracts/openzeppelin/ERC20.ts +251 -0
- package/contracts/openzeppelin/ERC20Burnable.json +303 -0
- package/contracts/openzeppelin/ERC20Burnable.ts +273 -0
- package/contracts/openzeppelin/ERC20Capped.json +285 -0
- package/contracts/openzeppelin/ERC20Capped.ts +262 -0
- package/contracts/openzeppelin/ERC20FlashMint.json +349 -0
- package/contracts/openzeppelin/ERC20FlashMint.ts +284 -0
- package/contracts/openzeppelin/ERC20Pausable.json +311 -0
- package/contracts/openzeppelin/ERC20Pausable.ts +320 -0
- package/contracts/openzeppelin/ERC20Permit.json +347 -0
- package/contracts/openzeppelin/ERC20Permit.ts +284 -0
- package/contracts/openzeppelin/ERC20PresetFixedSupply.json +329 -0
- package/contracts/openzeppelin/ERC20PresetFixedSupply.ts +273 -0
- package/contracts/openzeppelin/ERC20PresetMinterPauser.json +663 -0
- package/contracts/openzeppelin/ERC20PresetMinterPauser.ts +583 -0
- package/contracts/openzeppelin/ERC20Snapshot.json +328 -0
- package/contracts/openzeppelin/ERC20Snapshot.ts +302 -0
- package/contracts/openzeppelin/ERC20Votes.json +584 -0
- package/contracts/openzeppelin/ERC20Votes.ts +430 -0
- package/contracts/openzeppelin/ERC20VotesComp.json +627 -0
- package/contracts/openzeppelin/ERC20VotesComp.ts +452 -0
- package/contracts/openzeppelin/ERC20Wrapper.json +333 -0
- package/contracts/openzeppelin/ERC20Wrapper.ts +284 -0
- package/contracts/openzeppelin/ERC2771Context.json +21 -0
- package/contracts/openzeppelin/ERC2771Context.ts +90 -0
- package/contracts/openzeppelin/ERC2981.json +50 -0
- package/contracts/openzeppelin/ERC2981.ts +101 -0
- package/contracts/openzeppelin/ERC4626.json +662 -0
- package/contracts/openzeppelin/ERC4626.ts +485 -0
- package/contracts/openzeppelin/ERC721.json +348 -0
- package/contracts/openzeppelin/ERC721.ts +295 -0
- package/contracts/openzeppelin/ERC721Burnable.json +345 -0
- package/contracts/openzeppelin/ERC721Burnable.ts +306 -0
- package/contracts/openzeppelin/ERC721Enumerable.json +388 -0
- package/contracts/openzeppelin/ERC721Enumerable.ts +328 -0
- package/contracts/openzeppelin/ERC721Holder.json +36 -0
- package/contracts/openzeppelin/ERC721Holder.ts +90 -0
- package/contracts/openzeppelin/ERC721Pausable.json +371 -0
- package/contracts/openzeppelin/ERC721Pausable.ts +364 -0
- package/contracts/openzeppelin/ERC721PresetMinterPauserAutoId.json +742 -0
- package/contracts/openzeppelin/ERC721PresetMinterPauserAutoId.ts +638 -0
- package/contracts/openzeppelin/ERC721Royalty.json +361 -0
- package/contracts/openzeppelin/ERC721Royalty.ts +306 -0
- package/contracts/openzeppelin/ERC721URIStorage.json +332 -0
- package/contracts/openzeppelin/ERC721URIStorage.ts +295 -0
- package/contracts/openzeppelin/ERC721Votes.json +546 -0
- package/contracts/openzeppelin/ERC721Votes.ts +441 -0
- package/contracts/openzeppelin/ERC777.json +578 -0
- package/contracts/openzeppelin/ERC777.ts +473 -0
- package/contracts/openzeppelin/ERC777PresetFixedSupply.json +588 -0
- package/contracts/openzeppelin/ERC777PresetFixedSupply.ts +473 -0
- package/contracts/openzeppelin/EnumerableMap.json +1 -0
- package/contracts/openzeppelin/EnumerableMap.ts +83 -0
- package/contracts/openzeppelin/EnumerableSet.json +1 -0
- package/contracts/openzeppelin/EnumerableSet.ts +83 -0
- package/contracts/openzeppelin/Escrow.json +137 -0
- package/contracts/openzeppelin/Escrow.ts +225 -0
- package/contracts/openzeppelin/Governor.json +866 -0
- package/contracts/openzeppelin/Governor.ts +525 -0
- package/contracts/openzeppelin/GovernorCompatibilityBravo.json +1181 -0
- package/contracts/openzeppelin/GovernorCompatibilityBravo.ts +654 -0
- package/contracts/openzeppelin/GovernorCountingSimple.json +895 -0
- package/contracts/openzeppelin/GovernorCountingSimple.ts +536 -0
- package/contracts/openzeppelin/GovernorPreventLateQuorum.json +930 -0
- package/contracts/openzeppelin/GovernorPreventLateQuorum.ts +605 -0
- package/contracts/openzeppelin/GovernorProposalThreshold.json +866 -0
- package/contracts/openzeppelin/GovernorProposalThreshold.ts +525 -0
- package/contracts/openzeppelin/GovernorSettings.json +962 -0
- package/contracts/openzeppelin/GovernorSettings.ts +645 -0
- package/contracts/openzeppelin/GovernorTimelockCompound.json +990 -0
- package/contracts/openzeppelin/GovernorTimelockCompound.ts +638 -0
- package/contracts/openzeppelin/GovernorTimelockControl.json +983 -0
- package/contracts/openzeppelin/GovernorTimelockControl.ts +627 -0
- package/contracts/openzeppelin/GovernorVotes.json +879 -0
- package/contracts/openzeppelin/GovernorVotes.ts +536 -0
- package/contracts/openzeppelin/GovernorVotesComp.json +879 -0
- package/contracts/openzeppelin/GovernorVotesComp.ts +536 -0
- package/contracts/openzeppelin/GovernorVotesQuorumFraction.json +937 -0
- package/contracts/openzeppelin/GovernorVotesQuorumFraction.ts +598 -0
- package/contracts/openzeppelin/IAMB.json +327 -0
- package/contracts/openzeppelin/IAMB.ts +331 -0
- package/contracts/openzeppelin/IAccessControl.json +174 -0
- package/contracts/openzeppelin/IAccessControl.ts +214 -0
- package/contracts/openzeppelin/IAccessControlEnumerable.json +217 -0
- package/contracts/openzeppelin/IAccessControlEnumerable.ts +236 -0
- package/contracts/openzeppelin/IArbSys.json +270 -0
- package/contracts/openzeppelin/IArbSys.ts +233 -0
- package/contracts/openzeppelin/IBeacon.json +15 -0
- package/contracts/openzeppelin/IBeacon.ts +90 -0
- package/contracts/openzeppelin/IBridge.json +296 -0
- package/contracts/openzeppelin/IBridge.ts +287 -0
- package/contracts/openzeppelin/ICompoundTimelock.json +415 -0
- package/contracts/openzeppelin/ICompoundTimelock.ts +389 -0
- package/contracts/openzeppelin/ICrossDomainMessenger.json +101 -0
- package/contracts/openzeppelin/ICrossDomainMessenger.ts +181 -0
- package/contracts/openzeppelin/IERC1155.json +295 -0
- package/contracts/openzeppelin/IERC1155.ts +265 -0
- package/contracts/openzeppelin/IERC1155MetadataURI.json +314 -0
- package/contracts/openzeppelin/IERC1155MetadataURI.ts +276 -0
- package/contracts/openzeppelin/IERC1155Receiver.json +99 -0
- package/contracts/openzeppelin/IERC1155Receiver.ts +112 -0
- package/contracts/openzeppelin/IERC1271.json +26 -0
- package/contracts/openzeppelin/IERC1271.ts +90 -0
- package/contracts/openzeppelin/IERC1363.json +373 -0
- package/contracts/openzeppelin/IERC1363.ts +252 -0
- package/contracts/openzeppelin/IERC1363Receiver.json +36 -0
- package/contracts/openzeppelin/IERC1363Receiver.ts +90 -0
- package/contracts/openzeppelin/IERC1363Spender.json +31 -0
- package/contracts/openzeppelin/IERC1363Spender.ts +90 -0
- package/contracts/openzeppelin/IERC165.json +21 -0
- package/contracts/openzeppelin/IERC165.ts +90 -0
- package/contracts/openzeppelin/IERC1820Implementer.json +26 -0
- package/contracts/openzeppelin/IERC1820Implementer.ts +90 -0
- package/contracts/openzeppelin/IERC1820Registry.json +215 -0
- package/contracts/openzeppelin/IERC1820Registry.ts +218 -0
- package/contracts/openzeppelin/IERC1822Proxiable.json +15 -0
- package/contracts/openzeppelin/IERC1822Proxiable.ts +90 -0
- package/contracts/openzeppelin/IERC20.json +185 -0
- package/contracts/openzeppelin/IERC20.ts +196 -0
- package/contracts/openzeppelin/IERC20Metadata.json +224 -0
- package/contracts/openzeppelin/IERC20Metadata.ts +229 -0
- package/contracts/openzeppelin/IERC20Permit.json +77 -0
- package/contracts/openzeppelin/IERC20Permit.ts +112 -0
- package/contracts/openzeppelin/IERC2612.json +77 -0
- package/contracts/openzeppelin/IERC2612.ts +112 -0
- package/contracts/openzeppelin/IERC2981.json +50 -0
- package/contracts/openzeppelin/IERC2981.ts +101 -0
- package/contracts/openzeppelin/IERC3156FlashBorrower.json +41 -0
- package/contracts/openzeppelin/IERC3156FlashBorrower.ts +90 -0
- package/contracts/openzeppelin/IERC3156FlashLender.json +79 -0
- package/contracts/openzeppelin/IERC3156FlashLender.ts +112 -0
- package/contracts/openzeppelin/IERC4626.json +614 -0
- package/contracts/openzeppelin/IERC4626.ts +463 -0
- package/contracts/openzeppelin/IERC721.json +287 -0
- package/contracts/openzeppelin/IERC721.ts +262 -0
- package/contracts/openzeppelin/IERC721Enumerable.json +343 -0
- package/contracts/openzeppelin/IERC721Enumerable.ts +295 -0
- package/contracts/openzeppelin/IERC721Metadata.json +332 -0
- package/contracts/openzeppelin/IERC721Metadata.ts +295 -0
- package/contracts/openzeppelin/IERC721Receiver.json +36 -0
- package/contracts/openzeppelin/IERC721Receiver.ts +90 -0
- package/contracts/openzeppelin/IERC777.json +393 -0
- package/contracts/openzeppelin/IERC777.ts +360 -0
- package/contracts/openzeppelin/IERC777Recipient.json +40 -0
- package/contracts/openzeppelin/IERC777Recipient.ts +90 -0
- package/contracts/openzeppelin/IERC777Sender.json +40 -0
- package/contracts/openzeppelin/IERC777Sender.ts +90 -0
- package/contracts/openzeppelin/IFxMessageProcessor.json +25 -0
- package/contracts/openzeppelin/IFxMessageProcessor.ts +90 -0
- package/contracts/openzeppelin/IGovernor.json +683 -0
- package/contracts/openzeppelin/IGovernor.ts +448 -0
- package/contracts/openzeppelin/IGovernorCompatibilityBravo.json +913 -0
- package/contracts/openzeppelin/IGovernorCompatibilityBravo.ts +522 -0
- package/contracts/openzeppelin/IGovernorTimelock.json +768 -0
- package/contracts/openzeppelin/IGovernorTimelock.ts +510 -0
- package/contracts/openzeppelin/IInbox.json +377 -0
- package/contracts/openzeppelin/IInbox.ts +273 -0
- package/contracts/openzeppelin/IMessageProvider.json +34 -0
- package/contracts/openzeppelin/IMessageProvider.ts +134 -0
- package/contracts/openzeppelin/IOutbox.json +179 -0
- package/contracts/openzeppelin/IOutbox.ts +218 -0
- package/contracts/openzeppelin/IVotes.json +184 -0
- package/contracts/openzeppelin/IVotes.ts +196 -0
- package/contracts/openzeppelin/Initializable.json +15 -0
- package/contracts/openzeppelin/Initializable.ts +105 -0
- package/contracts/openzeppelin/LibAMB.json +1 -0
- package/contracts/openzeppelin/LibAMB.ts +83 -0
- package/contracts/openzeppelin/LibArbitrumL1.json +1 -0
- package/contracts/openzeppelin/LibArbitrumL1.ts +83 -0
- package/contracts/openzeppelin/LibArbitrumL2.json +15 -0
- package/contracts/openzeppelin/LibArbitrumL2.ts +90 -0
- package/contracts/openzeppelin/LibOptimism.json +1 -0
- package/contracts/openzeppelin/LibOptimism.ts +83 -0
- package/contracts/openzeppelin/Math.json +1 -0
- package/contracts/openzeppelin/Math.ts +83 -0
- package/contracts/openzeppelin/MerkleProof.json +1 -0
- package/contracts/openzeppelin/MerkleProof.ts +83 -0
- package/contracts/openzeppelin/MinimalForwarder.json +143 -0
- package/contracts/openzeppelin/MinimalForwarder.ts +112 -0
- package/contracts/openzeppelin/Multicall.json +21 -0
- package/contracts/openzeppelin/Multicall.ts +90 -0
- package/contracts/openzeppelin/Ownable.json +54 -0
- package/contracts/openzeppelin/Ownable.ts +134 -0
- package/contracts/openzeppelin/Pausable.json +41 -0
- package/contracts/openzeppelin/Pausable.ts +141 -0
- package/contracts/openzeppelin/PaymentSplitter.json +304 -0
- package/contracts/openzeppelin/PaymentSplitter.ts +281 -0
- package/contracts/openzeppelin/Proxy.json +10 -0
- package/contracts/openzeppelin/Proxy.ts +83 -0
- package/contracts/openzeppelin/ProxyAdmin.json +151 -0
- package/contracts/openzeppelin/ProxyAdmin.ts +189 -0
- package/contracts/openzeppelin/PullPayment.json +34 -0
- package/contracts/openzeppelin/PullPayment.ts +101 -0
- package/contracts/openzeppelin/ReentrancyGuard.json +1 -0
- package/contracts/openzeppelin/ReentrancyGuard.ts +83 -0
- package/contracts/openzeppelin/RefundEscrow.json +226 -0
- package/contracts/openzeppelin/RefundEscrow.ts +349 -0
- package/contracts/openzeppelin/SafeCast.json +1 -0
- package/contracts/openzeppelin/SafeCast.ts +83 -0
- package/contracts/openzeppelin/SafeERC20.json +1 -0
- package/contracts/openzeppelin/SafeERC20.ts +83 -0
- package/contracts/openzeppelin/SafeMath.json +1 -0
- package/contracts/openzeppelin/SafeMath.ts +83 -0
- package/contracts/openzeppelin/SignatureChecker.json +1 -0
- package/contracts/openzeppelin/SignatureChecker.ts +83 -0
- package/contracts/openzeppelin/SignedMath.json +1 -0
- package/contracts/openzeppelin/SignedMath.ts +83 -0
- package/contracts/openzeppelin/SignedSafeMath.json +1 -0
- package/contracts/openzeppelin/SignedSafeMath.ts +83 -0
- package/contracts/openzeppelin/StorageSlot.json +1 -0
- package/contracts/openzeppelin/StorageSlot.ts +83 -0
- package/contracts/openzeppelin/Strings.json +1 -0
- package/contracts/openzeppelin/Strings.ts +83 -0
- package/contracts/openzeppelin/TimelockController.json +867 -0
- package/contracts/openzeppelin/TimelockController.ts +583 -0
- package/contracts/openzeppelin/Timers.json +1 -0
- package/contracts/openzeppelin/Timers.ts +83 -0
- package/contracts/openzeppelin/TokenTimelock.json +69 -0
- package/contracts/openzeppelin/TokenTimelock.ts +123 -0
- package/contracts/openzeppelin/TransparentUpgradeableProxy.json +146 -0
- package/contracts/openzeppelin/TransparentUpgradeableProxy.ts +214 -0
- package/contracts/openzeppelin/UUPSUpgradeable.json +91 -0
- package/contracts/openzeppelin/UUPSUpgradeable.ts +192 -0
- package/contracts/openzeppelin/UpgradeableBeacon.json +104 -0
- package/contracts/openzeppelin/UpgradeableBeacon.ts +185 -0
- package/contracts/openzeppelin/VestingWallet.json +193 -0
- package/contracts/openzeppelin/VestingWallet.ts +208 -0
- package/contracts/openzeppelin/Votes.json +216 -0
- package/contracts/openzeppelin/Votes.ts +218 -0
- package/data/evm/eventHashes.json +19314 -0
- package/data/evm/events.json +19314 -0
- package/data/evm/functionHashes.json +121138 -0
- package/data/evm/functions.json +121140 -0
- package/data/tokens/coingecko.json +137409 -0
- package/dist/contracts/gen/base/ERC20Base/ERC20Base.js +94 -0
- package/dist/contracts/gnosis/GnosisSafe.js +357 -0
- package/dist/src/BlockchainExplorer/BlockChainExplorerFactory.js +114 -20
- package/dist/src/BlockchainExplorer/BlockChainExplorerProvider.js +8 -0
- package/dist/src/BlockchainExplorer/Bscscan.js +1 -0
- package/dist/src/BlockchainExplorer/Etherscan.js +14 -4
- package/dist/src/BlockchainExplorer/Evmscan.js +9 -0
- package/dist/src/BlockchainExplorer/Polyscan.js +1 -0
- package/dist/src/ChainAccountProvider.js +89 -0
- package/dist/src/ChainAccountsService.js +20 -2
- package/dist/src/Config.js +76 -0
- package/dist/src/blocks/BlockDateResolver.js +9 -8
- package/dist/src/bridges/hop/HopBridge.js +5 -2
- package/dist/src/chains/PlatformFactory.js +2 -2
- package/dist/src/chains/arbitrum/ArbWeb3Client.js +5 -24
- package/dist/src/chains/arbitrum/TokensServiceArbitrum.js +18 -0
- package/dist/src/chains/boba/BobaWeb3Client.js +5 -33
- package/dist/src/chains/xdai/XDaiWeb3Client.js +6 -30
- package/dist/src/class/SubjectKind.js +9 -0
- package/dist/src/class/SubjectStream.js +104 -0
- package/dist/src/class/Subscription.js +13 -0
- package/dist/src/clients/BscWeb3Client.js +5 -24
- package/dist/src/clients/ClientEventsStream.js +62 -18
- package/dist/src/clients/ClientPool.js +115 -55
- package/dist/src/clients/EthWeb3Client.js +7 -22
- package/dist/src/clients/EvmWeb3Client.js +25 -0
- package/dist/src/clients/HardhatWeb3Client.js +19 -40
- package/dist/src/clients/PolyWeb3Client.js +5 -51
- package/dist/src/clients/Web3Client.js +355 -10
- package/dist/src/clients/Web3ClientFactory.js +15 -0
- package/dist/src/clients/debug/ClientDebugMethods.js +64 -0
- package/dist/src/clients/utils/ClientEndpoints.js +6 -0
- package/dist/src/clients/utils/TxFactory.js +7 -12
- package/dist/src/contracts/Contract.js +2 -1
- package/dist/src/contracts/ContractAbiProvider.js +58 -0
- package/dist/src/contracts/ContractBase.js +161 -26
- package/dist/src/contracts/ContractReader.js +78 -2
- package/dist/src/contracts/ContractStorageReaderBase.js +15 -0
- package/dist/src/contracts/ContractStream.js +21 -8
- package/dist/src/contracts/ContractWriter.js +47 -20
- package/dist/src/contracts/TxContract.js +6 -3
- package/dist/src/contracts/common/ERC20.js +1 -1
- package/dist/src/contracts/utils/AbiDeserializer.js +15 -5
- package/dist/src/contracts/utils/InputDataUtils.js +5 -2
- package/dist/src/env/BigIntSerializer.js +2 -1
- package/dist/src/evm/EVM.js +214 -0
- package/dist/src/evm/OpcodesWalker.js +137 -0
- package/dist/src/evm/Stack.js +57 -0
- package/dist/src/evm/interfaces/IJumps.js +2 -0
- package/dist/src/evm/interfaces/IMemory.js +2 -0
- package/dist/src/evm/interfaces/IOpcode.js +2 -0
- package/dist/src/evm/interfaces/IStorage.js +2 -0
- package/dist/src/evm/opcodes/add.js +50 -0
- package/dist/src/evm/opcodes/addmod.js +19 -0
- package/dist/src/evm/opcodes/address.js +17 -0
- package/dist/src/evm/opcodes/and.js +56 -0
- package/dist/src/evm/opcodes/balance.js +22 -0
- package/dist/src/evm/opcodes/blockhash.js +22 -0
- package/dist/src/evm/opcodes/byte.js +30 -0
- package/dist/src/evm/opcodes/call.js +48 -0
- package/dist/src/evm/opcodes/callcode.js +48 -0
- package/dist/src/evm/opcodes/calldatacopy.js +27 -0
- package/dist/src/evm/opcodes/calldataload.js +33 -0
- package/dist/src/evm/opcodes/calldatasize.js +16 -0
- package/dist/src/evm/opcodes/caller.js +17 -0
- package/dist/src/evm/opcodes/callvalue.js +16 -0
- package/dist/src/evm/opcodes/codecopy.js +31 -0
- package/dist/src/evm/opcodes/codesize.js +16 -0
- package/dist/src/evm/opcodes/coinbase.js +16 -0
- package/dist/src/evm/opcodes/create.js +35 -0
- package/dist/src/evm/opcodes/create2.js +34 -0
- package/dist/src/evm/opcodes/delegatecall.js +44 -0
- package/dist/src/evm/opcodes/difficulty.js +16 -0
- package/dist/src/evm/opcodes/div.js +33 -0
- package/dist/src/evm/opcodes/dup.js +6 -0
- package/dist/src/evm/opcodes/eq.js +69 -0
- package/dist/src/evm/opcodes/exp.js +30 -0
- package/dist/src/evm/opcodes/extcodecopy.js +35 -0
- package/dist/src/evm/opcodes/extcodehash.js +22 -0
- package/dist/src/evm/opcodes/extcodesize.js +22 -0
- package/dist/src/evm/opcodes/gas.js +16 -0
- package/dist/src/evm/opcodes/gaslimit.js +16 -0
- package/dist/src/evm/opcodes/gasprice.js +16 -0
- package/dist/src/evm/opcodes/gt.js +36 -0
- package/dist/src/evm/opcodes/invalid.js +18 -0
- package/dist/src/evm/opcodes/iszero.js +51 -0
- package/dist/src/evm/opcodes/jump.js +66 -0
- package/dist/src/evm/opcodes/jumpdest.js +5 -0
- package/dist/src/evm/opcodes/jumpi.js +298 -0
- package/dist/src/evm/opcodes/log.js +74 -0
- package/dist/src/evm/opcodes/lt.js +36 -0
- package/dist/src/evm/opcodes/mload.js +28 -0
- package/dist/src/evm/opcodes/mod.js +30 -0
- package/dist/src/evm/opcodes/msize.js +16 -0
- package/dist/src/evm/opcodes/mstore.js +30 -0
- package/dist/src/evm/opcodes/mul.js +34 -0
- package/dist/src/evm/opcodes/mulmod.js +19 -0
- package/dist/src/evm/opcodes/not.js +28 -0
- package/dist/src/evm/opcodes/number.js +16 -0
- package/dist/src/evm/opcodes/or.js +30 -0
- package/dist/src/evm/opcodes/origin.js +16 -0
- package/dist/src/evm/opcodes/pc.js +5 -0
- package/dist/src/evm/opcodes/pop.js +5 -0
- package/dist/src/evm/opcodes/push.js +6 -0
- package/dist/src/evm/opcodes/return.js +70 -0
- package/dist/src/evm/opcodes/returndatacopy.js +31 -0
- package/dist/src/evm/opcodes/returndatasize.js +16 -0
- package/dist/src/evm/opcodes/revert.js +57 -0
- package/dist/src/evm/opcodes/sar.js +30 -0
- package/dist/src/evm/opcodes/selfdestruct.js +23 -0
- package/dist/src/evm/opcodes/sha3.js +56 -0
- package/dist/src/evm/opcodes/shl.js +35 -0
- package/dist/src/evm/opcodes/shr.js +30 -0
- package/dist/src/evm/opcodes/signextend.js +19 -0
- package/dist/src/evm/opcodes/sload.js +140 -0
- package/dist/src/evm/opcodes/sstore.js +189 -0
- package/dist/src/evm/opcodes/staticcall.js +44 -0
- package/dist/src/evm/opcodes/stop.js +17 -0
- package/dist/src/evm/opcodes/sub.js +30 -0
- package/dist/src/evm/opcodes/swap.js +6 -0
- package/dist/src/evm/opcodes/timestamp.js +16 -0
- package/dist/src/evm/opcodes/xor.js +30 -0
- package/dist/src/evm/opcodes.js +192 -0
- package/dist/src/evm/tx.class.js +154 -0
- package/dist/src/evm/utils/BigNumber.js +14 -0
- package/dist/src/evm/utils/hex.js +44 -0
- package/dist/src/evm/utils/opcodes.js +217 -0
- package/dist/src/evm/utils/stringify.js +14 -0
- package/dist/src/evm/utils/stringifyEvents.js +38 -0
- package/dist/src/evm/utils/stringifyFunctions.js +70 -0
- package/dist/src/evm/utils/stringifyInstructions.js +44 -0
- package/dist/src/evm/utils/stringifyMappings.js +62 -0
- package/dist/src/evm/utils/stringifyStructs.js +16 -0
- package/dist/src/evm/utils/stringifyVariables.js +33 -0
- package/dist/src/gen/ContractStorageReaderTemplate.js +11 -0
- package/dist/src/gen/Generator.js +37 -16
- package/dist/src/gen/GeneratorFromAbi.js +225 -72
- package/dist/src/gen/GeneratorStorageReader.js +89 -0
- package/dist/src/gen/utils/$gen.js +14 -0
- package/dist/src/gen/utils/Str.js +47 -0
- package/dist/src/hardhat/HardhatProvider.js +177 -0
- package/dist/src/indexer/BlocksTxIndexer.js +19 -7
- package/dist/src/indexer/handlers/BlocksWalker.js +65 -54
- package/dist/src/loggers/LoggerService.js +8 -5
- package/dist/src/models/TAccount.js +2 -0
- package/dist/src/ns/NameService.js +3 -0
- package/dist/src/ns/utils/$ns.js +6 -3
- package/dist/src/safe/$gnosis.js +23 -0
- package/dist/src/safe/GnosisSafeFactory.js +27 -0
- package/dist/src/safe/GnosisSafeHandler.js +361 -0
- package/dist/src/safe/transport/FileServiceTransport.js +92 -0
- package/dist/src/safe/transport/GnosisServiceTransport.js +78 -0
- package/dist/src/safe/transport/ISafeServiceTransport.js +2 -0
- package/dist/src/safe/transport/InMemoryServiceTransport.js +56 -0
- package/dist/src/solidity/SlotsParser.js +594 -0
- package/dist/src/solidity/SlotsStorage.js +158 -0
- package/dist/src/solidity/storage/Accessor.js +126 -0
- package/dist/src/solidity/storage/SlotDynamicArray.js +17 -0
- package/dist/src/solidity/storage/SlotFixedArray.js +28 -0
- package/dist/src/solidity/storage/SlotsStorageHandler.js +10 -0
- package/dist/src/solidity/storage/SlotsStorageTransport.js +126 -0
- package/dist/src/solidity/storage/handlers/SlotDynamicArrayHandler.js +47 -0
- package/dist/src/solidity/storage/handlers/SlotFixedArrayHandler.js +50 -0
- package/dist/src/solidity/storage/handlers/SlotMappingHandler.js +42 -0
- package/dist/src/solidity/storage/handlers/SlotStringHandler.js +109 -0
- package/dist/src/solidity/storage/handlers/SlotStructHandler.js +45 -0
- package/dist/src/solidity/storage/handlers/SlotValueHandler.js +30 -0
- package/dist/src/solidity/utils/$str.js +38 -0
- package/dist/src/solidity/utils/$types.js +22 -0
- package/dist/src/structs/PackedRanges.js +8 -1
- package/dist/src/tokens/TokenDataProvider.js +251 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js +3 -1
- package/dist/src/tokens/TokenExchanges/AmmV2ExchangeBase.js +4 -4
- package/dist/src/tokens/TokenExchanges/PancakeswapExchange.js +4 -7
- package/dist/src/tokens/TokenExchanges/SushiswapPolygonExchange.js +4 -5
- package/dist/src/tokens/TokenExchanges/UniswapExchange.js +4 -7
- package/dist/src/tokens/TokenOracles/AmmPriceV2Oracle.js +2 -4
- package/dist/src/tokens/TokenOracles/CoingeckoOracle.js +12 -0
- package/dist/src/tokens/TokenOracles/TokenPriceStore.js +1 -1
- package/dist/src/tokens/TokenProviders/TPChain.js +14 -7
- package/dist/src/tokens/TokenProviders/TPCoingecko.js +117 -0
- package/dist/src/tokens/TokenProviders/TPConfig.js +46 -0
- package/dist/src/tokens/TokenProviders/TPExplorer.js +35 -0
- package/dist/src/tokens/TokenService.js +5 -2
- package/dist/src/tokens/TokenTransferService.js +28 -18
- package/dist/src/tokens/TokensService.js +32 -177
- package/dist/src/tokens/TokensServiceFactory.js +13 -1
- package/dist/src/txs/TxDataBuilder.js +54 -22
- package/dist/src/txs/TxLogger.js +3 -3
- package/dist/src/txs/TxWriter.js +169 -37
- package/dist/src/txs/receipt/TxLogParser.js +11 -1
- package/dist/src/txs/receipt/TxLogsTransfer.js +14 -13
- package/dist/src/txs/receipt/TxTopicProvider.js +10 -6
- package/dist/src/txs/sig-transports/SigFileTransport.js +48 -0
- package/dist/src/utils/$abiParser.js +55 -20
- package/dist/src/utils/$abiType.js +184 -3
- package/dist/src/utils/$abiUtils.js +54 -5
- package/dist/src/utils/$account.js +30 -0
- package/dist/src/utils/$address.js +8 -0
- package/dist/src/utils/$bigint.js +52 -3
- package/dist/src/utils/$block.js +16 -0
- package/dist/src/utils/$bloom.js +42 -0
- package/dist/src/utils/$buffer.js +94 -0
- package/dist/src/utils/$cli.js +20 -0
- package/dist/src/utils/$color.js +171 -0
- package/dist/src/utils/$config.js +65 -5
- package/dist/src/utils/$const.js +4 -0
- package/dist/src/utils/$contract.js +20 -2
- package/dist/src/utils/$crypto.js +25 -0
- package/dist/src/utils/$csv.js +17 -27
- package/dist/src/utils/$date.js +129 -25
- package/dist/src/utils/$gas.js +15 -0
- package/dist/src/utils/$hex.js +77 -0
- package/dist/src/utils/$is.js +24 -21
- package/dist/src/utils/$logger.js +56 -3
- package/dist/src/utils/$machine.js +77 -0
- package/dist/src/utils/$number.js +24 -1
- package/dist/src/utils/$path.js +17 -0
- package/dist/src/utils/$promise.js +81 -0
- package/dist/src/utils/$require.js +15 -1
- package/dist/src/utils/$secret.js +29 -0
- package/dist/src/utils/$sign.js +96 -14
- package/dist/src/utils/$signRaw.js +48 -0
- package/dist/src/utils/$signSerializer.js +5 -4
- package/dist/src/utils/$txData.js +19 -0
- package/hardhat.config.js +21 -1
- package/package.json +28 -14
- package/readme.md +21 -4
- package/src/BlockchainExplorer/BlockChainExplorerFactory.ts +149 -39
- package/src/BlockchainExplorer/BlockChainExplorerProvider.ts +10 -0
- package/src/BlockchainExplorer/Bscscan.ts +1 -0
- package/src/BlockchainExplorer/Etherscan.ts +17 -5
- package/src/BlockchainExplorer/Evmscan.ts +8 -0
- package/src/BlockchainExplorer/IBlockChainExplorer.ts +3 -2
- package/src/BlockchainExplorer/Polyscan.ts +1 -0
- package/src/ChainAccountProvider.ts +84 -0
- package/src/ChainAccountsService.ts +21 -2
- package/src/Config.ts +85 -0
- package/src/blocks/BlockDateResolver.ts +10 -12
- package/src/bridges/hop/HopBridge.ts +9 -2
- package/src/bridges/hop/contracts/polygon/Dai_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Dai_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Dai_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Eth_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Eth_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Eth_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Matic_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Matic_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Matic_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdc_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdc_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdc_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdt_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdt_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Usdt_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Wbtc_l2AmmWrapperContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Wbtc_l2BridgeContract.ts +35 -35
- package/src/bridges/hop/contracts/polygon/Wbtc_l2SaddleSwapContract.ts +35 -35
- package/src/bridges/models/IBridge.ts +1 -1
- package/src/chains/PlatformFactory.ts +3 -2
- package/src/chains/arbitrum/ArbWeb3Client.ts +7 -22
- package/src/chains/arbitrum/TokensServiceArbitrum.ts +19 -0
- package/src/chains/boba/BobaWeb3Client.ts +5 -33
- package/src/chains/xdai/XDaiWeb3Client.ts +6 -32
- package/src/class/SubjectKind.ts +5 -0
- package/src/class/SubjectStream.ts +111 -0
- package/src/class/Subscription.ts +7 -0
- package/src/clients/BscWeb3Client.ts +5 -22
- package/src/clients/ClientEventsStream.ts +86 -19
- package/src/clients/ClientPool.ts +145 -61
- package/src/clients/EthWeb3Client.ts +8 -21
- package/src/clients/EvmWeb3Client.ts +26 -0
- package/src/clients/HardhatWeb3Client.ts +17 -39
- package/src/clients/PolyWeb3Client.ts +5 -54
- package/src/clients/Web3Client.ts +430 -32
- package/src/clients/Web3ClientFactory.ts +17 -1
- package/src/clients/debug/ClientDebugMethods.ts +75 -0
- package/src/clients/interfaces/IWeb3Client.ts +33 -5
- package/src/clients/interfaces/IWeb3EndpointOptions.ts +6 -0
- package/src/clients/utils/ClientEndpoints.ts +6 -0
- package/src/clients/utils/TxFactory.ts +13 -13
- package/src/contracts/Contract.ts +3 -2
- package/src/contracts/ContractAbiProvider.ts +68 -0
- package/src/contracts/ContractBase.ts +205 -36
- package/src/contracts/ContractReader.ts +116 -3
- package/src/contracts/ContractStorageReaderBase.ts +26 -0
- package/src/contracts/ContractStream.ts +24 -6
- package/src/contracts/ContractWriter.ts +58 -28
- package/src/contracts/TxContract.ts +7 -4
- package/src/contracts/common/ERC20.ts +1 -1
- package/src/contracts/utils/AbiDeserializer.ts +16 -7
- package/src/contracts/utils/InputDataUtils.ts +8 -6
- package/src/env/BigIntSerializer.ts +3 -1
- package/src/evm/EVM.ts +246 -0
- package/src/evm/OpcodesWalker.ts +149 -0
- package/src/evm/Stack.ts +58 -0
- package/src/evm/interfaces/IJumps.ts +3 -0
- package/src/evm/interfaces/IMemory.ts +3 -0
- package/src/evm/interfaces/IOpcode.ts +11 -0
- package/src/evm/interfaces/IStorage.ts +3 -0
- package/src/evm/opcodes/add.ts +49 -0
- package/src/evm/opcodes/addmod.ts +19 -0
- package/src/evm/opcodes/address.ts +22 -0
- package/src/evm/opcodes/and.ts +58 -0
- package/src/evm/opcodes/balance.ts +25 -0
- package/src/evm/opcodes/blockhash.ts +25 -0
- package/src/evm/opcodes/byte.ts +34 -0
- package/src/evm/opcodes/call.ts +69 -0
- package/src/evm/opcodes/callcode.ts +69 -0
- package/src/evm/opcodes/calldatacopy.ts +36 -0
- package/src/evm/opcodes/calldataload.ts +40 -0
- package/src/evm/opcodes/calldatasize.ts +21 -0
- package/src/evm/opcodes/caller.ts +22 -0
- package/src/evm/opcodes/callvalue.ts +21 -0
- package/src/evm/opcodes/codecopy.ts +37 -0
- package/src/evm/opcodes/codesize.ts +21 -0
- package/src/evm/opcodes/coinbase.ts +21 -0
- package/src/evm/opcodes/create.ts +42 -0
- package/src/evm/opcodes/create2.ts +41 -0
- package/src/evm/opcodes/delegatecall.ts +63 -0
- package/src/evm/opcodes/difficulty.ts +21 -0
- package/src/evm/opcodes/div.ts +35 -0
- package/src/evm/opcodes/dup.ts +7 -0
- package/src/evm/opcodes/eq.ts +92 -0
- package/src/evm/opcodes/exp.ts +34 -0
- package/src/evm/opcodes/extcodecopy.ts +42 -0
- package/src/evm/opcodes/extcodehash.ts +25 -0
- package/src/evm/opcodes/extcodesize.ts +25 -0
- package/src/evm/opcodes/gas.ts +21 -0
- package/src/evm/opcodes/gaslimit.ts +21 -0
- package/src/evm/opcodes/gasprice.ts +21 -0
- package/src/evm/opcodes/gt.ts +39 -0
- package/src/evm/opcodes/invalid.ts +24 -0
- package/src/evm/opcodes/iszero.ts +48 -0
- package/src/evm/opcodes/jump.ts +66 -0
- package/src/evm/opcodes/jumpdest.ts +6 -0
- package/src/evm/opcodes/jumpi.ts +367 -0
- package/src/evm/opcodes/log.ts +89 -0
- package/src/evm/opcodes/lt.ts +39 -0
- package/src/evm/opcodes/mload.ts +30 -0
- package/src/evm/opcodes/mod.ts +33 -0
- package/src/evm/opcodes/msize.ts +21 -0
- package/src/evm/opcodes/mstore.ts +33 -0
- package/src/evm/opcodes/mul.ts +38 -0
- package/src/evm/opcodes/mulmod.ts +19 -0
- package/src/evm/opcodes/not.ts +30 -0
- package/src/evm/opcodes/number.ts +21 -0
- package/src/evm/opcodes/or.ts +33 -0
- package/src/evm/opcodes/origin.ts +21 -0
- package/src/evm/opcodes/pc.ts +7 -0
- package/src/evm/opcodes/pop.ts +6 -0
- package/src/evm/opcodes/push.ts +8 -0
- package/src/evm/opcodes/return.ts +78 -0
- package/src/evm/opcodes/returndatacopy.ts +37 -0
- package/src/evm/opcodes/returndatasize.ts +21 -0
- package/src/evm/opcodes/revert.ts +64 -0
- package/src/evm/opcodes/sar.ts +33 -0
- package/src/evm/opcodes/selfdestruct.ts +26 -0
- package/src/evm/opcodes/sha3.ts +63 -0
- package/src/evm/opcodes/shl.ts +42 -0
- package/src/evm/opcodes/shr.ts +33 -0
- package/src/evm/opcodes/signextend.ts +25 -0
- package/src/evm/opcodes/sload.ts +190 -0
- package/src/evm/opcodes/sstore.ts +259 -0
- package/src/evm/opcodes/staticcall.ts +63 -0
- package/src/evm/opcodes/stop.ts +22 -0
- package/src/evm/opcodes/sub.ts +33 -0
- package/src/evm/opcodes/swap.ts +7 -0
- package/src/evm/opcodes/timestamp.ts +21 -0
- package/src/evm/opcodes/xor.ts +33 -0
- package/src/evm/opcodes.ts +207 -0
- package/src/evm/tx.class.ts +137 -0
- package/src/evm/utils/BigNumber.ts +9 -0
- package/src/evm/utils/hex.ts +37 -0
- package/src/evm/utils/opcodes.ts +213 -0
- package/src/evm/utils/stringify.ts +12 -0
- package/src/evm/utils/stringifyEvents.ts +37 -0
- package/src/evm/utils/stringifyFunctions.ts +41 -0
- package/src/evm/utils/stringifyInstructions.ts +38 -0
- package/src/evm/utils/stringifyMappings.ts +65 -0
- package/src/evm/utils/stringifyStructs.ts +16 -0
- package/src/evm/utils/stringifyVariables.ts +32 -0
- package/src/gen/ContractStorageReaderTemplate.ts +18 -0
- package/src/gen/ContractTemplate.ts +41 -7
- package/src/gen/Generator.ts +50 -19
- package/src/gen/GeneratorFromAbi.ts +239 -67
- package/src/gen/GeneratorStorageReader.ts +113 -0
- package/src/gen/utils/$gen.ts +11 -0
- package/src/gen/utils/Str.ts +40 -0
- package/src/handlers/TokenHandler.ts +1 -1
- package/src/hardhat/HardhatProvider.ts +207 -0
- package/src/indexer/BlocksTxIndexer.ts +36 -10
- package/src/indexer/handlers/BlocksWalker.ts +81 -62
- package/src/indexer/handlers/TxQueueLoader.ts +7 -7
- package/src/json/JsonObjectStore.ts +1 -1
- package/src/loggers/LoggerService.ts +9 -5
- package/src/loggers/TxLoggerService.ts +1 -1
- package/src/models/IToken.ts +9 -0
- package/src/models/TAccount.ts +30 -0
- package/src/models/TBufferLike.ts +2 -2
- package/src/models/TPlatform.ts +1 -1
- package/src/ns/NameService.ts +3 -0
- package/src/ns/utils/$ns.ts +3 -4
- package/src/safe/$gnosis.ts +20 -0
- package/src/safe/GnosisSafeFactory.ts +40 -0
- package/src/safe/GnosisSafeHandler.ts +432 -0
- package/src/safe/transport/FileServiceTransport.ts +115 -0
- package/src/safe/transport/GnosisServiceTransport.ts +83 -0
- package/src/safe/transport/ISafeServiceTransport.ts +26 -0
- package/src/safe/transport/InMemoryServiceTransport.ts +79 -0
- package/src/solidity/SlotsParser.ts +650 -0
- package/src/solidity/SlotsStorage.ts +177 -0
- package/src/solidity/storage/Accessor.spec.ts +45 -0
- package/src/solidity/storage/Accessor.ts +136 -0
- package/src/solidity/storage/SlotDynamicArray.ts +46 -0
- package/src/solidity/storage/SlotFixedArray.ts +31 -0
- package/src/solidity/storage/SlotsStorageHandler.ts +17 -0
- package/src/solidity/storage/SlotsStorageTransport.ts +152 -0
- package/src/solidity/storage/handlers/SlotDynamicArrayHandler.ts +52 -0
- package/src/solidity/storage/handlers/SlotFixedArrayHandler.ts +52 -0
- package/src/solidity/storage/handlers/SlotMappingHandler.ts +52 -0
- package/src/solidity/storage/handlers/SlotStringHandler.ts +130 -0
- package/src/solidity/storage/handlers/SlotStructHandler.ts +46 -0
- package/src/solidity/storage/handlers/SlotValueHandler.ts +36 -0
- package/src/solidity/utils/$str.ts +36 -0
- package/src/solidity/utils/$types.ts +16 -0
- package/src/structs/PackedRanges.ts +9 -3
- package/src/tokens/TokenDataProvider.ts +271 -0
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.ts +3 -1
- package/src/tokens/TokenExchanges/AmmV2ExchangeBase.ts +4 -3
- package/src/tokens/TokenExchanges/OneInchExchange.ts +1 -1
- package/src/tokens/TokenExchanges/PancakeswapExchange.ts +5 -10
- package/src/tokens/TokenExchanges/SushiswapPolygonExchange.ts +8 -5
- package/src/tokens/TokenExchanges/UniswapExchange.ts +6 -9
- package/src/tokens/TokenOracles/AmmPriceV2Oracle.ts +5 -5
- package/src/tokens/TokenOracles/CoingeckoOracle.ts +13 -0
- package/src/tokens/TokenOracles/TokenPriceStore.ts +1 -1
- package/src/tokens/TokenPriceService.ts +0 -1
- package/src/tokens/TokenProviders/ITokenProvider.ts +1 -1
- package/src/tokens/TokenProviders/TPChain.ts +20 -8
- package/src/tokens/TokenProviders/TPCoingecko.ts +121 -0
- package/src/tokens/TokenProviders/TPConfig.ts +53 -0
- package/src/tokens/TokenProviders/TPExplorer.ts +41 -0
- package/src/tokens/TokenService.ts +6 -3
- package/src/tokens/TokenSwapService.ts +1 -1
- package/src/tokens/TokenTransferService.ts +40 -24
- package/src/tokens/TokensService.ts +34 -179
- package/src/tokens/TokensServiceFactory.ts +13 -1
- package/src/tokens/defi/ISwapService.ts +1 -1
- package/src/tokens/defi/paraswap/Paraswap.ts +2 -1
- package/src/txs/ITxConfig.ts +1 -1
- package/src/txs/TxDataBuilder.ts +78 -34
- package/src/txs/TxLogger.ts +4 -4
- package/src/txs/TxWriter.ts +245 -48
- package/src/txs/conditional/GasWatcherTx.ts +0 -1
- package/src/txs/receipt/ITxLogItem.ts +8 -5
- package/src/txs/receipt/TxLogParser.ts +13 -2
- package/src/txs/receipt/TxLogsTransfer.ts +15 -15
- package/src/txs/receipt/TxTopicInMemoryProvider.ts +1 -1
- package/src/txs/receipt/TxTopicProvider.ts +7 -7
- package/src/txs/sig-transports/SigFileTransport.ts +52 -0
- package/src/utils/$abiParser.spec.ts +90 -0
- package/src/utils/$abiParser.ts +60 -25
- package/src/utils/$abiType.ts +195 -5
- package/src/utils/$abiUtils.ts +57 -6
- package/src/utils/$account.ts +30 -0
- package/src/utils/$address.ts +5 -0
- package/src/utils/$bigint.ts +56 -3
- package/src/utils/$block.ts +14 -1
- package/src/utils/$bloom.ts +43 -0
- package/src/utils/$buffer.ts +114 -0
- package/src/utils/$cli.ts +16 -0
- package/src/utils/$color.ts +211 -0
- package/src/utils/$config.ts +70 -7
- package/src/utils/$const.ts +1 -0
- package/src/utils/$contract.ts +21 -3
- package/src/utils/$crypto.ts +33 -0
- package/src/utils/$csv.ts +23 -7
- package/src/utils/$date.ts +194 -40
- package/src/utils/$gas.ts +17 -0
- package/src/utils/$hex.ts +72 -0
- package/src/utils/$is.ts +24 -22
- package/src/utils/$logger.ts +60 -2
- package/src/utils/$machine.ts +85 -0
- package/src/utils/$number.ts +24 -1
- package/src/utils/$path.ts +17 -1
- package/src/utils/$promise.ts +101 -0
- package/src/utils/$require.ts +15 -1
- package/src/utils/$secret.ts +27 -0
- package/src/utils/$sign.ts +115 -16
- package/src/utils/$signRaw.ts +50 -0
- package/src/utils/$signSerializer.ts +8 -6
- package/src/utils/$txData.ts +16 -0
- package/src/utils/$wallet.ts +1 -1
- package/test/Batch.spec.ts +89 -0
- package/test/BlockChainExplorer.spec.ts +33 -0
- package/test/ChainAccount.spec.ts +1 -1
- package/test/client.spec.ts +10 -11
- package/test/config.js +8 -0
- package/test/config.spec.ts +31 -0
- package/test/ecrecover.spec.ts +49 -0
- package/test/fixtures/contracts/Counter.sol +25 -0
- package/test/fixtures/contracts/Ecrecover.sol +33 -0
- package/test/fixtures/contracts/Foo.sol +32 -0
- package/test/fixtures/contracts/Foo.ts +78 -0
- package/test/fixtures/contracts/FreeToken.sol +263 -0
- package/test/fixtures/explorer/0xfbD2aa7efA2B46Ce3c58D7ab0D92C176c71499C0.html +2788 -0
- package/test/fixtures/gnosis/GnosisSafe.sol +422 -0
- package/test/fixtures/gnosis/GnosisSafeL2.sol +86 -0
- package/test/fixtures/gnosis/accessors/SimulateTxAccessor.sol +52 -0
- package/test/fixtures/gnosis/base/Executor.sol +27 -0
- package/test/fixtures/gnosis/base/FallbackManager.sol +53 -0
- package/test/fixtures/gnosis/base/GuardManager.sol +62 -0
- package/test/fixtures/gnosis/base/ModuleManager.sol +133 -0
- package/test/fixtures/gnosis/base/OwnerManager.sol +149 -0
- package/test/fixtures/gnosis/common/Enum.sol +8 -0
- package/test/fixtures/gnosis/common/EtherPaymentFallback.sol +13 -0
- package/test/fixtures/gnosis/common/SecuredTokenTransfer.sol +35 -0
- package/test/fixtures/gnosis/common/SelfAuthorized.sol +16 -0
- package/test/fixtures/gnosis/common/SignatureDecoder.sol +36 -0
- package/test/fixtures/gnosis/common/Singleton.sol +11 -0
- package/test/fixtures/gnosis/common/StorageAccessible.sol +47 -0
- package/test/fixtures/gnosis/external/GnosisSafeMath.sol +54 -0
- package/test/fixtures/gnosis/interfaces/ERC1155TokenReceiver.sol +49 -0
- package/test/fixtures/gnosis/interfaces/ERC721TokenReceiver.sol +24 -0
- package/test/fixtures/gnosis/interfaces/ERC777TokensRecipient.sol +13 -0
- package/test/fixtures/gnosis/interfaces/IERC165.sol +15 -0
- package/test/fixtures/gnosis/interfaces/ISignatureValidator.sol +20 -0
- package/test/fixtures/gnosis/interfaces/ViewStorageAccessible.sol +11 -0
- package/test/fixtures/gnosis/libraries/CreateCall.sol +30 -0
- package/test/fixtures/gnosis/libraries/GnosisSafeStorage.sol +21 -0
- package/test/fixtures/gnosis/libraries/MultiSend.sol +66 -0
- package/test/fixtures/gnosis/libraries/MultiSendCallOnly.sol +61 -0
- package/test/fixtures/gnosis/libraries/SignMessageLib.sol +34 -0
- package/test/fixtures/gnosis/proxies/GnosisSafeProxy.sol +44 -0
- package/test/fixtures/gnosis/proxies/GnosisSafeProxyFactory.sol +107 -0
- package/test/fixtures/gnosis/proxies/IProxyCreationCallback.sol +12 -0
- package/test/fixtures/scan/WETH.sol +1533 -0
- package/test/fixtures/slots/FooStorage.sol +8 -0
- package/test/fixtures/slots/FooStorageBase.sol +6 -0
- package/test/fixtures/slots/Vault.sol +85 -0
- package/test/generate/class.spec.ts +144 -6
- package/test/generate/evm.spec.ts +64 -0
- package/test/generate/openzeppelin.spec.ts +18 -0
- package/test/generate/slotreader.spec.ts +34 -0
- package/test/hardhat/TestNode.ts +37 -9
- package/test/hardhat/deploy.spec.ts +22 -0
- package/test/indexer/BlocksWalker.spec.ts +51 -0
- package/test/ns.spec.ts +4 -0
- package/test/receipt.spec.ts +1 -4
- package/test/safe/tx.act.ts +194 -0
- package/test/solidity/SlotsParser.spec.ts +186 -0
- package/test/solidity/SlotsReader.spec.ts +168 -0
- package/test/solidity/Storage.spec.ts +328 -0
- package/test/structs/PackedRanges.spec.ts +56 -0
- package/test/subscriptions.spec.ts +127 -0
- package/test/token.spec.ts +11 -0
- package/test/utils/abi-types.spec.ts +31 -0
- package/test/utils/abi-utils.spec.ts +23 -0
- package/test/utils/bigint.spec.ts +0 -1
- package/test/utils/date.spec.ts +3 -2
- package/test/utils/logbloom.spec.ts +17 -0
- package/test/utils/number.spec.ts +14 -3
- package/test/utils/sign.spec.ts +43 -7
- package/src/ChainAccounts.ts +0 -72
- package/src/structs/PackedRanges.spec.ts +0 -38
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GeneratorStorageReader = void 0;
|
|
7
|
+
const alot_1 = __importDefault(require("alot"));
|
|
8
|
+
const SlotsParser_1 = require("@dequanto/solidity/SlotsParser");
|
|
9
|
+
const _require_1 = require("@dequanto/utils/$require");
|
|
10
|
+
const atma_io_1 = require("atma-io");
|
|
11
|
+
const Str_1 = require("./utils/Str");
|
|
12
|
+
const _abiType_1 = require("@dequanto/utils/$abiType");
|
|
13
|
+
const _path_1 = require("@dequanto/utils/$path");
|
|
14
|
+
const _gen_1 = require("./utils/$gen");
|
|
15
|
+
class GeneratorStorageReader {
|
|
16
|
+
async generate(opts) {
|
|
17
|
+
let { client, sources, contractName, address } = opts;
|
|
18
|
+
let files = alot_1.default.fromObject(sources ?? {}).map(x => {
|
|
19
|
+
return {
|
|
20
|
+
path: x.key,
|
|
21
|
+
content: x.value.content
|
|
22
|
+
};
|
|
23
|
+
}).toArray();
|
|
24
|
+
if (files.length === 0) {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
let file = null;
|
|
28
|
+
if (files.length === 1) {
|
|
29
|
+
file = files[0];
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
let rgx = new RegExp(`contract \s*${contractName}`, 'i');
|
|
33
|
+
let main = await (0, alot_1.default)(files.reverse()).findAsync(async (x) => {
|
|
34
|
+
return rgx.test(x.content);
|
|
35
|
+
});
|
|
36
|
+
if (main == null) {
|
|
37
|
+
main = files[0];
|
|
38
|
+
}
|
|
39
|
+
file = main;
|
|
40
|
+
}
|
|
41
|
+
_require_1.$require.String(file?.content ?? file?.path, `Expected a source content to resolve slots`);
|
|
42
|
+
let slots = await SlotsParser_1.SlotsParser.slots({ code: file.content, path: file.path }, contractName, { files });
|
|
43
|
+
let methods = this.serializeSlots(slots);
|
|
44
|
+
let codeMethods = methods.join('\n\n');
|
|
45
|
+
let templatePath = _path_1.$path.resolve(`/src/gen/ContractStorageReaderTemplate.ts`);
|
|
46
|
+
let template = await atma_io_1.File.readAsync(templatePath, { skipHooks: true });
|
|
47
|
+
let className = _gen_1.$gen.toClassName(opts.name + 'StorageReader');
|
|
48
|
+
let code = template
|
|
49
|
+
.replace(`$NAME$`, className)
|
|
50
|
+
.replace(`/* METHODS */`, codeMethods)
|
|
51
|
+
.replace(`$SLOTS$`, JSON.stringify(slots, null, ' '));
|
|
52
|
+
return {
|
|
53
|
+
className: className,
|
|
54
|
+
code: code
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
serializeSlots(slots) {
|
|
58
|
+
return slots
|
|
59
|
+
.map(slot => this.serializeSlot(slot))
|
|
60
|
+
.map(Str_1.Str.formatMethod);
|
|
61
|
+
}
|
|
62
|
+
serializeSlot(slot) {
|
|
63
|
+
let name = slot.name;
|
|
64
|
+
let type = slot.type;
|
|
65
|
+
let { parametersTypes, parametersCall, returnType } = this.getParameters(type);
|
|
66
|
+
return `
|
|
67
|
+
async ${name}(${parametersTypes ?? ''}): Promise<${returnType}> {
|
|
68
|
+
return this.$storage.get('${name}', ${parametersCall ?? ''});
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
getParameters(type) {
|
|
73
|
+
if (type.startsWith('mapping')) {
|
|
74
|
+
let valueType = _abiType_1.$abiType.mapping.getValueType(type);
|
|
75
|
+
let keyType = _abiType_1.$abiType.mapping.getKeyType(type);
|
|
76
|
+
let keyTsType = _abiType_1.$abiType.getTsTypeFromDefinition(keyType);
|
|
77
|
+
let valueTsType = _abiType_1.$abiType.getTsTypeFromDefinition(valueType);
|
|
78
|
+
return {
|
|
79
|
+
parametersTypes: `key: ${keyTsType}`,
|
|
80
|
+
returnType: `${valueTsType}`,
|
|
81
|
+
parametersCall: 'key',
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
returnType: _abiType_1.$abiType.getTsTypeFromDefinition(type)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.GeneratorStorageReader = GeneratorStorageReader;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$gen = void 0;
|
|
4
|
+
var $gen;
|
|
5
|
+
(function ($gen) {
|
|
6
|
+
function toClassName(name) {
|
|
7
|
+
let str = name.replace(/[^\w_\-\\/]/g, '');
|
|
8
|
+
str = str.replace(/[\-\\/](\w)/g, (full, letter) => {
|
|
9
|
+
return letter.toUpperCase();
|
|
10
|
+
});
|
|
11
|
+
return str[0].toUpperCase() + str.substring(1);
|
|
12
|
+
}
|
|
13
|
+
$gen.toClassName = toClassName;
|
|
14
|
+
})($gen = exports.$gen || (exports.$gen = {}));
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Str = void 0;
|
|
7
|
+
const alot_1 = __importDefault(require("alot"));
|
|
8
|
+
var Str;
|
|
9
|
+
(function (Str) {
|
|
10
|
+
function formatMethod(str) {
|
|
11
|
+
str = trim(str);
|
|
12
|
+
str = indent(str, ' ');
|
|
13
|
+
return str;
|
|
14
|
+
}
|
|
15
|
+
Str.formatMethod = formatMethod;
|
|
16
|
+
function trim(str) {
|
|
17
|
+
let lines = str.split('\n');
|
|
18
|
+
let min = (0, alot_1.default)(lines).min(line => {
|
|
19
|
+
if (line.trim() === '') {
|
|
20
|
+
return Number.MAX_SAFE_INTEGER;
|
|
21
|
+
}
|
|
22
|
+
let match = /^\s*/.exec(line);
|
|
23
|
+
if (match == null) {
|
|
24
|
+
return Number.MAX_SAFE_INTEGER;
|
|
25
|
+
}
|
|
26
|
+
return match[0].length;
|
|
27
|
+
});
|
|
28
|
+
lines = lines.map((line, i) => {
|
|
29
|
+
let x = line.substring(min);
|
|
30
|
+
if ((i === 0) || (lines.length === i + 1)) {
|
|
31
|
+
if (x === '') {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return x;
|
|
36
|
+
}).filter(Boolean);
|
|
37
|
+
return lines.join('\n');
|
|
38
|
+
}
|
|
39
|
+
Str.trim = trim;
|
|
40
|
+
function indent(str, indent) {
|
|
41
|
+
return str
|
|
42
|
+
.split('\n')
|
|
43
|
+
.map(x => `${indent}${x}`)
|
|
44
|
+
.join('\n');
|
|
45
|
+
}
|
|
46
|
+
Str.indent = indent;
|
|
47
|
+
})(Str = exports.Str || (exports.Str = {}));
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HardhatProvider = void 0;
|
|
13
|
+
const memd_1 = __importDefault(require("memd"));
|
|
14
|
+
const HardhatWeb3Client_1 = require("@dequanto/clients/HardhatWeb3Client");
|
|
15
|
+
const atma_utils_1 = require("atma-utils");
|
|
16
|
+
const atma_io_1 = require("atma-io");
|
|
17
|
+
const ethers_1 = require("ethers");
|
|
18
|
+
const _logger_1 = require("@dequanto/utils/$logger");
|
|
19
|
+
const _number_1 = require("@dequanto/utils/$number");
|
|
20
|
+
class HardhatProvider {
|
|
21
|
+
constructor() {
|
|
22
|
+
/* lazy load */
|
|
23
|
+
this.hh = require('hardhat');
|
|
24
|
+
if (this.hh.ethers == null) {
|
|
25
|
+
throw new Error(`hardhat-ethers plugin should be installed and included in hardhat.config.js`);
|
|
26
|
+
}
|
|
27
|
+
if (this.hh.web3 == null) {
|
|
28
|
+
throw new Error(`hardhat-web3 plugin should be installed and included in hardhat.config.js`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
client(network = 'hardhat') {
|
|
32
|
+
if (network == 'localhost') {
|
|
33
|
+
return new HardhatWeb3Client_1.HardhatWeb3Client({
|
|
34
|
+
endpoints: [
|
|
35
|
+
{ url: 'http://127.0.0.1:8545' },
|
|
36
|
+
// Use `manual`, will be used for subscriptions only, otherwise BatchRequests will fail, as not implemented yet
|
|
37
|
+
// https://github.com/NomicFoundation/hardhat/issues/1324
|
|
38
|
+
{ url: 'ws://127.0.0.1:8545', manual: true },
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const web3 = this.hh.web3;
|
|
43
|
+
const client = new HardhatWeb3Client_1.HardhatWeb3Client({ web3 });
|
|
44
|
+
return client;
|
|
45
|
+
}
|
|
46
|
+
deployer(index = 0) {
|
|
47
|
+
const ethers = this.hh.ethers;
|
|
48
|
+
const accounts = this.hh.config.networks.hardhat.accounts;
|
|
49
|
+
const wallet = ethers.Wallet.fromMnemonic(accounts.mnemonic, accounts.path + `/${index}`);
|
|
50
|
+
return {
|
|
51
|
+
key: wallet.privateKey,
|
|
52
|
+
address: wallet.address,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async deployClass(Ctor, options) {
|
|
56
|
+
let ethers = this.hh.ethers;
|
|
57
|
+
let client = options?.client ?? this.client();
|
|
58
|
+
let signer = options?.deployer ?? this.deployer();
|
|
59
|
+
let params = options?.arguments ?? [];
|
|
60
|
+
let Factory = await this.getFactory([Ctor.name], client, signer);
|
|
61
|
+
const contract = await Factory.deploy(...params);
|
|
62
|
+
const receipt = await contract.deployed();
|
|
63
|
+
_logger_1.$logger.log(`Contract ${Ctor.name} deployed to ${contract.address}`);
|
|
64
|
+
return new Ctor(contract.address, client);
|
|
65
|
+
}
|
|
66
|
+
async deploySol(solContractPath, options) {
|
|
67
|
+
const client = options?.client ?? this.client();
|
|
68
|
+
const args = options?.arguments ?? [];
|
|
69
|
+
const signer = options?.deployer ?? this.deployer();
|
|
70
|
+
const dir = solContractPath.replace(/[^\/]+$/, '');
|
|
71
|
+
const filename = /(?<filename>[^\/]+)\.\w+$/.exec(solContractPath)?.groups.filename;
|
|
72
|
+
let root = options?.paths?.root;
|
|
73
|
+
let artifacts = options?.paths?.artifacts;
|
|
74
|
+
if (filename == null) {
|
|
75
|
+
throw new Error(`Filename not extracted from ${solContractPath}`);
|
|
76
|
+
}
|
|
77
|
+
let hhOptions = {
|
|
78
|
+
sources: dir,
|
|
79
|
+
root,
|
|
80
|
+
artifacts,
|
|
81
|
+
tsgen: false,
|
|
82
|
+
};
|
|
83
|
+
await this.hh.run('compile', hhOptions);
|
|
84
|
+
if (root == null) {
|
|
85
|
+
root = 'file://' + process.cwd();
|
|
86
|
+
}
|
|
87
|
+
if (artifacts == null && root != null) {
|
|
88
|
+
artifacts = atma_utils_1.class_Uri.combine(root, 'artifacts/');
|
|
89
|
+
}
|
|
90
|
+
if (root != null && solContractPath.toLowerCase().includes(root.toLowerCase())) {
|
|
91
|
+
let i = solContractPath.toLowerCase().indexOf(root.toLowerCase());
|
|
92
|
+
solContractPath = solContractPath.substring(i + root.length);
|
|
93
|
+
}
|
|
94
|
+
let outputDir = atma_utils_1.class_Uri.combine(artifacts, solContractPath);
|
|
95
|
+
let output = atma_utils_1.class_Uri.combine(outputDir, `${filename}.json`);
|
|
96
|
+
console.log(`Compiled OK Output ${output} outputDir ${outputDir}`);
|
|
97
|
+
if (await atma_io_1.File.existsAsync(output) === false) {
|
|
98
|
+
let path = `${outputDir}/`;
|
|
99
|
+
if (await atma_io_1.Directory.existsAsync(path) === false) {
|
|
100
|
+
throw new Error(`No JSONs found in ${outputDir}, nor ${output}`);
|
|
101
|
+
}
|
|
102
|
+
let files = await atma_io_1.Directory.readFilesAsync(path);
|
|
103
|
+
let jsons = files.filter(x => /(?<!dbg)\.json$/.test(x.uri.file));
|
|
104
|
+
if (jsons.length === 0) {
|
|
105
|
+
throw new Error(`No JSONs output found in ${outputDir}`);
|
|
106
|
+
}
|
|
107
|
+
if (jsons.length === 1) {
|
|
108
|
+
output = jsons[0].uri.toString();
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
let jsonFile = jsons.find(file => {
|
|
112
|
+
return filename.includes(file.uri.filename);
|
|
113
|
+
});
|
|
114
|
+
if (jsonFile == null) {
|
|
115
|
+
throw new Error(`Compiled JSON data not found for ${filename} in ${outputDir}`);
|
|
116
|
+
}
|
|
117
|
+
output = jsonFile.uri.toString();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
let { abi, bytecode } = await atma_io_1.File.readAsync(output);
|
|
121
|
+
let Factory = await this.getFactory([abi, bytecode], client, signer);
|
|
122
|
+
const contract = await Factory.deploy(...args);
|
|
123
|
+
const receipt = await contract.deployed();
|
|
124
|
+
return {
|
|
125
|
+
contract,
|
|
126
|
+
abi,
|
|
127
|
+
bytecode
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
async deployCode(solidityCode, options) {
|
|
131
|
+
let className = /contract\s+(?<name>[\w]+)/.exec(solidityCode).groups.name;
|
|
132
|
+
let rnd = _number_1.$number.randomInt(0, 10 ** 10);
|
|
133
|
+
let tmp = atma_io_1.env.getTmpPath(`hardhat/contracts/${className}_${rnd}.sol`);
|
|
134
|
+
let root = tmp.replace(/contracts\/[^/]+$/, '');
|
|
135
|
+
options.paths = {
|
|
136
|
+
root
|
|
137
|
+
};
|
|
138
|
+
await atma_io_1.File.writeAsync(tmp, solidityCode);
|
|
139
|
+
try {
|
|
140
|
+
return await this.deploySol(tmp, options);
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
await atma_io_1.Directory.removeAsync(root);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
getEthersProvider(client) {
|
|
147
|
+
if (client.options.web3 != null) {
|
|
148
|
+
let ethers = this.hh.ethers;
|
|
149
|
+
return ethers.provider;
|
|
150
|
+
}
|
|
151
|
+
let url = client.options?.endpoints[0].url;
|
|
152
|
+
if (url.startsWith('ws')) {
|
|
153
|
+
return new ethers_1.ethers.providers.WebSocketProvider(url);
|
|
154
|
+
}
|
|
155
|
+
return new ethers_1.ethers.providers.JsonRpcProvider(url);
|
|
156
|
+
}
|
|
157
|
+
async getFactory(factoryArgs, client, signer) {
|
|
158
|
+
let ethers = this.hh.ethers;
|
|
159
|
+
let Factory = await ethers.getContractFactory(...factoryArgs);
|
|
160
|
+
let provider = this.getEthersProvider(client);
|
|
161
|
+
let $signer = 'key' in signer
|
|
162
|
+
? new ethers.Wallet(signer.key, provider)
|
|
163
|
+
: signer;
|
|
164
|
+
Factory = Factory.connect($signer);
|
|
165
|
+
return Factory;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
__decorate([
|
|
169
|
+
memd_1.default.deco.memoize()
|
|
170
|
+
], HardhatProvider.prototype, "client", null);
|
|
171
|
+
__decorate([
|
|
172
|
+
memd_1.default.deco.memoize()
|
|
173
|
+
], HardhatProvider.prototype, "deployer", null);
|
|
174
|
+
__decorate([
|
|
175
|
+
memd_1.default.deco.memoize()
|
|
176
|
+
], HardhatProvider.prototype, "deployClass", null);
|
|
177
|
+
exports.HardhatProvider = HardhatProvider;
|
|
@@ -9,16 +9,17 @@ class BlocksTxIndexer {
|
|
|
9
9
|
this.platform = platform;
|
|
10
10
|
this.opts = opts;
|
|
11
11
|
this.listeners = [];
|
|
12
|
-
this.client = Web3ClientFactory_1.Web3ClientFactory.get(platform, {
|
|
12
|
+
this.client = this.opts.client ?? Web3ClientFactory_1.Web3ClientFactory.get(platform, {
|
|
13
13
|
ws: true
|
|
14
14
|
});
|
|
15
15
|
this.walker = new BlocksWalker_1.BlocksWalker({
|
|
16
16
|
name: `${opts?.name ?? 'indexer'}_${this.platform}`,
|
|
17
17
|
client: this.client,
|
|
18
18
|
loadTransactions: opts?.loadTransactions ?? true,
|
|
19
|
+
loadReceipts: opts?.loadReceipts ?? false,
|
|
19
20
|
persistance: opts?.persistance ?? true,
|
|
20
|
-
visitor: async (block,
|
|
21
|
-
return this.indexTransactions(block,
|
|
21
|
+
visitor: async (block, data) => {
|
|
22
|
+
return this.indexTransactions(block, data);
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
25
|
}
|
|
@@ -32,16 +33,27 @@ class BlocksTxIndexer {
|
|
|
32
33
|
async start(from, to) {
|
|
33
34
|
await this.walker.start(from, to);
|
|
34
35
|
if (to == null) {
|
|
35
|
-
this.client.subscribe('newBlockHeaders', (error, blockHeader) => {
|
|
36
|
-
|
|
36
|
+
await this.client.subscribe('newBlockHeaders', (error, blockHeader) => {
|
|
37
|
+
if (error) {
|
|
38
|
+
_logger_1.$logger.error(`Subscription to "newBlockHeaders" failed with`, error);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (blockHeader.transactions?.length === 0) {
|
|
42
|
+
// hardhat emits empty blocks
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.walker.processUntil(blockHeader.number + 1);
|
|
37
46
|
});
|
|
47
|
+
// Reload the blocknumber, to ensure we didn't missed the block between walker starting and subscription
|
|
48
|
+
let newTo = await this.client.getBlockNumber();
|
|
49
|
+
this.walker.processUntil(newTo + 1);
|
|
38
50
|
}
|
|
39
51
|
}
|
|
40
|
-
async indexTransactions(block,
|
|
52
|
+
async indexTransactions(block, data) {
|
|
41
53
|
for (let i = 0; i < this.listeners.length; i++) {
|
|
42
54
|
let indexer = this.listeners[i];
|
|
43
55
|
try {
|
|
44
|
-
await indexer(this.client, block,
|
|
56
|
+
await indexer(this.client, block, data);
|
|
45
57
|
}
|
|
46
58
|
catch (error) {
|
|
47
59
|
_logger_1.$logger.log(error);
|
|
@@ -10,28 +10,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BlocksWalker = void 0;
|
|
13
|
-
const a_di_1 = __importDefault(require("a-di"));
|
|
14
13
|
const alot_1 = __importDefault(require("alot"));
|
|
15
14
|
const memd_1 = __importDefault(require("memd"));
|
|
16
|
-
const
|
|
15
|
+
const everlog_1 = require("everlog");
|
|
17
16
|
const atma_io_1 = require("atma-io");
|
|
17
|
+
const atma_utils_1 = require("atma-utils");
|
|
18
18
|
const PackedRanges_1 = require("../../structs/PackedRanges");
|
|
19
|
-
const
|
|
20
|
-
const BlockDateResolver_1 = require("@dequanto/blocks/BlockDateResolver");
|
|
19
|
+
const _array_1 = require("@dequanto/utils/$array");
|
|
21
20
|
const _date_1 = require("@dequanto/utils/$date");
|
|
22
|
-
const atma_utils_1 = require("atma-utils");
|
|
23
|
-
const _is_1 = require("@dequanto/utils/$is");
|
|
24
21
|
const _logger_1 = require("@dequanto/utils/$logger");
|
|
22
|
+
const _block_1 = require("@dequanto/utils/$block");
|
|
23
|
+
const _require_1 = require("@dequanto/utils/$require");
|
|
25
24
|
class BlocksWalker {
|
|
26
25
|
constructor(params) {
|
|
27
26
|
this.params = params;
|
|
27
|
+
this.onEndPromise = new atma_utils_1.class_Dfr;
|
|
28
28
|
this.client = this.params.client;
|
|
29
29
|
this.visitor = this.params.visitor;
|
|
30
30
|
this.status = {
|
|
31
31
|
blockLoadTime: 0
|
|
32
32
|
};
|
|
33
|
-
this.cachedState = new atma_io_1.FileSafe(`./
|
|
34
|
-
|
|
33
|
+
this.cachedState = new atma_io_1.FileSafe(`./0xweb/block-indexers/${this.params.name}.json`, {
|
|
34
|
+
cached: false,
|
|
35
|
+
processSafe: true,
|
|
36
|
+
threadSafe: true
|
|
37
|
+
});
|
|
38
|
+
this.everlog = everlog_1.Everlog.createChannel(`indexer-${this.params.name}`, {
|
|
35
39
|
fields: [
|
|
36
40
|
{ name: 'Date', type: 'date' },
|
|
37
41
|
{ name: 'Total', type: 'number' },
|
|
@@ -50,30 +54,28 @@ class BlocksWalker {
|
|
|
50
54
|
if (this.isRestored === false) {
|
|
51
55
|
await this.restore();
|
|
52
56
|
}
|
|
53
|
-
|
|
54
|
-
if (onlyIncoming) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (from == null) {
|
|
57
|
+
if (to != null && from == null) {
|
|
58
58
|
throw new Error(`FromBlock should be set while ToBlock(${to}) is present`);
|
|
59
59
|
}
|
|
60
60
|
this.walker.setFrom(await this.getBlockNumber(from));
|
|
61
61
|
this.walker.setTo(await this.getBlockNumber(to));
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
_require_1.$require.Number(this.ranges.from, 'From should be a number');
|
|
63
|
+
_require_1.$require.Number(this.ranges.to, 'To should be a number');
|
|
64
64
|
this.walker.process();
|
|
65
|
-
_logger_1.$logger.log(`BlocksWalker starting. Processing: ${this.ranges.from}-${to}. Completed: ${this.ranges.totalAdded()}; ToDo: ${this.ranges.totalLeft()}`);
|
|
65
|
+
_logger_1.$logger.log(`BlocksWalker starting. Processing: ${this.ranges.from}-${to ?? 'latest'}. Completed: ${this.ranges.totalAdded()}; ToDo: ${this.ranges.totalLeft()}`);
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Can be called each time we get a new block from blockchain,
|
|
69
69
|
* the walker will process its current blocks and up until the specified number
|
|
70
|
+
* @param nr Number is not included: [from, end)
|
|
70
71
|
*/
|
|
71
72
|
async processUntil(nr) {
|
|
72
73
|
if (this.isRestored === false) {
|
|
73
74
|
await this.restore();
|
|
74
75
|
}
|
|
75
76
|
this.walker.process(nr);
|
|
76
|
-
|
|
77
|
+
this.onEndPromise.defer();
|
|
78
|
+
return this.onEndPromise;
|
|
77
79
|
}
|
|
78
80
|
stats() {
|
|
79
81
|
return {
|
|
@@ -94,7 +96,7 @@ class BlocksWalker {
|
|
|
94
96
|
catch (error) { }
|
|
95
97
|
this.walker = new RangeWalker({
|
|
96
98
|
range: this.ranges,
|
|
97
|
-
onVisit: (
|
|
99
|
+
onVisit: (nrs) => this.processBlocks(nrs),
|
|
98
100
|
onResult: (error, nr) => {
|
|
99
101
|
this.save();
|
|
100
102
|
this.log();
|
|
@@ -130,28 +132,29 @@ class BlocksWalker {
|
|
|
130
132
|
if (mix == null) {
|
|
131
133
|
return this.client.getBlockNumber();
|
|
132
134
|
}
|
|
133
|
-
|
|
134
|
-
return mix;
|
|
135
|
-
}
|
|
136
|
-
if (mix instanceof Date) {
|
|
137
|
-
let dateResolver = a_di_1.default.resolve(BlockDateResolver_1.BlockDateResolver, this.client);
|
|
138
|
-
return await dateResolver.getBlockNumberFor(mix);
|
|
139
|
-
}
|
|
140
|
-
throw new Error(`Invalid getBlockNumber param: ${mix}`);
|
|
135
|
+
return _block_1.$block.ensureNumber(mix, this.client);
|
|
141
136
|
}
|
|
142
|
-
async
|
|
137
|
+
async processBlocks(nrs) {
|
|
143
138
|
// reading block and transactions
|
|
144
139
|
let start = Date.now();
|
|
145
|
-
let
|
|
146
|
-
let
|
|
147
|
-
|
|
140
|
+
let blocks = await this.client.getBlocks(nrs);
|
|
141
|
+
let nr = await this.client.getBlockNumber();
|
|
142
|
+
let grouped = await (0, alot_1.default)(blocks).mapAsync(async (block) => {
|
|
148
143
|
let hashes = block.transactions;
|
|
149
|
-
txs =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
let txs = this.params.loadTransactions
|
|
145
|
+
? await this.client.getTransactions(hashes)
|
|
146
|
+
: null;
|
|
147
|
+
let receipts = this.params.loadReceipts
|
|
148
|
+
? await this.client.getTransactionReceipts(hashes)
|
|
149
|
+
: null;
|
|
150
|
+
return { block, txs, receipts };
|
|
151
|
+
}).toArrayAsync({ threads: 4 });
|
|
152
|
+
this.status.blockLoadTime = (Date.now() - start) / nrs.length;
|
|
153
|
+
await (0, alot_1.default)(grouped)
|
|
154
|
+
.forEachAsync(async ({ block, txs, receipts }) => {
|
|
155
|
+
await this.visitor(block, { txs, receipts });
|
|
156
|
+
})
|
|
157
|
+
.toArrayAsync({ threads: 4 });
|
|
155
158
|
}
|
|
156
159
|
async save() {
|
|
157
160
|
if (this.params.persistance !== false) {
|
|
@@ -171,12 +174,12 @@ class BlocksWalker {
|
|
|
171
174
|
this.walker.status.errors,
|
|
172
175
|
error,
|
|
173
176
|
];
|
|
174
|
-
this.
|
|
177
|
+
this.everlog.writeRow(row);
|
|
175
178
|
_logger_1.$logger.log(row.join());
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
__decorate([
|
|
179
|
-
memd_1.default.deco.memoize()
|
|
182
|
+
memd_1.default.deco.memoize({ perInstance: true })
|
|
180
183
|
], BlocksWalker.prototype, "restore", null);
|
|
181
184
|
__decorate([
|
|
182
185
|
memd_1.default.deco.throttle(1000 * 4)
|
|
@@ -189,6 +192,7 @@ class RangeWalker {
|
|
|
189
192
|
constructor(params) {
|
|
190
193
|
this.opts = {
|
|
191
194
|
threads: 1,
|
|
195
|
+
batch: 1,
|
|
192
196
|
timeout: 20000,
|
|
193
197
|
// log every N ms
|
|
194
198
|
logTimeWindow: 5000,
|
|
@@ -200,6 +204,7 @@ class RangeWalker {
|
|
|
200
204
|
};
|
|
201
205
|
this.busy = [];
|
|
202
206
|
this.errors = [];
|
|
207
|
+
this.opts.batch = params.batch ?? this.opts.batch;
|
|
203
208
|
this.range = params.range;
|
|
204
209
|
this.onVisit = params.onVisit;
|
|
205
210
|
this.onResult = params.onResult;
|
|
@@ -220,6 +225,7 @@ class RangeWalker {
|
|
|
220
225
|
this.range.from = nr;
|
|
221
226
|
}
|
|
222
227
|
setTo(nr) {
|
|
228
|
+
nr += 1;
|
|
223
229
|
let { from } = this.range;
|
|
224
230
|
if (from != null && from > nr) {
|
|
225
231
|
throw new Error(`To (${nr}) should be greater then From (${from})`);
|
|
@@ -263,44 +269,49 @@ class RangeWalker {
|
|
|
263
269
|
if (this.busy.length > this.opts.threads) {
|
|
264
270
|
return;
|
|
265
271
|
}
|
|
266
|
-
let
|
|
267
|
-
|
|
272
|
+
let arr = [];
|
|
273
|
+
while (arr.length < this.opts.batch) {
|
|
274
|
+
let next = this.range.next();
|
|
275
|
+
if (next == null) {
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
arr.push(next);
|
|
279
|
+
}
|
|
280
|
+
if (arr.length === 0) {
|
|
268
281
|
this.onComplete?.();
|
|
269
282
|
return null;
|
|
270
283
|
}
|
|
271
|
-
let
|
|
272
|
-
nr: next,
|
|
273
|
-
startedAt: Date.now()
|
|
274
|
-
};
|
|
284
|
+
let workersData = arr.map(nr => ({ nr, startedAt: Date.now() }));
|
|
275
285
|
let error = null;
|
|
276
286
|
try {
|
|
277
|
-
this.busy.push(
|
|
278
|
-
await this.onVisit(
|
|
287
|
+
this.busy.push(...workersData);
|
|
288
|
+
await this.onVisit(arr);
|
|
279
289
|
}
|
|
280
290
|
catch (err) {
|
|
281
291
|
_logger_1.$logger.log('BlocksWalker.tick error', err);
|
|
282
292
|
error = err;
|
|
283
293
|
}
|
|
284
|
-
this.onResult?.(error,
|
|
285
|
-
this.onTickComplete(
|
|
294
|
+
this.onResult?.(error, arr);
|
|
295
|
+
this.onTickComplete(workersData, error);
|
|
286
296
|
}
|
|
287
|
-
onTickComplete(
|
|
297
|
+
onTickComplete(workersData, error) {
|
|
298
|
+
let lastWorkerData = workersData[workersData.length - 1];
|
|
288
299
|
if (error != null) {
|
|
289
300
|
this.lastError = {
|
|
290
|
-
...
|
|
291
|
-
duration: Date.now() -
|
|
301
|
+
...lastWorkerData,
|
|
302
|
+
duration: Date.now() - lastWorkerData.startedAt,
|
|
292
303
|
error
|
|
293
304
|
};
|
|
294
305
|
this.errors.push(this.lastError);
|
|
295
306
|
this.status.errors += 1;
|
|
296
307
|
_logger_1.$logger.log(error);
|
|
297
308
|
}
|
|
298
|
-
let time = Date.now() - workerData.startedAt;
|
|
299
309
|
let prevAvgTime = this.status.avgTime;
|
|
300
310
|
let prevTotal = this.status.processed;
|
|
311
|
+
let time = (Date.now() - lastWorkerData.startedAt) / workersData.length;
|
|
301
312
|
this.status.avgTime = Math.round((prevAvgTime * prevTotal + time) / (prevTotal + 1));
|
|
302
|
-
this.status.processed +=
|
|
303
|
-
_array_1.$array.remove(this.busy,
|
|
313
|
+
this.status.processed += workersData.length;
|
|
314
|
+
workersData.forEach(x => _array_1.$array.remove(this.busy, x));
|
|
304
315
|
this.tick();
|
|
305
316
|
}
|
|
306
317
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LoggerService = void 0;
|
|
4
|
+
const _date_1 = require("@dequanto/utils/$date");
|
|
4
5
|
const everlog_1 = require("everlog");
|
|
5
6
|
class LoggerService {
|
|
6
7
|
constructor(name = 'journal') {
|
|
@@ -15,19 +16,21 @@ class LoggerService {
|
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
warn(message) {
|
|
18
|
-
this.write([
|
|
19
|
+
this.write(['Warn', message]);
|
|
19
20
|
}
|
|
20
21
|
error(message) {
|
|
21
|
-
this.write([
|
|
22
|
+
this.write(['Error', message]);
|
|
22
23
|
}
|
|
23
24
|
info(message) {
|
|
24
|
-
this.write([
|
|
25
|
+
this.write(['Info', message]);
|
|
25
26
|
}
|
|
26
27
|
write(row) {
|
|
27
28
|
let arr = typeof row === 'string' ? [row] : row;
|
|
28
|
-
|
|
29
|
+
let date = new Date();
|
|
30
|
+
arr.unshift(date);
|
|
29
31
|
this.channel.writeRow(arr);
|
|
30
|
-
|
|
32
|
+
arr[0] = _date_1.$date.format(date, 'HH:mm:ss');
|
|
33
|
+
console.log(arr.join(' '));
|
|
31
34
|
return this;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
@@ -15,5 +15,8 @@ class NameService {
|
|
|
15
15
|
_require_1.$require.notNull(provider, `NS Provider for ${domain} not found`);
|
|
16
16
|
return provider.getAddress(domain);
|
|
17
17
|
}
|
|
18
|
+
supports(mix) {
|
|
19
|
+
return this.providers.some(x => x.supports(mix));
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
exports.NameService = NameService;
|