@gearbox-protocol/sdk 1.22.4 → 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 +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 +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/core/transactions.js
CHANGED
|
@@ -1,37 +1,19 @@
|
|
|
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.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimGearRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return JSON.
|
|
31
|
-
|
|
32
|
-
TxSerializer.deserialize = function (data) {
|
|
33
|
-
return JSON.parse(data).map(function (e) {
|
|
34
|
-
var params = JSON.parse(e.content);
|
|
4
|
+
const contracts_1 = require("../contracts/contracts");
|
|
5
|
+
const contractsRegister_1 = require("../contracts/contractsRegister");
|
|
6
|
+
const token_1 = require("../tokens/token");
|
|
7
|
+
const formatter_1 = require("../utils/formatter");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const eventOrTx_1 = require("./eventOrTx");
|
|
10
|
+
class TxSerializer {
|
|
11
|
+
static serialize(items) {
|
|
12
|
+
return JSON.stringify(items.map(i => i.serialize()));
|
|
13
|
+
}
|
|
14
|
+
static deserialize(data) {
|
|
15
|
+
return JSON.parse(data).map(e => {
|
|
16
|
+
const params = JSON.parse(e.content);
|
|
35
17
|
switch (e.type) {
|
|
36
18
|
case "TxAddLiquidity":
|
|
37
19
|
return new TxAddLiquidity(params);
|
|
@@ -64,434 +46,429 @@ var TxSerializer = /** @class */ (function () {
|
|
|
64
46
|
case "TxEnableTokens":
|
|
65
47
|
return new TxEnableTokens(params);
|
|
66
48
|
default:
|
|
67
|
-
throw new Error(
|
|
49
|
+
throw new Error(`Unknown transaction for parsing: ${e.type}`);
|
|
68
50
|
}
|
|
69
51
|
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}());
|
|
52
|
+
}
|
|
53
|
+
}
|
|
73
54
|
exports.TxSerializer = TxSerializer;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
55
|
+
class TxAddLiquidity extends eventOrTx_1.EVMTx {
|
|
56
|
+
amount;
|
|
57
|
+
underlyingToken;
|
|
58
|
+
pool;
|
|
59
|
+
constructor(opts) {
|
|
60
|
+
super({
|
|
78
61
|
block: opts.block,
|
|
79
62
|
txHash: opts.txHash,
|
|
80
63
|
txStatus: opts.txStatus,
|
|
81
64
|
timestamp: opts.timestamp,
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
TxAddLiquidity.prototype.serialize = function () {
|
|
65
|
+
});
|
|
66
|
+
this.amount = opts.amount;
|
|
67
|
+
this.underlyingToken = opts.underlyingToken;
|
|
68
|
+
this.pool = opts.pool;
|
|
69
|
+
}
|
|
70
|
+
toString() {
|
|
71
|
+
const [underlyingSymbol, underlyingDecimals] = (0, token_1.extractTokenData)(this.underlyingToken);
|
|
72
|
+
return `${(0, contractsRegister_1.getContractName)(this.pool)}: Deposit ${(0, formatter_1.formatBN)(this.amount, underlyingDecimals || 18)} ${underlyingSymbol}`;
|
|
73
|
+
}
|
|
74
|
+
serialize() {
|
|
93
75
|
return {
|
|
94
76
|
type: "TxAddLiquidity",
|
|
95
77
|
content: JSON.stringify(this),
|
|
96
78
|
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}(eventOrTx_1.EVMTx));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
100
81
|
exports.TxAddLiquidity = TxAddLiquidity;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
82
|
+
class TxRemoveLiquidity extends eventOrTx_1.EVMTx {
|
|
83
|
+
amount;
|
|
84
|
+
dieselToken;
|
|
85
|
+
pool;
|
|
86
|
+
constructor(opts) {
|
|
87
|
+
super({
|
|
105
88
|
block: opts.block,
|
|
106
89
|
txHash: opts.txHash,
|
|
107
90
|
txStatus: opts.txStatus,
|
|
108
91
|
timestamp: opts.timestamp,
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
TxRemoveLiquidity.prototype.serialize = function () {
|
|
92
|
+
});
|
|
93
|
+
this.amount = opts.amount;
|
|
94
|
+
this.dieselToken = opts.dieselToken;
|
|
95
|
+
this.pool = opts.pool;
|
|
96
|
+
}
|
|
97
|
+
toString() {
|
|
98
|
+
const [dSymbol, dDecimals] = (0, token_1.extractTokenData)(this.dieselToken);
|
|
99
|
+
return `${(0, contractsRegister_1.getContractName)(this.pool)}: Withdraw ${(0, formatter_1.formatBN)(this.amount, dDecimals || 18)} ${dSymbol}`;
|
|
100
|
+
}
|
|
101
|
+
serialize() {
|
|
120
102
|
return {
|
|
121
103
|
type: "TxRemoveLiquidity",
|
|
122
104
|
content: JSON.stringify(this),
|
|
123
105
|
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
}(eventOrTx_1.EVMTx));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
127
108
|
exports.TxRemoveLiquidity = TxRemoveLiquidity;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
109
|
+
class TXSwap extends eventOrTx_1.EVMTx {
|
|
110
|
+
protocol;
|
|
111
|
+
operation;
|
|
112
|
+
amountFrom;
|
|
113
|
+
amountTo;
|
|
114
|
+
tokenFrom;
|
|
115
|
+
tokenTo;
|
|
116
|
+
creditManager;
|
|
117
|
+
constructor(opts) {
|
|
118
|
+
super({
|
|
132
119
|
block: opts.block,
|
|
133
120
|
txHash: opts.txHash,
|
|
134
121
|
txStatus: opts.txStatus,
|
|
135
122
|
timestamp: opts.timestamp,
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
var toPart = "";
|
|
123
|
+
});
|
|
124
|
+
this.protocol = opts.protocol;
|
|
125
|
+
this.operation = opts.operation;
|
|
126
|
+
this.amountFrom = opts.amountFrom;
|
|
127
|
+
this.amountTo = opts.amountTo;
|
|
128
|
+
this.tokenFrom = opts.tokenFrom;
|
|
129
|
+
this.tokenTo = opts.tokenTo;
|
|
130
|
+
this.creditManager = opts.creditManager;
|
|
131
|
+
}
|
|
132
|
+
toString() {
|
|
133
|
+
let toPart = "";
|
|
148
134
|
if (this.tokenTo && this.amountTo) {
|
|
149
|
-
|
|
150
|
-
toPart =
|
|
135
|
+
const [toSymbol, toDecimals] = (0, token_1.extractTokenData)(this.tokenTo);
|
|
136
|
+
toPart = ` ⇒ ${(0, formatter_1.formatBN)(this.amountTo, toDecimals || 18)} ${toSymbol}`;
|
|
151
137
|
}
|
|
152
|
-
|
|
153
|
-
return
|
|
154
|
-
}
|
|
155
|
-
|
|
138
|
+
const [fromSymbol, fromDecimals] = (0, token_1.extractTokenData)(this.tokenFrom);
|
|
139
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: ${this.operation} ${(0, formatter_1.formatBN)(this.amountFrom, fromDecimals || 18)} ${fromSymbol} ${toPart} on ${(0, contractsRegister_1.getContractName)(this.protocol)}`;
|
|
140
|
+
}
|
|
141
|
+
serialize() {
|
|
156
142
|
return {
|
|
157
143
|
type: "TxSwap",
|
|
158
144
|
content: JSON.stringify(this),
|
|
159
145
|
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
}(eventOrTx_1.EVMTx));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
163
148
|
exports.TXSwap = TXSwap;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
149
|
+
class TxAddCollateral extends eventOrTx_1.EVMTx {
|
|
150
|
+
amount;
|
|
151
|
+
addedToken;
|
|
152
|
+
creditManager;
|
|
153
|
+
constructor(opts) {
|
|
154
|
+
super({
|
|
168
155
|
block: opts.block,
|
|
169
156
|
txHash: opts.txHash,
|
|
170
157
|
txStatus: opts.txStatus,
|
|
171
158
|
timestamp: opts.timestamp,
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
TxAddCollateral.prototype.serialize = function () {
|
|
159
|
+
});
|
|
160
|
+
this.amount = opts.amount;
|
|
161
|
+
this.addedToken = opts.addedToken;
|
|
162
|
+
this.creditManager = opts.creditManager;
|
|
163
|
+
}
|
|
164
|
+
toString() {
|
|
165
|
+
const [addedSymbol, addedDecimals] = (0, token_1.extractTokenData)(this.addedToken);
|
|
166
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Added ${(0, formatter_1.formatBN)(this.amount, addedDecimals || 18)} ${addedSymbol} as collateral`;
|
|
167
|
+
}
|
|
168
|
+
serialize() {
|
|
183
169
|
return {
|
|
184
170
|
type: "TxAddCollateral",
|
|
185
171
|
content: JSON.stringify(this),
|
|
186
172
|
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
}(eventOrTx_1.EVMTx));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
190
175
|
exports.TxAddCollateral = TxAddCollateral;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
176
|
+
class TxIncreaseBorrowAmount extends eventOrTx_1.EVMTx {
|
|
177
|
+
amount;
|
|
178
|
+
underlyingToken;
|
|
179
|
+
creditManager;
|
|
180
|
+
constructor(opts) {
|
|
181
|
+
super({
|
|
195
182
|
block: opts.block,
|
|
196
183
|
txHash: opts.txHash,
|
|
197
184
|
txStatus: opts.txStatus,
|
|
198
185
|
timestamp: opts.timestamp,
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
TxIncreaseBorrowAmount.prototype.serialize = function () {
|
|
186
|
+
});
|
|
187
|
+
this.amount = opts.amount;
|
|
188
|
+
this.underlyingToken = opts.underlyingToken;
|
|
189
|
+
this.creditManager = opts.creditManager;
|
|
190
|
+
}
|
|
191
|
+
toString() {
|
|
192
|
+
const [tokenSymbol, tokenDecimals] = (0, token_1.extractTokenData)(this.underlyingToken);
|
|
193
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Borrowed amount was increased for ${(0, formatter_1.formatBN)(this.amount, tokenDecimals || 18)} ${tokenSymbol}`;
|
|
194
|
+
}
|
|
195
|
+
serialize() {
|
|
210
196
|
return {
|
|
211
197
|
type: "TxIncreaseBorrowAmount",
|
|
212
198
|
content: JSON.stringify(this),
|
|
213
199
|
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
}(eventOrTx_1.EVMTx));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
217
202
|
exports.TxIncreaseBorrowAmount = TxIncreaseBorrowAmount;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
203
|
+
class TxDecreaseBorrowAmount extends eventOrTx_1.EVMTx {
|
|
204
|
+
amount;
|
|
205
|
+
underlyingToken;
|
|
206
|
+
creditManager;
|
|
207
|
+
constructor(opts) {
|
|
208
|
+
super({
|
|
222
209
|
block: opts.block,
|
|
223
210
|
txHash: opts.txHash,
|
|
224
211
|
txStatus: opts.txStatus,
|
|
225
212
|
timestamp: opts.timestamp,
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
TxDecreaseBorrowAmount.prototype.serialize = function () {
|
|
213
|
+
});
|
|
214
|
+
this.amount = opts.amount;
|
|
215
|
+
this.underlyingToken = opts.underlyingToken;
|
|
216
|
+
this.creditManager = opts.creditManager;
|
|
217
|
+
}
|
|
218
|
+
toString() {
|
|
219
|
+
const [tokenSymbol, tokenDecimals] = (0, token_1.extractTokenData)(this.underlyingToken);
|
|
220
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Borrowed amount was decreased for ${(0, formatter_1.formatBN)(this.amount, tokenDecimals || 18)} ${tokenSymbol}`;
|
|
221
|
+
}
|
|
222
|
+
serialize() {
|
|
237
223
|
return {
|
|
238
224
|
type: "TxIncreaseBorrowAmount",
|
|
239
225
|
content: JSON.stringify(this),
|
|
240
226
|
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
}(eventOrTx_1.EVMTx));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
244
229
|
exports.TxDecreaseBorrowAmount = TxDecreaseBorrowAmount;
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
230
|
+
class TxOpenAccount extends eventOrTx_1.EVMTx {
|
|
231
|
+
amount;
|
|
232
|
+
underlyingToken;
|
|
233
|
+
leverage;
|
|
234
|
+
creditManager;
|
|
235
|
+
constructor(opts) {
|
|
236
|
+
super({
|
|
249
237
|
block: opts.block,
|
|
250
238
|
txHash: opts.txHash,
|
|
251
239
|
txStatus: opts.txStatus,
|
|
252
240
|
timestamp: opts.timestamp,
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
|
|
241
|
+
});
|
|
242
|
+
this.amount = opts.amount;
|
|
243
|
+
this.underlyingToken = opts.underlyingToken;
|
|
244
|
+
this.leverage = opts.leverage;
|
|
245
|
+
this.creditManager = opts.creditManager;
|
|
246
|
+
}
|
|
247
|
+
toString() {
|
|
248
|
+
const [tokenSymbol, tokenDecimals] = (0, token_1.extractTokenData)(this.underlyingToken);
|
|
249
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: opening ${(0, formatter_1.formatBN)(this.amount, tokenDecimals || 18)} ${tokenSymbol} x ${this.leverage.toFixed(2)} ⇒
|
|
250
|
+
${(0, formatter_1.formatBN)((this.amount *
|
|
251
|
+
BigInt(Math.floor(this.leverage * Number(constants_1.LEVERAGE_DECIMALS)))) /
|
|
252
|
+
constants_1.LEVERAGE_DECIMALS, tokenDecimals || 18)} ${tokenSymbol}`;
|
|
253
|
+
}
|
|
254
|
+
serialize() {
|
|
267
255
|
return {
|
|
268
256
|
type: "TxOpenAccount",
|
|
269
257
|
content: JSON.stringify(this),
|
|
270
258
|
};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
}(eventOrTx_1.EVMTx));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
274
261
|
exports.TxOpenAccount = TxOpenAccount;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
262
|
+
class TxOpenMultitokenAccount extends eventOrTx_1.EVMTx {
|
|
263
|
+
borrowedAmount;
|
|
264
|
+
creditManager;
|
|
265
|
+
underlyingToken;
|
|
266
|
+
assets;
|
|
267
|
+
constructor(opts) {
|
|
268
|
+
super({
|
|
279
269
|
block: opts.block,
|
|
280
270
|
txHash: opts.txHash,
|
|
281
271
|
txStatus: opts.txStatus,
|
|
282
272
|
timestamp: opts.timestamp,
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
var tokenSymbol = (0, token_1.extractTokenData)(assetAddress)[0];
|
|
273
|
+
});
|
|
274
|
+
this.borrowedAmount = opts.borrowedAmount;
|
|
275
|
+
this.underlyingToken = opts.underlyingToken;
|
|
276
|
+
this.creditManager = opts.creditManager;
|
|
277
|
+
this.assets = opts.assets;
|
|
278
|
+
}
|
|
279
|
+
toString() {
|
|
280
|
+
const assetSymbols = this.assets.reduce((acc, assetAddress) => {
|
|
281
|
+
const [tokenSymbol] = (0, token_1.extractTokenData)(assetAddress);
|
|
293
282
|
if (tokenSymbol)
|
|
294
283
|
acc.push(tokenSymbol);
|
|
295
284
|
return acc;
|
|
296
285
|
}, []);
|
|
297
|
-
|
|
298
|
-
return
|
|
299
|
-
}
|
|
300
|
-
|
|
286
|
+
const [symbol, underlyingDecimals] = (0, token_1.extractTokenData)(this.underlyingToken);
|
|
287
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: opening. Borrowed amount: ${(0, formatter_1.formatBN)(this.borrowedAmount, underlyingDecimals || 18)} ${symbol}; assets: ${assetSymbols.join(", ")}`;
|
|
288
|
+
}
|
|
289
|
+
serialize() {
|
|
301
290
|
return {
|
|
302
291
|
type: "TxOpenMultitokenAccount",
|
|
303
292
|
content: JSON.stringify(this),
|
|
304
293
|
};
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
}(eventOrTx_1.EVMTx));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
308
296
|
exports.TxOpenMultitokenAccount = TxOpenMultitokenAccount;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
297
|
+
class TxClaimReward extends eventOrTx_1.EVMTx {
|
|
298
|
+
contracts;
|
|
299
|
+
constructor(opts) {
|
|
300
|
+
super({
|
|
313
301
|
block: opts.block,
|
|
314
302
|
txHash: opts.txHash,
|
|
315
303
|
txStatus: opts.txStatus,
|
|
316
304
|
timestamp: opts.timestamp,
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
return _this;
|
|
305
|
+
});
|
|
306
|
+
this.contracts = opts.contracts;
|
|
320
307
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
308
|
+
toString() {
|
|
309
|
+
const contractNames = this.contracts.map(contract => {
|
|
310
|
+
const contractInfo = contracts_1.contractParams[contract];
|
|
324
311
|
return contractInfo.name;
|
|
325
312
|
});
|
|
326
|
-
return
|
|
327
|
-
}
|
|
328
|
-
|
|
313
|
+
return `Pools reward claimed: ${contractNames.join(", ")}`;
|
|
314
|
+
}
|
|
315
|
+
serialize() {
|
|
329
316
|
return {
|
|
330
317
|
type: "TxClaimReward",
|
|
331
318
|
content: JSON.stringify(this),
|
|
332
319
|
};
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
}(eventOrTx_1.EVMTx));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
336
322
|
exports.TxClaimReward = TxClaimReward;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
return _super.call(this, {
|
|
323
|
+
class TxClaimNFT extends eventOrTx_1.EVMTx {
|
|
324
|
+
constructor(opts) {
|
|
325
|
+
super({
|
|
341
326
|
block: opts.block,
|
|
342
327
|
txHash: opts.txHash,
|
|
343
328
|
txStatus: opts.txStatus,
|
|
344
329
|
timestamp: opts.timestamp,
|
|
345
|
-
})
|
|
330
|
+
});
|
|
346
331
|
}
|
|
347
|
-
|
|
348
|
-
return
|
|
349
|
-
}
|
|
350
|
-
|
|
332
|
+
toString() {
|
|
333
|
+
return `NFT claimed`;
|
|
334
|
+
}
|
|
335
|
+
serialize() {
|
|
351
336
|
return {
|
|
352
337
|
type: "TxClaimNFT",
|
|
353
338
|
content: JSON.stringify(this),
|
|
354
339
|
};
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
}(eventOrTx_1.EVMTx));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
358
342
|
exports.TxClaimNFT = TxClaimNFT;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
343
|
+
class TxClaimGearRewards extends eventOrTx_1.EVMTx {
|
|
344
|
+
token;
|
|
345
|
+
amount;
|
|
346
|
+
constructor(opts) {
|
|
347
|
+
super({
|
|
363
348
|
block: opts.block,
|
|
364
349
|
txHash: opts.txHash,
|
|
365
350
|
txStatus: opts.txStatus,
|
|
366
351
|
timestamp: opts.timestamp,
|
|
367
|
-
})
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
TxClaimGearRewards.prototype.serialize = function () {
|
|
352
|
+
});
|
|
353
|
+
this.amount = opts.amount;
|
|
354
|
+
this.token = opts.token;
|
|
355
|
+
}
|
|
356
|
+
toString() {
|
|
357
|
+
const [symbol, decimals] = (0, token_1.extractTokenData)(this.token);
|
|
358
|
+
return `GEAR Rewards claimed: ${(0, formatter_1.formatBN)(this.amount, decimals || 18)} ${symbol} `;
|
|
359
|
+
}
|
|
360
|
+
serialize() {
|
|
377
361
|
return {
|
|
378
362
|
type: "TxClaimGearRewards",
|
|
379
363
|
content: JSON.stringify(this),
|
|
380
364
|
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
}(eventOrTx_1.EVMTx));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
384
367
|
exports.TxClaimGearRewards = TxClaimGearRewards;
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
368
|
+
class TxRepayAccount extends eventOrTx_1.EVMTx {
|
|
369
|
+
creditManager;
|
|
370
|
+
constructor(opts) {
|
|
371
|
+
super({
|
|
389
372
|
block: opts.block,
|
|
390
373
|
txHash: opts.txHash,
|
|
391
374
|
txStatus: opts.txStatus,
|
|
392
375
|
timestamp: opts.timestamp,
|
|
393
|
-
})
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
TxRepayAccount.prototype.serialize = function () {
|
|
376
|
+
});
|
|
377
|
+
this.creditManager = opts.creditManager;
|
|
378
|
+
}
|
|
379
|
+
toString() {
|
|
380
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Repaying account`;
|
|
381
|
+
}
|
|
382
|
+
serialize() {
|
|
401
383
|
return {
|
|
402
384
|
type: "TxRepayAccount",
|
|
403
385
|
content: JSON.stringify(this),
|
|
404
386
|
};
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
}(eventOrTx_1.EVMTx));
|
|
387
|
+
}
|
|
388
|
+
}
|
|
408
389
|
exports.TxRepayAccount = TxRepayAccount;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
390
|
+
class TxCloseAccount extends eventOrTx_1.EVMTx {
|
|
391
|
+
creditManager;
|
|
392
|
+
constructor(opts) {
|
|
393
|
+
super({
|
|
413
394
|
block: opts.block,
|
|
414
395
|
txHash: opts.txHash,
|
|
415
396
|
txStatus: opts.txStatus,
|
|
416
397
|
timestamp: opts.timestamp,
|
|
417
|
-
})
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
TxCloseAccount.prototype.serialize = function () {
|
|
398
|
+
});
|
|
399
|
+
this.creditManager = opts.creditManager;
|
|
400
|
+
}
|
|
401
|
+
toString() {
|
|
402
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Closing account`;
|
|
403
|
+
}
|
|
404
|
+
serialize() {
|
|
425
405
|
return {
|
|
426
406
|
type: "TxCloseAccount",
|
|
427
407
|
content: JSON.stringify(this),
|
|
428
408
|
};
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
}(eventOrTx_1.EVMTx));
|
|
409
|
+
}
|
|
410
|
+
}
|
|
432
411
|
exports.TxCloseAccount = TxCloseAccount;
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
412
|
+
class TxApprove extends eventOrTx_1.EVMTx {
|
|
413
|
+
token;
|
|
414
|
+
constructor(opts) {
|
|
415
|
+
super({
|
|
437
416
|
block: opts.block,
|
|
438
417
|
txHash: opts.txHash,
|
|
439
418
|
txStatus: opts.txStatus,
|
|
440
419
|
timestamp: opts.timestamp,
|
|
441
|
-
})
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
TxApprove.prototype.serialize = function () {
|
|
420
|
+
});
|
|
421
|
+
this.token = opts.token;
|
|
422
|
+
}
|
|
423
|
+
toString() {
|
|
424
|
+
const [symbol] = (0, token_1.extractTokenData)(this.token);
|
|
425
|
+
return `Approve ${symbol}`;
|
|
426
|
+
}
|
|
427
|
+
serialize() {
|
|
450
428
|
return {
|
|
451
429
|
type: "TxApprove",
|
|
452
430
|
content: JSON.stringify(this),
|
|
453
431
|
};
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
}(eventOrTx_1.EVMTx));
|
|
432
|
+
}
|
|
433
|
+
}
|
|
457
434
|
exports.TxApprove = TxApprove;
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
435
|
+
class TxEnableTokens extends eventOrTx_1.EVMTx {
|
|
436
|
+
enabledTokens;
|
|
437
|
+
disabledTokens;
|
|
438
|
+
creditManager;
|
|
439
|
+
constructor(opts) {
|
|
440
|
+
super({
|
|
462
441
|
block: opts.block,
|
|
463
442
|
txHash: opts.txHash,
|
|
464
443
|
txStatus: opts.txStatus,
|
|
465
444
|
timestamp: opts.timestamp,
|
|
466
|
-
})
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
var tokenSymbol = (0, token_1.extractTokenData)(address)[0];
|
|
445
|
+
});
|
|
446
|
+
this.enabledTokens = opts.enabledTokens;
|
|
447
|
+
this.disabledTokens = opts.disabledTokens;
|
|
448
|
+
this.creditManager = opts.creditManager;
|
|
449
|
+
}
|
|
450
|
+
toString() {
|
|
451
|
+
const enabledSymbols = this.enabledTokens.map(address => {
|
|
452
|
+
const [tokenSymbol] = (0, token_1.extractTokenData)(address);
|
|
475
453
|
return tokenSymbol;
|
|
476
454
|
});
|
|
477
|
-
|
|
478
|
-
|
|
455
|
+
const disabledSymbols = this.disabledTokens.map(address => {
|
|
456
|
+
const [tokenSymbol] = (0, token_1.extractTokenData)(address);
|
|
479
457
|
return tokenSymbol;
|
|
480
458
|
});
|
|
481
|
-
|
|
482
|
-
enabledSymbols.length > 0 ?
|
|
459
|
+
const currentSentences = [
|
|
460
|
+
enabledSymbols.length > 0 ? `enabled: ${enabledSymbols.join(", ")}` : "",
|
|
483
461
|
disabledSymbols.length > 0
|
|
484
|
-
?
|
|
462
|
+
? `disabled: ${disabledSymbols.join(", ")}`
|
|
485
463
|
: "",
|
|
486
|
-
].filter(
|
|
487
|
-
return
|
|
488
|
-
}
|
|
489
|
-
|
|
464
|
+
].filter(s => !!s);
|
|
465
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: ${currentSentences.join("; ")}`;
|
|
466
|
+
}
|
|
467
|
+
serialize() {
|
|
490
468
|
return {
|
|
491
469
|
type: "TxEnableTokens",
|
|
492
470
|
content: JSON.stringify(this),
|
|
493
471
|
};
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
}(eventOrTx_1.EVMTx));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
497
474
|
exports.TxEnableTokens = TxEnableTokens;
|