@gearbox-protocol/sdk 1.22.4 → 1.23.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/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 +19 -20
- package/lib/core/events.js +698 -711
- 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 +3 -3
- package/lib/core/rewardClaimer.js +5 -48
- package/lib/core/rewardConvex.d.ts +1 -1
- package/lib/core/rewardConvex.js +58 -118
- package/lib/core/rewardConvex.spec.js +56 -58
- 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
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var caWithoutLP = {
|
|
3
|
+
const chai_1 = require("chai");
|
|
4
|
+
const decimals_1 = require("../tokens/decimals");
|
|
5
|
+
const token_1 = require("../tokens/token");
|
|
6
|
+
const formatter_1 = require("../utils/formatter");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const creditAccount_1 = require("./creditAccount");
|
|
9
|
+
const prices = {
|
|
10
|
+
[token_1.tokenDataByNetwork.Mainnet.WETH.toLowerCase()]: (0, formatter_1.toBN)("1738.11830000", constants_1.PRICE_DECIMALS_POW),
|
|
11
|
+
[token_1.tokenDataByNetwork.Mainnet.DAI.toLowerCase()]: (0, formatter_1.toBN)("0.99941103", constants_1.PRICE_DECIMALS_POW),
|
|
12
|
+
[token_1.tokenDataByNetwork.Mainnet.STETH.toLowerCase()]: (0, formatter_1.toBN)("1703.87588096", constants_1.PRICE_DECIMALS_POW),
|
|
13
|
+
};
|
|
14
|
+
const lpAPY = { STETH: 38434 };
|
|
15
|
+
const caWithoutLP = {
|
|
18
16
|
assets: [
|
|
19
17
|
{
|
|
20
18
|
balance: (0, formatter_1.toBN)("54780", decimals_1.decimals.DAI),
|
|
@@ -30,7 +28,7 @@ var caWithoutLP = {
|
|
|
30
28
|
borrowRate: 7712,
|
|
31
29
|
underlyingToken: token_1.tokenDataByNetwork.Mainnet.DAI.toLowerCase(),
|
|
32
30
|
};
|
|
33
|
-
|
|
31
|
+
const caWithLP = {
|
|
34
32
|
assets: [
|
|
35
33
|
{
|
|
36
34
|
balance: (0, formatter_1.toBN)("119.999999999999999997", decimals_1.decimals.STETH),
|
|
@@ -46,92 +44,92 @@ var caWithLP = {
|
|
|
46
44
|
borrowRate: 5736,
|
|
47
45
|
underlyingToken: token_1.tokenDataByNetwork.Mainnet.WETH.toLowerCase(),
|
|
48
46
|
};
|
|
49
|
-
describe("CreditAccount calcOverallAPY test",
|
|
50
|
-
it("overall APY calculation for caWithoutLP is correct",
|
|
51
|
-
|
|
47
|
+
describe("CreditAccount calcOverallAPY test", () => {
|
|
48
|
+
it("overall APY calculation for caWithoutLP is correct", () => {
|
|
49
|
+
const result = (0, creditAccount_1.calcOverallAPY)({
|
|
52
50
|
caAssets: caWithoutLP.assets,
|
|
53
51
|
totalValue: caWithoutLP.totalValue,
|
|
54
52
|
debt: caWithoutLP.debt,
|
|
55
53
|
borrowRate: caWithoutLP.borrowRate,
|
|
56
54
|
underlyingToken: caWithoutLP.underlyingToken,
|
|
57
|
-
lpAPY
|
|
58
|
-
prices
|
|
55
|
+
lpAPY,
|
|
56
|
+
prices,
|
|
59
57
|
});
|
|
60
58
|
(0, chai_1.expect)(result).to.be.eq(-6.94841);
|
|
61
59
|
});
|
|
62
|
-
it("overall APY calculation for caWithLP is correct",
|
|
63
|
-
|
|
60
|
+
it("overall APY calculation for caWithLP is correct", () => {
|
|
61
|
+
const result = (0, creditAccount_1.calcOverallAPY)({
|
|
64
62
|
caAssets: caWithLP.assets,
|
|
65
63
|
totalValue: caWithLP.totalValue,
|
|
66
64
|
debt: caWithLP.debt,
|
|
67
65
|
borrowRate: caWithLP.borrowRate,
|
|
68
66
|
underlyingToken: caWithLP.underlyingToken,
|
|
69
|
-
lpAPY
|
|
70
|
-
prices
|
|
67
|
+
lpAPY,
|
|
68
|
+
prices,
|
|
71
69
|
});
|
|
72
70
|
(0, chai_1.expect)(result).to.be.eq(14.4919);
|
|
73
71
|
});
|
|
74
|
-
it("overall APY is undefined when !lpAPY",
|
|
75
|
-
|
|
72
|
+
it("overall APY is undefined when !lpAPY", () => {
|
|
73
|
+
const result = (0, creditAccount_1.calcOverallAPY)({
|
|
76
74
|
caAssets: caWithLP.assets,
|
|
77
75
|
totalValue: caWithLP.totalValue,
|
|
78
76
|
debt: caWithLP.debt,
|
|
79
77
|
borrowRate: caWithLP.borrowRate,
|
|
80
78
|
underlyingToken: caWithLP.underlyingToken,
|
|
81
79
|
lpAPY: undefined,
|
|
82
|
-
prices
|
|
80
|
+
prices,
|
|
83
81
|
});
|
|
84
82
|
(0, chai_1.expect)(result).to.be.eq(undefined);
|
|
85
83
|
});
|
|
86
|
-
it("overall APY is undefined when !totalValue",
|
|
87
|
-
|
|
84
|
+
it("overall APY is undefined when !totalValue", () => {
|
|
85
|
+
const result = (0, creditAccount_1.calcOverallAPY)({
|
|
88
86
|
caAssets: caWithLP.assets,
|
|
89
87
|
totalValue: undefined,
|
|
90
88
|
debt: caWithLP.debt,
|
|
91
89
|
borrowRate: caWithLP.borrowRate,
|
|
92
90
|
underlyingToken: caWithLP.underlyingToken,
|
|
93
|
-
lpAPY
|
|
94
|
-
prices
|
|
91
|
+
lpAPY,
|
|
92
|
+
prices,
|
|
95
93
|
});
|
|
96
94
|
(0, chai_1.expect)(result).to.be.eq(undefined);
|
|
97
95
|
});
|
|
98
|
-
it("overall APY is undefined when !debt",
|
|
99
|
-
|
|
96
|
+
it("overall APY is undefined when !debt", () => {
|
|
97
|
+
const result = (0, creditAccount_1.calcOverallAPY)({
|
|
100
98
|
caAssets: caWithLP.assets,
|
|
101
99
|
totalValue: caWithLP.totalValue,
|
|
102
100
|
debt: undefined,
|
|
103
101
|
borrowRate: caWithLP.borrowRate,
|
|
104
102
|
underlyingToken: caWithLP.underlyingToken,
|
|
105
|
-
lpAPY
|
|
106
|
-
prices
|
|
103
|
+
lpAPY,
|
|
104
|
+
prices,
|
|
107
105
|
});
|
|
108
106
|
(0, chai_1.expect)(result).to.be.eq(undefined);
|
|
109
107
|
});
|
|
110
|
-
it("overall APY is undefined when totalValue lte 0",
|
|
111
|
-
|
|
108
|
+
it("overall APY is undefined when totalValue lte 0", () => {
|
|
109
|
+
const result = (0, creditAccount_1.calcOverallAPY)({
|
|
112
110
|
caAssets: caWithLP.assets,
|
|
113
|
-
totalValue:
|
|
111
|
+
totalValue: 0n,
|
|
114
112
|
debt: undefined,
|
|
115
113
|
borrowRate: caWithLP.borrowRate,
|
|
116
114
|
underlyingToken: caWithLP.underlyingToken,
|
|
117
|
-
lpAPY
|
|
118
|
-
prices
|
|
115
|
+
lpAPY,
|
|
116
|
+
prices,
|
|
119
117
|
});
|
|
120
118
|
(0, chai_1.expect)(result).to.be.eq(undefined);
|
|
121
119
|
});
|
|
122
120
|
});
|
|
123
|
-
describe("CreditAccount calcMaxIncreaseBorrow test",
|
|
124
|
-
it("health max increase borrow is zero if hf < 1",
|
|
125
|
-
|
|
126
|
-
(0, chai_1.expect)(result.toString()).to.be.eq(
|
|
121
|
+
describe("CreditAccount calcMaxIncreaseBorrow test", () => {
|
|
122
|
+
it("health max increase borrow is zero if hf < 1", () => {
|
|
123
|
+
const result = creditAccount_1.CreditAccountData.calcMaxIncreaseBorrow(9999, BigInt("156522834253690396032546"), 0, 9300);
|
|
124
|
+
(0, chai_1.expect)(result.toString()).to.be.eq("0");
|
|
127
125
|
});
|
|
128
|
-
it("health max increase borrow is calculated correctly",
|
|
129
|
-
|
|
130
|
-
(0, chai_1.expect)(result.toString()).to.be.eq(
|
|
126
|
+
it("health max increase borrow is calculated correctly", () => {
|
|
127
|
+
const result = creditAccount_1.CreditAccountData.calcMaxIncreaseBorrow(10244, BigInt("156522834253690396032546"), 0, 9300);
|
|
128
|
+
(0, chai_1.expect)(result.toString()).to.be.eq("54559387939857795188487");
|
|
131
129
|
});
|
|
132
|
-
it("health max increase borrow is calculated correctly (low hf, high debt)",
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
(0, chai_1.expect)(result.toString()).to.be.eq(
|
|
130
|
+
it("health max increase borrow is calculated correctly (low hf, high debt)", () => {
|
|
131
|
+
const loweHf = 10244;
|
|
132
|
+
const result = creditAccount_1.CreditAccountData.calcMaxIncreaseBorrow(loweHf, BigInt("54782991988791638611392"), 0, 9300);
|
|
133
|
+
(0, chai_1.expect)(result.toString()).to.be.eq("19095785778950228315970");
|
|
136
134
|
});
|
|
137
135
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ethers, Signer } from "ethers";
|
|
2
2
|
import { MultiCall } from "../pathfinder/core";
|
|
3
3
|
import { ChartsCreditManagerPayload, CreditManagerDataPayload } from "../payload/creditManager";
|
|
4
4
|
import { ICreditManager } from "../types";
|
|
@@ -10,20 +10,20 @@ export declare class CreditManagerData {
|
|
|
10
10
|
readonly isWETH: boolean;
|
|
11
11
|
readonly canBorrow: boolean;
|
|
12
12
|
readonly borrowRate: number;
|
|
13
|
-
readonly minAmount:
|
|
14
|
-
readonly maxAmount:
|
|
13
|
+
readonly minAmount: bigint;
|
|
14
|
+
readonly maxAmount: bigint;
|
|
15
15
|
readonly maxLeverageFactor: number;
|
|
16
|
-
readonly availableLiquidity:
|
|
16
|
+
readonly availableLiquidity: bigint;
|
|
17
17
|
readonly collateralTokens: Array<string>;
|
|
18
18
|
readonly adapters: Record<string, string>;
|
|
19
|
-
readonly liquidationThresholds: Record<string,
|
|
19
|
+
readonly liquidationThresholds: Record<string, bigint>;
|
|
20
20
|
readonly version: number;
|
|
21
21
|
readonly creditFacade: string;
|
|
22
22
|
readonly creditConfigurator: string;
|
|
23
23
|
readonly isDegenMode: boolean;
|
|
24
24
|
readonly degenNFT: string;
|
|
25
25
|
readonly isIncreaseDebtForbidden: boolean;
|
|
26
|
-
readonly forbiddenTokenMask:
|
|
26
|
+
readonly forbiddenTokenMask: bigint;
|
|
27
27
|
readonly maxEnabledTokensLength: number;
|
|
28
28
|
readonly feeInterest: number;
|
|
29
29
|
readonly feeLiquidation: number;
|
|
@@ -34,12 +34,12 @@ export declare class CreditManagerData {
|
|
|
34
34
|
constructor(payload: CreditManagerDataPayload);
|
|
35
35
|
getContractETH(signer: Signer | ethers.providers.Provider): ICreditManager;
|
|
36
36
|
contractToAdapter(contractAddress: string): string | undefined;
|
|
37
|
-
encodeAddCollateral(accountAddress: string, tokenAddress: string, amount:
|
|
38
|
-
encodeIncreaseDebt(amount:
|
|
39
|
-
encodeDecreaseDebt(amount:
|
|
40
|
-
validateOpenAccount(collateral:
|
|
41
|
-
protected validateOpenAccountV1(collateral:
|
|
42
|
-
protected validateOpenAccountV2(debt:
|
|
37
|
+
encodeAddCollateral(accountAddress: string, tokenAddress: string, amount: bigint): MultiCall;
|
|
38
|
+
encodeIncreaseDebt(amount: bigint): MultiCall;
|
|
39
|
+
encodeDecreaseDebt(amount: bigint): MultiCall;
|
|
40
|
+
validateOpenAccount(collateral: bigint, debt: bigint): true;
|
|
41
|
+
protected validateOpenAccountV1(collateral: bigint, debt: bigint): true;
|
|
42
|
+
protected validateOpenAccountV2(debt: bigint): true;
|
|
43
43
|
get id(): string;
|
|
44
44
|
}
|
|
45
45
|
export declare class ChartsCreditManagerData {
|
|
@@ -51,10 +51,10 @@ export declare class ChartsCreditManagerData {
|
|
|
51
51
|
readonly borrowRate: number;
|
|
52
52
|
readonly borrowRateOld: number;
|
|
53
53
|
readonly borrowRateChange: number;
|
|
54
|
-
readonly minAmount:
|
|
55
|
-
readonly maxAmount:
|
|
54
|
+
readonly minAmount: bigint;
|
|
55
|
+
readonly maxAmount: bigint;
|
|
56
56
|
readonly maxLeverageFactor: number;
|
|
57
|
-
readonly availableLiquidity:
|
|
57
|
+
readonly availableLiquidity: bigint;
|
|
58
58
|
readonly version: number;
|
|
59
59
|
readonly feeInterest: number;
|
|
60
60
|
readonly feeLiquidation: number;
|
|
@@ -64,15 +64,15 @@ export declare class ChartsCreditManagerData {
|
|
|
64
64
|
readonly totalClosedAccounts: number;
|
|
65
65
|
readonly totalRepaidAccounts: number;
|
|
66
66
|
readonly totalLiquidatedAccounts: number;
|
|
67
|
-
readonly totalBorrowed:
|
|
68
|
-
readonly totalBorrowedOld:
|
|
67
|
+
readonly totalBorrowed: bigint;
|
|
68
|
+
readonly totalBorrowedOld: bigint;
|
|
69
69
|
readonly totalBorrowedChange: number;
|
|
70
|
-
readonly totalRepaid:
|
|
71
|
-
readonly totalProfit:
|
|
72
|
-
readonly totalProfitOld:
|
|
70
|
+
readonly totalRepaid: bigint;
|
|
71
|
+
readonly totalProfit: bigint;
|
|
72
|
+
readonly totalProfitOld: bigint;
|
|
73
73
|
readonly pnlChange: number;
|
|
74
|
-
readonly totalLosses:
|
|
75
|
-
readonly totalLossesOld:
|
|
74
|
+
readonly totalLosses: bigint;
|
|
75
|
+
readonly totalLossesOld: bigint;
|
|
76
76
|
readonly totalBorrowedInUSD: number;
|
|
77
77
|
readonly totalLossesInUSD: number;
|
|
78
78
|
readonly totalProfitInUSD: number;
|
|
@@ -82,14 +82,14 @@ export declare class ChartsCreditManagerData {
|
|
|
82
82
|
readonly totalOpenedAccountsChange: number;
|
|
83
83
|
readonly totalClosedAccountsChange: number;
|
|
84
84
|
readonly totalLiquidatedAccountsChange: number;
|
|
85
|
-
readonly liquidationThresholds: Record<string,
|
|
85
|
+
readonly liquidationThresholds: Record<string, bigint>;
|
|
86
86
|
constructor(payload: ChartsCreditManagerPayload);
|
|
87
87
|
}
|
|
88
88
|
export interface CalcHealthFactorProps {
|
|
89
89
|
assets: Array<Asset>;
|
|
90
|
-
prices: Record<string,
|
|
91
|
-
liquidationThresholds: Record<string,
|
|
90
|
+
prices: Record<string, bigint>;
|
|
91
|
+
liquidationThresholds: Record<string, bigint>;
|
|
92
92
|
underlyingToken: string;
|
|
93
|
-
borrowed:
|
|
93
|
+
borrowed: bigint;
|
|
94
94
|
}
|
|
95
95
|
export declare function calcHealthFactor({ assets, prices, liquidationThresholds, underlyingToken, borrowed, }: CalcHealthFactorProps): number;
|