dequanto 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +11 -0
- package/actions/gen.act.ts +38 -0
- package/actions/tokens.act.ts +12 -0
- package/configs/dequanto.yml +51 -0
- package/contracts/abi/erc20.abi.json +222 -0
- package/contracts/gen/amm/AmmFactoryV2ContractBase.ts +66 -0
- package/contracts/gen/amm/AmmMasterChefV2ContractBase.ts +158 -0
- package/contracts/gen/amm/AmmPairContractV2Base.ts +158 -0
- package/contracts/gen/amm/AmmPairContractV3Base.ts +125 -0
- package/contracts/gen/amm/AmmRouterV2ContractBase.ts +124 -0
- package/contracts/gen/amm/AmmVaultV2ContractBase.ts +214 -0
- package/contracts/gen/base/ERC20Base.ts +90 -0
- package/contracts/gen/bsc/OneInchRouterV3Base.ts +57 -0
- package/contracts/gen/eth/WETHBase/WETHBase.sol +756 -0
- package/contracts/gen/eth/WETHBase.ts +136 -0
- package/contracts/gen/polygon/ERC20PolygonBase.ts +305 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/Address.sol +216 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/BeaconProxy.sol +61 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/Bridge.sol +437 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/BridgeGetters.sol +70 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/BridgeGovernance.sol +142 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/BridgeImplementation.sol +34 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/BridgeSetters.sol +57 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/BridgeState.sol +52 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/BridgeStructs.sol +66 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/BytesLib.sol +510 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/Context.sol +23 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/ERC1967Proxy.sol +32 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/ERC1967Upgrade.sol +193 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/IBeacon.sol +15 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/IERC20.sol +81 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/IWormhole.sol +42 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/Ownable.sol +71 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/Proxy.sol +85 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/SafeERC20.sol +98 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/StorageSlot.sol +83 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/Structs.sol +40 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/Token.sol +12 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/TokenBridge.sol +15 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/TokenImplementation.sol +177 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase/TokenState.sol +31 -0
- package/contracts/gen/polygon/WormholeBridgeContractBase.ts +231 -0
- package/contracts/gen/xdai/WXDaiTokenContractBase.ts +136 -0
- package/data/cex/eth.csv +356 -0
- package/data/tokens/1inch.json +16557 -0
- package/data/tokens/arbitrum.json +1 -0
- package/data/tokens/sushi.json +56388 -0
- package/dist/contracts/gen/amm/AmmFactoryV2ContractBase.js +53 -0
- package/dist/contracts/gen/amm/AmmMasterChefV2ContractBase.js +122 -0
- package/dist/contracts/gen/amm/AmmPairContractV2Base.js +122 -0
- package/dist/contracts/gen/amm/AmmPairContractV3Base.js +98 -0
- package/dist/contracts/gen/amm/AmmRouterV2ContractBase.js +95 -0
- package/dist/contracts/gen/amm/AmmVaultV2ContractBase.js +164 -0
- package/dist/contracts/gen/base/ERC20Base.js +64 -0
- package/dist/contracts/gen/bsc/OneInchRouterV3Base.js +47 -0
- package/dist/contracts/gen/eth/WETHBase.js +96 -0
- package/dist/contracts/gen/polygon/ERC20PolygonBase.js +233 -0
- package/dist/contracts/gen/polygon/WormholeBridgeContractBase.js +172 -0
- package/dist/contracts/gen/xdai/WXDaiTokenContractBase.js +96 -0
- package/dist/src/BlockchainExplorer/BlockChainExplorerFactory.js +227 -0
- package/dist/src/BlockchainExplorer/BlockChainExplorerProvider.js +32 -0
- package/dist/src/BlockchainExplorer/BlockNumberCache.js +33 -0
- package/dist/src/BlockchainExplorer/Bscscan.js +27 -0
- package/dist/src/BlockchainExplorer/Etherscan.js +27 -0
- package/dist/src/BlockchainExplorer/IAbiProvider.js +2 -0
- package/dist/src/BlockchainExplorer/IBlockChainExplorer.js +2 -0
- package/dist/src/BlockchainExplorer/Polyscan.js +27 -0
- package/dist/src/ChainAccounts.js +69 -0
- package/dist/src/ChainAccountsService.js +75 -0
- package/dist/src/Config.js +7 -0
- package/dist/src/blocks/BlockDateResolver.js +125 -0
- package/dist/src/bridges/BridgeFactory.js +19 -0
- package/dist/src/bridges/hop/HopAddresses.js +520 -0
- package/dist/src/bridges/hop/HopBridge.js +327 -0
- package/dist/src/bridges/hop/contracts/gen.act.js +43 -0
- package/dist/src/bridges/hop/contracts/polygon/Dai_l2AmmWrapperContract.js +52 -0
- package/dist/src/bridges/hop/contracts/polygon/Dai_l2BridgeContract.js +319 -0
- package/dist/src/bridges/hop/contracts/polygon/Dai_l2SaddleSwapContract.js +178 -0
- package/dist/src/bridges/hop/contracts/polygon/Eth_l2AmmWrapperContract.js +52 -0
- package/dist/src/bridges/hop/contracts/polygon/Eth_l2BridgeContract.js +319 -0
- package/dist/src/bridges/hop/contracts/polygon/Eth_l2SaddleSwapContract.js +178 -0
- package/dist/src/bridges/hop/contracts/polygon/Matic_l2AmmWrapperContract.js +52 -0
- package/dist/src/bridges/hop/contracts/polygon/Matic_l2BridgeContract.js +319 -0
- package/dist/src/bridges/hop/contracts/polygon/Matic_l2SaddleSwapContract.js +178 -0
- package/dist/src/bridges/hop/contracts/polygon/Usdc_l2AmmWrapperContract.js +52 -0
- package/dist/src/bridges/hop/contracts/polygon/Usdc_l2BridgeContract.js +319 -0
- package/dist/src/bridges/hop/contracts/polygon/Usdc_l2SaddleSwapContract.js +178 -0
- package/dist/src/bridges/hop/contracts/polygon/Usdt_l2AmmWrapperContract.js +52 -0
- package/dist/src/bridges/hop/contracts/polygon/Usdt_l2BridgeContract.js +319 -0
- package/dist/src/bridges/hop/contracts/polygon/Usdt_l2SaddleSwapContract.js +178 -0
- package/dist/src/bridges/hop/contracts/polygon/Wbtc_l2AmmWrapperContract.js +52 -0
- package/dist/src/bridges/hop/contracts/polygon/Wbtc_l2BridgeContract.js +319 -0
- package/dist/src/bridges/hop/contracts/polygon/Wbtc_l2SaddleSwapContract.js +178 -0
- package/dist/src/bridges/models/IBridge.js +2 -0
- package/dist/src/bridges/wormhole/contracts/WormholeBridgeContract.js +15 -0
- package/dist/src/chains/PlatformFactory.js +42 -0
- package/dist/src/chains/arbitrum/ArbTokenProvider.js +40 -0
- package/dist/src/chains/arbitrum/ArbWeb3Client.js +39 -0
- package/dist/src/chains/arbitrum/Arbiscan.js +27 -0
- package/dist/src/chains/boba/BobaWeb3Client.js +47 -0
- package/dist/src/chains/boba/Bobascan.js +28 -0
- package/dist/src/chains/xdai/XDaiWeb3Client.js +87 -0
- package/dist/src/chains/xdai/XDaiscan.js +27 -0
- package/dist/src/chains/xdai/tokens/WXDaiTokenContract.js +15 -0
- package/dist/src/clients/BscWeb3Client.js +38 -0
- package/dist/src/clients/ClientEventsStream.js +34 -0
- package/dist/src/clients/ClientPool.js +560 -0
- package/dist/src/clients/ClientPoolStats.js +52 -0
- package/dist/src/clients/EthWeb3Client.js +35 -0
- package/dist/src/clients/HardhatWeb3Client.js +56 -0
- package/dist/src/clients/PolyWeb3Client.js +77 -0
- package/dist/src/clients/Web3Client.js +186 -0
- package/dist/src/clients/Web3ClientFactory.js +32 -0
- package/dist/src/clients/interfaces/IWeb3Client.js +2 -0
- package/dist/src/clients/interfaces/IWeb3ClientStatus.js +2 -0
- package/dist/src/clients/interfaces/IWeb3EndpointOptions.js +2 -0
- package/dist/src/clients/model/ClientStatus.js +9 -0
- package/dist/src/clients/model/PromiEventWrap.js +52 -0
- package/dist/src/clients/model/SubscriptionWrap.js +42 -0
- package/dist/src/clients/utils/ClientEndpoints.js +27 -0
- package/dist/src/clients/utils/ClientErrorUtil.js +30 -0
- package/dist/src/clients/utils/TxFactory.js +14 -0
- package/dist/src/contracts/BscContract.js +30 -0
- package/dist/src/contracts/Contract.js +90 -0
- package/dist/src/contracts/ContractBase.js +139 -0
- package/dist/src/contracts/ContractFactory.js +17 -0
- package/dist/src/contracts/ContractProvider.js +40 -0
- package/dist/src/contracts/ContractReader.js +76 -0
- package/dist/src/contracts/ContractStream.js +20 -0
- package/dist/src/contracts/ContractWriter.js +62 -0
- package/dist/src/contracts/EthContract.js +31 -0
- package/dist/src/contracts/TxContract.js +37 -0
- package/dist/src/contracts/common/ERC20.js +14 -0
- package/dist/src/contracts/common/ERC20Polygon.js +14 -0
- package/dist/src/contracts/common/PoolPair.js +23 -0
- package/dist/src/contracts/utils/AbiDeserializer.js +89 -0
- package/dist/src/contracts/utils/ConvertUtils.js +21 -0
- package/dist/src/contracts/utils/InputDataUtils.js +87 -0
- package/dist/src/contracts/utils/TypeUtils.js +24 -0
- package/dist/src/defi/OneInch/OneInchRouter.js +14 -0
- package/dist/src/env/BigIntSerializer.js +19 -0
- package/dist/src/gen/Ast.js +12 -0
- package/dist/src/gen/ContractTemplate.js +27 -0
- package/dist/src/gen/Generator.js +180 -0
- package/dist/src/gen/GeneratorFromAbi.js +361 -0
- package/dist/src/handlers/TokenHandler.js +69 -0
- package/dist/src/indexer/BlocksTxIndexer.js +52 -0
- package/dist/src/indexer/PendingTxIndexer.js +96 -0
- package/dist/src/indexer/handlers/BlocksWalker.js +306 -0
- package/dist/src/indexer/handlers/TxQueueLoader.js +117 -0
- package/dist/src/json/JsonArrayStore.js +296 -0
- package/dist/src/json/JsonObjectStore.js +214 -0
- package/dist/src/json/JsonStore.spec.js +83 -0
- package/dist/src/loggers/ILogger.js +2 -0
- package/dist/src/loggers/LoggerService.js +34 -0
- package/dist/src/loggers/TxLoggerService.js +122 -0
- package/dist/src/models/IContractDetails.js +2 -0
- package/dist/src/models/IToken.js +2 -0
- package/dist/src/models/ITokenGlob.js +6 -0
- package/dist/src/models/ITransactionDetails.js +2 -0
- package/dist/src/models/TAddress.js +2 -0
- package/dist/src/models/TBufferLike.js +2 -0
- package/dist/src/models/THex.js +2 -0
- package/dist/src/models/TPlatform.js +2 -0
- package/dist/src/models/TResult.js +2 -0
- package/dist/src/ns/NameService.js +19 -0
- package/dist/src/ns/providers/EnsProvider.js +41 -0
- package/dist/src/ns/providers/INsProvider.js +2 -0
- package/dist/src/ns/providers/UDProvider.js +39 -0
- package/dist/src/ns/utils/$ns.js +17 -0
- package/dist/src/structs/PackedRanges.js +186 -0
- package/dist/src/structs/PackedRanges.spec.js +30 -0
- package/dist/src/tokens/TokenExchangeService.js +110 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/AmmUtilts.js +17 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/V2/AmmFactoryV2Contract.js +15 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/V2/AmmMasterChefV2Contract.js +15 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Contract.js +16 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js +144 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/V2/AmmRouterV2Contract.js +15 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/V2/AmmVaultV2Contract.js +15 -0
- package/dist/src/tokens/TokenExchanges/AmmBase/V3/AmmPairV3Contract.js +22 -0
- package/dist/src/tokens/TokenExchanges/AmmV2ExchangeBase.js +194 -0
- package/dist/src/tokens/TokenExchanges/OneInchExchange.js +92 -0
- package/dist/src/tokens/TokenExchanges/PancakeswapExchange.js +28 -0
- package/dist/src/tokens/TokenExchanges/SushiswapPolygonExchange.js +28 -0
- package/dist/src/tokens/TokenExchanges/UniswapExchange.js +28 -0
- package/dist/src/tokens/TokenOracles/AmmPriceV2Oracle.js +319 -0
- package/dist/src/tokens/TokenOracles/TokenPriceStore.js +108 -0
- package/dist/src/tokens/TokenPriceService.js +196 -0
- package/dist/src/tokens/TokenPriceServiceProvider.js +31 -0
- package/dist/src/tokens/TokenProviders/ATokenProvider.js +38 -0
- package/dist/src/tokens/TokenProviders/ITokenProvider.js +2 -0
- package/dist/src/tokens/TokenProviders/TPChain.js +35 -0
- package/dist/src/tokens/TokenProviders/TPCoinmarketcap.js +63 -0
- package/dist/src/tokens/TokenProviders/TPOneInch.js +65 -0
- package/dist/src/tokens/TokenProviders/TPSushiswap.js +89 -0
- package/dist/src/tokens/TokenProviders/TPUniswap.js +84 -0
- package/dist/src/tokens/TokenService.js +115 -0
- package/dist/src/tokens/TokenSwapService.js +37 -0
- package/dist/src/tokens/TokenTransferService.js +189 -0
- package/dist/src/tokens/TokensService.js +236 -0
- package/dist/src/tokens/TokensServiceBsc.js +18 -0
- package/dist/src/tokens/TokensServiceEth.js +15 -0
- package/dist/src/tokens/TokensServiceFactory.js +29 -0
- package/dist/src/tokens/TokensServicePolygon.js +18 -0
- package/dist/src/tokens/TokensServiceXDai.js +24 -0
- package/dist/src/tokens/defi/ISwapService.js +2 -0
- package/dist/src/tokens/defi/paraswap/Paraswap.js +135 -0
- package/dist/src/tokens/erc20/eth/WETH.js +14 -0
- package/dist/src/tokens/utils/TokenUtils.js +66 -0
- package/dist/src/txs/ITxConfig.js +2 -0
- package/dist/src/txs/TxDataBuilder.js +159 -0
- package/dist/src/txs/TxLogger.js +119 -0
- package/dist/src/txs/TxProvider.js +73 -0
- package/dist/src/txs/TxService.js +19 -0
- package/dist/src/txs/TxWriter.js +287 -0
- package/dist/src/txs/conditional/GasWatcherLogger.js +61 -0
- package/dist/src/txs/conditional/GasWatcherService.js +103 -0
- package/dist/src/txs/conditional/GasWatcherStore.js +25 -0
- package/dist/src/txs/conditional/GasWatcherTx.js +126 -0
- package/dist/src/txs/receipt/ITxLogItem.js +2 -0
- package/dist/src/txs/receipt/TxLogParser.js +27 -0
- package/dist/src/txs/receipt/TxLogsTransfer.js +50 -0
- package/dist/src/txs/receipt/TxTopicInMemoryProvider.js +41 -0
- package/dist/src/txs/receipt/TxTopicProvider.js +25 -0
- package/dist/src/utils/$abiParser.js +159 -0
- package/dist/src/utils/$abiType.js +77 -0
- package/dist/src/utils/$abiUtils.js +43 -0
- package/dist/src/utils/$address.js +41 -0
- package/dist/src/utils/$array.js +60 -0
- package/dist/src/utils/$bigint.js +130 -0
- package/dist/src/utils/$block.js +10 -0
- package/dist/src/utils/$class.js +13 -0
- package/dist/src/utils/$config.js +18 -0
- package/dist/src/utils/$contract.js +67 -0
- package/dist/src/utils/$csv.js +79 -0
- package/dist/src/utils/$date.js +496 -0
- package/dist/src/utils/$fn.js +117 -0
- package/dist/src/utils/$is.js +40 -0
- package/dist/src/utils/$logger.js +15 -0
- package/dist/src/utils/$number.js +95 -0
- package/dist/src/utils/$object.js +82 -0
- package/dist/src/utils/$path.js +33 -0
- package/dist/src/utils/$promise.js +13 -0
- package/dist/src/utils/$require.js +127 -0
- package/dist/src/utils/$sign.js +35 -0
- package/dist/src/utils/$signSerializer.js +264 -0
- package/dist/src/utils/$wallet.js +13 -0
- package/dist/src/utils/types.js +2 -0
- package/dist/src/wallets/Wallet.js +26 -0
- package/dist/src/wallets/WalletBsc.js +17 -0
- package/dist/src/wallets/WalletService.js +35 -0
- package/dist/src/www/utils/BlockChainExplorerFormatter.js +15 -0
- package/hardhat.config.js +6 -0
- package/package.json +52 -0
- package/readme.md +76 -0
- package/src/BlockchainExplorer/BlockChainExplorerFactory.ts +273 -0
- package/src/BlockchainExplorer/BlockChainExplorerProvider.ts +26 -0
- package/src/BlockchainExplorer/BlockNumberCache.ts +46 -0
- package/src/BlockchainExplorer/Bscscan.ts +23 -0
- package/src/BlockchainExplorer/Etherscan.ts +25 -0
- package/src/BlockchainExplorer/IAbiProvider.ts +5 -0
- package/src/BlockchainExplorer/IBlockChainExplorer.ts +37 -0
- package/src/BlockchainExplorer/Polyscan.ts +23 -0
- package/src/ChainAccounts.ts +72 -0
- package/src/ChainAccountsService.ts +74 -0
- package/src/Config.ts +34 -0
- package/src/blocks/BlockDateResolver.ts +149 -0
- package/src/bridges/BridgeFactory.ts +16 -0
- package/src/bridges/hop/HopAddresses.ts +518 -0
- package/src/bridges/hop/HopBridge.ts +430 -0
- package/src/bridges/hop/contracts/gen.act.ts +50 -0
- package/src/bridges/hop/contracts/polygon/Dai_l2AmmWrapperContract.ts +69 -0
- package/src/bridges/hop/contracts/polygon/Dai_l2BridgeContract.ts +453 -0
- package/src/bridges/hop/contracts/polygon/Dai_l2SaddleSwapContract.ts +264 -0
- package/src/bridges/hop/contracts/polygon/Eth_l2AmmWrapperContract.ts +69 -0
- package/src/bridges/hop/contracts/polygon/Eth_l2BridgeContract.ts +453 -0
- package/src/bridges/hop/contracts/polygon/Eth_l2SaddleSwapContract.ts +264 -0
- package/src/bridges/hop/contracts/polygon/Matic_l2AmmWrapperContract.ts +69 -0
- package/src/bridges/hop/contracts/polygon/Matic_l2BridgeContract.ts +453 -0
- package/src/bridges/hop/contracts/polygon/Matic_l2SaddleSwapContract.ts +264 -0
- package/src/bridges/hop/contracts/polygon/Usdc_l2AmmWrapperContract.ts +69 -0
- package/src/bridges/hop/contracts/polygon/Usdc_l2BridgeContract.ts +453 -0
- package/src/bridges/hop/contracts/polygon/Usdc_l2SaddleSwapContract.ts +264 -0
- package/src/bridges/hop/contracts/polygon/Usdt_l2AmmWrapperContract.ts +69 -0
- package/src/bridges/hop/contracts/polygon/Usdt_l2BridgeContract.ts +453 -0
- package/src/bridges/hop/contracts/polygon/Usdt_l2SaddleSwapContract.ts +264 -0
- package/src/bridges/hop/contracts/polygon/Wbtc_l2AmmWrapperContract.ts +69 -0
- package/src/bridges/hop/contracts/polygon/Wbtc_l2BridgeContract.ts +453 -0
- package/src/bridges/hop/contracts/polygon/Wbtc_l2SaddleSwapContract.ts +264 -0
- package/src/bridges/models/IBridge.ts +43 -0
- package/src/bridges/wormhole/contracts/WormholeBridgeContract.ts +14 -0
- package/src/chains/PlatformFactory.ts +45 -0
- package/src/chains/arbitrum/ArbTokenProvider.ts +39 -0
- package/src/chains/arbitrum/ArbWeb3Client.ts +39 -0
- package/src/chains/arbitrum/Arbiscan.ts +24 -0
- package/src/chains/boba/BobaWeb3Client.ts +49 -0
- package/src/chains/boba/Bobascan.ts +25 -0
- package/src/chains/xdai/XDaiWeb3Client.ts +82 -0
- package/src/chains/xdai/XDaiscan.ts +24 -0
- package/src/chains/xdai/tokens/WXDaiTokenContract.json +279 -0
- package/src/chains/xdai/tokens/WXDaiTokenContract.ts +14 -0
- package/src/clients/BscWeb3Client.ts +38 -0
- package/src/clients/ClientEventsStream.ts +33 -0
- package/src/clients/ClientPool.ts +673 -0
- package/src/clients/ClientPoolStats.ts +64 -0
- package/src/clients/EthWeb3Client.ts +36 -0
- package/src/clients/HardhatWeb3Client.ts +60 -0
- package/src/clients/PolyWeb3Client.ts +91 -0
- package/src/clients/Web3Client.ts +228 -0
- package/src/clients/Web3ClientFactory.ts +28 -0
- package/src/clients/interfaces/IWeb3Client.ts +14 -0
- package/src/clients/interfaces/IWeb3ClientStatus.ts +23 -0
- package/src/clients/interfaces/IWeb3EndpointOptions.ts +9 -0
- package/src/clients/model/ClientStatus.ts +5 -0
- package/src/clients/model/PromiEventWrap.ts +61 -0
- package/src/clients/model/SubscriptionWrap.ts +53 -0
- package/src/clients/utils/ClientEndpoints.ts +26 -0
- package/src/clients/utils/ClientErrorUtil.ts +26 -0
- package/src/clients/utils/TxFactory.ts +17 -0
- package/src/contracts/BscContract.ts +28 -0
- package/src/contracts/Contract.ts +126 -0
- package/src/contracts/ContractBase.ts +158 -0
- package/src/contracts/ContractFactory.ts +19 -0
- package/src/contracts/ContractProvider.ts +55 -0
- package/src/contracts/ContractReader.ts +87 -0
- package/src/contracts/ContractStream.ts +18 -0
- package/src/contracts/ContractWriter.ts +97 -0
- package/src/contracts/EthContract.ts +29 -0
- package/src/contracts/TxContract.ts +43 -0
- package/src/contracts/common/ERC20.ts +13 -0
- package/src/contracts/common/ERC20Polygon.ts +13 -0
- package/src/contracts/common/PoolPair.ts +22 -0
- package/src/contracts/utils/AbiDeserializer.ts +98 -0
- package/src/contracts/utils/ConvertUtils.ts +16 -0
- package/src/contracts/utils/InputDataUtils.ts +93 -0
- package/src/contracts/utils/TypeUtils.ts +21 -0
- package/src/defi/OneInch/OneInchRouter.ts +13 -0
- package/src/env/BigIntSerializer.ts +18 -0
- package/src/gen/Ast.ts +12 -0
- package/src/gen/ContractTemplate.ts +36 -0
- package/src/gen/Generator.ts +227 -0
- package/src/gen/GeneratorFromAbi.ts +402 -0
- package/src/handlers/TokenHandler.ts +78 -0
- package/src/indexer/BlocksTxIndexer.ts +69 -0
- package/src/indexer/PendingTxIndexer.ts +124 -0
- package/src/indexer/handlers/BlocksWalker.ts +390 -0
- package/src/indexer/handlers/TxQueueLoader.ts +143 -0
- package/src/json/JsonArrayStore.ts +310 -0
- package/src/json/JsonObjectStore.ts +239 -0
- package/src/json/JsonStore.spec.ts +98 -0
- package/src/loggers/ILogger.ts +3 -0
- package/src/loggers/LoggerService.ts +39 -0
- package/src/loggers/TxLoggerService.ts +146 -0
- package/src/models/IContractDetails.ts +8 -0
- package/src/models/IToken.ts +11 -0
- package/src/models/ITokenGlob.ts +14 -0
- package/src/models/ITransactionDetails.ts +11 -0
- package/src/models/TAddress.ts +1 -0
- package/src/models/TBufferLike.ts +2 -0
- package/src/models/THex.ts +1 -0
- package/src/models/TPlatform.ts +1 -0
- package/src/models/TResult.ts +6 -0
- package/src/ns/NameService.ts +21 -0
- package/src/ns/providers/EnsProvider.ts +45 -0
- package/src/ns/providers/INsProvider.ts +6 -0
- package/src/ns/providers/UDProvider.ts +49 -0
- package/src/ns/utils/$ns.ts +15 -0
- package/src/structs/PackedRanges.spec.ts +38 -0
- package/src/structs/PackedRanges.ts +207 -0
- package/src/tokens/TokenExchangeService.ts +126 -0
- package/src/tokens/TokenExchanges/AmmBase/AmmUtilts.ts +16 -0
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmFactoryV2Contract.ts +15 -0
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmMasterChefV2Contract.ts +15 -0
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Contract.ts +17 -0
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.ts +208 -0
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmRouterV2Contract.ts +15 -0
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmVaultV2Contract.ts +15 -0
- package/src/tokens/TokenExchanges/AmmBase/V3/AmmPairV3Contract.ts +24 -0
- package/src/tokens/TokenExchanges/AmmV2ExchangeBase.ts +242 -0
- package/src/tokens/TokenExchanges/OneInchExchange.ts +111 -0
- package/src/tokens/TokenExchanges/PancakeswapExchange.ts +30 -0
- package/src/tokens/TokenExchanges/SushiswapPolygonExchange.ts +30 -0
- package/src/tokens/TokenExchanges/UniswapExchange.ts +31 -0
- package/src/tokens/TokenOracles/AmmPriceV2Oracle.ts +440 -0
- package/src/tokens/TokenOracles/TokenPriceStore.ts +129 -0
- package/src/tokens/TokenPriceService.ts +276 -0
- package/src/tokens/TokenPriceServiceProvider.ts +36 -0
- package/src/tokens/TokenProviders/ATokenProvider.ts +42 -0
- package/src/tokens/TokenProviders/ITokenProvider.ts +9 -0
- package/src/tokens/TokenProviders/TPChain.ts +41 -0
- package/src/tokens/TokenProviders/TPCoinmarketcap.ts +82 -0
- package/src/tokens/TokenProviders/TPOneInch.ts +71 -0
- package/src/tokens/TokenProviders/TPSushiswap.ts +96 -0
- package/src/tokens/TokenProviders/TPUniswap.ts +85 -0
- package/src/tokens/TokenService.ts +128 -0
- package/src/tokens/TokenSwapService.ts +47 -0
- package/src/tokens/TokenTransferService.ts +216 -0
- package/src/tokens/TokensService.ts +252 -0
- package/src/tokens/TokensServiceBsc.ts +17 -0
- package/src/tokens/TokensServiceEth.ts +9 -0
- package/src/tokens/TokensServiceFactory.ts +24 -0
- package/src/tokens/TokensServicePolygon.ts +17 -0
- package/src/tokens/TokensServiceXDai.ts +26 -0
- package/src/tokens/defi/ISwapService.ts +12 -0
- package/src/tokens/defi/paraswap/Paraswap.ts +244 -0
- package/src/tokens/erc20/eth/WETH.ts +13 -0
- package/src/tokens/utils/TokenUtils.ts +63 -0
- package/src/txs/ITxConfig.ts +27 -0
- package/src/txs/TxDataBuilder.ts +207 -0
- package/src/txs/TxLogger.ts +121 -0
- package/src/txs/TxProvider.ts +68 -0
- package/src/txs/TxService.ts +19 -0
- package/src/txs/TxWriter.ts +370 -0
- package/src/txs/conditional/GasWatcherLogger.ts +57 -0
- package/src/txs/conditional/GasWatcherService.ts +117 -0
- package/src/txs/conditional/GasWatcherStore.ts +40 -0
- package/src/txs/conditional/GasWatcherTx.ts +143 -0
- package/src/txs/receipt/ITxLogItem.ts +25 -0
- package/src/txs/receipt/TxLogParser.ts +29 -0
- package/src/txs/receipt/TxLogsTransfer.ts +61 -0
- package/src/txs/receipt/TxTopicInMemoryProvider.ts +45 -0
- package/src/txs/receipt/TxTopicProvider.ts +29 -0
- package/src/utils/$abiParser.ts +179 -0
- package/src/utils/$abiType.ts +85 -0
- package/src/utils/$abiUtils.ts +38 -0
- package/src/utils/$address.ts +37 -0
- package/src/utils/$array.ts +57 -0
- package/src/utils/$bigint.ts +127 -0
- package/src/utils/$block.ts +7 -0
- package/src/utils/$class.ts +8 -0
- package/src/utils/$config.ts +17 -0
- package/src/utils/$contract.ts +67 -0
- package/src/utils/$csv.ts +54 -0
- package/src/utils/$date.ts +473 -0
- package/src/utils/$fn.ts +134 -0
- package/src/utils/$is.ts +37 -0
- package/src/utils/$logger.ts +10 -0
- package/src/utils/$number.ts +89 -0
- package/src/utils/$object.ts +95 -0
- package/src/utils/$path.ts +32 -0
- package/src/utils/$promise.ts +7 -0
- package/src/utils/$require.ts +118 -0
- package/src/utils/$sign.ts +36 -0
- package/src/utils/$signSerializer.ts +339 -0
- package/src/utils/$wallet.ts +10 -0
- package/src/utils/types.ts +29 -0
- package/src/wallets/Wallet.ts +33 -0
- package/src/wallets/WalletBsc.ts +13 -0
- package/src/wallets/WalletService.ts +43 -0
- package/src/www/utils/BlockChainExplorerFormatter.ts +13 -0
- package/test/ChainAccount.spec.ts +9 -0
- package/test/client.spec.ts +59 -0
- package/test/fixtures/DaiTokenContract.ts +13 -0
- package/test/fixtures/receipts/swap.json +94 -0
- package/test/generate/class.spec.ts +27 -0
- package/test/hardhat/TestNode.ts +61 -0
- package/test/ns.spec.ts +30 -0
- package/test/receipt.spec.ts +27 -0
- package/test/utils/abi-parser.spec.ts +117 -0
- package/test/utils/bigint.spec.ts +40 -0
- package/test/utils/date.spec.ts +8 -0
- package/test/utils/fn.spec.ts +39 -0
- package/test/utils/number.spec.ts +41 -0
- package/test/utils/sign.spec.ts +22 -0
- package/tsconfig-build.json +24 -0
- package/tsconfig-src.json +36 -0
- package/tsconfig.json +27 -0
- package/typings/globals/assertion/index.d.ts +159 -0
- package/typings/globals/assertion/typings.json +10 -0
- package/typings/globals/atma-utest/index.d.ts +53 -0
- package/typings/globals/atma-utest/typings.json +10 -0
- package/typings/globals/axios/index.d.ts +6 -0
- package/typings/globals/mask/index.d.ts +6 -0
- package/typings/globals/mask/typings.json +9 -0
- package/typings/index.d.ts +6 -0
- package/typings.json +6 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-Generated Class: 2021-11-09 14:26
|
|
3
|
+
*/
|
|
4
|
+
import di from 'a-di';
|
|
5
|
+
import { TAddress } from '@dequanto/models/TAddress';
|
|
6
|
+
|
|
7
|
+
import { Bscscan } from '@dequanto/BlockchainExplorer/Bscscan';
|
|
8
|
+
import { BscWeb3Client } from '@dequanto/clients/BscWeb3Client';
|
|
9
|
+
import { ClientEventsStream } from '@dequanto/clients/ClientEventsStream';
|
|
10
|
+
import { ContractBase } from '@dequanto/contracts/ContractBase';
|
|
11
|
+
import { AbiItem } from 'web3-utils';
|
|
12
|
+
import { TxWriter } from '@dequanto/txs/TxWriter';
|
|
13
|
+
import { Web3Client } from '@dequanto/clients/Web3Client';
|
|
14
|
+
import { IBlockChainExplorer } from '@dequanto/BlockchainExplorer/IBlockChainExplorer';
|
|
15
|
+
|
|
16
|
+
export class AmmPairContractV2Base extends ContractBase {
|
|
17
|
+
constructor(
|
|
18
|
+
public address: TAddress = '0x7752e1fa9f3a2e860856458517008558deb989e3',
|
|
19
|
+
public client: Web3Client = di.resolve(BscWeb3Client),
|
|
20
|
+
public explorer: IBlockChainExplorer = di.resolve(Bscscan)
|
|
21
|
+
) {
|
|
22
|
+
super(address, client, explorer)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async DOMAIN_SEPARATOR (): Promise<Buffer | string> {
|
|
26
|
+
return this.$read('function DOMAIN_SEPARATOR() returns bytes32');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async MINIMUM_LIQUIDITY (): Promise<bigint> {
|
|
30
|
+
return this.$read('function MINIMUM_LIQUIDITY() returns uint256');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async PERMIT_TYPEHASH (): Promise<Buffer | string> {
|
|
34
|
+
return this.$read('function PERMIT_TYPEHASH() returns bytes32');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async allowance (input0: TAddress, input1: TAddress): Promise<bigint> {
|
|
38
|
+
return this.$read('function allowance(address, address) returns uint256', input0, input1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async approve (eoa: {address: TAddress, key: string}, spender: TAddress, value: bigint): Promise<TxWriter> {
|
|
42
|
+
return this.$write('function approve(address, uint256) returns bool', eoa, spender, value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async balanceOf (input0: TAddress): Promise<bigint> {
|
|
46
|
+
return this.$read('function balanceOf(address) returns uint256', input0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async burn (eoa: {address: TAddress, key: string}, to: TAddress): Promise<TxWriter> {
|
|
50
|
+
return this.$write('function burn(address) returns (uint256 amount0,uint256 amount1)', eoa, to);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async decimals (): Promise<number> {
|
|
54
|
+
return this.$read('function decimals() returns uint8');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async factory (): Promise<TAddress> {
|
|
58
|
+
return this.$read('function factory() returns address');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async getReserves (): Promise<{ _reserve0: bigint, _reserve1: bigint, _blockTimestampLast: number }> {
|
|
62
|
+
return this.$read('function getReserves() returns (uint112 _reserve0,uint112 _reserve1,uint32 _blockTimestampLast)');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async initialize (eoa: {address: TAddress, key: string}, _token0: TAddress, _token1: TAddress): Promise<TxWriter> {
|
|
66
|
+
return this.$write('function initialize(address, address)', eoa, _token0, _token1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async kLast (): Promise<bigint> {
|
|
70
|
+
return this.$read('function kLast() returns uint256');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async mint (eoa: {address: TAddress, key: string}, to: TAddress): Promise<TxWriter> {
|
|
74
|
+
return this.$write('function mint(address) returns uint256 liquidity', eoa, to);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async name (): Promise<string> {
|
|
78
|
+
return this.$read('function name() returns string');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async nonces (input0: TAddress): Promise<bigint> {
|
|
82
|
+
return this.$read('function nonces(address) returns uint256', input0);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async permit (eoa: {address: TAddress, key: string}, owner: TAddress, spender: TAddress, value: bigint, deadline: bigint, v: number, r: Buffer | string, s: Buffer | string): Promise<TxWriter> {
|
|
86
|
+
return this.$write('function permit(address, address, uint256, uint256, uint8, bytes32, bytes32)', eoa, owner, spender, value, deadline, v, r, s);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async price0CumulativeLast (): Promise<bigint> {
|
|
90
|
+
return this.$read('function price0CumulativeLast() returns uint256');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async price1CumulativeLast (): Promise<bigint> {
|
|
94
|
+
return this.$read('function price1CumulativeLast() returns uint256');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async skim (eoa: {address: TAddress, key: string}, to: TAddress): Promise<TxWriter> {
|
|
98
|
+
return this.$write('function skim(address)', eoa, to);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async swap (eoa: {address: TAddress, key: string}, amount0Out: bigint, amount1Out: bigint, to: TAddress, data: Buffer | string): Promise<TxWriter> {
|
|
102
|
+
return this.$write('function swap(uint256, uint256, address, bytes)', eoa, amount0Out, amount1Out, to, data);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async symbol (): Promise<string> {
|
|
106
|
+
return this.$read('function symbol() returns string');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async sync (eoa: {address: TAddress, key: string}, ): Promise<TxWriter> {
|
|
110
|
+
return this.$write('function sync()', eoa);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async token0 (): Promise<TAddress> {
|
|
114
|
+
return this.$read('function token0() returns address');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async token1 (): Promise<TAddress> {
|
|
118
|
+
return this.$read('function token1() returns address');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async totalSupply (): Promise<bigint> {
|
|
122
|
+
return this.$read('function totalSupply() returns uint256');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async transfer (eoa: {address: TAddress, key: string}, to: TAddress, value: bigint): Promise<TxWriter> {
|
|
126
|
+
return this.$write('function transfer(address, uint256) returns bool', eoa, to, value);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async transferFrom (eoa: {address: TAddress, key: string}, from: TAddress, to: TAddress, value: bigint): Promise<TxWriter> {
|
|
130
|
+
return this.$write('function transferFrom(address, address, uint256) returns bool', eoa, from, to, value);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
onApproval (fn: (owner: TAddress, spender: TAddress, value: bigint) => void): ClientEventsStream<any> {
|
|
134
|
+
return this.$on('Approval', fn);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
onBurn (fn: (sender: TAddress, amount0: bigint, amount1: bigint, to: TAddress) => void): ClientEventsStream<any> {
|
|
138
|
+
return this.$on('Burn', fn);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
onMint (fn: (sender: TAddress, amount0: bigint, amount1: bigint) => void): ClientEventsStream<any> {
|
|
142
|
+
return this.$on('Mint', fn);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
onSwap (fn: (sender: TAddress, amount0In: bigint, amount1In: bigint, amount0Out: bigint, amount1Out: bigint, to: TAddress) => void): ClientEventsStream<any> {
|
|
146
|
+
return this.$on('Swap', fn);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
onSync (fn: (reserve0: bigint, reserve1: bigint) => void): ClientEventsStream<any> {
|
|
150
|
+
return this.$on('Sync', fn);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
onTransfer (fn: (from: TAddress, to: TAddress, value: bigint) => void): ClientEventsStream<any> {
|
|
154
|
+
return this.$on('Transfer', fn);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
abi = [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint112","name":"reserve0","type":"uint112"},{"indexed":false,"internalType":"uint112","name":"reserve1","type":"uint112"}],"name":"Sync","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"_reserve0","type":"uint112"},{"internalType":"uint112","name":"_reserve1","type":"uint112"},{"internalType":"uint32","name":"_blockTimestampLast","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"kLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"price0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"skim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount0Out","type":"uint256"},{"internalType":"uint256","name":"amount1Out","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"sync","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]
|
|
158
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import di from 'a-di';
|
|
2
|
+
import { TAddress } from '@dequanto/models/TAddress';
|
|
3
|
+
|
|
4
|
+
import { Etherscan } from '@dequanto/BlockchainExplorer/Etherscan';
|
|
5
|
+
import { EthWeb3Client } from '@dequanto/clients/EthWeb3Client';
|
|
6
|
+
|
|
7
|
+
import { ContractBase } from '@dequanto/contracts/ContractBase';
|
|
8
|
+
import { AbiItem } from 'web3-utils';
|
|
9
|
+
import { TxWriter } from '@dequanto/txs/TxWriter';
|
|
10
|
+
|
|
11
|
+
export class AmmPairContractV3Base extends ContractBase {
|
|
12
|
+
constructor(
|
|
13
|
+
public address: TAddress = '0x8f8ef111b67c04eb1641f5ff19ee54cda062f163',
|
|
14
|
+
public client = di.resolve(EthWeb3Client),
|
|
15
|
+
public explorer = di.resolve(Etherscan)
|
|
16
|
+
) {
|
|
17
|
+
super(address, client, explorer)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async burn (eoa: {address: TAddress, key: string}, tickLower: number, tickUpper: number, amount: bigint): Promise<TxWriter> {
|
|
21
|
+
return this.$write('function burn(int24, int24, uint128) returns (uint256 amount0,uint256 amount1)', eoa, tickLower, tickUpper, amount);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async collect (eoa: {address: TAddress, key: string}, recipient: TAddress, tickLower: number, tickUpper: number, amount0Requested: bigint, amount1Requested: bigint): Promise<TxWriter> {
|
|
25
|
+
return this.$write('function collect(address, int24, int24, uint128, uint128) returns (uint128 amount0,uint128 amount1)', eoa, recipient, tickLower, tickUpper, amount0Requested, amount1Requested);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async collectProtocol (eoa: {address: TAddress, key: string}, recipient: TAddress, amount0Requested: bigint, amount1Requested: bigint): Promise<TxWriter> {
|
|
29
|
+
return this.$write('function collectProtocol(address, uint128, uint128) returns (uint128 amount0,uint128 amount1)', eoa, recipient, amount0Requested, amount1Requested);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async factory (): Promise<TAddress> {
|
|
33
|
+
return this.$read('function factory() returns address');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async fee (): Promise<number> {
|
|
37
|
+
return this.$read('function fee() returns uint24');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async feeGrowthGlobal0X128 (): Promise<bigint> {
|
|
41
|
+
return this.$read('function feeGrowthGlobal0X128() returns uint256');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async feeGrowthGlobal1X128 (): Promise<bigint> {
|
|
45
|
+
return this.$read('function feeGrowthGlobal1X128() returns uint256');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async flash (eoa: {address: TAddress, key: string}, recipient: TAddress, amount0: bigint, amount1: bigint, data: Buffer | string): Promise<TxWriter> {
|
|
49
|
+
return this.$write('function flash(address, uint256, uint256, bytes)', eoa, recipient, amount0, amount1, data);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async increaseObservationCardinalityNext (eoa: {address: TAddress, key: string}, observationCardinalityNext: number): Promise<TxWriter> {
|
|
53
|
+
return this.$write('function increaseObservationCardinalityNext(uint16)', eoa, observationCardinalityNext);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async initialize (eoa: {address: TAddress, key: string}, sqrtPriceX96: bigint): Promise<TxWriter> {
|
|
57
|
+
return this.$write('function initialize(uint160)', eoa, sqrtPriceX96);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async liquidity (): Promise<bigint> {
|
|
61
|
+
return this.$read('function liquidity() returns uint128');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async maxLiquidityPerTick (): Promise<bigint> {
|
|
65
|
+
return this.$read('function maxLiquidityPerTick() returns uint128');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async mint (eoa: {address: TAddress, key: string}, recipient: TAddress, tickLower: number, tickUpper: number, amount: bigint, data: Buffer | string): Promise<TxWriter> {
|
|
69
|
+
return this.$write('function mint(address, int24, int24, uint128, bytes) returns (uint256 amount0,uint256 amount1)', eoa, recipient, tickLower, tickUpper, amount, data);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async observations (input0: bigint): Promise<{ blockTimestamp: number, tickCumulative: number, secondsPerLiquidityCumulativeX128: bigint, initialized: boolean }> {
|
|
73
|
+
return this.$read('function observations(uint256) returns (uint32 blockTimestamp,int56 tickCumulative,uint160 secondsPerLiquidityCumulativeX128,bool initialized)', input0);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async observe (secondsAgos: number[]): Promise<{ tickCumulatives: number[], secondsPerLiquidityCumulativeX128s: bigint[] }> {
|
|
77
|
+
return this.$read('function observe(uint32[]) returns (int56[] tickCumulatives,uint160[] secondsPerLiquidityCumulativeX128s)', secondsAgos);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async positions (input0: Buffer | string): Promise<{ liquidity: bigint, feeGrowthInside0LastX128: bigint, feeGrowthInside1LastX128: bigint, tokensOwed0: bigint, tokensOwed1: bigint }> {
|
|
81
|
+
return this.$read('function positions(bytes32) returns (uint128 liquidity,uint256 feeGrowthInside0LastX128,uint256 feeGrowthInside1LastX128,uint128 tokensOwed0,uint128 tokensOwed1)', input0);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async protocolFees (): Promise<{ token0: bigint, token1: bigint }> {
|
|
85
|
+
return this.$read('function protocolFees() returns (uint128 token0,uint128 token1)');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async setFeeProtocol (eoa: {address: TAddress, key: string}, feeProtocol0: number, feeProtocol1: number): Promise<TxWriter> {
|
|
89
|
+
return this.$write('function setFeeProtocol(uint8, uint8)', eoa, feeProtocol0, feeProtocol1);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async slot0 (): Promise<{ sqrtPriceX96: bigint, tick: number, observationIndex: number, observationCardinality: number, observationCardinalityNext: number, feeProtocol: number, unlocked: boolean }> {
|
|
93
|
+
return this.$read('function slot0() returns (uint160 sqrtPriceX96,int24 tick,uint16 observationIndex,uint16 observationCardinality,uint16 observationCardinalityNext,uint8 feeProtocol,bool unlocked)');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async snapshotCumulativesInside (tickLower: number, tickUpper: number): Promise<{ tickCumulativeInside: number, secondsPerLiquidityInsideX128: bigint, secondsInside: number }> {
|
|
97
|
+
return this.$read('function snapshotCumulativesInside(int24, int24) returns (int56 tickCumulativeInside,uint160 secondsPerLiquidityInsideX128,uint32 secondsInside)', tickLower, tickUpper);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async swap (eoa: {address: TAddress, key: string}, recipient: TAddress, zeroForOne: boolean, amountSpecified: bigint, sqrtPriceLimitX96: bigint, data: Buffer | string): Promise<TxWriter> {
|
|
101
|
+
return this.$write('function swap(address, bool, int256, uint160, bytes) returns (int256 amount0,int256 amount1)', eoa, recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async tickBitmap (input0: number): Promise<bigint> {
|
|
105
|
+
return this.$read('function tickBitmap(int16) returns uint256', input0);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async tickSpacing (): Promise<number> {
|
|
109
|
+
return this.$read('function tickSpacing() returns int24');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async ticks (input0: number): Promise<{ liquidityGross: bigint, liquidityNet: bigint, feeGrowthOutside0X128: bigint, feeGrowthOutside1X128: bigint, tickCumulativeOutside: number, secondsPerLiquidityOutsideX128: bigint, secondsOutside: number, initialized: boolean }> {
|
|
113
|
+
return this.$read('function ticks(int24) returns (uint128 liquidityGross,int128 liquidityNet,uint256 feeGrowthOutside0X128,uint256 feeGrowthOutside1X128,int56 tickCumulativeOutside,uint160 secondsPerLiquidityOutsideX128,uint32 secondsOutside,bool initialized)', input0);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async token0 (): Promise<TAddress> {
|
|
117
|
+
return this.$read('function token0() returns address');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async token1 (): Promise<TAddress> {
|
|
121
|
+
return this.$read('function token1() returns address');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
abi = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"CollectProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid1","type":"uint256"}],"name":"Flash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"feeProtocol0Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol0New","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1New","type":"uint8"}],"name":"SetFeeProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"},{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collectProtocol","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal0X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal1X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"name":"increaseObservationCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLiquidityPerTick","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"int56","name":"tickCumulative","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityCumulativeX128","type":"uint160"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"int56[]","name":"tickCumulatives","type":"int56[]"},{"internalType":"uint160[]","name":"secondsPerLiquidityCumulativeX128s","type":"uint160[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"positions","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"token0","type":"uint128"},{"internalType":"uint128","name":"token1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"feeProtocol0","type":"uint8"},{"internalType":"uint8","name":"feeProtocol1","type":"uint8"}],"name":"setFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"},{"internalType":"uint8","name":"feeProtocol","type":"uint8"},{"internalType":"bool","name":"unlocked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"snapshotCumulativesInside","outputs":[{"internalType":"int56","name":"tickCumulativeInside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsInside","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"","type":"int16"}],"name":"tickBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"ticks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint256","name":"feeGrowthOutside0X128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthOutside1X128","type":"uint256"},{"internalType":"int56","name":"tickCumulativeOutside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityOutsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsOutside","type":"uint32"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
|
|
125
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-Generated Class: 2021-11-09 14:26
|
|
3
|
+
*/
|
|
4
|
+
import di from 'a-di';
|
|
5
|
+
import { TAddress } from '@dequanto/models/TAddress';
|
|
6
|
+
|
|
7
|
+
import { Bscscan } from '@dequanto/BlockchainExplorer/Bscscan';
|
|
8
|
+
import { BscWeb3Client } from '@dequanto/clients/BscWeb3Client';
|
|
9
|
+
import { ClientEventsStream } from '@dequanto/clients/ClientEventsStream';
|
|
10
|
+
import { ContractBase } from '@dequanto/contracts/ContractBase';
|
|
11
|
+
import { AbiItem } from 'web3-utils';
|
|
12
|
+
import { TxWriter } from '@dequanto/txs/TxWriter';
|
|
13
|
+
import { Web3Client } from '@dequanto/clients/Web3Client';
|
|
14
|
+
import { IBlockChainExplorer } from '@dequanto/BlockchainExplorer/IBlockChainExplorer';
|
|
15
|
+
|
|
16
|
+
export class AmmRouterV2ContractBase extends ContractBase {
|
|
17
|
+
constructor(
|
|
18
|
+
public address: TAddress = '0x10ED43C718714eb63d5aA57B78B54704E256024E',
|
|
19
|
+
public client: Web3Client = di.resolve(BscWeb3Client),
|
|
20
|
+
public explorer: IBlockChainExplorer = di.resolve(Bscscan)
|
|
21
|
+
) {
|
|
22
|
+
super(address, client, explorer)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async WETH (): Promise<TAddress> {
|
|
26
|
+
return this.$read('function WETH() returns address');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async addLiquidity (eoa: {address: TAddress, key: string}, tokenA: TAddress, tokenB: TAddress, amountADesired: bigint, amountBDesired: bigint, amountAMin: bigint, amountBMin: bigint, to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
30
|
+
return this.$write('function addLiquidity(address, address, uint256, uint256, uint256, uint256, address, uint256) returns (uint256 amountA,uint256 amountB,uint256 liquidity)', eoa, tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, to, deadline);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async addLiquidityETH (eoa: {address: TAddress, key: string}, token: TAddress, amountTokenDesired: bigint, amountTokenMin: bigint, amountETHMin: bigint, to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
34
|
+
return this.$write('function addLiquidityETH(address, uint256, uint256, uint256, address, uint256) returns (uint256 amountToken,uint256 amountETH,uint256 liquidity)', eoa, token, amountTokenDesired, amountTokenMin, amountETHMin, to, deadline);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async factory (): Promise<TAddress> {
|
|
38
|
+
return this.$read('function factory() returns address');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async getAmountIn (amountOut: bigint, reserveIn: bigint, reserveOut: bigint): Promise<{ amountIn: bigint }> {
|
|
42
|
+
return this.$read('function getAmountIn(uint256, uint256, uint256) returns uint256 amountIn', amountOut, reserveIn, reserveOut);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async getAmountOut (amountIn: bigint, reserveIn: bigint, reserveOut: bigint): Promise<{ amountOut: bigint }> {
|
|
46
|
+
return this.$read('function getAmountOut(uint256, uint256, uint256) returns uint256 amountOut', amountIn, reserveIn, reserveOut);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async getAmountsIn (amountOut: bigint, path: TAddress[]): Promise<{ amounts: bigint[] }> {
|
|
50
|
+
return this.$read('function getAmountsIn(uint256, address[]) returns uint256[] amounts', amountOut, path);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async getAmountsOut (amountIn: bigint, path: TAddress[]): Promise<{ amounts: bigint[] }> {
|
|
54
|
+
return this.$read('function getAmountsOut(uint256, address[]) returns uint256[] amounts', amountIn, path);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async quote (amountA: bigint, reserveA: bigint, reserveB: bigint): Promise<{ amountB: bigint }> {
|
|
58
|
+
return this.$read('function quote(uint256, uint256, uint256) returns uint256 amountB', amountA, reserveA, reserveB);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async removeLiquidity (eoa: {address: TAddress, key: string}, tokenA: TAddress, tokenB: TAddress, liquidity: bigint, amountAMin: bigint, amountBMin: bigint, to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
62
|
+
return this.$write('function removeLiquidity(address, address, uint256, uint256, uint256, address, uint256) returns (uint256 amountA,uint256 amountB)', eoa, tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async removeLiquidityETH (eoa: {address: TAddress, key: string}, token: TAddress, liquidity: bigint, amountTokenMin: bigint, amountETHMin: bigint, to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
66
|
+
return this.$write('function removeLiquidityETH(address, uint256, uint256, uint256, address, uint256) returns (uint256 amountToken,uint256 amountETH)', eoa, token, liquidity, amountTokenMin, amountETHMin, to, deadline);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async removeLiquidityETHSupportingFeeOnTransferTokens (eoa: {address: TAddress, key: string}, token: TAddress, liquidity: bigint, amountTokenMin: bigint, amountETHMin: bigint, to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
70
|
+
return this.$write('function removeLiquidityETHSupportingFeeOnTransferTokens(address, uint256, uint256, uint256, address, uint256) returns uint256 amountETH', eoa, token, liquidity, amountTokenMin, amountETHMin, to, deadline);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async removeLiquidityETHWithPermit (eoa: {address: TAddress, key: string}, token: TAddress, liquidity: bigint, amountTokenMin: bigint, amountETHMin: bigint, to: TAddress, deadline: bigint, approveMax: boolean, v: number, r: Buffer | string, s: Buffer | string): Promise<TxWriter> {
|
|
74
|
+
return this.$write('function removeLiquidityETHWithPermit(address, uint256, uint256, uint256, address, uint256, bool, uint8, bytes32, bytes32) returns (uint256 amountToken,uint256 amountETH)', eoa, token, liquidity, amountTokenMin, amountETHMin, to, deadline, approveMax, v, r, s);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async removeLiquidityETHWithPermitSupportingFeeOnTransferTokens (eoa: {address: TAddress, key: string}, token: TAddress, liquidity: bigint, amountTokenMin: bigint, amountETHMin: bigint, to: TAddress, deadline: bigint, approveMax: boolean, v: number, r: Buffer | string, s: Buffer | string): Promise<TxWriter> {
|
|
78
|
+
return this.$write('function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(address, uint256, uint256, uint256, address, uint256, bool, uint8, bytes32, bytes32) returns uint256 amountETH', eoa, token, liquidity, amountTokenMin, amountETHMin, to, deadline, approveMax, v, r, s);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async removeLiquidityWithPermit (eoa: {address: TAddress, key: string}, tokenA: TAddress, tokenB: TAddress, liquidity: bigint, amountAMin: bigint, amountBMin: bigint, to: TAddress, deadline: bigint, approveMax: boolean, v: number, r: Buffer | string, s: Buffer | string): Promise<TxWriter> {
|
|
82
|
+
return this.$write('function removeLiquidityWithPermit(address, address, uint256, uint256, uint256, address, uint256, bool, uint8, bytes32, bytes32) returns (uint256 amountA,uint256 amountB)', eoa, tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline, approveMax, v, r, s);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async swapETHForExactTokens (eoa: {address: TAddress, key: string}, amountOut: bigint, path: TAddress[], to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
86
|
+
return this.$write('function swapETHForExactTokens(uint256, address[], address, uint256) returns uint256[] amounts', eoa, amountOut, path, to, deadline);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async swapExactETHForTokens (eoa: {address: TAddress, key: string}, amountOutMin: bigint, path: TAddress[], to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
90
|
+
return this.$write('function swapExactETHForTokens(uint256, address[], address, uint256) returns uint256[] amounts', eoa, amountOutMin, path, to, deadline);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async swapExactETHForTokensSupportingFeeOnTransferTokens (eoa: {address: TAddress, key: string}, amountOutMin: bigint, path: TAddress[], to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
94
|
+
return this.$write('function swapExactETHForTokensSupportingFeeOnTransferTokens(uint256, address[], address, uint256)', eoa, amountOutMin, path, to, deadline);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async swapExactTokensForETH (eoa: {address: TAddress, key: string}, amountIn: bigint, amountOutMin: bigint, path: TAddress[], to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
98
|
+
return this.$write('function swapExactTokensForETH(uint256, uint256, address[], address, uint256) returns uint256[] amounts', eoa, amountIn, amountOutMin, path, to, deadline);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async swapExactTokensForETHSupportingFeeOnTransferTokens (eoa: {address: TAddress, key: string}, amountIn: bigint, amountOutMin: bigint, path: TAddress[], to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
102
|
+
return this.$write('function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256, uint256, address[], address, uint256)', eoa, amountIn, amountOutMin, path, to, deadline);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async swapExactTokensForTokens (eoa: {address: TAddress, key: string}, amountIn: bigint, amountOutMin: bigint, path: TAddress[], to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
106
|
+
return this.$write('function swapExactTokensForTokens(uint256, uint256, address[], address, uint256) returns uint256[] amounts', eoa, amountIn, amountOutMin, path, to, deadline);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async swapExactTokensForTokensSupportingFeeOnTransferTokens (eoa: {address: TAddress, key: string}, amountIn: bigint, amountOutMin: bigint, path: TAddress[], to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
110
|
+
return this.$write('function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256, uint256, address[], address, uint256)', eoa, amountIn, amountOutMin, path, to, deadline);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async swapTokensForExactETH (eoa: {address: TAddress, key: string}, amountOut: bigint, amountInMax: bigint, path: TAddress[], to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
114
|
+
return this.$write('function swapTokensForExactETH(uint256, uint256, address[], address, uint256) returns uint256[] amounts', eoa, amountOut, amountInMax, path, to, deadline);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async swapTokensForExactTokens (eoa: {address: TAddress, key: string}, amountOut: bigint, amountInMax: bigint, path: TAddress[], to: TAddress, deadline: bigint): Promise<TxWriter> {
|
|
118
|
+
return this.$write('function swapTokensForExactTokens(uint256, uint256, address[], address, uint256) returns uint256[] amounts', eoa, amountOut, amountInMax, path, to, deadline);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
abi = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountTokenDesired","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountIn","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsIn","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"reserveA","type":"uint256"},{"internalType":"uint256","name":"reserveB","type":"uint256"}],"name":"quote","outputs":[{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidityETHSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityETHWithPermit","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityETHWithPermitSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityWithPermit","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapETHForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactETHForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactETHForTokensSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForETHSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokensSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
|
|
124
|
+
}
|