@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
package/lib/core/operations.js
CHANGED
|
@@ -4,9 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.OperationData = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const moment_1 = __importDefault(require("moment"));
|
|
8
|
+
class OperationData {
|
|
9
|
+
id;
|
|
10
|
+
address;
|
|
11
|
+
txHash;
|
|
12
|
+
blockNum;
|
|
13
|
+
operation;
|
|
14
|
+
timestamp;
|
|
15
|
+
date;
|
|
16
|
+
constructor(payload) {
|
|
10
17
|
this.id = payload.id;
|
|
11
18
|
this.address = payload.address;
|
|
12
19
|
this.txHash = payload.txHash;
|
|
@@ -15,6 +22,5 @@ var OperationData = /** @class */ (function () {
|
|
|
15
22
|
this.timestamp = payload.timestamp;
|
|
16
23
|
this.date = (0, moment_1.default)(payload.timestamp * 1000).format("Do MMM YYYY");
|
|
17
24
|
}
|
|
18
|
-
|
|
19
|
-
}());
|
|
25
|
+
}
|
|
20
26
|
exports.OperationData = OperationData;
|
package/lib/core/pool/data.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { providers, Signer } from "ethers";
|
|
2
2
|
import { ChartsPoolDataPayload, PoolDataPayload, UserPoolPayload } from "../../payload/pool";
|
|
3
3
|
import { IPoolService } from "../../types";
|
|
4
4
|
export declare class PoolData {
|
|
@@ -7,28 +7,28 @@ export declare class PoolData {
|
|
|
7
7
|
readonly underlyingToken: string;
|
|
8
8
|
readonly dieselToken: string;
|
|
9
9
|
readonly isWETH: boolean;
|
|
10
|
-
readonly expectedLiquidity:
|
|
11
|
-
readonly expectedLiquidityLimit:
|
|
12
|
-
readonly availableLiquidity:
|
|
13
|
-
readonly totalBorrowed:
|
|
10
|
+
readonly expectedLiquidity: bigint;
|
|
11
|
+
readonly expectedLiquidityLimit: bigint;
|
|
12
|
+
readonly availableLiquidity: bigint;
|
|
13
|
+
readonly totalBorrowed: bigint;
|
|
14
14
|
readonly depositAPY: number;
|
|
15
15
|
readonly borrowAPY: number;
|
|
16
|
-
readonly borrowAPYRay:
|
|
16
|
+
readonly borrowAPYRay: bigint;
|
|
17
17
|
readonly dieselRate: number;
|
|
18
|
-
readonly dieselRateRay:
|
|
18
|
+
readonly dieselRateRay: bigint;
|
|
19
19
|
readonly withdrawFee: number;
|
|
20
|
-
readonly timestampLU:
|
|
21
|
-
readonly cumulativeIndex_RAY:
|
|
20
|
+
readonly timestampLU: bigint;
|
|
21
|
+
readonly cumulativeIndex_RAY: bigint;
|
|
22
22
|
readonly isPaused: boolean;
|
|
23
23
|
constructor(payload: PoolDataPayload);
|
|
24
24
|
getContractETH(signer: Signer): IPoolService;
|
|
25
|
-
static calculateBorrowRate({ modelAddress, provider, expectedLiquidity, availableLiquidity, }:
|
|
25
|
+
static calculateBorrowRate({ modelAddress, provider, expectedLiquidity, availableLiquidity, }: CalculateBorrowRateProps): Promise<import("ethers").BigNumber>;
|
|
26
26
|
}
|
|
27
|
-
interface
|
|
27
|
+
interface CalculateBorrowRateProps {
|
|
28
28
|
modelAddress: string;
|
|
29
29
|
provider: providers.Provider;
|
|
30
|
-
expectedLiquidity:
|
|
31
|
-
availableLiquidity:
|
|
30
|
+
expectedLiquidity: bigint;
|
|
31
|
+
availableLiquidity: bigint;
|
|
32
32
|
}
|
|
33
33
|
export declare class ChartsPoolData {
|
|
34
34
|
readonly id: string;
|
|
@@ -44,35 +44,35 @@ export declare class ChartsPoolData {
|
|
|
44
44
|
readonly earned7DInUSD: number;
|
|
45
45
|
readonly utilization: number;
|
|
46
46
|
readonly dieselRate: number;
|
|
47
|
-
readonly dieselRateRay:
|
|
47
|
+
readonly dieselRateRay: bigint;
|
|
48
48
|
readonly depositAPY: number;
|
|
49
|
-
readonly depositAPYRay:
|
|
49
|
+
readonly depositAPYRay: bigint;
|
|
50
50
|
readonly borrowAPY: number;
|
|
51
|
-
readonly borrowAPYRay:
|
|
51
|
+
readonly borrowAPYRay: bigint;
|
|
52
52
|
readonly lmAPY: number;
|
|
53
|
-
readonly availableLiquidity:
|
|
53
|
+
readonly availableLiquidity: bigint;
|
|
54
54
|
readonly availableLiquidityChange: number;
|
|
55
55
|
readonly availableLiquidityInUSD: number;
|
|
56
56
|
readonly caLockedValue: number;
|
|
57
57
|
readonly caLockedValueChange: number;
|
|
58
58
|
readonly caLockedValueInUSD: number;
|
|
59
|
-
readonly expectedLiquidity:
|
|
59
|
+
readonly expectedLiquidity: bigint;
|
|
60
60
|
readonly expectedLiquidityChange: number;
|
|
61
61
|
readonly expectedLiquidityInUSD: number;
|
|
62
62
|
readonly expectedLiqWeekAgo: number;
|
|
63
|
-
readonly expectedLiquidityLimit:
|
|
63
|
+
readonly expectedLiquidityLimit: bigint;
|
|
64
64
|
readonly expectedLiquidityLimitInUSD: number;
|
|
65
|
-
readonly totalBorrowed:
|
|
65
|
+
readonly totalBorrowed: bigint;
|
|
66
66
|
readonly totalBorrowedChange: number;
|
|
67
67
|
readonly totalBorrowedInUSD: number;
|
|
68
|
-
readonly debtWithInterest:
|
|
68
|
+
readonly debtWithInterest: bigint;
|
|
69
69
|
readonly debtWithInterestChange: number;
|
|
70
70
|
readonly debtWithInterestInUSD: number;
|
|
71
|
-
readonly debtWithInterestOld:
|
|
72
|
-
readonly oldAvailableLiquidity:
|
|
71
|
+
readonly debtWithInterestOld: bigint;
|
|
72
|
+
readonly oldAvailableLiquidity: bigint;
|
|
73
73
|
readonly oldCALockedValue: number;
|
|
74
|
-
readonly oldExpectedLiquidity:
|
|
75
|
-
readonly oldTotalBorrowed:
|
|
74
|
+
readonly oldExpectedLiquidity: bigint;
|
|
75
|
+
readonly oldTotalBorrowed: bigint;
|
|
76
76
|
readonly withdrawFee: number;
|
|
77
77
|
readonly depositAPY1DAverage: number;
|
|
78
78
|
readonly depositAPY1DAverageChange: number;
|
|
@@ -89,13 +89,13 @@ export declare class UserPoolData {
|
|
|
89
89
|
readonly dieselToken: string;
|
|
90
90
|
readonly underlyingToken: string;
|
|
91
91
|
readonly depositAPY: number;
|
|
92
|
-
readonly depositAPYRay:
|
|
92
|
+
readonly depositAPYRay: bigint;
|
|
93
93
|
readonly lmAPY: number;
|
|
94
|
-
readonly providedLiquidity:
|
|
94
|
+
readonly providedLiquidity: bigint;
|
|
95
95
|
readonly providedLiquidityInUSD: number;
|
|
96
|
-
readonly dieselBalance:
|
|
96
|
+
readonly dieselBalance: bigint;
|
|
97
97
|
readonly dieselBalanceInUSD: number;
|
|
98
|
-
readonly lmRewards:
|
|
98
|
+
readonly lmRewards: bigint;
|
|
99
99
|
readonly lmRewardsInUSD: number;
|
|
100
100
|
readonly pnlInNativeToken: number;
|
|
101
101
|
readonly pnlInUSD: number;
|
package/lib/core/pool/data.js
CHANGED
|
@@ -1,86 +1,112 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.UserPoolData = exports.ChartsPoolData = exports.PoolData = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const formatter_1 = require("../../utils/formatter");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
class PoolData {
|
|
8
|
+
id;
|
|
9
|
+
address;
|
|
10
|
+
underlyingToken;
|
|
11
|
+
dieselToken;
|
|
12
|
+
isWETH;
|
|
13
|
+
// Information
|
|
14
|
+
expectedLiquidity;
|
|
15
|
+
expectedLiquidityLimit;
|
|
16
|
+
availableLiquidity;
|
|
17
|
+
totalBorrowed;
|
|
18
|
+
depositAPY;
|
|
19
|
+
borrowAPY;
|
|
20
|
+
borrowAPYRay;
|
|
21
|
+
dieselRate;
|
|
22
|
+
dieselRateRay;
|
|
23
|
+
withdrawFee;
|
|
24
|
+
timestampLU;
|
|
25
|
+
cumulativeIndex_RAY;
|
|
26
|
+
isPaused = false;
|
|
27
|
+
constructor(payload) {
|
|
47
28
|
this.id = payload.addr.toLowerCase();
|
|
48
29
|
this.address = payload.addr.toLowerCase();
|
|
49
30
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
50
31
|
this.dieselToken = payload.dieselToken.toLowerCase();
|
|
51
32
|
this.isWETH = payload.isWETH || false;
|
|
52
|
-
this.expectedLiquidity =
|
|
53
|
-
this.expectedLiquidityLimit =
|
|
54
|
-
this.availableLiquidity =
|
|
55
|
-
this.totalBorrowed =
|
|
56
|
-
this.depositAPY =
|
|
57
|
-
|
|
58
|
-
this.
|
|
59
|
-
|
|
60
|
-
this.
|
|
33
|
+
this.expectedLiquidity = (0, formatter_1.toBigInt)(payload.expectedLiquidity || 0);
|
|
34
|
+
this.expectedLiquidityLimit = (0, formatter_1.toBigInt)(payload.expectedLiquidityLimit || 0);
|
|
35
|
+
this.availableLiquidity = (0, formatter_1.toBigInt)(payload.availableLiquidity || 0);
|
|
36
|
+
this.totalBorrowed = (0, formatter_1.toBigInt)(payload.totalBorrowed || 0);
|
|
37
|
+
this.depositAPY =
|
|
38
|
+
(0, formatter_1.rayToNumber)(payload.depositAPY_RAY) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
39
|
+
this.borrowAPY =
|
|
40
|
+
(0, formatter_1.rayToNumber)(payload.borrowAPY_RAY) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
41
|
+
this.borrowAPYRay = (0, formatter_1.toBigInt)(payload.borrowAPY_RAY || 0);
|
|
42
|
+
this.dieselRate = (0, formatter_1.rayToNumber)(payload.dieselRate_RAY || 0);
|
|
43
|
+
this.dieselRateRay = (0, formatter_1.toBigInt)(payload.dieselRate_RAY || 0);
|
|
61
44
|
this.withdrawFee =
|
|
62
|
-
|
|
63
|
-
this.timestampLU =
|
|
64
|
-
this.cumulativeIndex_RAY =
|
|
45
|
+
Number((0, formatter_1.toBigInt)(payload.withdrawFee || 0)) / Number(constants_1.PERCENTAGE_DECIMALS);
|
|
46
|
+
this.timestampLU = (0, formatter_1.toBigInt)(payload.timestampLU || 0);
|
|
47
|
+
this.cumulativeIndex_RAY = (0, formatter_1.toBigInt)(payload.cumulativeIndex_RAY || 0);
|
|
65
48
|
}
|
|
66
|
-
|
|
49
|
+
getContractETH(signer) {
|
|
67
50
|
return types_1.IPoolService__factory.connect(this.address, signer);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
model = types_1.IInterestRateModel__factory.connect(modelAddress, provider);
|
|
75
|
-
return [2 /*return*/, model.calcBorrowRate(expectedLiquidity, availableLiquidity)];
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
return PoolData;
|
|
80
|
-
}());
|
|
51
|
+
}
|
|
52
|
+
static async calculateBorrowRate({ modelAddress, provider, expectedLiquidity, availableLiquidity, }) {
|
|
53
|
+
const model = types_1.IInterestRateModel__factory.connect(modelAddress, provider);
|
|
54
|
+
return model.calcBorrowRate(expectedLiquidity, availableLiquidity);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
81
57
|
exports.PoolData = PoolData;
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
class ChartsPoolData {
|
|
59
|
+
id;
|
|
60
|
+
address;
|
|
61
|
+
underlyingToken;
|
|
62
|
+
dieselToken;
|
|
63
|
+
isWETH;
|
|
64
|
+
addLiqCount;
|
|
65
|
+
addedLiquidity;
|
|
66
|
+
removeLiqCount;
|
|
67
|
+
removedLiquidity;
|
|
68
|
+
earned7D;
|
|
69
|
+
earned7DInUSD;
|
|
70
|
+
utilization;
|
|
71
|
+
dieselRate;
|
|
72
|
+
dieselRateRay;
|
|
73
|
+
depositAPY;
|
|
74
|
+
depositAPYRay;
|
|
75
|
+
borrowAPY;
|
|
76
|
+
borrowAPYRay;
|
|
77
|
+
lmAPY;
|
|
78
|
+
availableLiquidity;
|
|
79
|
+
availableLiquidityChange;
|
|
80
|
+
availableLiquidityInUSD;
|
|
81
|
+
caLockedValue;
|
|
82
|
+
caLockedValueChange;
|
|
83
|
+
caLockedValueInUSD;
|
|
84
|
+
expectedLiquidity;
|
|
85
|
+
expectedLiquidityChange;
|
|
86
|
+
expectedLiquidityInUSD;
|
|
87
|
+
expectedLiqWeekAgo;
|
|
88
|
+
expectedLiquidityLimit;
|
|
89
|
+
expectedLiquidityLimitInUSD;
|
|
90
|
+
totalBorrowed;
|
|
91
|
+
totalBorrowedChange;
|
|
92
|
+
totalBorrowedInUSD;
|
|
93
|
+
debtWithInterest;
|
|
94
|
+
debtWithInterestChange;
|
|
95
|
+
debtWithInterestInUSD;
|
|
96
|
+
debtWithInterestOld;
|
|
97
|
+
oldAvailableLiquidity;
|
|
98
|
+
oldCALockedValue;
|
|
99
|
+
oldExpectedLiquidity;
|
|
100
|
+
oldTotalBorrowed;
|
|
101
|
+
withdrawFee;
|
|
102
|
+
depositAPY1DAverage;
|
|
103
|
+
depositAPY1DAverageChange;
|
|
104
|
+
depositAPY7DAverage;
|
|
105
|
+
depositAPY30DAverage;
|
|
106
|
+
oldUniqueLPs;
|
|
107
|
+
uniqueLPs;
|
|
108
|
+
uniqueLPsChange;
|
|
109
|
+
constructor(payload) {
|
|
84
110
|
this.id = (payload.addr || "").toLowerCase();
|
|
85
111
|
this.address = (payload.addr || "").toLowerCase();
|
|
86
112
|
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
@@ -89,46 +115,44 @@ var ChartsPoolData = /** @class */ (function () {
|
|
|
89
115
|
this.earned7D = payload.earned7D || 0;
|
|
90
116
|
this.earned7DInUSD = payload.earned7DInUSD || 0;
|
|
91
117
|
this.utilization =
|
|
92
|
-
|
|
93
|
-
.
|
|
94
|
-
.div(ethers_1.BigNumber.from(payload.expectedLiquidity || 0))
|
|
95
|
-
.toNumber() / constants_1.PERCENTAGE_DECIMALS;
|
|
118
|
+
Number(((0, formatter_1.toBigInt)(payload.totalBorrowed || 0) * constants_1.PERCENTAGE_FACTOR) /
|
|
119
|
+
(0, formatter_1.toBigInt)(payload.expectedLiquidity || 0)) / Number(constants_1.PERCENTAGE_DECIMALS);
|
|
96
120
|
this.dieselRate = (0, formatter_1.rayToNumber)(payload.dieselRate_RAY || 0);
|
|
97
|
-
this.dieselRateRay =
|
|
121
|
+
this.dieselRateRay = (0, formatter_1.toBigInt)(payload.dieselRate_RAY || 0);
|
|
98
122
|
this.depositAPY =
|
|
99
|
-
(0, formatter_1.rayToNumber)(payload.depositAPY_RAY || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
100
|
-
this.depositAPYRay =
|
|
123
|
+
(0, formatter_1.rayToNumber)(payload.depositAPY_RAY || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
124
|
+
this.depositAPYRay = (0, formatter_1.toBigInt)(payload.depositAPY_RAY);
|
|
101
125
|
this.borrowAPY =
|
|
102
|
-
(0, formatter_1.rayToNumber)(payload.borrowAPY_RAY || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
103
|
-
this.borrowAPYRay =
|
|
104
|
-
this.lmAPY = (payload.lmAPY || 0) / constants_1.
|
|
105
|
-
this.availableLiquidity =
|
|
106
|
-
this.oldAvailableLiquidity =
|
|
126
|
+
(0, formatter_1.rayToNumber)(payload.borrowAPY_RAY || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
127
|
+
this.borrowAPYRay = (0, formatter_1.toBigInt)(payload.borrowAPY_RAY || 0);
|
|
128
|
+
this.lmAPY = (payload.lmAPY || 0) / Number(constants_1.PERCENTAGE_DECIMALS);
|
|
129
|
+
this.availableLiquidity = (0, formatter_1.toBigInt)(payload.availableLiquidity || 0);
|
|
130
|
+
this.oldAvailableLiquidity = (0, formatter_1.toBigInt)(payload.availableLiquidityOld || 0);
|
|
107
131
|
this.availableLiquidityChange =
|
|
108
|
-
(payload.availableLiquidity10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
132
|
+
(payload.availableLiquidity10kBasis || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
109
133
|
this.availableLiquidityInUSD = payload.availableLiquidityInUSD || 0;
|
|
110
134
|
this.caLockedValue = payload.caLockedValue || 0;
|
|
111
135
|
this.oldCALockedValue = payload.caLockedValueOld || 0;
|
|
112
136
|
this.caLockedValueChange =
|
|
113
|
-
(payload.caLockedValue10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
137
|
+
(payload.caLockedValue10kBasis || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
114
138
|
this.caLockedValueInUSD = payload.caLockedValueUSD || 0;
|
|
115
|
-
this.expectedLiquidity =
|
|
116
|
-
this.oldExpectedLiquidity =
|
|
139
|
+
this.expectedLiquidity = (0, formatter_1.toBigInt)(payload.expectedLiquidity || 0);
|
|
140
|
+
this.oldExpectedLiquidity = (0, formatter_1.toBigInt)(payload.expectedLiquidityOld || 0);
|
|
117
141
|
this.expectedLiquidityChange =
|
|
118
|
-
(payload.expectedLiquidity10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
142
|
+
(payload.expectedLiquidity10kBasis || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
119
143
|
this.expectedLiquidityInUSD = payload.expectedLiquidityInUSD || 0;
|
|
120
144
|
this.expectedLiqWeekAgo = payload.expectedLiqWeekAgo || 0;
|
|
121
|
-
this.expectedLiquidityLimit =
|
|
145
|
+
this.expectedLiquidityLimit = (0, formatter_1.toBigInt)(payload.expectedLiquidityLimit || 0);
|
|
122
146
|
this.expectedLiquidityLimitInUSD = payload.expectedLiquidityLimitInUSD || 0;
|
|
123
|
-
this.totalBorrowed =
|
|
124
|
-
this.oldTotalBorrowed =
|
|
147
|
+
this.totalBorrowed = (0, formatter_1.toBigInt)(payload.totalBorrowed || 0);
|
|
148
|
+
this.oldTotalBorrowed = (0, formatter_1.toBigInt)(payload.totalBorrowedOld || 0);
|
|
125
149
|
this.totalBorrowedChange =
|
|
126
|
-
(payload.totalBorrowed10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
150
|
+
(payload.totalBorrowed10kBasis || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
127
151
|
this.totalBorrowedInUSD = payload.totalBorrowedInUSD || 0;
|
|
128
|
-
this.debtWithInterest =
|
|
129
|
-
this.debtWithInterestOld =
|
|
152
|
+
this.debtWithInterest = (0, formatter_1.toBigInt)(payload.debtWithInterest || 0);
|
|
153
|
+
this.debtWithInterestOld = (0, formatter_1.toBigInt)(payload.debtWithInterestOld || 0);
|
|
130
154
|
this.debtWithInterestChange =
|
|
131
|
-
(payload.debtWithInterest10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
155
|
+
(payload.debtWithInterest10kBasis || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
132
156
|
this.debtWithInterestInUSD = payload.debtWithInterestInUSD || 0;
|
|
133
157
|
this.withdrawFee = payload.withdrawFee || 0;
|
|
134
158
|
this.addLiqCount = payload.addLiqCount || 0;
|
|
@@ -136,36 +160,54 @@ var ChartsPoolData = /** @class */ (function () {
|
|
|
136
160
|
this.removeLiqCount = payload.removeLiqCount || 0;
|
|
137
161
|
this.removedLiquidity = payload.removedLiquidity || 0;
|
|
138
162
|
this.depositAPY1DAverage =
|
|
139
|
-
(payload.depositAPY1DAverage || 0) / constants_1.PERCENTAGE_DECIMALS;
|
|
163
|
+
(payload.depositAPY1DAverage || 0) / Number(constants_1.PERCENTAGE_DECIMALS);
|
|
140
164
|
this.depositAPY1DAverageChange =
|
|
141
|
-
(payload.depositAPY1DAverage10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
165
|
+
(payload.depositAPY1DAverage10kBasis || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
142
166
|
this.depositAPY7DAverage =
|
|
143
|
-
(payload.depositAPY7DAverage || 0) / constants_1.PERCENTAGE_DECIMALS;
|
|
167
|
+
(payload.depositAPY7DAverage || 0) / Number(constants_1.PERCENTAGE_DECIMALS);
|
|
144
168
|
this.depositAPY30DAverage =
|
|
145
|
-
(payload.depositAPY30DAverage || 0) / constants_1.PERCENTAGE_DECIMALS;
|
|
169
|
+
(payload.depositAPY30DAverage || 0) / Number(constants_1.PERCENTAGE_DECIMALS);
|
|
146
170
|
this.uniqueLPs = payload.uniqueLPs || 0;
|
|
147
171
|
this.oldUniqueLPs = payload.uniqueLPsOld || 0;
|
|
148
172
|
this.uniqueLPsChange =
|
|
149
|
-
(payload.uniqueLPs10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
173
|
+
(payload.uniqueLPs10kBasis || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
150
174
|
}
|
|
151
|
-
|
|
152
|
-
}());
|
|
175
|
+
}
|
|
153
176
|
exports.ChartsPoolData = ChartsPoolData;
|
|
154
|
-
|
|
155
|
-
|
|
177
|
+
class UserPoolData {
|
|
178
|
+
id;
|
|
179
|
+
address;
|
|
180
|
+
dieselToken;
|
|
181
|
+
underlyingToken;
|
|
182
|
+
depositAPY;
|
|
183
|
+
depositAPYRay;
|
|
184
|
+
lmAPY;
|
|
185
|
+
providedLiquidity;
|
|
186
|
+
providedLiquidityInUSD;
|
|
187
|
+
dieselBalance;
|
|
188
|
+
dieselBalanceInUSD;
|
|
189
|
+
lmRewards;
|
|
190
|
+
lmRewardsInUSD;
|
|
191
|
+
pnlInNativeToken;
|
|
192
|
+
pnlInUSD;
|
|
193
|
+
addedLiq;
|
|
194
|
+
addLiqCount;
|
|
195
|
+
removeLiqCount;
|
|
196
|
+
removedLiq;
|
|
197
|
+
constructor(payload) {
|
|
156
198
|
this.id = (payload.pool || "").toLowerCase();
|
|
157
199
|
this.address = payload.pool || "";
|
|
158
200
|
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
159
201
|
this.dieselToken = (payload.dieselToken || "").toLowerCase();
|
|
160
202
|
this.depositAPY =
|
|
161
|
-
(0, formatter_1.rayToNumber)(payload.depositAPY_RAY || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
162
|
-
this.depositAPYRay =
|
|
163
|
-
this.lmAPY = (payload.lmAPY || 0) / constants_1.PERCENTAGE_FACTOR;
|
|
164
|
-
this.providedLiquidity =
|
|
203
|
+
(0, formatter_1.rayToNumber)(payload.depositAPY_RAY || 0) * Number(constants_1.PERCENTAGE_DECIMALS);
|
|
204
|
+
this.depositAPYRay = (0, formatter_1.toBigInt)(payload.depositAPY_RAY || 0);
|
|
205
|
+
this.lmAPY = (payload.lmAPY || 0) / Number(constants_1.PERCENTAGE_FACTOR || 0);
|
|
206
|
+
this.providedLiquidity = (0, formatter_1.toBigInt)(payload.liqValue || 0);
|
|
165
207
|
this.providedLiquidityInUSD = payload.liqValueInUSD;
|
|
166
|
-
this.dieselBalance =
|
|
208
|
+
this.dieselBalance = (0, formatter_1.toBigInt)(payload.dieselBalanceBI || 0);
|
|
167
209
|
this.dieselBalanceInUSD = payload.dieselBalance;
|
|
168
|
-
this.lmRewards =
|
|
210
|
+
this.lmRewards = (0, formatter_1.toBigInt)(payload.lmRewards || 0);
|
|
169
211
|
this.lmRewardsInUSD = payload.lmRewardsInUSD;
|
|
170
212
|
this.pnlInNativeToken = payload.liqPnlInNativeToken;
|
|
171
213
|
this.pnlInUSD = payload.liqPnlInUSD;
|
|
@@ -174,6 +216,5 @@ var UserPoolData = /** @class */ (function () {
|
|
|
174
216
|
this.removeLiqCount = payload.removeLiqCount;
|
|
175
217
|
this.removedLiq = payload.removedLiq;
|
|
176
218
|
}
|
|
177
|
-
|
|
178
|
-
}());
|
|
219
|
+
}
|
|
179
220
|
exports.UserPoolData = UserPoolData;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BigNumber } from "ethers";
|
|
2
1
|
import { TokenData } from "../../tokens/tokenData";
|
|
3
2
|
export interface BasePoolOperation {
|
|
4
3
|
amount: string;
|
|
@@ -15,7 +14,7 @@ export declare abstract class AbstractPoolOperation {
|
|
|
15
14
|
readonly user: string;
|
|
16
15
|
readonly sessionId: string;
|
|
17
16
|
readonly pool: string;
|
|
18
|
-
readonly amount:
|
|
17
|
+
readonly amount: bigint;
|
|
19
18
|
constructor(opts: BasePoolOperation);
|
|
20
19
|
abstract toString(token: TokenData): string;
|
|
21
20
|
}
|
|
@@ -1,48 +1,36 @@
|
|
|
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.PoolOperation = exports.AbstractPoolOperation = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
const moment_1 = require("moment");
|
|
5
|
+
const contractsRegister_1 = require("../../contracts/contractsRegister");
|
|
6
|
+
const formatter_1 = require("../../utils/formatter");
|
|
7
|
+
class AbstractPoolOperation {
|
|
8
|
+
txHash;
|
|
9
|
+
date;
|
|
10
|
+
timestamp;
|
|
11
|
+
user;
|
|
12
|
+
sessionId;
|
|
13
|
+
pool;
|
|
14
|
+
amount;
|
|
15
|
+
constructor(opts) {
|
|
25
16
|
this.txHash = opts.tx_hash;
|
|
26
|
-
this.amount =
|
|
17
|
+
this.amount = BigInt(opts.amount);
|
|
27
18
|
this.pool = opts.pool;
|
|
28
19
|
this.sessionId = opts.session_id;
|
|
29
20
|
this.user = opts.user;
|
|
30
21
|
this.timestamp = opts.timestamp;
|
|
31
22
|
this.date = (0, moment_1.unix)(opts.timestamp).format("Do MMM YYYY");
|
|
32
23
|
}
|
|
33
|
-
|
|
34
|
-
}());
|
|
24
|
+
}
|
|
35
25
|
exports.AbstractPoolOperation = AbstractPoolOperation;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return _this;
|
|
26
|
+
class PoolOperation extends AbstractPoolOperation {
|
|
27
|
+
event;
|
|
28
|
+
constructor(ops) {
|
|
29
|
+
super(ops);
|
|
30
|
+
this.event = ops.event;
|
|
42
31
|
}
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
}(AbstractPoolOperation));
|
|
32
|
+
toString(token) {
|
|
33
|
+
return `${this.event} ${(0, formatter_1.formatBN)(this.amount, token.decimals)} ${(0, contractsRegister_1.getContractName)(this.pool)}`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
48
36
|
exports.PoolOperation = PoolOperation;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigNumberish } from "ethers";
|
|
2
2
|
export interface PriceUpdate {
|
|
3
3
|
token: string;
|
|
4
4
|
price: BigNumberish;
|
|
5
5
|
}
|
|
6
6
|
export declare class PriceOracleData {
|
|
7
|
-
protected _prices: Record<string,
|
|
7
|
+
protected _prices: Record<string, bigint>;
|
|
8
8
|
constructor(prices: Array<PriceUpdate>);
|
|
9
9
|
updatePrices(prices: Array<PriceUpdate>): void;
|
|
10
|
-
convert(amount:
|
|
11
|
-
convertFromUSD(amount:
|
|
12
|
-
convertToUSD(amount:
|
|
13
|
-
getPrice(token: string):
|
|
10
|
+
convert(amount: bigint, from: string, to: string): bigint;
|
|
11
|
+
convertFromUSD(amount: bigint, token: string): bigint;
|
|
12
|
+
convertToUSD(amount: bigint, token: string): bigint;
|
|
13
|
+
getPrice(token: string): bigint;
|
|
14
14
|
}
|
package/lib/core/priceOracle.js
CHANGED
|
@@ -1,38 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PriceOracleData = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const token_1 = require("../tokens/token");
|
|
5
|
+
const formatter_1 = require("../utils/formatter");
|
|
6
|
+
class PriceOracleData {
|
|
7
|
+
_prices = {};
|
|
8
|
+
constructor(prices) {
|
|
9
9
|
this.updatePrices(prices);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_this._prices[p.token.toLowerCase()] = ethers_1.BigNumber.from(p.price);
|
|
11
|
+
updatePrices(prices) {
|
|
12
|
+
prices.forEach(p => {
|
|
13
|
+
this._prices[p.token.toLowerCase()] = (0, formatter_1.toBigInt)(p.price);
|
|
15
14
|
});
|
|
16
|
-
}
|
|
17
|
-
|
|
15
|
+
}
|
|
16
|
+
convert(amount, from, to) {
|
|
18
17
|
return this.convertFromUSD(this.convertToUSD(amount, from), to);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return amount
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
PriceOracleData.prototype.getPrice = function (token) {
|
|
31
|
-
var price = this._prices[token.toLowerCase()];
|
|
32
|
-
if (!price)
|
|
33
|
-
throw new Error("Price for ".concat(token, " not found"));
|
|
18
|
+
}
|
|
19
|
+
convertFromUSD(amount, token) {
|
|
20
|
+
return (amount * 10n ** BigInt((0, token_1.getDecimals)(token))) / this.getPrice(token);
|
|
21
|
+
}
|
|
22
|
+
convertToUSD(amount, token) {
|
|
23
|
+
return (amount * this.getPrice(token)) / 10n ** BigInt((0, token_1.getDecimals)(token));
|
|
24
|
+
}
|
|
25
|
+
getPrice(token) {
|
|
26
|
+
const price = this._prices[token.toLowerCase()];
|
|
27
|
+
if (price === undefined)
|
|
28
|
+
throw new Error(`Price for ${token} not found`);
|
|
34
29
|
return price;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}());
|
|
30
|
+
}
|
|
31
|
+
}
|
|
38
32
|
exports.PriceOracleData = PriceOracleData;
|