@gearbox-protocol/sdk 1.22.3 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apy/convexAPY.d.ts +10 -10
- package/lib/apy/convexAPY.js +100 -121
- package/lib/apy/curveAPY.d.ts +3 -4
- package/lib/apy/curveAPY.js +57 -111
- package/lib/apy/index.js +4 -6
- package/lib/apy/lidoAPY.d.ts +1 -2
- package/lib/apy/lidoAPY.js +14 -62
- package/lib/apy/yearnAPY.d.ts +2 -3
- package/lib/apy/yearnAPY.js +26 -82
- package/lib/contracts/contracts.js +9 -22
- package/lib/contracts/contractsRegister.js +39 -51
- package/lib/contracts/protocols.js +10 -11
- package/lib/core/adapter.js +9 -4
- package/lib/core/assets.d.ts +6 -7
- package/lib/core/assets.js +60 -70
- package/lib/core/chains.js +30 -80
- package/lib/core/constants.d.ts +9 -10
- package/lib/core/constants.js +9 -12
- package/lib/core/creditAccount.d.ts +20 -20
- package/lib/core/creditAccount.js +123 -134
- package/lib/core/creditAccount.spec.js +50 -52
- package/lib/core/creditManager.d.ts +26 -26
- package/lib/core/creditManager.js +172 -136
- package/lib/core/creditManager.spec.js +59 -61
- package/lib/core/creditSession.d.ts +12 -13
- package/lib/core/creditSession.js +120 -77
- package/lib/core/errors.d.ts +2 -3
- package/lib/core/errors.js +11 -27
- package/lib/core/eventOrTx.js +35 -73
- package/lib/core/events.d.ts +31 -24
- package/lib/core/events.js +702 -702
- package/lib/core/operations.js +11 -5
- package/lib/core/pool/data.d.ts +29 -29
- package/lib/core/pool/data.js +153 -112
- package/lib/core/pool/operation.d.ts +1 -2
- package/lib/core/pool/operation.js +23 -35
- package/lib/core/priceOracle.d.ts +6 -6
- package/lib/core/priceOracle.js +23 -29
- package/lib/core/rewardClaimer.d.ts +2 -2
- package/lib/core/rewardClaimer.js +5 -48
- package/lib/core/rewardConvex.js +54 -114
- package/lib/core/rewardConvex.spec.js +41 -43
- package/lib/core/strategy.d.ts +5 -6
- package/lib/core/strategy.js +67 -69
- package/lib/core/strategy.spec.js +32 -34
- package/lib/core/tokenDistributor.d.ts +1 -2
- package/lib/core/trade.d.ts +6 -6
- package/lib/core/trade.js +70 -115
- package/lib/core/transactions.d.ts +21 -22
- package/lib/core/transactions.js +285 -308
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -2
- package/lib/oracles/oracles.d.ts +1 -2
- package/lib/oracles/priceFeeds.js +2 -3
- package/lib/parsers/ERC20Parser.js +20 -38
- package/lib/parsers/abstractParser.js +33 -31
- package/lib/parsers/addressProviderParser.js +12 -30
- package/lib/parsers/airdropDistributorParser.js +12 -30
- package/lib/parsers/convexBaseRewardPoolAdapterParser.js +24 -42
- package/lib/parsers/convexBaseRewardPoolAdapterParser.spec.js +11 -11
- package/lib/parsers/convexBoosterAdapterParser.js +26 -44
- package/lib/parsers/convexBoosterAdapterParser.spec.js +10 -10
- package/lib/parsers/convextRewardPoolParser.js +12 -30
- package/lib/parsers/creditFacadeParser.js +26 -45
- package/lib/parsers/creditFacadeParser.spec.js +13 -13
- package/lib/parsers/creditManagerParser.js +12 -30
- package/lib/parsers/curveAdapterParser.js +60 -78
- package/lib/parsers/curveAdapterParser.spec.js +20 -27
- package/lib/parsers/dataCompressorParser.js +12 -30
- package/lib/parsers/lidoAdapterParser.js +15 -33
- package/lib/parsers/lidoAdapterParser.spec.js +9 -9
- package/lib/parsers/lidoOracleParser.js +12 -30
- package/lib/parsers/lidoSTETHParser.js +19 -37
- package/lib/parsers/multicallParser.js +16 -34
- package/lib/parsers/offchainOracleParser.js +13 -31
- package/lib/parsers/poolParser.js +11 -29
- package/lib/parsers/priceOracleParser.js +13 -31
- package/lib/parsers/txParser.js +86 -96
- package/lib/parsers/uniV2AdapterParser.js +35 -55
- package/lib/parsers/uniV2AdapterParser.spec.js +15 -16
- package/lib/parsers/uniV3AdapterParser.js +56 -74
- package/lib/parsers/uniV3AdapterParser.spec.js +23 -24
- package/lib/parsers/wstETHAdapterParser.js +25 -43
- package/lib/parsers/wstETHAdapterParser.spec.js +11 -11
- package/lib/parsers/yearnAdapterParser.spec.js +17 -17
- package/lib/parsers/yearnV2AdapterParser.js +25 -43
- package/lib/pathfinder/core.d.ts +3 -4
- package/lib/pathfinder/pathOptions.js +52 -101
- package/lib/pathfinder/pathOptions.spec.js +55 -57
- package/lib/pathfinder/pathfinder.d.ts +3 -3
- package/lib/pathfinder/pathfinder.js +109 -202
- package/lib/pathfinder/pathfinder.spec.js +13 -13
- package/lib/strategies/convex.js +111 -123
- package/lib/strategies/creditFacade.js +34 -37
- package/lib/strategies/curve.js +74 -80
- package/lib/strategies/lido.js +26 -32
- package/lib/strategies/uniswapV2.js +21 -24
- package/lib/strategies/uniswapV3.js +33 -36
- package/lib/strategies/yearn.js +47 -59
- package/lib/tokens/balancer.js +3 -5
- package/lib/tokens/convex.js +14 -29
- package/lib/tokens/curveLP.js +22 -28
- package/lib/tokens/gear.js +1 -1
- package/lib/tokens/normal.js +3 -5
- package/lib/tokens/token.js +29 -35
- package/lib/tokens/tokenData.d.ts +0 -9
- package/lib/tokens/tokenData.js +17 -15
- package/lib/tokens/yearn.js +3 -5
- package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface__factory.js +9 -12
- package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface__factory.js +9 -12
- package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACLEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACLExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACL__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactoryEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactoryGetters__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactory__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProviderEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProvider__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributorEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributor__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegisterEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegister__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditAccount.sol/ICrediAccountExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditAccount.sol/ICreditAccount__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfiguratorEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfiguratorExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfigurator__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExtended__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacade__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2Events__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2Exceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressorExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressor__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributorEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributor__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFTEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFTExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFT__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDieselToken.sol/IDieselTokenExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDieselToken.sol/IDieselToken__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IInterestRateModel__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeedEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeedExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeed__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPhantomERC20__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolServiceEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolService__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceFeedType__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Events__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Exceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Ext__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IVersion__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IWETHGateway__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditFilter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditManager__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IAdapter.sol/IAdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IAdapter.sol/IAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IUniversalAdapter.sol/IUniversalAdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IUniversalAdapter.sol/IUniversalAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/external/IWETH__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/pool/PoolService__factory.js +27 -50
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/test/interfaces/ITokenTestSuite__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IBaseRewardPool__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IBooster__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IClaimZap__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IConvexToken__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IRewards.sol/IBasicRewards__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IRewards.sol/IRewards__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ICrvDeposit__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ICurveGauge__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ICurveVoteEscrow__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IDeposit__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IFeeDistro__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IMinter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IPools__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IRegistry__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IRewardFactory__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IRewards__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IStaker__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IStashFactory__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IStash__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ITokenFactory__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ITokenMinter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IVestedEscrow__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IVoting__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IWalletChecker__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePoolStETH__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool_2.sol/ICurvePool2Assets__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool_3.sol/ICurvePool3Assets__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool_4.sol/ICurvePool4Assets__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurveRegistry__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/ILidoOracle__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETHGetters__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETH__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETHGetters__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETH__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETHGateway.sol/IwstETHGateWay__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IQuoter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IUniswapV2Router01__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IUniswapV2Router02__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IUniswapV3.sol/ISwapRouter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/yearn/IYVault__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BaseRewardPoolAdapter.sol/IConvexV1BaseRewardPoolAdapterErrors__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BaseRewardPoolAdapter.sol/IConvexV1BaseRewardPoolAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BoosterAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1Adapter.sol/ICurveV1AdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1Adapter.sol/ICurveV1Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1_2AssetsAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1_3AssetsAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1_4AssetsAdapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1AdapterEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1AdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/IwstETHV1Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapPathChecker__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV2Adapter.sol/IUniswapV2AdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV2Adapter.sol/IUniswapV2Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV3Adapter.sol/IUniswapV3AdapterExceptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV3Adapter.sol/IUniswapV3Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/yearn/IYearnV2Adapter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/test/config/SupportedContracts.sol/ISupportedContracts__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/test/mocks/integrations/LidoMock.sol/ILidoMockEvents__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositorOptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositor__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IGasPricer__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorkerOptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorker__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IPathResolver__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IRouterComponent__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IRouter__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ISwapAggregator__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ISwapper__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawerOptions__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawer__factory.js +9 -12
- package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IWrapper__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC20/IERC20__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC721/IERC721Receiver__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC721/IERC721__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata__factory.js +9 -12
- package/lib/types/factories/@openzeppelin/contracts/utils/introspection/IERC165__factory.js +9 -12
- package/lib/types/factories/contracts/IGas__factory.js +9 -12
- package/lib/types/factories/contracts/IGnosisSafeSignatureValidator__factory.js +9 -12
- package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributorEvents__factory.js +9 -12
- package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributorExceptions__factory.js +9 -12
- package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributor__factory.js +9 -12
- package/lib/types/factories/contracts/support/IOffchainOracle__factory.js +9 -12
- package/lib/types/factories/contracts/support/MultiCall.sol/Multicall2__factory.js +27 -50
- package/lib/utils/errors.js +1 -1
- package/lib/utils/extracter.js +4 -4
- package/lib/utils/formatter.d.ts +8 -8
- package/lib/utils/formatter.js +73 -87
- package/lib/utils/loading.js +3 -3
- package/lib/utils/mappers.js +7 -34
- package/lib/utils/math.d.ts +10 -7
- package/lib/utils/math.js +22 -25
- package/lib/utils/multicall.js +32 -98
- package/lib/utils/price.d.ts +3 -4
- package/lib/utils/price.js +8 -20
- package/lib/utils/repeater.js +12 -53
- package/lib/utils/validate.js +2 -2
- package/lib/watchers/creditAccountWatcher.js +136 -237
- package/lib/watchers/creditAccountWatcher.spec.js +51 -68
- package/lib/watchers/creditManagerWatcher.js +21 -71
- package/lib/watchers/creditManagerWatcher.spec.js +20 -23
- package/package.json +2 -2
- package/lib/core/history.d.ts +0 -42
- package/lib/core/history.js +0 -2
- package/lib/core/wcOperation/abstractOperations.d.ts +0 -23
- package/lib/core/wcOperation/abstractOperations.js +0 -39
- package/lib/core/wcOperation/index.d.ts +0 -11
- package/lib/core/wcOperation/index.js +0 -30
- package/lib/core/wcOperation/operations.d.ts +0 -88
- package/lib/core/wcOperation/operations.js +0 -146
- package/lib/core/wcOperation/types.d.ts +0 -15
- package/lib/core/wcOperation/types.js +0 -2
package/lib/index.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export * from "./core/strategy";
|
|
|
17
17
|
export * from "./core/tokenDistributor";
|
|
18
18
|
export * from "./core/trade";
|
|
19
19
|
export * from "./core/transactions";
|
|
20
|
-
export * from "./core/wcOperation";
|
|
21
20
|
export * from "./oracles/oracles";
|
|
22
21
|
export * from "./oracles/priceFeeds";
|
|
23
22
|
export * from "./payload/creditAccount";
|
|
@@ -34,7 +33,6 @@ export * from "./utils/validate";
|
|
|
34
33
|
export * from "./apy";
|
|
35
34
|
export { AdapterInterface } from "./contracts/adapters";
|
|
36
35
|
export * from "./contracts/contractsRegister";
|
|
37
|
-
export * from "./core/history";
|
|
38
36
|
export * from "./parsers/txParser";
|
|
39
37
|
export * from "./pathfinder/core";
|
|
40
38
|
export * from "./pathfinder/pathfinder";
|
package/lib/index.js
CHANGED
|
@@ -34,7 +34,6 @@ __exportStar(require("./core/strategy"), exports);
|
|
|
34
34
|
__exportStar(require("./core/tokenDistributor"), exports);
|
|
35
35
|
__exportStar(require("./core/trade"), exports);
|
|
36
36
|
__exportStar(require("./core/transactions"), exports);
|
|
37
|
-
__exportStar(require("./core/wcOperation"), exports);
|
|
38
37
|
__exportStar(require("./oracles/oracles"), exports);
|
|
39
38
|
__exportStar(require("./oracles/priceFeeds"), exports);
|
|
40
39
|
__exportStar(require("./payload/creditAccount"), exports);
|
|
@@ -53,7 +52,6 @@ __exportStar(require("./apy"), exports);
|
|
|
53
52
|
var adapters_1 = require("./contracts/adapters");
|
|
54
53
|
Object.defineProperty(exports, "AdapterInterface", { enumerable: true, get: function () { return adapters_1.AdapterInterface; } });
|
|
55
54
|
__exportStar(require("./contracts/contractsRegister"), exports);
|
|
56
|
-
__exportStar(require("./core/history"), exports);
|
|
57
55
|
__exportStar(require("./parsers/txParser"), exports);
|
|
58
56
|
__exportStar(require("./pathfinder/core"), exports);
|
|
59
57
|
__exportStar(require("./pathfinder/pathfinder"), exports);
|
package/lib/oracles/oracles.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BigNumber } from "ethers";
|
|
2
1
|
import { NetworkType } from "../core/chains";
|
|
3
2
|
import { SupportedToken } from "../tokens/token";
|
|
4
3
|
export interface PriceFeed {
|
|
@@ -44,7 +43,7 @@ export type PriceFeedData = {
|
|
|
44
43
|
} | {
|
|
45
44
|
type: OracleType.BOUNDED_ORACLE;
|
|
46
45
|
targetPriceFeed: Record<NetworkType, string>;
|
|
47
|
-
upperBound:
|
|
46
|
+
upperBound: bigint;
|
|
48
47
|
} | {
|
|
49
48
|
type: OracleType.COMPOSITE_ORACLE;
|
|
50
49
|
targetToBasePriceFeed: Record<NetworkType, string>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.priceFeedsByNetwork = exports.GAS_PRICE_FEED = void 0;
|
|
4
|
-
|
|
5
|
-
var oracles_1 = require("./oracles");
|
|
4
|
+
const oracles_1 = require("./oracles");
|
|
6
5
|
exports.GAS_PRICE_FEED = "0x169e633a2d1e6c10dd91238ba11c4a708dfef37c";
|
|
7
6
|
exports.priceFeedsByNetwork = {
|
|
8
7
|
"1INCH": {
|
|
@@ -303,7 +302,7 @@ exports.priceFeedsByNetwork = {
|
|
|
303
302
|
Mainnet: "0x3D7aE7E594f2f2091Ad8798313450130d0Aba3a0",
|
|
304
303
|
Goerli: "0xd6852347062aB885B6Fb9F7220BedCc5A39CE862",
|
|
305
304
|
},
|
|
306
|
-
upperBound:
|
|
305
|
+
upperBound: (BigInt(1e8) * 11n) / 10n,
|
|
307
306
|
},
|
|
308
307
|
},
|
|
309
308
|
sUSD: {
|
|
@@ -1,54 +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.ERC20Parser = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_this.ifc = types_1.IERC20__factory.createInterface();
|
|
28
|
-
return _this;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const formatter_1 = require("../utils/formatter");
|
|
6
|
+
const abstractParser_1 = require("./abstractParser");
|
|
7
|
+
class ERC20Parser extends abstractParser_1.AbstractParser {
|
|
8
|
+
constructor(symbol) {
|
|
9
|
+
super(symbol);
|
|
10
|
+
this.adapterName = "Token";
|
|
11
|
+
this.ifc = types_1.IERC20__factory.createInterface();
|
|
29
12
|
}
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
parse(calldata) {
|
|
14
|
+
const { functionFragment, functionName } = this.parseSelector(calldata);
|
|
32
15
|
switch (functionFragment.name) {
|
|
33
16
|
case "totalSupply": {
|
|
34
|
-
return
|
|
17
|
+
return `${functionName}()`;
|
|
35
18
|
}
|
|
36
19
|
case "balanceOf": {
|
|
37
|
-
|
|
38
|
-
return
|
|
20
|
+
const [address] = this.decodeFunctionData(functionFragment, calldata);
|
|
21
|
+
return `${functionName}(${address})`;
|
|
39
22
|
}
|
|
40
23
|
case "allowance": {
|
|
41
|
-
|
|
42
|
-
return
|
|
24
|
+
const [account, to] = this.decodeFunctionData(functionFragment, calldata);
|
|
25
|
+
return `${functionName}(account: ${account}, to: ${to})`;
|
|
43
26
|
}
|
|
44
27
|
case "approve": {
|
|
45
|
-
|
|
46
|
-
return
|
|
28
|
+
const [spender, amount] = this.decodeFunctionData(functionFragment, calldata);
|
|
29
|
+
return `${functionName}(${spender}, [${(0, formatter_1.toBigInt)(amount).toString()}])`;
|
|
47
30
|
}
|
|
48
31
|
default:
|
|
49
|
-
return
|
|
32
|
+
return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
|
|
50
33
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}(abstractParser_1.AbstractParser));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
54
36
|
exports.ERC20Parser = ERC20Parser;
|
|
@@ -1,44 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AbstractParser = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const decimals_1 = require("../tokens/decimals");
|
|
6
|
+
const token_1 = require("../tokens/token");
|
|
7
|
+
const formatter_1 = require("../utils/formatter");
|
|
8
|
+
class AbstractParser {
|
|
9
|
+
contract;
|
|
10
|
+
ifc;
|
|
11
|
+
adapterName;
|
|
12
|
+
constructor(contract) {
|
|
10
13
|
this.contract = contract;
|
|
11
14
|
this.adapterName = "Contract";
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return { functionFragment
|
|
17
|
-
}
|
|
18
|
-
|
|
16
|
+
parseSelector(calldata) {
|
|
17
|
+
const functionFragment = this.ifc.getFunction(ethers_1.utils.hexDataSlice(calldata, 0, 4));
|
|
18
|
+
const functionName = `${this.adapterName}[${this.contract}].${functionFragment.name}`;
|
|
19
|
+
return { functionFragment, functionName };
|
|
20
|
+
}
|
|
21
|
+
decodeFunctionData(functionFragment, data) {
|
|
19
22
|
return this.ifc.decodeFunctionData(functionFragment, data);
|
|
20
|
-
}
|
|
21
|
-
|
|
23
|
+
}
|
|
24
|
+
encodeFunctionResult(functionFragment, data) {
|
|
22
25
|
return this.ifc.encodeFunctionResult(functionFragment, data);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
}
|
|
27
|
+
tokenSymbol(address) {
|
|
28
|
+
const symbol = token_1.tokenSymbolByAddress[address.toLowerCase()];
|
|
26
29
|
if (!symbol)
|
|
27
|
-
throw new Error(
|
|
30
|
+
throw new Error(`Unknown token: ${address}`);
|
|
28
31
|
return symbol;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
}
|
|
33
|
+
formatBN(amount, token) {
|
|
34
|
+
return `${(0, formatter_1.formatBN)(amount, decimals_1.decimals[token])} [${(0, formatter_1.toBigInt)(amount).toString()}]`;
|
|
35
|
+
}
|
|
36
|
+
parseToObject(address, calldata) {
|
|
37
|
+
const { functionFragment } = this.parseSelector(calldata);
|
|
38
|
+
const args = this.decodeFunctionData(functionFragment, calldata);
|
|
36
39
|
return {
|
|
37
|
-
address
|
|
38
|
-
functionFragment
|
|
39
|
-
args
|
|
40
|
+
address,
|
|
41
|
+
functionFragment,
|
|
42
|
+
args,
|
|
40
43
|
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}());
|
|
44
|
+
}
|
|
45
|
+
}
|
|
44
46
|
exports.AbstractParser = AbstractParser;
|
|
@@ -1,32 +1,15 @@
|
|
|
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.AddressProviderParser = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_this.ifc = types_1.IAddressProvider__factory.createInterface();
|
|
26
|
-
return _this;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const abstractParser_1 = require("./abstractParser");
|
|
6
|
+
class AddressProviderParser extends abstractParser_1.AbstractParser {
|
|
7
|
+
constructor() {
|
|
8
|
+
super("AddressProvider");
|
|
9
|
+
this.ifc = types_1.IAddressProvider__factory.createInterface();
|
|
27
10
|
}
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
parse(calldata) {
|
|
12
|
+
const { functionFragment, functionName } = this.parseSelector(calldata);
|
|
30
13
|
switch (functionFragment.name) {
|
|
31
14
|
case "getWethToken":
|
|
32
15
|
case "getGearToken":
|
|
@@ -34,12 +17,11 @@ var AddressProviderParser = /** @class */ (function (_super) {
|
|
|
34
17
|
case "getDataCompressor":
|
|
35
18
|
case "getWETHGateway":
|
|
36
19
|
case "getPriceOracle": {
|
|
37
|
-
return
|
|
20
|
+
return `${functionName}()`;
|
|
38
21
|
}
|
|
39
22
|
default:
|
|
40
|
-
return
|
|
23
|
+
return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
|
|
41
24
|
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}(abstractParser_1.AbstractParser));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
45
27
|
exports.AddressProviderParser = AddressProviderParser;
|
|
@@ -1,40 +1,22 @@
|
|
|
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.AirdropDistributorParser = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_this.ifc = types_1.IAirdropDistributor__factory.createInterface();
|
|
26
|
-
return _this;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const abstractParser_1 = require("./abstractParser");
|
|
6
|
+
class AirdropDistributorParser extends abstractParser_1.AbstractParser {
|
|
7
|
+
constructor() {
|
|
8
|
+
super("AirdropDistributor");
|
|
9
|
+
this.ifc = types_1.IAirdropDistributor__factory.createInterface();
|
|
27
10
|
}
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
parse(calldata) {
|
|
12
|
+
const { functionFragment, functionName } = this.parseSelector(calldata);
|
|
30
13
|
switch (functionFragment.name) {
|
|
31
14
|
case "merkleRoot": {
|
|
32
|
-
return
|
|
15
|
+
return `${functionName}()`;
|
|
33
16
|
}
|
|
34
17
|
default:
|
|
35
|
-
return
|
|
18
|
+
return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
|
|
36
19
|
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}(abstractParser_1.AbstractParser));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
40
22
|
exports.AirdropDistributorParser = AirdropDistributorParser;
|
|
@@ -1,64 +1,46 @@
|
|
|
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.ConvexBaseRewardPoolAdapterParser = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_this.ifc = types_1.IConvexV1BaseRewardPoolAdapter__factory.createInterface();
|
|
4
|
+
const contracts_1 = require("../contracts/contracts");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const abstractParser_1 = require("./abstractParser");
|
|
7
|
+
class ConvexBaseRewardPoolAdapterParser extends abstractParser_1.AbstractParser {
|
|
8
|
+
constructor(contract, isContract) {
|
|
9
|
+
super(contract);
|
|
10
|
+
this.ifc = types_1.IConvexV1BaseRewardPoolAdapter__factory.createInterface();
|
|
27
11
|
if (!isContract)
|
|
28
|
-
|
|
29
|
-
return _this;
|
|
12
|
+
this.adapterName = "ConvexV1BaseRewardPoolAdapter";
|
|
30
13
|
}
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
parse(calldata) {
|
|
15
|
+
const { functionFragment, functionName } = this.parseSelector(calldata);
|
|
33
16
|
switch (functionFragment.name) {
|
|
34
17
|
case "stake":
|
|
35
18
|
case "stakeAll": {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return
|
|
19
|
+
const [amount] = this.decodeFunctionData(functionFragment, calldata);
|
|
20
|
+
const amountStr = amount ? `amount: ${this.formatAmount(amount)}` : "";
|
|
21
|
+
return `${functionName}(${amountStr})`;
|
|
39
22
|
}
|
|
40
23
|
case "withdraw":
|
|
41
24
|
case "withdrawAndUnwrap": {
|
|
42
|
-
|
|
43
|
-
return
|
|
25
|
+
const [amount, claim] = this.decodeFunctionData(functionFragment, calldata);
|
|
26
|
+
return `${functionName}(amount: ${this.formatAmount(amount)}, claim: ${claim})`;
|
|
44
27
|
}
|
|
45
28
|
case "withdrawAll":
|
|
46
29
|
case "withdrawAllAndUnwrap": {
|
|
47
|
-
|
|
48
|
-
return
|
|
30
|
+
const [claim] = this.decodeFunctionData(functionFragment, calldata);
|
|
31
|
+
return `${functionName}(claim: ${claim})`;
|
|
49
32
|
}
|
|
50
33
|
case "rewardRate":
|
|
51
|
-
return
|
|
34
|
+
return `${functionName}()`;
|
|
52
35
|
case "totalSupply":
|
|
53
|
-
return
|
|
36
|
+
return `${functionName}()`;
|
|
54
37
|
default:
|
|
55
|
-
return
|
|
38
|
+
return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
|
|
56
39
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
40
|
+
}
|
|
41
|
+
formatAmount(amount) {
|
|
59
42
|
return this.formatBN(amount, contracts_1.contractParams[this.contract]
|
|
60
43
|
.stakedToken);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
}(abstractParser_1.AbstractParser));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
64
46
|
exports.ConvexBaseRewardPoolAdapterParser = ConvexBaseRewardPoolAdapterParser;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
describe("ConvexV1BaseRewardPoolAdapterParser test",
|
|
8
|
-
it("stake / withdraw functions works well",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
const chai_1 = require("chai");
|
|
4
|
+
const constants_1 = require("../core/constants");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const convexBaseRewardPoolAdapterParser_1 = require("./convexBaseRewardPoolAdapterParser");
|
|
7
|
+
describe("ConvexV1BaseRewardPoolAdapterParser test", () => {
|
|
8
|
+
it("stake / withdraw functions works well", () => {
|
|
9
|
+
let parser = new convexBaseRewardPoolAdapterParser_1.ConvexBaseRewardPoolAdapterParser("CONVEX_FRAX3CRV_POOL", false);
|
|
10
|
+
const ifc = types_1.IConvexV1BaseRewardPoolAdapter__factory.createInterface();
|
|
11
|
+
let parsed = parser.parse(ifc.encodeFunctionData("stake", [(constants_1.WAD * 199n) / 10n]));
|
|
12
12
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].stake(amount: 19.90 [19900000000000000000])", "Incorrect parse stake");
|
|
13
13
|
parsed = parser.parse(ifc.encodeFunctionData("stakeAll"));
|
|
14
14
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].stakeAll()", "Incorrect parse stakeAll");
|
|
15
|
-
parsed = parser.parse(ifc.encodeFunctionData("withdraw", [constants_1.WAD
|
|
15
|
+
parsed = parser.parse(ifc.encodeFunctionData("withdraw", [(constants_1.WAD * 199n) / 1000n, false]));
|
|
16
16
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].withdraw(amount: 0.19 [199000000000000000], claim: false)", "Incorrect parse withdraw");
|
|
17
|
-
parsed = parser.parse(ifc.encodeFunctionData("withdrawAndUnwrap", [constants_1.WAD
|
|
17
|
+
parsed = parser.parse(ifc.encodeFunctionData("withdrawAndUnwrap", [(constants_1.WAD * 2n) / 1000n, true]));
|
|
18
18
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].withdrawAndUnwrap(amount: 0.002 [2000000000000000], claim: true)", "Incorrect parse withdrawAndUnwrap");
|
|
19
19
|
parsed = parser.parse(ifc.encodeFunctionData("withdrawAll", [false]));
|
|
20
20
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].withdrawAll(claim: false)", "Incorrect parse withdrawAll");
|
|
@@ -1,62 +1,44 @@
|
|
|
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.ConvexBoosterAdapterParser = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_this.ifc = types_1.IConvexV1BoosterAdapter__factory.createInterface();
|
|
4
|
+
const convex_1 = require("../tokens/convex");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const abstractParser_1 = require("./abstractParser");
|
|
7
|
+
class ConvexBoosterAdapterParser extends abstractParser_1.AbstractParser {
|
|
8
|
+
constructor(contract, isContract) {
|
|
9
|
+
super(contract);
|
|
10
|
+
this.ifc = types_1.IConvexV1BoosterAdapter__factory.createInterface();
|
|
27
11
|
if (!isContract)
|
|
28
|
-
|
|
29
|
-
return _this;
|
|
12
|
+
this.adapterName = "ConvexV1BoosterAdapter";
|
|
30
13
|
}
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
parse(calldata) {
|
|
15
|
+
const { functionFragment, functionName } = this.parseSelector(calldata);
|
|
33
16
|
switch (functionFragment.name) {
|
|
34
17
|
case "deposit": {
|
|
35
|
-
|
|
36
|
-
return
|
|
18
|
+
const [pid, amount, stake] = this.decodeFunctionData(functionFragment, calldata);
|
|
19
|
+
return `${functionName}(pid: ${this.formatPid(pid)}, amount: ${this.formatAmount(amount, pid)}, stake: ${stake})`;
|
|
37
20
|
}
|
|
38
21
|
case "depositAll": {
|
|
39
|
-
|
|
40
|
-
return
|
|
22
|
+
const [pid, stake] = this.decodeFunctionData(functionFragment, calldata);
|
|
23
|
+
return `${functionName}(pid: ${this.formatPid(pid)}, stake: ${stake})`;
|
|
41
24
|
}
|
|
42
25
|
case "withdraw": {
|
|
43
|
-
|
|
44
|
-
return
|
|
26
|
+
const [pid, amount] = this.decodeFunctionData(functionFragment, calldata);
|
|
27
|
+
return `${functionName}(pid: ${this.formatPid(pid)}, amount: ${this.formatAmount(amount, pid)})`;
|
|
45
28
|
}
|
|
46
29
|
case "withdrawAll": {
|
|
47
|
-
|
|
48
|
-
return
|
|
30
|
+
const [pid] = this.decodeFunctionData(functionFragment, calldata);
|
|
31
|
+
return `${functionName}(pid: ${this.formatPid(pid)})`;
|
|
49
32
|
}
|
|
50
33
|
default:
|
|
51
|
-
return
|
|
34
|
+
return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
|
|
52
35
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
36
|
+
}
|
|
37
|
+
formatAmount(amount, pid) {
|
|
55
38
|
return this.formatBN(amount, convex_1.convexLpTokenByPid[pid]);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}(abstractParser_1.AbstractParser));
|
|
39
|
+
}
|
|
40
|
+
formatPid(pid) {
|
|
41
|
+
return `${pid} [${convex_1.convexPoolByPid[pid]}]`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
62
44
|
exports.ConvexBoosterAdapterParser = ConvexBoosterAdapterParser;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
describe("ConvexV1BaseRewardPoolAdapterParser test",
|
|
8
|
-
it("stake / withdraw functions works well",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
const chai_1 = require("chai");
|
|
4
|
+
const constants_1 = require("../core/constants");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const convexBoosterAdapterParser_1 = require("./convexBoosterAdapterParser");
|
|
7
|
+
describe("ConvexV1BaseRewardPoolAdapterParser test", () => {
|
|
8
|
+
it("stake / withdraw functions works well", () => {
|
|
9
|
+
let parser = new convexBoosterAdapterParser_1.ConvexBoosterAdapterParser("CONVEX_BOOSTER", false);
|
|
10
|
+
const ifc = types_1.IConvexV1BoosterAdapter__factory.createInterface();
|
|
11
|
+
let parsed = parser.parse(ifc.encodeFunctionData("deposit", [9, constants_1.WAD * 19999n, false]));
|
|
12
12
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].deposit(pid: 9 [CONVEX_3CRV_POOL], amount: 19.99K [19999000000000000000000], stake: false)", "Incorrect parse deposit");
|
|
13
13
|
parsed = parser.parse(ifc.encodeFunctionData("depositAll", [32, true]));
|
|
14
14
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].depositAll(pid: 32 [CONVEX_FRAX3CRV_POOL], stake: true)", "Incorrect parse depositAll");
|
|
15
|
-
parsed = parser.parse(ifc.encodeFunctionData("withdraw", [9, constants_1.WAD
|
|
15
|
+
parsed = parser.parse(ifc.encodeFunctionData("withdraw", [9, (constants_1.WAD * 555n) / 10n]));
|
|
16
16
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].withdraw(pid: 9 [CONVEX_3CRV_POOL], amount: 55.50 [55500000000000000000])", "Incorrect parse withdraw");
|
|
17
17
|
parsed = parser.parse(ifc.encodeFunctionData("withdrawAll", [32]));
|
|
18
18
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].withdrawAll(pid: 32 [CONVEX_FRAX3CRV_POOL])", "Incorrect parse withdrawAll");
|