@gearbox-protocol/sdk 1.22.3 → 1.23.0
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/lib/apy/convexAPY.d.ts +10 -10
- package/lib/apy/convexAPY.js +100 -121
- package/lib/apy/curveAPY.d.ts +3 -4
- package/lib/apy/curveAPY.js +57 -111
- package/lib/apy/index.js +4 -6
- package/lib/apy/lidoAPY.d.ts +1 -2
- package/lib/apy/lidoAPY.js +14 -62
- package/lib/apy/yearnAPY.d.ts +2 -3
- package/lib/apy/yearnAPY.js +26 -82
- package/lib/contracts/contracts.js +9 -22
- package/lib/contracts/contractsRegister.js +39 -51
- package/lib/contracts/protocols.js +10 -11
- package/lib/core/adapter.js +9 -4
- package/lib/core/assets.d.ts +6 -7
- package/lib/core/assets.js +60 -70
- package/lib/core/chains.js +30 -80
- package/lib/core/constants.d.ts +9 -10
- package/lib/core/constants.js +9 -12
- package/lib/core/creditAccount.d.ts +20 -20
- package/lib/core/creditAccount.js +123 -134
- package/lib/core/creditAccount.spec.js +50 -52
- package/lib/core/creditManager.d.ts +26 -26
- package/lib/core/creditManager.js +172 -136
- package/lib/core/creditManager.spec.js +59 -61
- package/lib/core/creditSession.d.ts +12 -13
- package/lib/core/creditSession.js +120 -77
- package/lib/core/errors.d.ts +2 -3
- package/lib/core/errors.js +11 -27
- package/lib/core/eventOrTx.js +35 -73
- package/lib/core/events.d.ts +31 -24
- package/lib/core/events.js +702 -702
- package/lib/core/operations.js +11 -5
- package/lib/core/pool/data.d.ts +29 -29
- package/lib/core/pool/data.js +153 -112
- package/lib/core/pool/operation.d.ts +1 -2
- package/lib/core/pool/operation.js +23 -35
- package/lib/core/priceOracle.d.ts +6 -6
- package/lib/core/priceOracle.js +23 -29
- package/lib/core/rewardClaimer.d.ts +2 -2
- package/lib/core/rewardClaimer.js +5 -48
- package/lib/core/rewardConvex.js +54 -114
- package/lib/core/rewardConvex.spec.js +41 -43
- package/lib/core/strategy.d.ts +5 -6
- package/lib/core/strategy.js +67 -69
- package/lib/core/strategy.spec.js +32 -34
- package/lib/core/tokenDistributor.d.ts +1 -2
- package/lib/core/trade.d.ts +6 -6
- package/lib/core/trade.js +70 -115
- package/lib/core/transactions.d.ts +21 -22
- package/lib/core/transactions.js +285 -308
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -2
- package/lib/oracles/oracles.d.ts +1 -2
- package/lib/oracles/priceFeeds.js +2 -3
- package/lib/parsers/ERC20Parser.js +20 -38
- package/lib/parsers/abstractParser.js +33 -31
- package/lib/parsers/addressProviderParser.js +12 -30
- package/lib/parsers/airdropDistributorParser.js +12 -30
- package/lib/parsers/convexBaseRewardPoolAdapterParser.js +24 -42
- package/lib/parsers/convexBaseRewardPoolAdapterParser.spec.js +11 -11
- package/lib/parsers/convexBoosterAdapterParser.js +26 -44
- package/lib/parsers/convexBoosterAdapterParser.spec.js +10 -10
- package/lib/parsers/convextRewardPoolParser.js +12 -30
- package/lib/parsers/creditFacadeParser.js +26 -45
- package/lib/parsers/creditFacadeParser.spec.js +13 -13
- package/lib/parsers/creditManagerParser.js +12 -30
- package/lib/parsers/curveAdapterParser.js +60 -78
- package/lib/parsers/curveAdapterParser.spec.js +20 -27
- package/lib/parsers/dataCompressorParser.js +12 -30
- package/lib/parsers/lidoAdapterParser.js +15 -33
- package/lib/parsers/lidoAdapterParser.spec.js +9 -9
- package/lib/parsers/lidoOracleParser.js +12 -30
- package/lib/parsers/lidoSTETHParser.js +19 -37
- package/lib/parsers/multicallParser.js +16 -34
- package/lib/parsers/offchainOracleParser.js +13 -31
- package/lib/parsers/poolParser.js +11 -29
- package/lib/parsers/priceOracleParser.js +13 -31
- package/lib/parsers/txParser.js +86 -96
- package/lib/parsers/uniV2AdapterParser.js +35 -55
- package/lib/parsers/uniV2AdapterParser.spec.js +15 -16
- package/lib/parsers/uniV3AdapterParser.js +56 -74
- package/lib/parsers/uniV3AdapterParser.spec.js +23 -24
- package/lib/parsers/wstETHAdapterParser.js +25 -43
- package/lib/parsers/wstETHAdapterParser.spec.js +11 -11
- package/lib/parsers/yearnAdapterParser.spec.js +17 -17
- package/lib/parsers/yearnV2AdapterParser.js +25 -43
- package/lib/pathfinder/core.d.ts +3 -4
- package/lib/pathfinder/pathOptions.js +52 -101
- package/lib/pathfinder/pathOptions.spec.js +55 -57
- package/lib/pathfinder/pathfinder.d.ts +3 -3
- package/lib/pathfinder/pathfinder.js +109 -202
- package/lib/pathfinder/pathfinder.spec.js +13 -13
- package/lib/strategies/convex.js +111 -123
- package/lib/strategies/creditFacade.js +34 -37
- package/lib/strategies/curve.js +74 -80
- package/lib/strategies/lido.js +26 -32
- package/lib/strategies/uniswapV2.js +21 -24
- package/lib/strategies/uniswapV3.js +33 -36
- package/lib/strategies/yearn.js +47 -59
- package/lib/tokens/balancer.js +3 -5
- package/lib/tokens/convex.js +14 -29
- package/lib/tokens/curveLP.js +22 -28
- package/lib/tokens/gear.js +1 -1
- package/lib/tokens/normal.js +3 -5
- package/lib/tokens/token.js +29 -35
- package/lib/tokens/tokenData.d.ts +0 -9
- package/lib/tokens/tokenData.js +17 -15
- package/lib/tokens/yearn.js +3 -5
- package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface__factory.js +9 -12
- package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface__factory.js +9 -12
- package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACLEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACLExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACL__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactoryEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactoryGetters__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactory__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProviderEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProvider__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributorEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributor__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegisterEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegister__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditAccount.sol/ICrediAccountExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditAccount.sol/ICreditAccount__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfiguratorEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfiguratorExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfigurator__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExtended__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacade__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2Events__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2Exceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressorExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressor__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributorEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributor__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFTEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFTExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFT__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDieselToken.sol/IDieselTokenExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDieselToken.sol/IDieselToken__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IInterestRateModel__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeedEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeedExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeed__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPhantomERC20__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolServiceEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolService__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceFeedType__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Events__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Exceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Ext__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IVersion__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IWETHGateway__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditFilter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditManager__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IAdapter.sol/IAdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IAdapter.sol/IAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IUniversalAdapter.sol/IUniversalAdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IUniversalAdapter.sol/IUniversalAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/external/IWETH__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/pool/PoolService__factory.js +27 -50
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/test/interfaces/ITokenTestSuite__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IBaseRewardPool__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IBooster__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IClaimZap__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IConvexToken__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IRewards.sol/IBasicRewards__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IRewards.sol/IRewards__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ICrvDeposit__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ICurveGauge__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ICurveVoteEscrow__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IDeposit__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IFeeDistro__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IMinter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IPools__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IRegistry__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IRewardFactory__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IRewards__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IStaker__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IStashFactory__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IStash__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ITokenFactory__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ITokenMinter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IVestedEscrow__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IVoting__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IWalletChecker__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePoolStETH__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool_2.sol/ICurvePool2Assets__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool_3.sol/ICurvePool3Assets__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool_4.sol/ICurvePool4Assets__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurveRegistry__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/ILidoOracle__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETHGetters__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETH__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETHGetters__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETH__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETHGateway.sol/IwstETHGateWay__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IQuoter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IUniswapV2Router01__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IUniswapV2Router02__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IUniswapV3.sol/ISwapRouter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/yearn/IYVault__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BaseRewardPoolAdapter.sol/IConvexV1BaseRewardPoolAdapterErrors__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BaseRewardPoolAdapter.sol/IConvexV1BaseRewardPoolAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BoosterAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1Adapter.sol/ICurveV1AdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1Adapter.sol/ICurveV1Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1_2AssetsAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1_3AssetsAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1_4AssetsAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1AdapterEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1AdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/IwstETHV1Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapPathChecker__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV2Adapter.sol/IUniswapV2AdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV2Adapter.sol/IUniswapV2Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV3Adapter.sol/IUniswapV3AdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV3Adapter.sol/IUniswapV3Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/yearn/IYearnV2Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/test/config/SupportedContracts.sol/ISupportedContracts__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/test/mocks/integrations/LidoMock.sol/ILidoMockEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositorOptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositor__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IGasPricer__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorkerOptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorker__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IPathResolver__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IRouterComponent__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IRouter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ISwapAggregator__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ISwapper__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawerOptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawer__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IWrapper__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC20/IERC20__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC721/IERC721Receiver__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC721/IERC721__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/utils/introspection/IERC165__factory.js +9 -12
- package/lib/types/factories/contracts/IGas__factory.js +9 -12
- package/lib/types/factories/contracts/IGnosisSafeSignatureValidator__factory.js +9 -12
- package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributorEvents__factory.js +9 -12
- package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributorExceptions__factory.js +9 -12
- package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributor__factory.js +9 -12
- package/lib/types/factories/contracts/support/IOffchainOracle__factory.js +9 -12
- package/lib/types/factories/contracts/support/MultiCall.sol/Multicall2__factory.js +27 -50
- package/lib/utils/errors.js +1 -1
- package/lib/utils/extracter.js +4 -4
- package/lib/utils/formatter.d.ts +8 -8
- package/lib/utils/formatter.js +73 -87
- package/lib/utils/loading.js +3 -3
- package/lib/utils/mappers.js +7 -34
- package/lib/utils/math.d.ts +10 -7
- package/lib/utils/math.js +22 -25
- package/lib/utils/multicall.js +32 -98
- package/lib/utils/price.d.ts +3 -4
- package/lib/utils/price.js +8 -20
- package/lib/utils/repeater.js +12 -53
- package/lib/utils/validate.js +2 -2
- package/lib/watchers/creditAccountWatcher.js +136 -237
- package/lib/watchers/creditAccountWatcher.spec.js +51 -68
- package/lib/watchers/creditManagerWatcher.js +21 -71
- package/lib/watchers/creditManagerWatcher.spec.js +20 -23
- package/package.json +2 -2
- package/lib/core/history.d.ts +0 -42
- package/lib/core/history.js +0 -2
- package/lib/core/wcOperation/abstractOperations.d.ts +0 -23
- package/lib/core/wcOperation/abstractOperations.js +0 -39
- package/lib/core/wcOperation/index.d.ts +0 -11
- package/lib/core/wcOperation/index.js +0 -30
- package/lib/core/wcOperation/operations.d.ts +0 -88
- package/lib/core/wcOperation/operations.js +0 -146
- package/lib/core/wcOperation/types.d.ts +0 -15
- package/lib/core/wcOperation/types.js +0 -2
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.IERC165__factory = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
9
|
{
|
|
10
10
|
inputs: [
|
|
11
11
|
{
|
|
@@ -26,16 +26,13 @@ var _abi = [
|
|
|
26
26
|
type: "function",
|
|
27
27
|
},
|
|
28
28
|
];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
IERC165__factory.createInterface = function () {
|
|
29
|
+
class IERC165__factory {
|
|
30
|
+
static abi = _abi;
|
|
31
|
+
static createInterface() {
|
|
33
32
|
return new ethers_1.utils.Interface(_abi);
|
|
34
|
-
}
|
|
35
|
-
|
|
33
|
+
}
|
|
34
|
+
static connect(address, signerOrProvider) {
|
|
36
35
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return IERC165__factory;
|
|
40
|
-
}());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
41
38
|
exports.IERC165__factory = IERC165__factory;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.IGas__factory = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
9
|
{
|
|
10
10
|
inputs: [],
|
|
11
11
|
name: "configure",
|
|
@@ -20,16 +20,13 @@ var _abi = [
|
|
|
20
20
|
type: "function",
|
|
21
21
|
},
|
|
22
22
|
];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
IGas__factory.createInterface = function () {
|
|
23
|
+
class IGas__factory {
|
|
24
|
+
static abi = _abi;
|
|
25
|
+
static createInterface() {
|
|
27
26
|
return new ethers_1.utils.Interface(_abi);
|
|
28
|
-
}
|
|
29
|
-
|
|
27
|
+
}
|
|
28
|
+
static connect(address, signerOrProvider) {
|
|
30
29
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return IGas__factory;
|
|
34
|
-
}());
|
|
30
|
+
}
|
|
31
|
+
}
|
|
35
32
|
exports.IGas__factory = IGas__factory;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.IGnosisSafeSignatureValidator__factory = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
9
|
{
|
|
10
10
|
inputs: [
|
|
11
11
|
{
|
|
@@ -31,16 +31,13 @@ var _abi = [
|
|
|
31
31
|
type: "function",
|
|
32
32
|
},
|
|
33
33
|
];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
IGnosisSafeSignatureValidator__factory.createInterface = function () {
|
|
34
|
+
class IGnosisSafeSignatureValidator__factory {
|
|
35
|
+
static abi = _abi;
|
|
36
|
+
static createInterface() {
|
|
38
37
|
return new ethers_1.utils.Interface(_abi);
|
|
39
|
-
}
|
|
40
|
-
|
|
38
|
+
}
|
|
39
|
+
static connect(address, signerOrProvider) {
|
|
41
40
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return IGnosisSafeSignatureValidator__factory;
|
|
45
|
-
}());
|
|
41
|
+
}
|
|
42
|
+
}
|
|
46
43
|
exports.IGnosisSafeSignatureValidator__factory = IGnosisSafeSignatureValidator__factory;
|
package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributorEvents__factory.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ITokenDistributorEvents__factory = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
9
|
{
|
|
10
10
|
anonymous: false,
|
|
11
11
|
inputs: [
|
|
@@ -95,16 +95,13 @@ var _abi = [
|
|
|
95
95
|
type: "event",
|
|
96
96
|
},
|
|
97
97
|
];
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
ITokenDistributorEvents__factory.createInterface = function () {
|
|
98
|
+
class ITokenDistributorEvents__factory {
|
|
99
|
+
static abi = _abi;
|
|
100
|
+
static createInterface() {
|
|
102
101
|
return new ethers_1.utils.Interface(_abi);
|
|
103
|
-
}
|
|
104
|
-
|
|
102
|
+
}
|
|
103
|
+
static connect(address, signerOrProvider) {
|
|
105
104
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return ITokenDistributorEvents__factory;
|
|
109
|
-
}());
|
|
105
|
+
}
|
|
106
|
+
}
|
|
110
107
|
exports.ITokenDistributorEvents__factory = ITokenDistributorEvents__factory;
|
package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributorExceptions__factory.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ITokenDistributorExceptions__factory = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
9
|
{
|
|
10
10
|
inputs: [
|
|
11
11
|
{
|
|
@@ -49,16 +49,13 @@ var _abi = [
|
|
|
49
49
|
type: "error",
|
|
50
50
|
},
|
|
51
51
|
];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
ITokenDistributorExceptions__factory.createInterface = function () {
|
|
52
|
+
class ITokenDistributorExceptions__factory {
|
|
53
|
+
static abi = _abi;
|
|
54
|
+
static createInterface() {
|
|
56
55
|
return new ethers_1.utils.Interface(_abi);
|
|
57
|
-
}
|
|
58
|
-
|
|
56
|
+
}
|
|
57
|
+
static connect(address, signerOrProvider) {
|
|
59
58
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return ITokenDistributorExceptions__factory;
|
|
63
|
-
}());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
64
61
|
exports.ITokenDistributorExceptions__factory = ITokenDistributorExceptions__factory;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ITokenDistributor__factory = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
9
|
{
|
|
10
10
|
inputs: [
|
|
11
11
|
{
|
|
@@ -282,16 +282,13 @@ var _abi = [
|
|
|
282
282
|
type: "function",
|
|
283
283
|
},
|
|
284
284
|
];
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
ITokenDistributor__factory.createInterface = function () {
|
|
285
|
+
class ITokenDistributor__factory {
|
|
286
|
+
static abi = _abi;
|
|
287
|
+
static createInterface() {
|
|
289
288
|
return new ethers_1.utils.Interface(_abi);
|
|
290
|
-
}
|
|
291
|
-
|
|
289
|
+
}
|
|
290
|
+
static connect(address, signerOrProvider) {
|
|
292
291
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return ITokenDistributor__factory;
|
|
296
|
-
}());
|
|
292
|
+
}
|
|
293
|
+
}
|
|
297
294
|
exports.ITokenDistributor__factory = ITokenDistributor__factory;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.IOffchainOracle__factory = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
9
|
{
|
|
10
10
|
inputs: [
|
|
11
11
|
{
|
|
@@ -60,16 +60,13 @@ var _abi = [
|
|
|
60
60
|
type: "function",
|
|
61
61
|
},
|
|
62
62
|
];
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
IOffchainOracle__factory.createInterface = function () {
|
|
63
|
+
class IOffchainOracle__factory {
|
|
64
|
+
static abi = _abi;
|
|
65
|
+
static createInterface() {
|
|
67
66
|
return new ethers_1.utils.Interface(_abi);
|
|
68
|
-
}
|
|
69
|
-
|
|
67
|
+
}
|
|
68
|
+
static connect(address, signerOrProvider) {
|
|
70
69
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return IOffchainOracle__factory;
|
|
74
|
-
}());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
75
72
|
exports.IOffchainOracle__factory = IOffchainOracle__factory;
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.Multicall2__factory = void 0;
|
|
19
4
|
/* Autogenerated file. Do not edit manually. */
|
|
20
5
|
/* tslint:disable */
|
|
21
6
|
/* eslint-disable */
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
24
9
|
{
|
|
25
10
|
inputs: [
|
|
26
11
|
{
|
|
@@ -333,44 +318,36 @@ var _abi = [
|
|
|
333
318
|
type: "function",
|
|
334
319
|
},
|
|
335
320
|
];
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
function Multicall2__factory() {
|
|
341
|
-
var args = [];
|
|
342
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
343
|
-
args[_i] = arguments[_i];
|
|
344
|
-
}
|
|
345
|
-
var _this = this;
|
|
321
|
+
const _bytecode = "0x608060405234801561001057600080fd5b50610b51806100206000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806372425d9d11610081578063bce38bd71161005b578063bce38bd714610181578063c3077fa9146101a1578063ee82ac5e146101b457600080fd5b806372425d9d1461016757806386d516e81461016d578063a8b0574e1461017357600080fd5b8063399542e9116100b2578063399542e91461011757806342cbb15c146101395780634d2301cc1461013f57600080fd5b80630f28c97d146100d9578063252dba42146100ee57806327e86d6e1461010f575b600080fd5b425b6040519081526020015b60405180910390f35b6101016100fc3660046107df565b6101c6565b6040516100e5929190610896565b6100db610373565b61012a61012536600461091e565b610386565b6040516100e5939291906109db565b436100db565b6100db61014d366004610a03565b73ffffffffffffffffffffffffffffffffffffffff163190565b446100db565b456100db565b6040514181526020016100e5565b61019461018f36600461091e565b61039e565b6040516100e59190610a25565b61012a6101af3660046107df565b610599565b6100db6101c2366004610a38565b4090565b8051439060609067ffffffffffffffff8111156101e5576101e56105b6565b60405190808252806020026020018201604052801561021857816020015b60608152602001906001900390816102035790505b50905060005b835181101561036d5760008085838151811061023c5761023c610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1686848151811061027057610270610a51565b6020026020010151602001516040516102899190610a80565b6000604051808303816000865af19150503d80600081146102c6576040519150601f19603f3d011682016040523d82523d6000602084013e6102cb565b606091505b50915091508161033c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4d756c746963616c6c206167677265676174653a2063616c6c206661696c656460448201526064015b60405180910390fd5b8084848151811061034f5761034f610a51565b602002602001018190525050508061036690610acb565b905061021e565b50915091565b6000610380600143610b04565b40905090565b4380406060610395858561039e565b90509250925092565b6060815167ffffffffffffffff8111156103ba576103ba6105b6565b60405190808252806020026020018201604052801561040057816020015b6040805180820190915260008152606060208201528152602001906001900390816103d85790505b50905060005b82518110156105925760008084838151811061042457610424610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1685848151811061045857610458610a51565b6020026020010151602001516040516104719190610a80565b6000604051808303816000865af19150503d80600081146104ae576040519150601f19603f3d011682016040523d82523d6000602084013e6104b3565b606091505b5091509150851561054b578161054b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4d756c746963616c6c32206167677265676174653a2063616c6c206661696c6560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610333565b604051806040016040528083151581526020018281525084848151811061057457610574610a51565b602002602001018190525050508061058b90610acb565b9050610406565b5092915050565b60008060606105a9600185610386565b9196909550909350915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610608576106086105b6565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610655576106556105b6565b604052919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461068157600080fd5b919050565b6000601f838184011261069857600080fd5b8235602067ffffffffffffffff808311156106b5576106b56105b6565b8260051b6106c483820161060e565b93845286810183019383810190898611156106de57600080fd5b84890192505b858310156107d2578235848111156106fc5760008081fd5b890160407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828d0381018213156107335760008081fd5b61073b6105e5565b61074689850161065d565b8152828401358881111561075a5760008081fd5b8085019450508d603f8501126107705760008081fd5b8884013588811115610784576107846105b6565b6107938a848e8401160161060e565b92508083528e848287010111156107aa5760008081fd5b808486018b85013760009083018a0152808901919091528452505091840191908401906106e4565b9998505050505050505050565b6000602082840312156107f157600080fd5b813567ffffffffffffffff81111561080857600080fd5b61081484828501610686565b949350505050565b60005b8381101561083757818101518382015260200161081f565b83811115610846576000848401525b50505050565b6000815180845261086481602086016020860161081c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610910577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030184526108fe86835161084c565b955092840192908401906001016108c4565b509398975050505050505050565b6000806040838503121561093157600080fd5b8235801515811461094157600080fd5b9150602083013567ffffffffffffffff81111561095d57600080fd5b61096985828601610686565b9150509250929050565b6000815180845260208085019450848260051b860182860160005b858110156109ce578383038952815180511515845285015160408685018190526109ba8186018361084c565b9a87019a945050509084019060010161098e565b5090979650505050505050565b8381528260208201526060604082015260006109fa6060830184610973565b95945050505050565b600060208284031215610a1557600080fd5b610a1e8261065d565b9392505050565b602081526000610a1e6020830184610973565b600060208284031215610a4a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610a9281846020870161081c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610afd57610afd610a9c565b5060010190565b600082821015610b1657610b16610a9c565b50039056fea264697066735822122092d61a9709ff595b49607930e3d51d9c38e79d27aa8d99be52568187de248c6264736f6c634300080a0033";
|
|
322
|
+
const isSuperArgs = (xs) => xs.length > 1;
|
|
323
|
+
class Multicall2__factory extends ethers_1.ContractFactory {
|
|
324
|
+
constructor(...args) {
|
|
346
325
|
if (isSuperArgs(args)) {
|
|
347
|
-
|
|
326
|
+
super(...args);
|
|
348
327
|
}
|
|
349
328
|
else {
|
|
350
|
-
|
|
329
|
+
super(_abi, _bytecode, args[0]);
|
|
351
330
|
}
|
|
352
|
-
return _this;
|
|
353
331
|
}
|
|
354
|
-
|
|
355
|
-
return
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
return
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
return
|
|
365
|
-
}
|
|
366
|
-
|
|
332
|
+
deploy(overrides) {
|
|
333
|
+
return super.deploy(overrides || {});
|
|
334
|
+
}
|
|
335
|
+
getDeployTransaction(overrides) {
|
|
336
|
+
return super.getDeployTransaction(overrides || {});
|
|
337
|
+
}
|
|
338
|
+
attach(address) {
|
|
339
|
+
return super.attach(address);
|
|
340
|
+
}
|
|
341
|
+
connect(signer) {
|
|
342
|
+
return super.connect(signer);
|
|
343
|
+
}
|
|
344
|
+
static bytecode = _bytecode;
|
|
345
|
+
static abi = _abi;
|
|
346
|
+
static createInterface() {
|
|
367
347
|
return new ethers_1.utils.Interface(_abi);
|
|
368
|
-
}
|
|
369
|
-
|
|
348
|
+
}
|
|
349
|
+
static connect(address, signerOrProvider) {
|
|
370
350
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
Multicall2__factory.abi = _abi;
|
|
374
|
-
return Multicall2__factory;
|
|
375
|
-
}(ethers_1.ContractFactory));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
376
353
|
exports.Multicall2__factory = Multicall2__factory;
|
package/lib/utils/errors.js
CHANGED
package/lib/utils/extracter.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUnderlyingToken = exports.getPoolTokens = void 0;
|
|
4
4
|
function getPoolTokens(pool) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const safePool = pool instanceof Error ? undefined : pool;
|
|
6
|
+
const { dieselToken, underlyingToken } = safePool || {};
|
|
7
7
|
return {
|
|
8
|
-
dieselToken
|
|
9
|
-
underlyingToken
|
|
8
|
+
dieselToken,
|
|
9
|
+
underlyingToken,
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
exports.getPoolTokens = getPoolTokens;
|
package/lib/utils/formatter.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigNumberish } from "ethers";
|
|
2
2
|
export declare function rayToNumber(num: BigNumberish): number;
|
|
3
|
-
export declare function formatRAY(num?:
|
|
4
|
-
export declare function formatBN(
|
|
5
|
-
export declare function formatBn4dig(num:
|
|
6
|
-
export declare function toHumanFormat(num:
|
|
7
|
-
export declare function toSignificant(num:
|
|
8
|
-
export declare
|
|
3
|
+
export declare function formatRAY(num?: bigint): string;
|
|
4
|
+
export declare function formatBN(num: BigNumberish | undefined, decimals: number, precision?: number): string;
|
|
5
|
+
export declare function formatBn4dig(num: bigint, precision?: number): string;
|
|
6
|
+
export declare function toHumanFormat(num: bigint, precision?: number): string;
|
|
7
|
+
export declare function toSignificant(num: bigint, decimals: number): string;
|
|
8
|
+
export declare const toBigInt: (v: BigNumberish) => bigint;
|
|
9
|
+
export declare function toBN(num: string, decimals: number): bigint;
|
|
9
10
|
export declare function shortAddress(address?: string): string;
|
|
10
11
|
export declare function shortHash(address?: string): string;
|
|
11
|
-
export declare const formatRate: (rate: BigNumberish | undefined) => string;
|
|
12
12
|
export declare function formatDate(date: Date): string;
|
|
13
13
|
export declare function formatPercentage(healthFactor: number, decimals?: number): string;
|
|
14
14
|
export declare function formatLeverage(leverage: number, decimals?: number): string;
|
package/lib/utils/formatter.js
CHANGED
|
@@ -1,146 +1,132 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatDateTime = exports.formatLeverage = exports.formatPercentage = exports.formatDate = exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var constants_1 = require("../core/constants");
|
|
3
|
+
exports.formatDateTime = exports.formatLeverage = exports.formatPercentage = exports.formatDate = exports.shortHash = exports.shortAddress = exports.toBN = exports.toBigInt = exports.toSignificant = exports.toHumanFormat = exports.formatBn4dig = exports.formatBN = exports.formatRAY = exports.rayToNumber = void 0;
|
|
4
|
+
const decimal_js_light_1 = require("decimal.js-light");
|
|
5
|
+
const moment_1 = require("moment");
|
|
6
|
+
const constants_1 = require("../core/constants");
|
|
8
7
|
function rayToNumber(num) {
|
|
9
|
-
return (
|
|
8
|
+
return Number((0, exports.toBigInt)(num) / 10n ** 21n) / 1000000;
|
|
10
9
|
}
|
|
11
10
|
exports.rayToNumber = rayToNumber;
|
|
12
|
-
function formatRAY(num) {
|
|
13
|
-
return toSignificant(num
|
|
11
|
+
function formatRAY(num = 0n) {
|
|
12
|
+
return toSignificant(num, 27);
|
|
14
13
|
}
|
|
15
14
|
exports.formatRAY = formatRAY;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return "-";
|
|
21
|
-
}
|
|
22
|
-
// if (BigNumber.from(num).gt(BigNumber.from(10).pow(37))) {
|
|
23
|
-
// return "MAX";
|
|
24
|
-
// }
|
|
25
|
-
if (!precision && ethers_1.BigNumber.from(num).gt(ethers_1.BigNumber.from(10).pow(21))) {
|
|
26
|
-
precision = 2;
|
|
27
|
-
}
|
|
28
|
-
if (!precision && ethers_1.BigNumber.from(num).gt(ethers_1.BigNumber.from(10).pow(24))) {
|
|
29
|
-
precision = 0;
|
|
15
|
+
const limitPrecision = (n, p) => {
|
|
16
|
+
const notZero = n !== 0n;
|
|
17
|
+
if (n <= 10n && notZero) {
|
|
18
|
+
return 6;
|
|
30
19
|
}
|
|
31
|
-
if (
|
|
32
|
-
|
|
20
|
+
if (n <= 100n && notZero) {
|
|
21
|
+
return 5;
|
|
33
22
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (decimals <= 6) {
|
|
37
|
-
number = ethers_1.BigNumber.from(num).mul(ethers_1.BigNumber.from(10).pow(6 - decimals));
|
|
23
|
+
if (n <= 1000n && notZero) {
|
|
24
|
+
return 4;
|
|
38
25
|
}
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
if (n <= 10000n && notZero) {
|
|
27
|
+
return 3;
|
|
41
28
|
}
|
|
42
|
-
if (
|
|
43
|
-
|
|
29
|
+
if (p === undefined && n > 10n ** 21n) {
|
|
30
|
+
return 2;
|
|
44
31
|
}
|
|
45
|
-
if (
|
|
46
|
-
|
|
32
|
+
if (p === undefined && n > 10n ** 24n) {
|
|
33
|
+
return 0;
|
|
47
34
|
}
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
return p;
|
|
36
|
+
};
|
|
37
|
+
const limitNum = (n, d = 18) => {
|
|
38
|
+
let limited = n <= 2n ? 0n : n;
|
|
39
|
+
if (d <= 6) {
|
|
40
|
+
return limited * 10n ** BigInt(6 - d);
|
|
50
41
|
}
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
else {
|
|
43
|
+
return limited / 10n ** BigInt(d - 6);
|
|
53
44
|
}
|
|
54
|
-
|
|
45
|
+
};
|
|
46
|
+
function formatBN(num, decimals, precision) {
|
|
47
|
+
if (num === undefined)
|
|
48
|
+
return "-";
|
|
49
|
+
const numBInt = (0, exports.toBigInt)(num);
|
|
50
|
+
// GUSD: 2 decimals
|
|
51
|
+
const limitedNum = limitNum(numBInt, decimals);
|
|
52
|
+
const limitedPrecision = limitPrecision(limitedNum, precision);
|
|
53
|
+
return toHumanFormat(limitedNum, limitedPrecision);
|
|
55
54
|
}
|
|
56
55
|
exports.formatBN = formatBN;
|
|
57
|
-
function formatBn4dig(num, precision) {
|
|
58
|
-
if (precision === void 0) { precision = 2; }
|
|
56
|
+
function formatBn4dig(num, precision = 2) {
|
|
59
57
|
if (precision > 6) {
|
|
60
58
|
throw new Error("Precision is too high, try <= 6");
|
|
61
59
|
}
|
|
62
|
-
|
|
63
|
-
if (numStr.length
|
|
64
|
-
|
|
60
|
+
const numStr = num.toString();
|
|
61
|
+
if (numStr.length <= 6) {
|
|
62
|
+
const completed = "0".repeat(6 - numStr.length) + numStr;
|
|
63
|
+
return `0.${completed.slice(0, precision)}`;
|
|
65
64
|
}
|
|
66
|
-
return numStr.length
|
|
67
|
-
? "0.".concat(numStr.slice(0, precision))
|
|
68
|
-
: "".concat(numStr.slice(0, numStr.length - 6), ".").concat(numStr.slice(numStr.length - 6, numStr.length - 6 + precision));
|
|
65
|
+
return `${numStr.slice(0, numStr.length - 6)}.${numStr.slice(numStr.length - 6, numStr.length - 6 + precision)}`;
|
|
69
66
|
}
|
|
70
67
|
exports.formatBn4dig = formatBn4dig;
|
|
71
|
-
function toHumanFormat(num, precision) {
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
return "".concat(formatBn4dig(num.div(1e9), precision), "Bn");
|
|
68
|
+
function toHumanFormat(num, precision = 2) {
|
|
69
|
+
if (num >= BigInt(1e15)) {
|
|
70
|
+
return `${formatBn4dig(num / BigInt(1e9), precision)}Bn`;
|
|
75
71
|
}
|
|
76
|
-
if (num
|
|
77
|
-
return
|
|
72
|
+
if (num >= BigInt(1e12)) {
|
|
73
|
+
return `${formatBn4dig(num / BigInt(1e6), precision)}M`;
|
|
78
74
|
}
|
|
79
|
-
if (num
|
|
80
|
-
return
|
|
75
|
+
if (num >= BigInt(1e9)) {
|
|
76
|
+
return `${formatBn4dig(num / BigInt(1e3), precision)}K`;
|
|
81
77
|
}
|
|
82
78
|
return formatBn4dig(num, precision);
|
|
83
79
|
}
|
|
84
80
|
exports.toHumanFormat = toHumanFormat;
|
|
85
81
|
function toSignificant(num, decimals) {
|
|
86
|
-
if (num
|
|
82
|
+
if (num === 1n)
|
|
87
83
|
return "0";
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
const divider = new decimal_js_light_1.Decimal(10).toPower(decimals);
|
|
85
|
+
const number = new decimal_js_light_1.Decimal(num.toString()).div(divider);
|
|
90
86
|
return number.toSignificantDigits(6, 4).toString();
|
|
91
87
|
}
|
|
92
88
|
exports.toSignificant = toSignificant;
|
|
89
|
+
const toBigInt = (v) => BigInt(v.toString());
|
|
90
|
+
exports.toBigInt = toBigInt;
|
|
93
91
|
function toBN(num, decimals) {
|
|
94
92
|
if (num === "")
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return
|
|
93
|
+
return 0n;
|
|
94
|
+
const multiplier = new decimal_js_light_1.Decimal(10).toPower(decimals);
|
|
95
|
+
const number = new decimal_js_light_1.Decimal(num).mul(multiplier);
|
|
96
|
+
return BigInt(number.toFixed(0));
|
|
99
97
|
}
|
|
100
98
|
exports.toBN = toBN;
|
|
101
99
|
function shortAddress(address) {
|
|
102
100
|
return address === undefined
|
|
103
101
|
? ""
|
|
104
|
-
:
|
|
102
|
+
: `${address.slice(0, 6)}...${address.slice(address.length - 4)}`;
|
|
105
103
|
}
|
|
106
104
|
exports.shortAddress = shortAddress;
|
|
107
105
|
function shortHash(address) {
|
|
108
|
-
return address === undefined ? "" :
|
|
106
|
+
return address === undefined ? "" : `${address.slice(0, 5)}...`;
|
|
109
107
|
}
|
|
110
108
|
exports.shortHash = shortHash;
|
|
111
|
-
var formatRate = function (rate) {
|
|
112
|
-
return rate
|
|
113
|
-
? "".concat((ethers_1.BigNumber.from(rate)
|
|
114
|
-
.mul(constants_1.PERCENTAGE_FACTOR)
|
|
115
|
-
.mul(100)
|
|
116
|
-
.div(constants_1.RAY)
|
|
117
|
-
.toNumber() / constants_1.PERCENTAGE_FACTOR).toFixed(2), "%")
|
|
118
|
-
: "0.00%";
|
|
119
|
-
};
|
|
120
|
-
exports.formatRate = formatRate;
|
|
121
109
|
function formatDate(date) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
110
|
+
const d = new Date(date);
|
|
111
|
+
let month = `${d.getMonth() + 1}`;
|
|
112
|
+
let day = `${d.getDate()}`;
|
|
113
|
+
const year = d.getFullYear();
|
|
126
114
|
if (month.length < 2)
|
|
127
|
-
month =
|
|
115
|
+
month = `0${month}`;
|
|
128
116
|
if (day.length < 2)
|
|
129
|
-
day =
|
|
117
|
+
day = `0${day}`;
|
|
130
118
|
return [year, month, day].join("-");
|
|
131
119
|
}
|
|
132
120
|
exports.formatDate = formatDate;
|
|
133
|
-
function formatPercentage(healthFactor, decimals) {
|
|
134
|
-
|
|
135
|
-
return (healthFactor / constants_1.PERCENTAGE_FACTOR).toFixed(decimals);
|
|
121
|
+
function formatPercentage(healthFactor, decimals = 2) {
|
|
122
|
+
return (healthFactor / Number(constants_1.PERCENTAGE_FACTOR)).toFixed(decimals);
|
|
136
123
|
}
|
|
137
124
|
exports.formatPercentage = formatPercentage;
|
|
138
|
-
function formatLeverage(leverage, decimals) {
|
|
139
|
-
|
|
140
|
-
return (leverage / constants_1.LEVERAGE_DECIMALS).toFixed(decimals);
|
|
125
|
+
function formatLeverage(leverage, decimals = 2) {
|
|
126
|
+
return (leverage / Number(constants_1.LEVERAGE_DECIMALS)).toFixed(decimals);
|
|
141
127
|
}
|
|
142
128
|
exports.formatLeverage = formatLeverage;
|
|
143
129
|
function formatDateTime(timestamp) {
|
|
144
|
-
return
|
|
130
|
+
return `${(0, moment_1.unix)(timestamp).format("Do MMM YYYY HH:mm")} UTC`;
|
|
145
131
|
}
|
|
146
132
|
exports.formatDateTime = formatDateTime;
|