@gearbox-protocol/sdk 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/.idea/gearbox-sdk.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.prettierrc +10 -0
- package/README.md +4 -0
- package/lib/config.d.ts +1 -0
- package/lib/config.js +4 -0
- package/lib/core/constants.d.ts +17 -0
- package/lib/core/constants.js +36 -0
- package/lib/core/contracts.d.ts +64 -0
- package/lib/core/contracts.js +104 -0
- package/lib/core/contractsRegister.d.ts +2 -0
- package/lib/core/contractsRegister.js +43 -0
- package/lib/core/creditAccount.d.ts +35 -0
- package/lib/core/creditAccount.js +98 -0
- package/lib/core/creditCard.d.ts +13 -0
- package/lib/core/creditCard.js +2 -0
- package/lib/core/creditManager.d.ts +37 -0
- package/lib/core/creditManager.js +118 -0
- package/lib/core/creditOperation.d.ts +9 -0
- package/lib/core/creditOperation.js +2 -0
- package/lib/core/creditSession.d.ts +26 -0
- package/lib/core/creditSession.js +44 -0
- package/lib/core/errors.d.ts +26 -0
- package/lib/core/errors.js +74 -0
- package/lib/core/event.d.ts +42 -0
- package/lib/core/event.js +2 -0
- package/lib/core/eventOrTx.d.ts +36 -0
- package/lib/core/eventOrTx.js +97 -0
- package/lib/core/events.d.ts +369 -0
- package/lib/core/events.js +730 -0
- package/lib/core/history.d.ts +42 -0
- package/lib/core/history.js +2 -0
- package/lib/core/operations.d.ts +22 -0
- package/lib/core/operations.js +20 -0
- package/lib/core/oracles.d.ts +6 -0
- package/lib/core/oracles.js +2 -0
- package/lib/core/pool.d.ts +28 -0
- package/lib/core/pool.js +32 -0
- package/lib/core/swap.d.ts +4 -0
- package/lib/core/swap.js +8 -0
- package/lib/core/token.d.ts +3 -0
- package/lib/core/token.js +229 -0
- package/lib/core/tokenData.d.ts +28 -0
- package/lib/core/tokenData.js +58 -0
- package/lib/core/tokenDistributor.d.ts +12 -0
- package/lib/core/tokenDistributor.js +9 -0
- package/lib/core/trade.d.ts +35 -0
- package/lib/core/trade.js +62 -0
- package/lib/core/transactions.d.ts +127 -0
- package/lib/core/transactions.js +306 -0
- package/lib/index.d.ts +33 -0
- package/lib/index.js +47 -0
- package/lib/payload/creditAccount.d.ts +26 -0
- package/lib/payload/creditAccount.js +2 -0
- package/lib/payload/creditManager.d.ts +43 -0
- package/lib/payload/creditManager.js +2 -0
- package/lib/payload/creditSession.d.ts +23 -0
- package/lib/payload/creditSession.js +2 -0
- package/lib/payload/graphPayload.d.ts +9 -0
- package/lib/payload/graphPayload.js +2 -0
- package/lib/payload/pool.d.ts +17 -0
- package/lib/payload/pool.js +3 -0
- package/lib/payload/token.d.ts +5 -0
- package/lib/payload/token.js +2 -0
- package/lib/types/ACL.d.ts +491 -0
- package/lib/types/ACLTrait.d.ts +148 -0
- package/lib/types/ACLTraitTest.d.ts +209 -0
- package/lib/types/AbstractAccountMiner.d.ts +143 -0
- package/lib/types/AccountFactory.d.ts +716 -0
- package/lib/types/AccountMinerAuction.d.ts +391 -0
- package/lib/types/AccountMinerMock.d.ts +241 -0
- package/lib/types/AccountMinerNonReceivableTest.d.ts +127 -0
- package/lib/types/AccountMinerOwnFunds.d.ts +218 -0
- package/lib/types/AccountMining.d.ts +222 -0
- package/lib/types/AdaptersDeployer.d.ts +262 -0
- package/lib/types/AddressProvider.d.ts +912 -0
- package/lib/types/AggregatorV3Interface.d.ts +234 -0
- package/lib/types/ChainlinkPriceFeedMock.d.ts +215 -0
- package/lib/types/ContractsRegister.d.ts +398 -0
- package/lib/types/CoreDeployer.d.ts +394 -0
- package/lib/types/CreditAccount.d.ts +443 -0
- package/lib/types/CreditFilter.d.ts +1609 -0
- package/lib/types/CreditFilterMock.d.ts +1687 -0
- package/lib/types/CreditManager.d.ts +1285 -0
- package/lib/types/CreditManagerMockForFilter.d.ts +605 -0
- package/lib/types/CreditManagerMockForPoolTest.d.ts +204 -0
- package/lib/types/CurveMock.d.ts +298 -0
- package/lib/types/CurveV1Adapter.d.ts +349 -0
- package/lib/types/DataCompressor.d.ts +1331 -0
- package/lib/types/Deployer.d.ts +224 -0
- package/lib/types/DieselToken.d.ts +567 -0
- package/lib/types/ERC165.d.ts +116 -0
- package/lib/types/ERC20.d.ts +411 -0
- package/lib/types/ERC20BlockingMock.d.ts +568 -0
- package/lib/types/ERC721.d.ts +625 -0
- package/lib/types/Errors.d.ts +1854 -0
- package/lib/types/ExecutorMock.d.ts +140 -0
- package/lib/types/FlashLoanAttacker.d.ts +170 -0
- package/lib/types/FuzzHarness.d.ts +124 -0
- package/lib/types/GearBeta.d.ts +745 -0
- package/lib/types/GearToken.d.ts +888 -0
- package/lib/types/GenesisDeployer.d.ts +282 -0
- package/lib/types/IAccountFactory.d.ts +317 -0
- package/lib/types/IAccountMiner.d.ts +124 -0
- package/lib/types/IAppAddressProvider.d.ts +198 -0
- package/lib/types/IAppCreditManager.d.ts +408 -0
- package/lib/types/IAppERC20.d.ts +309 -0
- package/lib/types/IAppPoolService.d.ts +166 -0
- package/lib/types/ICreditAccount.d.ts +430 -0
- package/lib/types/ICreditAccountData.d.ts +347 -0
- package/lib/types/ICreditFilter.d.ts +1162 -0
- package/lib/types/ICreditManager.d.ts +971 -0
- package/lib/types/ICurvePool.d.ts +298 -0
- package/lib/types/IDataCompressor.d.ts +1231 -0
- package/lib/types/IERC165.d.ts +116 -0
- package/lib/types/IERC20.d.ts +294 -0
- package/lib/types/IERC721.d.ts +472 -0
- package/lib/types/IERC721Enumerable.d.ts +564 -0
- package/lib/types/IERC721Metadata.d.ts +523 -0
- package/lib/types/IERC721Receiver.d.ts +132 -0
- package/lib/types/IGearToken.d.ts +527 -0
- package/lib/types/IInterestRateModel.d.ts +121 -0
- package/lib/types/IMerkleDistributor.d.ts +190 -0
- package/lib/types/IPoolService.d.ts +772 -0
- package/lib/types/IPriceOracle.d.ts +211 -0
- package/lib/types/IQuoter.d.ts +269 -0
- package/lib/types/ISwapRouter.d.ts +404 -0
- package/lib/types/IUniswapV2Migrator.d.ts +134 -0
- package/lib/types/IUniswapV2Router01.d.ts +1119 -0
- package/lib/types/IUniswapV2Router02.d.ts +1432 -0
- package/lib/types/IUniswapV3SwapCallback.d.ts +127 -0
- package/lib/types/IWETH.d.ts +169 -0
- package/lib/types/IWETHGateway.d.ts +335 -0
- package/lib/types/IYVault.d.ts +558 -0
- package/lib/types/LeveragedActions.d.ts +772 -0
- package/lib/types/LinearInterestRateModel.d.ts +279 -0
- package/lib/types/MockPoolService.d.ts +1271 -0
- package/lib/types/Multicall2.d.ts +449 -0
- package/lib/types/Ownable.d.ts +169 -0
- package/lib/types/PathFinder.d.ts +379 -0
- package/lib/types/Pausable.d.ts +105 -0
- package/lib/types/PercentageMathTest.d.ts +154 -0
- package/lib/types/PoolDeployer.d.ts +282 -0
- package/lib/types/PoolService.d.ts +1174 -0
- package/lib/types/PriceOracle.d.ts +387 -0
- package/lib/types/Proxy.d.ts +78 -0
- package/lib/types/StepVesting.d.ts +411 -0
- package/lib/types/TestPoolService.d.ts +1294 -0
- package/lib/types/TokenDistributor.d.ts +640 -0
- package/lib/types/TokenFeeMock.d.ts +544 -0
- package/lib/types/TokenMock.d.ts +531 -0
- package/lib/types/TreasuryMock.d.ts +86 -0
- package/lib/types/UniswapRouterMock.d.ts +1520 -0
- package/lib/types/UniswapV2Adapter.d.ts +1463 -0
- package/lib/types/UniswapV3Adapter.d.ts +455 -0
- package/lib/types/VestingDeployer.d.ts +247 -0
- package/lib/types/WETHGateway.d.ts +376 -0
- package/lib/types/WETHMock.d.ts +433 -0
- package/lib/types/WadRayMathTest.d.ts +316 -0
- package/lib/types/YearnAdapter.d.ts +609 -0
- package/lib/types/YearnMock.d.ts +795 -0
- package/lib/types/YearnPriceFeed.d.ts +399 -0
- package/lib/types/commons.d.ts +16 -0
- package/lib/types/commons.js +5 -0
- package/lib/types/factories/ACLTraitTest__factory.d.ts +52 -0
- package/lib/types/factories/ACLTraitTest__factory.js +138 -0
- package/lib/types/factories/ACLTrait__factory.d.ts +31 -0
- package/lib/types/factories/ACLTrait__factory.js +75 -0
- package/lib/types/factories/ACL__factory.d.ts +45 -0
- package/lib/types/factories/ACL__factory.js +317 -0
- package/lib/types/factories/AbstractAccountMiner__factory.d.ts +30 -0
- package/lib/types/factories/AbstractAccountMiner__factory.js +61 -0
- package/lib/types/factories/AccountFactory__factory.d.ts +72 -0
- package/lib/types/factories/AccountFactory__factory.js +508 -0
- package/lib/types/factories/AccountMinerAuction__factory.js +304 -0
- package/lib/types/factories/AccountMinerMock__factory.js +196 -0
- package/lib/types/factories/AccountMinerNonReceivableTest__factory.js +84 -0
- package/lib/types/factories/AccountMinerOwnFunds__factory.js +181 -0
- package/lib/types/factories/AccountMining__factory.d.ts +56 -0
- package/lib/types/factories/AccountMining__factory.js +192 -0
- package/lib/types/factories/AdaptersDeployer__factory.d.ts +85 -0
- package/lib/types/factories/AdaptersDeployer__factory.js +202 -0
- package/lib/types/factories/AddressProvider__factory.d.ts +52 -0
- package/lib/types/factories/AddressProvider__factory.js +582 -0
- package/lib/types/factories/AggregatorV3Interface__factory.d.ts +22 -0
- package/lib/types/factories/AggregatorV3Interface__factory.js +133 -0
- package/lib/types/factories/ChainlinkPriceFeedMock__factory.d.ts +42 -0
- package/lib/types/factories/ChainlinkPriceFeedMock__factory.js +193 -0
- package/lib/types/factories/ContractsRegister__factory.d.ts +56 -0
- package/lib/types/factories/ContractsRegister__factory.js +310 -0
- package/lib/types/factories/CoreDeployer__factory.js +331 -0
- package/lib/types/factories/CreditAccount__factory.d.ts +32 -0
- package/lib/types/factories/CreditAccount__factory.js +262 -0
- package/lib/types/factories/CreditFilterMock__factory.d.ts +56 -0
- package/lib/types/factories/CreditFilterMock__factory.js +1083 -0
- package/lib/types/factories/CreditFilter__factory.d.ts +56 -0
- package/lib/types/factories/CreditFilter__factory.js +1047 -0
- package/lib/types/factories/CreditManagerMockForFilter__factory.d.ts +38 -0
- package/lib/types/factories/CreditManagerMockForFilter__factory.js +324 -0
- package/lib/types/factories/CreditManagerMockForPoolTest__factory.d.ts +48 -0
- package/lib/types/factories/CreditManagerMockForPoolTest__factory.js +131 -0
- package/lib/types/factories/CreditManager__factory.d.ts +77 -0
- package/lib/types/factories/CreditManager__factory.js +1030 -0
- package/lib/types/factories/CurveMock__factory.d.ts +42 -0
- package/lib/types/factories/CurveMock__factory.js +210 -0
- package/lib/types/factories/CurveV1Adapter__factory.d.ts +42 -0
- package/lib/types/factories/CurveV1Adapter__factory.js +254 -0
- package/lib/types/factories/DataCompressor__factory.d.ts +71 -0
- package/lib/types/factories/DataCompressor__factory.js +944 -0
- package/lib/types/factories/Deployer__factory.js +248 -0
- package/lib/types/factories/DieselToken__factory.d.ts +56 -0
- package/lib/types/factories/DieselToken__factory.js +432 -0
- package/lib/types/factories/ERC165__factory.d.ts +22 -0
- package/lib/types/factories/ERC165__factory.js +41 -0
- package/lib/types/factories/ERC20BlockingMock__factory.d.ts +56 -0
- package/lib/types/factories/ERC20BlockingMock__factory.js +429 -0
- package/lib/types/factories/ERC20__factory.d.ts +56 -0
- package/lib/types/factories/ERC20__factory.js +339 -0
- package/lib/types/factories/ERC721__factory.d.ts +56 -0
- package/lib/types/factories/ERC721__factory.js +468 -0
- package/lib/types/factories/Errors__factory.d.ts +28 -0
- package/lib/types/factories/Errors__factory.js +1015 -0
- package/lib/types/factories/ExecutorMock__factory.d.ts +38 -0
- package/lib/types/factories/ExecutorMock__factory.js +103 -0
- package/lib/types/factories/FlashLoanAttacker__factory.d.ts +48 -0
- package/lib/types/factories/FlashLoanAttacker__factory.js +117 -0
- package/lib/types/factories/FuzzHarness__factory.d.ts +38 -0
- package/lib/types/factories/FuzzHarness__factory.js +92 -0
- package/lib/types/factories/GearBeta__factory.d.ts +52 -0
- package/lib/types/factories/GearBeta__factory.js +527 -0
- package/lib/types/factories/GearToken__factory.d.ts +56 -0
- package/lib/types/factories/GearToken__factory.js +708 -0
- package/lib/types/factories/GenesisDeployer__factory.d.ts +108 -0
- package/lib/types/factories/GenesisDeployer__factory.js +231 -0
- package/lib/types/factories/IAccountFactory__factory.d.ts +35 -0
- package/lib/types/factories/IAccountFactory__factory.js +226 -0
- package/lib/types/factories/IAccountMiner__factory.d.ts +28 -0
- package/lib/types/factories/IAccountMiner__factory.js +48 -0
- package/lib/types/factories/IAppAddressProvider__factory.d.ts +18 -0
- package/lib/types/factories/IAppAddressProvider__factory.js +100 -0
- package/lib/types/factories/IAppCreditManager__factory.d.ts +42 -0
- package/lib/types/factories/IAppCreditManager__factory.js +204 -0
- package/lib/types/factories/IAppERC20__factory.d.ts +22 -0
- package/lib/types/factories/IAppERC20__factory.js +194 -0
- package/lib/types/factories/IAppPoolService__factory.d.ts +22 -0
- package/lib/types/factories/IAppPoolService__factory.js +69 -0
- package/lib/types/factories/ICreditAccountData__factory.d.ts +35 -0
- package/lib/types/factories/ICreditAccountData__factory.js +216 -0
- package/lib/types/factories/ICreditAccount__factory.d.ts +22 -0
- package/lib/types/factories/ICreditAccount__factory.js +218 -0
- package/lib/types/factories/ICreditFilter__factory.d.ts +35 -0
- package/lib/types/factories/ICreditFilter__factory.js +700 -0
- package/lib/types/factories/ICreditManager__factory.d.ts +56 -0
- package/lib/types/factories/ICreditManager__factory.js +720 -0
- package/lib/types/factories/ICurvePool__factory.d.ts +22 -0
- package/lib/types/factories/ICurvePool__factory.js +168 -0
- package/lib/types/factories/IDataCompressor__factory.d.ts +51 -0
- package/lib/types/factories/IDataCompressor__factory.js +826 -0
- package/lib/types/factories/IERC165__factory.d.ts +22 -0
- package/lib/types/factories/IERC165__factory.js +41 -0
- package/lib/types/factories/IERC20__factory.d.ts +35 -0
- package/lib/types/factories/IERC20__factory.js +205 -0
- package/lib/types/factories/IERC721Enumerable__factory.d.ts +35 -0
- package/lib/types/factories/IERC721Enumerable__factory.js +363 -0
- package/lib/types/factories/IERC721Metadata__factory.d.ts +35 -0
- package/lib/types/factories/IERC721Metadata__factory.js +352 -0
- package/lib/types/factories/IERC721Receiver__factory.d.ts +22 -0
- package/lib/types/factories/IERC721Receiver__factory.js +56 -0
- package/lib/types/factories/IERC721__factory.d.ts +35 -0
- package/lib/types/factories/IERC721__factory.js +307 -0
- package/lib/types/factories/IGearToken__factory.d.ts +35 -0
- package/lib/types/factories/IGearToken__factory.js +342 -0
- package/lib/types/factories/IInterestRateModel__factory.d.ts +22 -0
- package/lib/types/factories/IInterestRateModel__factory.js +46 -0
- package/lib/types/factories/IMerkleDistributor__factory.d.ts +35 -0
- package/lib/types/factories/IMerkleDistributor__factory.js +109 -0
- package/lib/types/factories/IPoolService__factory.d.ts +35 -0
- package/lib/types/factories/IPoolService__factory.js +580 -0
- package/lib/types/factories/IPriceOracle__factory.d.ts +35 -0
- package/lib/types/factories/IPriceOracle__factory.js +112 -0
- package/lib/types/factories/IQuoter__factory.d.ts +22 -0
- package/lib/types/factories/IQuoter__factory.js +148 -0
- package/lib/types/factories/ISwapRouter__factory.d.ts +27 -0
- package/lib/types/factories/ISwapRouter__factory.js +236 -0
- package/lib/types/factories/IUniswapV2Migrator__factory.d.ts +18 -0
- package/lib/types/factories/IUniswapV2Migrator__factory.js +55 -0
- package/lib/types/factories/IUniswapV2Router01__factory.d.ts +22 -0
- package/lib/types/factories/IUniswapV2Router01__factory.js +771 -0
- package/lib/types/factories/IUniswapV2Router02__factory.d.ts +22 -0
- package/lib/types/factories/IUniswapV2Router02__factory.js +973 -0
- package/lib/types/factories/IUniswapV3SwapCallback__factory.d.ts +18 -0
- package/lib/types/factories/IUniswapV3SwapCallback__factory.js +45 -0
- package/lib/types/factories/IWETHGateway__factory.d.ts +18 -0
- package/lib/types/factories/IWETHGateway__factory.js +150 -0
- package/lib/types/factories/IWETH__factory.d.ts +22 -0
- package/lib/types/factories/IWETH__factory.js +66 -0
- package/lib/types/factories/IYVault__factory.d.ts +35 -0
- package/lib/types/factories/IYVault__factory.js +411 -0
- package/lib/types/factories/LeveragedActions__factory.d.ts +84 -0
- package/lib/types/factories/LeveragedActions__factory.js +569 -0
- package/lib/types/factories/LinearInterestRateModel__factory.d.ts +42 -0
- package/lib/types/factories/LinearInterestRateModel__factory.js +209 -0
- package/lib/types/factories/MockPoolService__factory.d.ts +56 -0
- package/lib/types/factories/MockPoolService__factory.js +889 -0
- package/lib/types/factories/Multicall2__factory.d.ts +52 -0
- package/lib/types/factories/Multicall2__factory.js +364 -0
- package/lib/types/factories/Ownable__factory.d.ts +42 -0
- package/lib/types/factories/Ownable__factory.js +74 -0
- package/lib/types/factories/PathFinder__factory.d.ts +61 -0
- package/lib/types/factories/PathFinder__factory.js +302 -0
- package/lib/types/factories/Pausable__factory.d.ts +31 -0
- package/lib/types/factories/Pausable__factory.js +61 -0
- package/lib/types/factories/PercentageMathTest__factory.d.ts +32 -0
- package/lib/types/factories/PercentageMathTest__factory.js +101 -0
- package/lib/types/factories/PoolDeployer__factory.d.ts +113 -0
- package/lib/types/factories/PoolDeployer__factory.js +257 -0
- package/lib/types/factories/PoolService__factory.d.ts +56 -0
- package/lib/types/factories/PoolService__factory.js +873 -0
- package/lib/types/factories/PriceOracle__factory.d.ts +56 -0
- package/lib/types/factories/PriceOracle__factory.js +290 -0
- package/lib/types/factories/Proxy__factory.d.ts +13 -0
- package/lib/types/factories/Proxy__factory.js +30 -0
- package/lib/types/factories/StepVesting__factory.d.ts +52 -0
- package/lib/types/factories/StepVesting__factory.js +296 -0
- package/lib/types/factories/TestPoolService__factory.d.ts +56 -0
- package/lib/types/factories/TestPoolService__factory.js +932 -0
- package/lib/types/factories/TokenDistributor__factory.d.ts +82 -0
- package/lib/types/factories/TokenDistributor__factory.js +481 -0
- package/lib/types/factories/TokenFeeMock__factory.d.ts +56 -0
- package/lib/types/factories/TokenFeeMock__factory.js +427 -0
- package/lib/types/factories/TokenMock__factory.d.ts +56 -0
- package/lib/types/factories/TokenMock__factory.js +409 -0
- package/lib/types/factories/TreasuryMock__factory.d.ts +35 -0
- package/lib/types/factories/TreasuryMock__factory.js +70 -0
- package/lib/types/factories/UniswapRouterMock__factory.d.ts +32 -0
- package/lib/types/factories/UniswapRouterMock__factory.js +1046 -0
- package/lib/types/factories/UniswapV2Adapter__factory.d.ts +42 -0
- package/lib/types/factories/UniswapV2Adapter__factory.js +1059 -0
- package/lib/types/factories/UniswapV3Adapter__factory.d.ts +47 -0
- package/lib/types/factories/UniswapV3Adapter__factory.js +322 -0
- package/lib/types/factories/VestingDeployer__factory.js +216 -0
- package/lib/types/factories/WETHGateway__factory.d.ts +70 -0
- package/lib/types/factories/WETHGateway__factory.js +241 -0
- package/lib/types/factories/WETHMock__factory.d.ts +52 -0
- package/lib/types/factories/WETHMock__factory.js +355 -0
- package/lib/types/factories/WadRayMathTest__factory.d.ts +32 -0
- package/lib/types/factories/WadRayMathTest__factory.js +239 -0
- package/lib/types/factories/YearnAdapter__factory.d.ts +56 -0
- package/lib/types/factories/YearnAdapter__factory.js +497 -0
- package/lib/types/factories/YearnMock__factory.d.ts +56 -0
- package/lib/types/factories/YearnMock__factory.js +598 -0
- package/lib/types/factories/YearnPriceFeed__factory.d.ts +56 -0
- package/lib/types/factories/YearnPriceFeed__factory.js +350 -0
- package/lib/types/hardhat.d.ts +343 -0
- package/lib/types/index.d.ts +152 -0
- package/lib/types/index.js +156 -0
- package/lib/utils/events.d.ts +2 -0
- package/lib/utils/events.js +13 -0
- package/lib/utils/formatter.d.ts +13 -0
- package/lib/utils/formatter.js +125 -0
- package/lib/utils/loading.d.ts +1 -0
- package/lib/utils/loading.js +17 -0
- package/lib/utils/math.d.ts +6 -0
- package/lib/utils/math.js +44 -0
- package/lib/utils/multicall.d.ts +15 -0
- package/lib/utils/multicall.js +84 -0
- package/lib/utils/repeater.d.ts +1 -0
- package/lib/utils/repeater.js +72 -0
- package/lib/utils/validate.d.ts +1 -0
- package/lib/utils/validate.js +13 -0
- package/package.json +27 -0
- package/src/abi/adapters/YearnV2.sol/YearnAdapter.dbg.json +4 -0
- package/src/abi/adapters/YearnV2.sol/YearnAdapter.json +455 -0
- package/src/abi/core/ACL.sol/ACL.dbg.json +4 -0
- package/src/abi/core/ACL.sol/ACL.json +262 -0
- package/src/abi/core/ACLTrait.sol/ACLTrait.dbg.json +4 -0
- package/src/abi/core/ACLTrait.sol/ACLTrait.json +64 -0
- package/src/abi/core/AccountMining.sol/AccountMining.dbg.json +4 -0
- package/src/abi/core/AccountMining.sol/AccountMining.json +150 -0
- package/src/abi/core/AddressProvider.sol/AddressProvider.dbg.json +4 -0
- package/src/abi/core/AddressProvider.sol/AddressProvider.json +496 -0
- package/src/abi/core/ContractsRegister.sol/ContractsRegister.dbg.json +4 -0
- package/src/abi/core/ContractsRegister.sol/ContractsRegister.json +255 -0
- package/src/abi/credit/LeverageActions.sol/LeveragedActions.dbg.json +4 -0
- package/src/abi/credit/LeverageActions.sol/LeveragedActions.json +514 -0
- package/src/abi/deployer/AdaptersDeployer.sol/AdaptersDeployer.dbg.json +4 -0
- package/src/abi/deployer/AdaptersDeployer.sol/AdaptersDeployer.json +160 -0
- package/src/abi/deployer/GenesisDeployer.sol/GenesisDeployer.dbg.json +4 -0
- package/src/abi/deployer/GenesisDeployer.sol/GenesisDeployer.json +189 -0
- package/src/abi/deployer/PoolDeployer.sol/PoolDeployer.dbg.json +4 -0
- package/src/abi/deployer/PoolDeployer.sol/PoolDeployer.json +215 -0
- package/src/abi/fuzzing/FuzzHarness.sol/FuzzHarness.dbg.json +4 -0
- package/src/abi/fuzzing/FuzzHarness.sol/FuzzHarness.json +50 -0
- package/src/abi/integrations/yearn/IYVault.sol/IYVault.dbg.json +4 -0
- package/src/abi/integrations/yearn/IYVault.sol/IYVault.json +400 -0
- package/src/abi/interfaces/IGearToken.sol/IGearToken.dbg.json +4 -0
- package/src/abi/interfaces/IGearToken.sol/IGearToken.json +331 -0
- package/src/abi/interfaces/IMerkleDistributor.sol/IMerkleDistributor.dbg.json +4 -0
- package/src/abi/interfaces/IMerkleDistributor.sol/IMerkleDistributor.json +98 -0
- package/src/abi/mocks/core/ACLTraitTest.sol/ACLTraitTest.dbg.json +4 -0
- package/src/abi/mocks/core/ACLTraitTest.sol/ACLTraitTest.json +96 -0
- package/src/abi/mocks/credit/ExecutorMock.sol/ExecutorMock.dbg.json +4 -0
- package/src/abi/mocks/credit/ExecutorMock.sol/ExecutorMock.json +61 -0
- package/src/abi/mocks/integrations/CurveMock.sol/CurveMock.dbg.json +4 -0
- package/src/abi/mocks/integrations/CurveMock.sol/CurveMock.json +168 -0
- package/src/abi/mocks/integrations/YearnMock.sol/YearnMock.dbg.json +4 -0
- package/src/abi/mocks/integrations/YearnMock.sol/YearnMock.json +556 -0
- package/src/abi/mocks/oracles/ChainlinkPriceFeedMock.sol/ChainlinkPriceFeedMock.dbg.json +4 -0
- package/src/abi/mocks/oracles/ChainlinkPriceFeedMock.sol/ChainlinkPriceFeedMock.json +151 -0
- package/src/abi/mocks/pool/CreditManagerMockForPoolTest.sol/CreditManagerMockForPoolTest.dbg.json +4 -0
- package/src/abi/mocks/pool/CreditManagerMockForPoolTest.sol/CreditManagerMockForPoolTest.json +89 -0
- package/src/abi/mocks/tokens/ERC20Blocking.sol/ERC20BlockingMock.dbg.json +4 -0
- package/src/abi/mocks/tokens/ERC20Blocking.sol/ERC20BlockingMock.json +387 -0
- package/src/abi/mocks/tokens/ERC20Fee.sol/TokenFeeMock.dbg.json +4 -0
- package/src/abi/mocks/tokens/ERC20Fee.sol/TokenFeeMock.json +385 -0
- package/src/abi/oracles/YearnPriceFeed.sol/YearnPriceFeed.dbg.json +4 -0
- package/src/abi/oracles/YearnPriceFeed.sol/YearnPriceFeed.json +321 -0
- package/src/abi/support/PathFinder.sol/PathFinder.dbg.json +4 -0
- package/src/abi/support/PathFinder.sol/PathFinder.json +189 -0
- package/src/abi/tokens/GearNFT.sol/GearBeta.dbg.json +4 -0
- package/src/abi/tokens/GearNFT.sol/GearBeta.json +485 -0
- package/src/abi/tokens/TokenDistributor.sol/TokenDistributor.dbg.json +4 -0
- package/src/abi/tokens/TokenDistributor.sol/TokenDistributor.json +439 -0
- package/src/abi/tokens/Vesting.sol/StepVesting.dbg.json +4 -0
- package/src/abi/tokens/Vesting.sol/StepVesting.json +254 -0
- package/src/config.ts +1 -0
- package/src/core/constants.ts +44 -0
- package/src/core/contracts.ts +151 -0
- package/src/core/contractsRegister.ts +51 -0
- package/src/core/creditAccount.ts +105 -0
- package/src/core/creditCard.ts +15 -0
- package/src/core/creditManager.ts +171 -0
- package/src/core/creditOperation.ts +9 -0
- package/src/core/creditSession.ts +67 -0
- package/src/core/errors.ts +45 -0
- package/src/core/eventOrTx.ts +94 -0
- package/src/core/events.ts +1167 -0
- package/src/core/history.ts +55 -0
- package/src/core/operations.ts +35 -0
- package/src/core/oracles.ts +7 -0
- package/src/core/pool.ts +60 -0
- package/src/core/swap.ts +4 -0
- package/src/core/token.ts +275 -0
- package/src/core/tokenData.ts +84 -0
- package/src/core/tokenDistributor.ts +14 -0
- package/src/core/trade.ts +83 -0
- package/src/core/transactions.ts +407 -0
- package/src/index.ts +42 -0
- package/src/payload/creditAccount.ts +29 -0
- package/src/payload/creditManager.ts +46 -0
- package/src/payload/creditSession.ts +24 -0
- package/src/payload/graphPayload.ts +10 -0
- package/src/payload/pool.ts +20 -0
- package/src/payload/token.ts +5 -0
- package/src/types/ACL.d.ts +491 -0
- package/src/types/ACLTrait.d.ts +148 -0
- package/src/types/ACLTraitTest.d.ts +209 -0
- package/src/types/AccountFactory.d.ts +716 -0
- package/src/types/AccountMining.d.ts +222 -0
- package/src/types/AddressProvider.d.ts +912 -0
- package/src/types/AggregatorV3Interface.d.ts +234 -0
- package/src/types/ChainlinkPriceFeedMock.d.ts +215 -0
- package/src/types/ContractsRegister.d.ts +398 -0
- package/src/types/CreditAccount.d.ts +443 -0
- package/src/types/CreditFilter.d.ts +1609 -0
- package/src/types/CreditFilterMock.d.ts +1687 -0
- package/src/types/CreditManager.d.ts +1285 -0
- package/src/types/CreditManagerMockForFilter.d.ts +605 -0
- package/src/types/CreditManagerMockForPoolTest.d.ts +204 -0
- package/src/types/CurveMock.d.ts +298 -0
- package/src/types/CurveV1Adapter.d.ts +349 -0
- package/src/types/DataCompressor.d.ts +1331 -0
- package/src/types/DieselToken.d.ts +567 -0
- package/src/types/ERC165.d.ts +116 -0
- package/src/types/ERC20.d.ts +411 -0
- package/src/types/ERC20BlockingMock.d.ts +568 -0
- package/src/types/ERC721.d.ts +625 -0
- package/src/types/Errors.d.ts +1854 -0
- package/src/types/ExecutorMock.d.ts +140 -0
- package/src/types/FlashLoanAttacker.d.ts +170 -0
- package/src/types/FuzzHarness.d.ts +124 -0
- package/src/types/GearBeta.d.ts +745 -0
- package/src/types/GearToken.d.ts +888 -0
- package/src/types/IAccountFactory.d.ts +317 -0
- package/src/types/IAccountMiner.d.ts +124 -0
- package/src/types/IAppAddressProvider.d.ts +198 -0
- package/src/types/IAppCreditManager.d.ts +408 -0
- package/src/types/IAppERC20.d.ts +309 -0
- package/src/types/IAppPoolService.d.ts +166 -0
- package/src/types/ICreditAccount.d.ts +430 -0
- package/src/types/ICreditFilter.d.ts +1162 -0
- package/src/types/ICreditManager.d.ts +971 -0
- package/src/types/ICurvePool.d.ts +298 -0
- package/src/types/IDataCompressor.d.ts +1231 -0
- package/src/types/IERC165.d.ts +116 -0
- package/src/types/IERC20.d.ts +294 -0
- package/src/types/IERC721.d.ts +472 -0
- package/src/types/IERC721Enumerable.d.ts +564 -0
- package/src/types/IERC721Metadata.d.ts +523 -0
- package/src/types/IERC721Receiver.d.ts +132 -0
- package/src/types/IGearToken.d.ts +527 -0
- package/src/types/IInterestRateModel.d.ts +121 -0
- package/src/types/IMerkleDistributor.d.ts +190 -0
- package/src/types/IPoolService.d.ts +772 -0
- package/src/types/IPriceOracle.d.ts +211 -0
- package/src/types/IQuoter.d.ts +269 -0
- package/src/types/ISwapRouter.d.ts +404 -0
- package/src/types/IUniswapV2Migrator.d.ts +134 -0
- package/src/types/IUniswapV2Router01.d.ts +1119 -0
- package/src/types/IUniswapV2Router02.d.ts +1432 -0
- package/src/types/IUniswapV3SwapCallback.d.ts +127 -0
- package/src/types/IWETH.d.ts +169 -0
- package/src/types/IWETHGateway.d.ts +335 -0
- package/src/types/IYVault.d.ts +558 -0
- package/src/types/LeveragedActions.d.ts +772 -0
- package/src/types/LinearInterestRateModel.d.ts +279 -0
- package/src/types/MockPoolService.d.ts +1271 -0
- package/src/types/Multicall2.d.ts +449 -0
- package/src/types/Ownable.d.ts +169 -0
- package/src/types/PathFinder.d.ts +379 -0
- package/src/types/Pausable.d.ts +105 -0
- package/src/types/PercentageMathTest.d.ts +154 -0
- package/src/types/PoolService.d.ts +1174 -0
- package/src/types/PriceOracle.d.ts +387 -0
- package/src/types/StepVesting.d.ts +411 -0
- package/src/types/TestPoolService.d.ts +1294 -0
- package/src/types/TokenDistributor.d.ts +640 -0
- package/src/types/TokenFeeMock.d.ts +544 -0
- package/src/types/TokenMock.d.ts +531 -0
- package/src/types/TreasuryMock.d.ts +86 -0
- package/src/types/UniswapRouterMock.d.ts +1520 -0
- package/src/types/UniswapV2Adapter.d.ts +1463 -0
- package/src/types/UniswapV3Adapter.d.ts +455 -0
- package/src/types/WETHGateway.d.ts +376 -0
- package/src/types/WETHMock.d.ts +433 -0
- package/src/types/WadRayMathTest.d.ts +316 -0
- package/src/types/YearnAdapter.d.ts +609 -0
- package/src/types/YearnMock.d.ts +795 -0
- package/src/types/YearnPriceFeed.d.ts +399 -0
- package/src/types/commons.d.ts +16 -0
- package/src/types/commons.js +5 -0
- package/src/types/commons.ts +37 -0
- package/src/types/factories/ACLTraitTest__factory.ts +137 -0
- package/src/types/factories/ACLTrait__factory.ts +76 -0
- package/src/types/factories/ACL__factory.ts +308 -0
- package/src/types/factories/AccountFactory__factory.ts +510 -0
- package/src/types/factories/AccountMining__factory.ts +214 -0
- package/src/types/factories/AddressProvider__factory.ts +579 -0
- package/src/types/factories/AggregatorV3Interface__factory.ts +141 -0
- package/src/types/factories/ChainlinkPriceFeedMock__factory.ts +209 -0
- package/src/types/factories/ContractsRegister__factory.ts +312 -0
- package/src/types/factories/CreditAccount__factory.ts +256 -0
- package/src/types/factories/CreditFilterMock__factory.ts +1092 -0
- package/src/types/factories/CreditFilter__factory.ts +1053 -0
- package/src/types/factories/CreditManagerMockForFilter__factory.ts +325 -0
- package/src/types/factories/CreditManagerMockForPoolTest__factory.ts +137 -0
- package/src/types/factories/CreditManager__factory.ts +1063 -0
- package/src/types/factories/CurveMock__factory.ts +206 -0
- package/src/types/factories/CurveV1Adapter__factory.ts +263 -0
- package/src/types/factories/DataCompressor__factory.ts +946 -0
- package/src/types/factories/DieselToken__factory.ts +449 -0
- package/src/types/factories/ERC165__factory.ts +39 -0
- package/src/types/factories/ERC20BlockingMock__factory.ts +434 -0
- package/src/types/factories/ERC20__factory.ts +334 -0
- package/src/types/factories/ERC721__factory.ts +463 -0
- package/src/types/factories/Errors__factory.ts +1006 -0
- package/src/types/factories/ExecutorMock__factory.ts +97 -0
- package/src/types/factories/FlashLoanAttacker__factory.ts +119 -0
- package/src/types/factories/FuzzHarness__factory.ts +94 -0
- package/src/types/factories/GearBeta__factory.ts +521 -0
- package/src/types/factories/GearToken__factory.ts +704 -0
- package/src/types/factories/IAccountFactory__factory.ts +230 -0
- package/src/types/factories/IAccountMiner__factory.ts +49 -0
- package/src/types/factories/IAppAddressProvider__factory.ts +104 -0
- package/src/types/factories/IAppCreditManager__factory.ts +208 -0
- package/src/types/factories/IAppERC20__factory.ts +195 -0
- package/src/types/factories/IAppPoolService__factory.ts +73 -0
- package/src/types/factories/ICreditAccount__factory.ts +222 -0
- package/src/types/factories/ICreditFilter__factory.ts +701 -0
- package/src/types/factories/ICreditManager__factory.ts +724 -0
- package/src/types/factories/ICurvePool__factory.ts +169 -0
- package/src/types/factories/IDataCompressor__factory.ts +830 -0
- package/src/types/factories/IERC165__factory.ts +42 -0
- package/src/types/factories/IERC20__factory.ts +203 -0
- package/src/types/factories/IERC721Enumerable__factory.ts +367 -0
- package/src/types/factories/IERC721Metadata__factory.ts +356 -0
- package/src/types/factories/IERC721Receiver__factory.ts +60 -0
- package/src/types/factories/IERC721__factory.ts +308 -0
- package/src/types/factories/IGearToken__factory.ts +343 -0
- package/src/types/factories/IInterestRateModel__factory.ts +50 -0
- package/src/types/factories/IMerkleDistributor__factory.ts +113 -0
- package/src/types/factories/IPoolService__factory.ts +581 -0
- package/src/types/factories/IPriceOracle__factory.ts +113 -0
- package/src/types/factories/IQuoter__factory.ts +149 -0
- package/src/types/factories/ISwapRouter__factory.ts +237 -0
- package/src/types/factories/IUniswapV2Migrator__factory.ts +59 -0
- package/src/types/factories/IUniswapV2Router01__factory.ts +775 -0
- package/src/types/factories/IUniswapV2Router02__factory.ts +977 -0
- package/src/types/factories/IUniswapV3SwapCallback__factory.ts +53 -0
- package/src/types/factories/IWETHGateway__factory.ts +151 -0
- package/src/types/factories/IWETH__factory.ts +64 -0
- package/src/types/factories/IYVault__factory.ts +412 -0
- package/src/types/factories/LeveragedActions__factory.ts +571 -0
- package/src/types/factories/LinearInterestRateModel__factory.ts +237 -0
- package/src/types/factories/MockPoolService__factory.ts +891 -0
- package/src/types/factories/Multicall2__factory.ts +358 -0
- package/src/types/factories/Ownable__factory.ts +75 -0
- package/src/types/factories/PathFinder__factory.ts +301 -0
- package/src/types/factories/Pausable__factory.ts +62 -0
- package/src/types/factories/PercentageMathTest__factory.ts +98 -0
- package/src/types/factories/PoolService__factory.ts +898 -0
- package/src/types/factories/PriceOracle__factory.ts +289 -0
- package/src/types/factories/StepVesting__factory.ts +290 -0
- package/src/types/factories/TestPoolService__factory.ts +960 -0
- package/src/types/factories/TokenDistributor__factory.ts +483 -0
- package/src/types/factories/TokenFeeMock__factory.ts +439 -0
- package/src/types/factories/TokenMock__factory.ts +407 -0
- package/src/types/factories/TreasuryMock__factory.ts +64 -0
- package/src/types/factories/UniswapRouterMock__factory.ts +1043 -0
- package/src/types/factories/UniswapV2Adapter__factory.ts +1064 -0
- package/src/types/factories/UniswapV3Adapter__factory.ts +327 -0
- package/src/types/factories/WETHGateway__factory.ts +240 -0
- package/src/types/factories/WETHMock__factory.ts +349 -0
- package/src/types/factories/WadRayMathTest__factory.ts +236 -0
- package/src/types/factories/YearnAdapter__factory.ts +499 -0
- package/src/types/factories/YearnMock__factory.ts +594 -0
- package/src/types/factories/YearnPriceFeed__factory.ts +378 -0
- package/src/types/hardhat.d.ts +343 -0
- package/src/types/index.d.ts +174 -0
- package/src/types/index.js +178 -0
- package/src/types/index.ts +156 -0
- package/src/utils/events.ts +10 -0
- package/src/utils/formatter.ts +138 -0
- package/src/utils/loading.ts +9 -0
- package/src/utils/math.ts +42 -0
- package/src/utils/multicall.ts +54 -0
- package/src/utils/repeater.ts +18 -0
- package/src/utils/validate.ts +8 -0
- package/tsconfig.json +62 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BigNumber } from "ethers";
|
|
2
|
+
export declare type BasicEvent = {
|
|
3
|
+
protocol: string;
|
|
4
|
+
txHash: string;
|
|
5
|
+
timestamp: number;
|
|
6
|
+
};
|
|
7
|
+
export declare type BasicSwapEvent = BasicEvent & {
|
|
8
|
+
from: string;
|
|
9
|
+
fromAmount: BigNumber;
|
|
10
|
+
to: string;
|
|
11
|
+
toAmount: BigNumber;
|
|
12
|
+
};
|
|
13
|
+
export declare type HistoryEvent = (BasicEvent & {
|
|
14
|
+
action: "OpenCreditAccount";
|
|
15
|
+
initialFunds: BigNumber;
|
|
16
|
+
leverage: number;
|
|
17
|
+
}) | (BasicEvent & {
|
|
18
|
+
action: "CloseCreditAccount";
|
|
19
|
+
remainingFunds: BigNumber;
|
|
20
|
+
}) | (BasicEvent & {
|
|
21
|
+
action: "LiquidateCreditAccount";
|
|
22
|
+
remainingFunds: BigNumber;
|
|
23
|
+
}) | (BasicEvent & {
|
|
24
|
+
action: "IncreaseBorrowedAmount";
|
|
25
|
+
amount: BigNumber;
|
|
26
|
+
}) | (BasicEvent & {
|
|
27
|
+
action: "AddCollateral";
|
|
28
|
+
token: string;
|
|
29
|
+
amount: BigNumber;
|
|
30
|
+
}) | (BasicEvent & {
|
|
31
|
+
action: "RepayCreditAccount";
|
|
32
|
+
repayAmount: BigNumber;
|
|
33
|
+
}) | (BasicEvent & {
|
|
34
|
+
action: "TransferAccount";
|
|
35
|
+
newAccount: string;
|
|
36
|
+
}) | (BasicSwapEvent & {
|
|
37
|
+
action: "Swap";
|
|
38
|
+
}) | (BasicSwapEvent & {
|
|
39
|
+
action: "Deposit";
|
|
40
|
+
}) | (BasicSwapEvent & {
|
|
41
|
+
action: "Withdraw";
|
|
42
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class OperationData {
|
|
2
|
+
readonly id: number;
|
|
3
|
+
readonly address: string;
|
|
4
|
+
readonly txHash: string;
|
|
5
|
+
readonly blockNum: number;
|
|
6
|
+
readonly operation: string;
|
|
7
|
+
readonly timestamp: number;
|
|
8
|
+
readonly date: string;
|
|
9
|
+
constructor(payload: OperationDataPayload);
|
|
10
|
+
}
|
|
11
|
+
export interface OperationDataPayload {
|
|
12
|
+
id: number;
|
|
13
|
+
address: string;
|
|
14
|
+
txHash: string;
|
|
15
|
+
blockNum: number;
|
|
16
|
+
operation: string;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
}
|
|
19
|
+
export interface OperationsList {
|
|
20
|
+
id: string;
|
|
21
|
+
data: Array<OperationData>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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.OperationData = void 0;
|
|
7
|
+
var moment_1 = __importDefault(require("moment"));
|
|
8
|
+
var OperationData = /** @class */ (function () {
|
|
9
|
+
function OperationData(payload) {
|
|
10
|
+
this.id = payload.id;
|
|
11
|
+
this.address = payload.address;
|
|
12
|
+
this.txHash = payload.txHash;
|
|
13
|
+
this.blockNum = payload.blockNum;
|
|
14
|
+
this.operation = payload.operation;
|
|
15
|
+
this.timestamp = payload.timestamp;
|
|
16
|
+
this.date = (0, moment_1.default)(payload.timestamp * 1000).format("Do MMM YYYY");
|
|
17
|
+
}
|
|
18
|
+
return OperationData;
|
|
19
|
+
}());
|
|
20
|
+
exports.OperationData = OperationData;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BigNumber, Signer } from "ethers";
|
|
2
|
+
import { IAppPoolService } from "../types";
|
|
3
|
+
import { PoolDataPayload } from "../payload/pool";
|
|
4
|
+
export declare class PoolData {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly address: string;
|
|
7
|
+
readonly underlyingToken: string;
|
|
8
|
+
readonly dieselToken: string;
|
|
9
|
+
readonly isWETH: boolean;
|
|
10
|
+
readonly expectedLiquidity: BigNumber;
|
|
11
|
+
readonly expectedLiquidityLimit: BigNumber;
|
|
12
|
+
readonly availableLiquidity: BigNumber;
|
|
13
|
+
readonly totalBorrowed: BigNumber;
|
|
14
|
+
readonly depositAPY: number;
|
|
15
|
+
readonly borrowAPY: number;
|
|
16
|
+
readonly borrowAPYRay: BigNumber;
|
|
17
|
+
readonly dieselRate: number;
|
|
18
|
+
readonly dieselRateRay: BigNumber;
|
|
19
|
+
readonly withdrawFee: number;
|
|
20
|
+
readonly timestampLU: BigNumber;
|
|
21
|
+
readonly cumulativeIndex_RAY: BigNumber;
|
|
22
|
+
constructor(payload: PoolDataPayload);
|
|
23
|
+
getContractETH(signer: Signer): IAppPoolService;
|
|
24
|
+
}
|
|
25
|
+
export interface PoolsStat {
|
|
26
|
+
tvl: number;
|
|
27
|
+
totalBorrowed: number;
|
|
28
|
+
}
|
package/lib/core/pool.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PoolData = void 0;
|
|
4
|
+
var ethers_1 = require("ethers");
|
|
5
|
+
var types_1 = require("../types");
|
|
6
|
+
var formatter_1 = require("../utils/formatter");
|
|
7
|
+
var PoolData = /** @class */ (function () {
|
|
8
|
+
function PoolData(payload) {
|
|
9
|
+
this.id = payload.addr;
|
|
10
|
+
this.address = payload.addr;
|
|
11
|
+
this.underlyingToken = payload.underlyingToken || "";
|
|
12
|
+
this.dieselToken = payload.dieselToken || "";
|
|
13
|
+
this.isWETH = payload.isWETH || false;
|
|
14
|
+
this.expectedLiquidity = ethers_1.BigNumber.from(payload.expectedLiquidity);
|
|
15
|
+
this.expectedLiquidityLimit = ethers_1.BigNumber.from(payload.expectedLiquidityLimit || 0);
|
|
16
|
+
this.availableLiquidity = ethers_1.BigNumber.from(payload.availableLiquidity);
|
|
17
|
+
this.totalBorrowed = ethers_1.BigNumber.from(payload.totalBorrowed);
|
|
18
|
+
this.depositAPY = (0, formatter_1.rayToNumber)(payload.depositAPY_RAY) * 100;
|
|
19
|
+
this.borrowAPY = (0, formatter_1.rayToNumber)(payload.borrowAPY_RAY) * 100;
|
|
20
|
+
this.borrowAPYRay = ethers_1.BigNumber.from(payload.borrowAPY_RAY);
|
|
21
|
+
this.dieselRate = (0, formatter_1.rayToNumber)(payload.dieselRate_RAY);
|
|
22
|
+
this.dieselRateRay = ethers_1.BigNumber.from(payload.dieselRate_RAY);
|
|
23
|
+
this.withdrawFee = ethers_1.BigNumber.from(payload.withdrawFee).toNumber() / 100;
|
|
24
|
+
this.timestampLU = ethers_1.BigNumber.from(payload.timestampLU || 0);
|
|
25
|
+
this.cumulativeIndex_RAY = ethers_1.BigNumber.from(payload.cumulativeIndex_RAY || 0);
|
|
26
|
+
}
|
|
27
|
+
PoolData.prototype.getContractETH = function (signer) {
|
|
28
|
+
return types_1.IPoolService__factory.connect(this.address, signer);
|
|
29
|
+
};
|
|
30
|
+
return PoolData;
|
|
31
|
+
}());
|
|
32
|
+
exports.PoolData = PoolData;
|
package/lib/core/swap.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapType = void 0;
|
|
4
|
+
var SwapType;
|
|
5
|
+
(function (SwapType) {
|
|
6
|
+
SwapType[SwapType["ExactInput"] = 1] = "ExactInput";
|
|
7
|
+
SwapType[SwapType["ExactOutput"] = 2] = "ExactOutput";
|
|
8
|
+
})(SwapType = exports.SwapType || (exports.SwapType = {}));
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tokenDataByNetwork = void 0;
|
|
4
|
+
exports.tokenDataByNetwork = {
|
|
5
|
+
//
|
|
6
|
+
// MAINNET NETWORK
|
|
7
|
+
// 1INCH ETH AAVE BADGER BAL BTC COMP CREAM CRV
|
|
8
|
+
// DAI DPI GRT LINK SNX SRM SUSHI UNI USDC
|
|
9
|
+
// USDT YFI ZRX
|
|
10
|
+
Mainnet: {
|
|
11
|
+
"1INCH": {
|
|
12
|
+
address: "0x111111111117dc0aa78b770fa6a738034120c302",
|
|
13
|
+
type: "volatile"
|
|
14
|
+
},
|
|
15
|
+
AAVE: {
|
|
16
|
+
address: "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
|
|
17
|
+
type: "volatile"
|
|
18
|
+
},
|
|
19
|
+
COMP: {
|
|
20
|
+
address: "0xc00e94cb662c3520282e6f5717214004a7f26888",
|
|
21
|
+
type: "volatile"
|
|
22
|
+
},
|
|
23
|
+
CRV: {
|
|
24
|
+
address: "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
25
|
+
type: "volatile"
|
|
26
|
+
},
|
|
27
|
+
DAI: {
|
|
28
|
+
address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
|
|
29
|
+
type: "stable"
|
|
30
|
+
},
|
|
31
|
+
DPI: {
|
|
32
|
+
address: "0x1494ca1f11d487c2bbe4543e90080aeba4ba3c2b",
|
|
33
|
+
type: "volatile"
|
|
34
|
+
},
|
|
35
|
+
FEI: {
|
|
36
|
+
address: "0x956F47F50A910163D8BF957Cf5846D573E7f87CA",
|
|
37
|
+
type: "stable"
|
|
38
|
+
},
|
|
39
|
+
LINK: {
|
|
40
|
+
address: "0x514910771AF9Ca656af840dff83E8264EcF986CA",
|
|
41
|
+
type: "volatile"
|
|
42
|
+
},
|
|
43
|
+
SNX: {
|
|
44
|
+
address: "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
|
|
45
|
+
type: "volatile"
|
|
46
|
+
},
|
|
47
|
+
SUSHI: {
|
|
48
|
+
address: "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2",
|
|
49
|
+
type: "volatile"
|
|
50
|
+
},
|
|
51
|
+
UNI: {
|
|
52
|
+
address: "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
|
|
53
|
+
type: "volatile"
|
|
54
|
+
},
|
|
55
|
+
USDC: {
|
|
56
|
+
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
57
|
+
type: "stable"
|
|
58
|
+
},
|
|
59
|
+
USDT: {
|
|
60
|
+
address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
61
|
+
type: "stable"
|
|
62
|
+
},
|
|
63
|
+
WBTC: {
|
|
64
|
+
address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
|
|
65
|
+
type: "core"
|
|
66
|
+
},
|
|
67
|
+
WETH: {
|
|
68
|
+
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
69
|
+
type: "core"
|
|
70
|
+
},
|
|
71
|
+
YFI: {
|
|
72
|
+
address: "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e",
|
|
73
|
+
type: "volatile"
|
|
74
|
+
},
|
|
75
|
+
/// UPDATE
|
|
76
|
+
STETH: {
|
|
77
|
+
address: "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
|
|
78
|
+
type: "volatile"
|
|
79
|
+
},
|
|
80
|
+
FTM: {
|
|
81
|
+
address: "0x4E15361FD6b4BB609Fa63C81A2be19d873717870",
|
|
82
|
+
type: "volatile"
|
|
83
|
+
},
|
|
84
|
+
CVX: {
|
|
85
|
+
address: "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b",
|
|
86
|
+
type: "volatile"
|
|
87
|
+
},
|
|
88
|
+
FRAX: {
|
|
89
|
+
address: "0x853d955acef822db058eb8505911ed77f175b99e",
|
|
90
|
+
type: "stable"
|
|
91
|
+
},
|
|
92
|
+
FXS: {
|
|
93
|
+
address: "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",
|
|
94
|
+
type: "volatile"
|
|
95
|
+
},
|
|
96
|
+
LDO: {
|
|
97
|
+
address: "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32",
|
|
98
|
+
type: "volatile"
|
|
99
|
+
},
|
|
100
|
+
SPELL: {
|
|
101
|
+
address: "0x090185f2135308BaD17527004364eBcC2D37e5F6",
|
|
102
|
+
type: "volatile"
|
|
103
|
+
},
|
|
104
|
+
LUSD: {
|
|
105
|
+
address: "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0",
|
|
106
|
+
type: "stable"
|
|
107
|
+
},
|
|
108
|
+
SUSD: {
|
|
109
|
+
address: "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51",
|
|
110
|
+
type: "stable"
|
|
111
|
+
},
|
|
112
|
+
GUSD: {
|
|
113
|
+
address: "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd",
|
|
114
|
+
type: "stable"
|
|
115
|
+
},
|
|
116
|
+
// YEARN TOKENS
|
|
117
|
+
yvDAI: {
|
|
118
|
+
address: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95",
|
|
119
|
+
type: "lp"
|
|
120
|
+
},
|
|
121
|
+
yvUSDC: {
|
|
122
|
+
address: "0xa354f35829ae975e850e23e9615b11da1b3dc4de",
|
|
123
|
+
type: "lp"
|
|
124
|
+
},
|
|
125
|
+
yvWETH: {
|
|
126
|
+
address: "0xa258C4606Ca8206D8aA700cE2143D7db854D168c",
|
|
127
|
+
type: "lp"
|
|
128
|
+
},
|
|
129
|
+
yvWBTC: {
|
|
130
|
+
address: "0xA696a63cc78DfFa1a63E9E50587C197387FF6C7E",
|
|
131
|
+
type: "lp"
|
|
132
|
+
},
|
|
133
|
+
// CURVE LP TOKENS
|
|
134
|
+
"3Crv": {
|
|
135
|
+
address: "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
|
|
136
|
+
type: "lp"
|
|
137
|
+
},
|
|
138
|
+
steCRV: {
|
|
139
|
+
address: "0x06325440d014e39736583c165c2963ba99faf14e",
|
|
140
|
+
type: "lp"
|
|
141
|
+
},
|
|
142
|
+
FRAX3CRV: {
|
|
143
|
+
address: "0xd632f22692fac7611d2aa1c0d552930d43caed3b",
|
|
144
|
+
type: "lp"
|
|
145
|
+
},
|
|
146
|
+
LUSD3CRV: {
|
|
147
|
+
address: "0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA",
|
|
148
|
+
type: "lp"
|
|
149
|
+
},
|
|
150
|
+
crvPlain3andSUSD: {
|
|
151
|
+
address: "0xC25a3A3b969415c80451098fa907EC722572917F",
|
|
152
|
+
type: "lp"
|
|
153
|
+
},
|
|
154
|
+
gusd3CRV: {
|
|
155
|
+
address: "0xD2967f45c4f384DEEa880F807Be904762a3DeA07",
|
|
156
|
+
type: "lp"
|
|
157
|
+
},
|
|
158
|
+
// CONVEX LP TOKENS
|
|
159
|
+
cvx3Crv: {
|
|
160
|
+
address: "0x30D9410ED1D5DA1F6C8391af5338C93ab8d4035C",
|
|
161
|
+
type: "lp"
|
|
162
|
+
},
|
|
163
|
+
cvxsteCRV: {
|
|
164
|
+
address: "0x9518c9063eB0262D791f38d8d6Eb0aca33c63ed0",
|
|
165
|
+
type: "lp"
|
|
166
|
+
},
|
|
167
|
+
cvxFRAX3CRV: {
|
|
168
|
+
address: "0xbE0F6478E0E4894CFb14f32855603A083A57c7dA",
|
|
169
|
+
type: "lp"
|
|
170
|
+
},
|
|
171
|
+
cvxcrvPlain3andSUSD: {
|
|
172
|
+
address: "0x11D200ef1409cecA8D6d23e6496550f707772F11",
|
|
173
|
+
type: "lp"
|
|
174
|
+
},
|
|
175
|
+
cvxgusd3CRV: {
|
|
176
|
+
address: "0x15c2471ef46Fa721990730cfa526BcFb45574576",
|
|
177
|
+
type: "lp"
|
|
178
|
+
},
|
|
179
|
+
// YEARN- CURVE TOKENS
|
|
180
|
+
yvCurve_stETH: {
|
|
181
|
+
address: "0xdCD90C7f6324cfa40d7169ef80b12031770B4325",
|
|
182
|
+
type: "lp"
|
|
183
|
+
},
|
|
184
|
+
yvCurve_FRAX: {
|
|
185
|
+
address: "0xB4AdA607B9d6b2c9Ee07A275e9616B84AC560139",
|
|
186
|
+
type: "lp"
|
|
187
|
+
},
|
|
188
|
+
yvCurve_d3pool: {
|
|
189
|
+
address: "0x16825039dfe2a5b01F3E1E6a2BBF9a576c6F95c4",
|
|
190
|
+
type: "lp"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
//
|
|
194
|
+
// KOVAN NETWORK
|
|
195
|
+
// DAI LINK REP SNX USDC WBTC ZRX
|
|
196
|
+
//
|
|
197
|
+
Kovan: {
|
|
198
|
+
DAI: {
|
|
199
|
+
address: "0x9DC7B33C3B63fc00ed5472fBD7813eDDa6a64752",
|
|
200
|
+
type: "stable"
|
|
201
|
+
},
|
|
202
|
+
LINK: {
|
|
203
|
+
address: "0x6C994935826574E870549F09efF43BA8089A3D25",
|
|
204
|
+
type: "volatile"
|
|
205
|
+
},
|
|
206
|
+
// REP: {
|
|
207
|
+
// address: "0x633317172c0D41451F62025D73CE59065A370a50",
|
|
208
|
+
// priceFeedETH: "0x3A7e6117F2979EFf81855de32819FBba48a63e9e",
|
|
209
|
+
// type: "volatile",
|
|
210
|
+
// },
|
|
211
|
+
SNX: {
|
|
212
|
+
address: "0xB48891df9267EF65AABd32F497F6F2d1eB22A186",
|
|
213
|
+
type: "volatile"
|
|
214
|
+
},
|
|
215
|
+
USDC: {
|
|
216
|
+
address: "0x31EeB2d0F9B6fD8642914aB10F4dD473677D80df",
|
|
217
|
+
type: "stable"
|
|
218
|
+
},
|
|
219
|
+
WBTC: {
|
|
220
|
+
address: "0xE36bC5d8b689AD6d80e78c3e736670e80d4b329D",
|
|
221
|
+
type: "core"
|
|
222
|
+
}
|
|
223
|
+
// ZRX: {
|
|
224
|
+
// address: "0xB730c1449c58f29C69df33ccD5bd9d3cA66b23C1",
|
|
225
|
+
// priceFeedETH: "0xBc3f28Ccc21E9b5856E81E6372aFf57307E2E883",
|
|
226
|
+
// type: "volatile",
|
|
227
|
+
// },
|
|
228
|
+
}
|
|
229
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BigNumber } from "ethers";
|
|
2
|
+
import { TokenDataPayload } from "../payload/token";
|
|
3
|
+
import { NetworkType } from "./constants";
|
|
4
|
+
export declare class TokenData {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly symbol: string;
|
|
7
|
+
readonly address: string;
|
|
8
|
+
readonly decimals: number;
|
|
9
|
+
readonly icon?: string;
|
|
10
|
+
constructor(payload: TokenDataPayload);
|
|
11
|
+
compareBySymbol(b: TokenData): number;
|
|
12
|
+
}
|
|
13
|
+
export interface TokenBalance {
|
|
14
|
+
id: string;
|
|
15
|
+
balance: BigNumber;
|
|
16
|
+
}
|
|
17
|
+
export interface TokenAllowance {
|
|
18
|
+
id: string;
|
|
19
|
+
allowance: BigNumber;
|
|
20
|
+
}
|
|
21
|
+
export declare type TokenType = "core" | "stable" | "volatile" | "lp";
|
|
22
|
+
export interface TokenSavedData {
|
|
23
|
+
address: string;
|
|
24
|
+
type: TokenType;
|
|
25
|
+
}
|
|
26
|
+
export declare const WETHToken: Record<NetworkType, string>;
|
|
27
|
+
export declare const connectors: Record<NetworkType, Array<string>>;
|
|
28
|
+
export declare function getConnectors(networkType: NetworkType): string[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConnectors = exports.connectors = exports.WETHToken = exports.TokenData = void 0;
|
|
4
|
+
var config_1 = require("../config");
|
|
5
|
+
var token_1 = require("./token");
|
|
6
|
+
var TokenData = /** @class */ (function () {
|
|
7
|
+
function TokenData(payload) {
|
|
8
|
+
var _a;
|
|
9
|
+
this.id = payload.addr;
|
|
10
|
+
this.address = payload.addr;
|
|
11
|
+
// this.name = payload.name;
|
|
12
|
+
this.symbol = payload.symbol;
|
|
13
|
+
if (this.symbol === "WETH" || this.symbol === "dWETH") {
|
|
14
|
+
this.symbol = this.symbol.replace("WETH", "ETH");
|
|
15
|
+
}
|
|
16
|
+
this.decimals = payload.decimals;
|
|
17
|
+
this.icon = "".concat(config_1.STATIC_TOKEN).concat((_a = payload.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase(), ".svg");
|
|
18
|
+
}
|
|
19
|
+
TokenData.prototype.compareBySymbol = function (b) {
|
|
20
|
+
return this.symbol > b.symbol ? 1 : -1;
|
|
21
|
+
};
|
|
22
|
+
return TokenData;
|
|
23
|
+
}());
|
|
24
|
+
exports.TokenData = TokenData;
|
|
25
|
+
exports.WETHToken = {
|
|
26
|
+
Mainnet: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
27
|
+
Kovan: "0xd0a1e359811322d97991e03f863a0c30c2cf029c",
|
|
28
|
+
};
|
|
29
|
+
exports.connectors = {
|
|
30
|
+
Mainnet: [
|
|
31
|
+
"WETH",
|
|
32
|
+
"1INCH",
|
|
33
|
+
"DAI",
|
|
34
|
+
"USDC",
|
|
35
|
+
// "USDT",
|
|
36
|
+
"WBTC",
|
|
37
|
+
// "stETH",
|
|
38
|
+
// "PAX",
|
|
39
|
+
// "TUSD",
|
|
40
|
+
// "BNT",
|
|
41
|
+
// "BAL",
|
|
42
|
+
// "sUSD",
|
|
43
|
+
],
|
|
44
|
+
Kovan: ["WETH", "DAI", "USDC", "WBTC"],
|
|
45
|
+
};
|
|
46
|
+
function getConnectors(networkType) {
|
|
47
|
+
return exports.connectors[networkType].map(function (e) {
|
|
48
|
+
var _a;
|
|
49
|
+
var result = e === "WETH"
|
|
50
|
+
? exports.WETHToken[networkType]
|
|
51
|
+
: (_a = token_1.tokenDataByNetwork[networkType][e]) === null || _a === void 0 ? void 0 : _a.address;
|
|
52
|
+
if (!result) {
|
|
53
|
+
throw new Error("connector token ".concat(e, " not found"));
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.getConnectors = getConnectors;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VotingPower = void 0;
|
|
4
|
+
var VotingPower;
|
|
5
|
+
(function (VotingPower) {
|
|
6
|
+
VotingPower[VotingPower["A"] = 0] = "A";
|
|
7
|
+
VotingPower[VotingPower["B"] = 1] = "B";
|
|
8
|
+
VotingPower[VotingPower["ZERO_VOTING_POWER"] = 2] = "ZERO_VOTING_POWER";
|
|
9
|
+
})(VotingPower = exports.VotingPower || (exports.VotingPower = {}));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BigNumber } from "ethers";
|
|
2
|
+
import { SwapType } from "./swap";
|
|
3
|
+
import { BytesLike } from "@ethersproject/bytes";
|
|
4
|
+
export interface CloseTradePath {
|
|
5
|
+
path: Array<string>;
|
|
6
|
+
amountOutMin: BigNumber;
|
|
7
|
+
}
|
|
8
|
+
export declare class TradePath {
|
|
9
|
+
readonly swapType: SwapType;
|
|
10
|
+
readonly amount: BigNumber;
|
|
11
|
+
readonly rate: BigNumber;
|
|
12
|
+
readonly path: Array<string>;
|
|
13
|
+
readonly expectedAmount: BigNumber;
|
|
14
|
+
readonly pathUniV3: BytesLike | undefined;
|
|
15
|
+
readonly i: number | undefined;
|
|
16
|
+
readonly j: number | undefined;
|
|
17
|
+
readonly operationName: string | undefined;
|
|
18
|
+
constructor(params: {
|
|
19
|
+
swapType: SwapType;
|
|
20
|
+
amount: BigNumber;
|
|
21
|
+
path: Array<string>;
|
|
22
|
+
expectedAmount: BigNumber;
|
|
23
|
+
pathUniV3?: BytesLike;
|
|
24
|
+
i?: number;
|
|
25
|
+
j?: number;
|
|
26
|
+
operationName?: string;
|
|
27
|
+
});
|
|
28
|
+
getExpectedAmountWithSlippage(slippage: number): BigNumber;
|
|
29
|
+
getAmountInMax(slippage: number): BigNumber;
|
|
30
|
+
getAmountOutMin(slippage: number): BigNumber;
|
|
31
|
+
get from(): string;
|
|
32
|
+
get to(): string;
|
|
33
|
+
getFromAmount(slippage: number): BigNumber;
|
|
34
|
+
getToAmount(slippage: number): BigNumber;
|
|
35
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TradePath = void 0;
|
|
4
|
+
var swap_1 = require("./swap");
|
|
5
|
+
var constants_1 = require("./constants");
|
|
6
|
+
var TradePath = /** @class */ (function () {
|
|
7
|
+
function TradePath(params) {
|
|
8
|
+
this.swapType = params.swapType;
|
|
9
|
+
this.amount = params.amount;
|
|
10
|
+
this.path = params.path;
|
|
11
|
+
this.expectedAmount = params.expectedAmount;
|
|
12
|
+
this.pathUniV3 = params.pathUniV3;
|
|
13
|
+
this.rate =
|
|
14
|
+
params.swapType !== swap_1.SwapType.ExactInput
|
|
15
|
+
? params.expectedAmount.mul(constants_1.WAD).div(params.amount)
|
|
16
|
+
: constants_1.WAD.mul(params.amount).div(params.expectedAmount);
|
|
17
|
+
this.i = params.i;
|
|
18
|
+
this.j = params.j;
|
|
19
|
+
this.operationName = params.operationName;
|
|
20
|
+
}
|
|
21
|
+
TradePath.prototype.getExpectedAmountWithSlippage = function (slippage) {
|
|
22
|
+
return this.swapType === swap_1.SwapType.ExactInput
|
|
23
|
+
? this.getAmountOutMin(slippage)
|
|
24
|
+
: this.getAmountInMax(slippage);
|
|
25
|
+
};
|
|
26
|
+
TradePath.prototype.getAmountInMax = function (slippage) {
|
|
27
|
+
return this.expectedAmount
|
|
28
|
+
.mul(constants_1.PERCENTAGE_FACTOR + slippage)
|
|
29
|
+
.div(constants_1.PERCENTAGE_FACTOR);
|
|
30
|
+
};
|
|
31
|
+
TradePath.prototype.getAmountOutMin = function (slippage) {
|
|
32
|
+
return this.expectedAmount
|
|
33
|
+
.mul(constants_1.PERCENTAGE_FACTOR)
|
|
34
|
+
.div(constants_1.PERCENTAGE_FACTOR + slippage);
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(TradePath.prototype, "from", {
|
|
37
|
+
get: function () {
|
|
38
|
+
return this.path[0];
|
|
39
|
+
},
|
|
40
|
+
enumerable: false,
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(TradePath.prototype, "to", {
|
|
44
|
+
get: function () {
|
|
45
|
+
return this.path[this.path.length - 1];
|
|
46
|
+
},
|
|
47
|
+
enumerable: false,
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
TradePath.prototype.getFromAmount = function (slippage) {
|
|
51
|
+
return this.swapType === swap_1.SwapType.ExactInput
|
|
52
|
+
? this.amount
|
|
53
|
+
: this.getExpectedAmountWithSlippage(slippage);
|
|
54
|
+
};
|
|
55
|
+
TradePath.prototype.getToAmount = function (slippage) {
|
|
56
|
+
return this.swapType === swap_1.SwapType.ExactOutput
|
|
57
|
+
? this.amount
|
|
58
|
+
: this.getExpectedAmountWithSlippage(slippage);
|
|
59
|
+
};
|
|
60
|
+
return TradePath;
|
|
61
|
+
}());
|
|
62
|
+
exports.TradePath = TradePath;
|