@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/strategies/yearn.js
CHANGED
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.YearnV2Strategies = exports.YearnV2Multicaller = exports.YearnV2Calls = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
YearnV2Calls.deposit = function (amount, recipient) {
|
|
24
|
-
var contractInterface = types_1.IYVault__factory.createInterface();
|
|
4
|
+
const contracts_1 = require("../contracts/contracts");
|
|
5
|
+
const constants_1 = require("../core/constants");
|
|
6
|
+
const token_1 = require("../tokens/token");
|
|
7
|
+
const tokenType_1 = require("../tokens/tokenType");
|
|
8
|
+
const types_1 = require("../types");
|
|
9
|
+
const curve_1 = require("./curve");
|
|
10
|
+
const uniswapV2_1 = require("./uniswapV2");
|
|
11
|
+
class YearnV2Calls {
|
|
12
|
+
static deposit(amount, recipient) {
|
|
13
|
+
const contractInterface = types_1.IYVault__factory.createInterface();
|
|
25
14
|
if (amount && recipient) {
|
|
26
15
|
return contractInterface.encodeFunctionData("deposit(uint256,address)", [
|
|
27
16
|
amount,
|
|
@@ -32,9 +21,9 @@ var YearnV2Calls = /** @class */ (function () {
|
|
|
32
21
|
return contractInterface.encodeFunctionData("deposit(uint256)", [amount]);
|
|
33
22
|
}
|
|
34
23
|
return contractInterface.encodeFunctionData("deposit()");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
}
|
|
25
|
+
static withdraw(maxShares, recipient, maxLoss) {
|
|
26
|
+
const contractInterface = types_1.IYVault__factory.createInterface();
|
|
38
27
|
if (maxShares && recipient && maxLoss) {
|
|
39
28
|
return contractInterface.encodeFunctionData("withdraw(uint256,address,uint256)", [maxShares, recipient, maxLoss]);
|
|
40
29
|
}
|
|
@@ -50,40 +39,37 @@ var YearnV2Calls = /** @class */ (function () {
|
|
|
50
39
|
]);
|
|
51
40
|
}
|
|
52
41
|
return contractInterface.encodeFunctionData("withdraw()");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
56
44
|
exports.YearnV2Calls = YearnV2Calls;
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
class YearnV2Multicaller {
|
|
46
|
+
_address;
|
|
47
|
+
constructor(address) {
|
|
59
48
|
this._address = address;
|
|
60
49
|
}
|
|
61
|
-
|
|
50
|
+
static connect(address) {
|
|
62
51
|
return new YearnV2Multicaller(address);
|
|
63
|
-
}
|
|
64
|
-
|
|
52
|
+
}
|
|
53
|
+
deposit(amount, recipient) {
|
|
65
54
|
return {
|
|
66
55
|
target: this._address,
|
|
67
56
|
callData: YearnV2Calls.deposit(amount, recipient),
|
|
68
57
|
};
|
|
69
|
-
}
|
|
70
|
-
|
|
58
|
+
}
|
|
59
|
+
withdraw(maxShares, recipient, maxLoss) {
|
|
71
60
|
return {
|
|
72
61
|
target: this._address,
|
|
73
62
|
callData: YearnV2Calls.withdraw(maxShares, recipient, maxLoss),
|
|
74
63
|
};
|
|
75
|
-
};
|
|
76
|
-
return YearnV2Multicaller;
|
|
77
|
-
}());
|
|
78
|
-
exports.YearnV2Multicaller = YearnV2Multicaller;
|
|
79
|
-
var YearnV2Strategies = /** @class */ (function () {
|
|
80
|
-
function YearnV2Strategies() {
|
|
81
64
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
}
|
|
66
|
+
exports.YearnV2Multicaller = YearnV2Multicaller;
|
|
67
|
+
class YearnV2Strategies {
|
|
68
|
+
static underlyingToYearn(data, network, yearnVault, underlyingAmount) {
|
|
69
|
+
let calls = [];
|
|
70
|
+
const vaultParams = contracts_1.contractParams[yearnVault];
|
|
71
|
+
const yearnToken = vaultParams.shareToken;
|
|
72
|
+
const yearnParams = token_1.supportedTokens[yearnToken];
|
|
87
73
|
if (yearnParams.type === tokenType_1.TokenType.YEARN_ON_NORMAL_TOKEN) {
|
|
88
74
|
if (data.underlyingToken.toLowerCase() !==
|
|
89
75
|
token_1.tokenDataByNetwork[network][yearnParams.underlying].toLowerCase()) {
|
|
@@ -99,8 +85,8 @@ var YearnV2Strategies = /** @class */ (function () {
|
|
|
99
85
|
}
|
|
100
86
|
}
|
|
101
87
|
else if (yearnParams.type === tokenType_1.TokenType.YEARN_ON_CURVE_TOKEN) {
|
|
102
|
-
|
|
103
|
-
|
|
88
|
+
const curveTokenParams = token_1.supportedTokens[yearnParams.underlying];
|
|
89
|
+
const curvePool = curveTokenParams.pool;
|
|
104
90
|
calls = curve_1.CurveStrategies.underlyingToCurveLP(data, network, curvePool, underlyingAmount);
|
|
105
91
|
}
|
|
106
92
|
else {
|
|
@@ -108,12 +94,12 @@ var YearnV2Strategies = /** @class */ (function () {
|
|
|
108
94
|
}
|
|
109
95
|
calls.push(YearnV2Multicaller.connect(data.adapters[contracts_1.contractsByNetwork[network][yearnVault].toLowerCase()]).deposit());
|
|
110
96
|
return calls;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
97
|
+
}
|
|
98
|
+
static yearnToUnderlying(data, network, yearnVault, yearnSharesAmount) {
|
|
99
|
+
let calls = [];
|
|
100
|
+
const vaultParams = contracts_1.contractParams[yearnVault];
|
|
101
|
+
const yearnToken = vaultParams.shareToken;
|
|
102
|
+
const yearnParams = token_1.supportedTokens[yearnToken];
|
|
117
103
|
calls.push(YearnV2Multicaller.connect(data.adapters[contracts_1.contractsByNetwork[network][yearnVault].toLowerCase()]).withdraw(yearnSharesAmount));
|
|
118
104
|
if (yearnParams.type === tokenType_1.TokenType.YEARN_ON_NORMAL_TOKEN) {
|
|
119
105
|
if (data.underlyingToken.toLowerCase() !==
|
|
@@ -126,15 +112,17 @@ var YearnV2Strategies = /** @class */ (function () {
|
|
|
126
112
|
}
|
|
127
113
|
}
|
|
128
114
|
else if (yearnParams.type === tokenType_1.TokenType.YEARN_ON_CURVE_TOKEN) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
calls =
|
|
115
|
+
const curveTokenParams = token_1.supportedTokens[yearnParams.underlying];
|
|
116
|
+
const curvePool = curveTokenParams.pool;
|
|
117
|
+
calls = [
|
|
118
|
+
...calls,
|
|
119
|
+
...curve_1.CurveStrategies.allCurveLPToUnderlying(data, network, curvePool),
|
|
120
|
+
];
|
|
132
121
|
}
|
|
133
122
|
else {
|
|
134
123
|
throw new Error("Yearn vault type unknown");
|
|
135
124
|
}
|
|
136
125
|
return calls;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
}());
|
|
126
|
+
}
|
|
127
|
+
}
|
|
140
128
|
exports.YearnV2Strategies = YearnV2Strategies;
|
package/lib/tokens/balancer.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isBalancerLPToken = exports.balancerLpTokens = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const tradeTypes_1 = require("../pathfinder/tradeTypes");
|
|
5
|
+
const tokenType_1 = require("./tokenType");
|
|
6
6
|
exports.balancerLpTokens = {
|
|
7
7
|
"50OHM_50DAI": {
|
|
8
8
|
name: "Balancer 50OHM_50DAI",
|
|
@@ -47,7 +47,5 @@ exports.balancerLpTokens = {
|
|
|
47
47
|
],
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
return typeof t === "string" && !!exports.balancerLpTokens[t];
|
|
52
|
-
};
|
|
50
|
+
const isBalancerLPToken = (t) => typeof t === "string" && !!exports.balancerLpTokens[t];
|
|
53
51
|
exports.isBalancerLPToken = isBalancerLPToken;
|
package/lib/tokens/convex.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.convexLpTokenByPid = exports.convexPoolByPid = exports.isConvexStakedPhantomToken = exports.isConvexLPToken = exports.isConvexToken = exports.convexTokens = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const tradeTypes_1 = require("../pathfinder/tradeTypes");
|
|
5
|
+
const tokenType_1 = require("./tokenType");
|
|
6
|
+
const convexLpTokens = {
|
|
18
7
|
cvx3Crv: {
|
|
19
8
|
name: "Convex cvx3Crv",
|
|
20
9
|
symbol: "cvx3Crv",
|
|
@@ -289,7 +278,7 @@ var convexLpTokens = {
|
|
|
289
278
|
],
|
|
290
279
|
},
|
|
291
280
|
};
|
|
292
|
-
|
|
281
|
+
const convexStakedPhantomTokens = {
|
|
293
282
|
stkcvx3Crv: {
|
|
294
283
|
name: "Convex stkcvx3Crv",
|
|
295
284
|
symbol: "stkcvx3Crv",
|
|
@@ -564,27 +553,23 @@ var convexStakedPhantomTokens = {
|
|
|
564
553
|
],
|
|
565
554
|
},
|
|
566
555
|
};
|
|
567
|
-
exports.convexTokens =
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
!!exports.convexTokens[t];
|
|
556
|
+
exports.convexTokens = {
|
|
557
|
+
...convexLpTokens,
|
|
558
|
+
...convexStakedPhantomTokens,
|
|
571
559
|
};
|
|
560
|
+
const isConvexToken = (t) => typeof t === "string" &&
|
|
561
|
+
!!exports.convexTokens[t];
|
|
572
562
|
exports.isConvexToken = isConvexToken;
|
|
573
|
-
|
|
574
|
-
return typeof t === "string" && !!convexLpTokens[t];
|
|
575
|
-
};
|
|
563
|
+
const isConvexLPToken = (t) => typeof t === "string" && !!convexLpTokens[t];
|
|
576
564
|
exports.isConvexLPToken = isConvexLPToken;
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
!!convexStakedPhantomTokens[t];
|
|
580
|
-
};
|
|
565
|
+
const isConvexStakedPhantomToken = (t) => typeof t === "string" &&
|
|
566
|
+
!!convexStakedPhantomTokens[t];
|
|
581
567
|
exports.isConvexStakedPhantomToken = isConvexStakedPhantomToken;
|
|
582
|
-
exports.convexPoolByPid = Object.values(convexLpTokens).reduce(
|
|
568
|
+
exports.convexPoolByPid = Object.values(convexLpTokens).reduce((acc, value) => {
|
|
583
569
|
acc[value.pid] = value.pool;
|
|
584
570
|
return acc;
|
|
585
571
|
}, {});
|
|
586
|
-
exports.convexLpTokenByPid = Object.entries(convexLpTokens).reduce(
|
|
587
|
-
var token = _a[0], data = _a[1];
|
|
572
|
+
exports.convexLpTokenByPid = Object.entries(convexLpTokens).reduce((acc, [token, data]) => {
|
|
588
573
|
acc[data.pid] = token;
|
|
589
574
|
return acc;
|
|
590
575
|
}, {});
|
package/lib/tokens/curveLP.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.isCurveMetaToken = exports.isCurveLPToken = exports.curveTokens = exports.curveMetaTokens = exports.Curve3CrvUnderlyingTokenIndex = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const tradeTypes_1 = require("../pathfinder/tradeTypes");
|
|
6
|
+
const tokenType_1 = require("./tokenType");
|
|
18
7
|
exports.Curve3CrvUnderlyingTokenIndex = {
|
|
19
8
|
DAI: ethers_1.BigNumber.from(0),
|
|
20
9
|
USDC: ethers_1.BigNumber.from(1),
|
|
@@ -128,7 +117,7 @@ exports.curveMetaTokens = {
|
|
|
128
117
|
],
|
|
129
118
|
},
|
|
130
119
|
};
|
|
131
|
-
exports.curveTokens =
|
|
120
|
+
exports.curveTokens = {
|
|
132
121
|
// CURVE LP TOKENS
|
|
133
122
|
"3Crv": {
|
|
134
123
|
name: "Curve 3Crv",
|
|
@@ -152,7 +141,8 @@ exports.curveTokens = __assign({
|
|
|
152
141
|
tokenOut: "stkcvx3Crv",
|
|
153
142
|
},
|
|
154
143
|
],
|
|
155
|
-
},
|
|
144
|
+
},
|
|
145
|
+
crvFRAX: {
|
|
156
146
|
name: "Curve.fi FRAX/USDC",
|
|
157
147
|
symbol: "crvFRAX",
|
|
158
148
|
type: tokenType_1.TokenType.CURVE_LP_TOKEN,
|
|
@@ -174,7 +164,8 @@ exports.curveTokens = __assign({
|
|
|
174
164
|
tokenOut: "stkcvxcrvFRAX",
|
|
175
165
|
},
|
|
176
166
|
],
|
|
177
|
-
},
|
|
167
|
+
},
|
|
168
|
+
steCRV: {
|
|
178
169
|
name: "Curve steCRV",
|
|
179
170
|
symbol: "steCRV",
|
|
180
171
|
type: tokenType_1.TokenType.CURVE_LP_TOKEN,
|
|
@@ -196,7 +187,8 @@ exports.curveTokens = __assign({
|
|
|
196
187
|
tokenOut: "stkcvxsteCRV",
|
|
197
188
|
},
|
|
198
189
|
],
|
|
199
|
-
},
|
|
190
|
+
},
|
|
191
|
+
crvPlain3andSUSD: {
|
|
200
192
|
name: "Curve crvPlain3andSUSD",
|
|
201
193
|
symbol: "crvPlain3andSUSD",
|
|
202
194
|
type: tokenType_1.TokenType.CURVE_LP_TOKEN,
|
|
@@ -219,7 +211,8 @@ exports.curveTokens = __assign({
|
|
|
219
211
|
tokenOut: "stkcvxcrvPlain3andSUSD",
|
|
220
212
|
},
|
|
221
213
|
],
|
|
222
|
-
},
|
|
214
|
+
},
|
|
215
|
+
crvCRVETH: {
|
|
223
216
|
name: "Curve CRV-ETH",
|
|
224
217
|
symbol: "crvCRVETH",
|
|
225
218
|
type: tokenType_1.TokenType.CURVE_LP_TOKEN,
|
|
@@ -241,7 +234,8 @@ exports.curveTokens = __assign({
|
|
|
241
234
|
tokenOut: "stkcvxcrvCRVETH",
|
|
242
235
|
},
|
|
243
236
|
],
|
|
244
|
-
},
|
|
237
|
+
},
|
|
238
|
+
crvCVXETH: {
|
|
245
239
|
name: "Curve CVX-ETH",
|
|
246
240
|
symbol: "crvCVXETH",
|
|
247
241
|
type: tokenType_1.TokenType.CURVE_LP_TOKEN,
|
|
@@ -263,7 +257,8 @@ exports.curveTokens = __assign({
|
|
|
263
257
|
tokenOut: "stkcvxcrvCVXETH",
|
|
264
258
|
},
|
|
265
259
|
],
|
|
266
|
-
},
|
|
260
|
+
},
|
|
261
|
+
crvUSDTWBTCWETH: {
|
|
267
262
|
name: "Curve USDT/WBTC/WETH",
|
|
268
263
|
symbol: "crvUSDTWBTCWETH",
|
|
269
264
|
type: tokenType_1.TokenType.CURVE_LP_TOKEN,
|
|
@@ -285,7 +280,8 @@ exports.curveTokens = __assign({
|
|
|
285
280
|
tokenOut: "stkcvxcrvUSDTWBTCWETH",
|
|
286
281
|
},
|
|
287
282
|
],
|
|
288
|
-
},
|
|
283
|
+
},
|
|
284
|
+
LDOETH: {
|
|
289
285
|
name: "Curve LDOETH",
|
|
290
286
|
symbol: "LDOETH",
|
|
291
287
|
type: tokenType_1.TokenType.CURVE_LP_TOKEN,
|
|
@@ -307,12 +303,10 @@ exports.curveTokens = __assign({
|
|
|
307
303
|
tokenOut: "stkcvxLDOETH",
|
|
308
304
|
},
|
|
309
305
|
],
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return typeof t === "string" && !!exports.curveTokens[t];
|
|
306
|
+
},
|
|
307
|
+
...exports.curveMetaTokens,
|
|
313
308
|
};
|
|
309
|
+
const isCurveLPToken = (t) => typeof t === "string" && !!exports.curveTokens[t];
|
|
314
310
|
exports.isCurveLPToken = isCurveLPToken;
|
|
315
|
-
|
|
316
|
-
return typeof t === "string" && !!exports.curveMetaTokens[t];
|
|
317
|
-
};
|
|
311
|
+
const isCurveMetaToken = (t) => typeof t === "string" && !!exports.curveMetaTokens[t];
|
|
318
312
|
exports.isCurveMetaToken = isCurveMetaToken;
|
package/lib/tokens/gear.js
CHANGED
package/lib/tokens/normal.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNormalToken = exports.normalTokens = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const tradeTypes_1 = require("../pathfinder/tradeTypes");
|
|
5
|
+
const tokenType_1 = require("./tokenType");
|
|
6
6
|
exports.normalTokens = {
|
|
7
7
|
"1INCH": {
|
|
8
8
|
name: "1INCH",
|
|
@@ -728,7 +728,5 @@ exports.normalTokens = {
|
|
|
728
728
|
lpActions: [],
|
|
729
729
|
},
|
|
730
730
|
};
|
|
731
|
-
|
|
732
|
-
return typeof t === "string" && !!exports.normalTokens[t];
|
|
733
|
-
};
|
|
731
|
+
const isNormalToken = (t) => typeof t === "string" && !!exports.normalTokens[t];
|
|
734
732
|
exports.isNormalToken = isNormalToken;
|
package/lib/tokens/token.js
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.extractTokenData = exports.getDecimals = exports.isLPToken = exports.isSupportedToken = exports.tokenSymbolByAddress = exports.tokenDataByNetwork = exports.supportedTokens = exports.lpTokens = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
exports.lpTokens =
|
|
24
|
-
|
|
4
|
+
const mappers_1 = require("../utils/mappers");
|
|
5
|
+
const balancer_1 = require("./balancer");
|
|
6
|
+
const convex_1 = require("./convex");
|
|
7
|
+
const curveLP_1 = require("./curveLP");
|
|
8
|
+
const decimals_1 = require("./decimals");
|
|
9
|
+
const gear_1 = require("./gear");
|
|
10
|
+
const normal_1 = require("./normal");
|
|
11
|
+
const yearn_1 = require("./yearn");
|
|
12
|
+
exports.lpTokens = {
|
|
13
|
+
...curveLP_1.curveTokens,
|
|
14
|
+
...convex_1.convexTokens,
|
|
15
|
+
...yearn_1.yearnTokens,
|
|
16
|
+
...balancer_1.balancerLpTokens,
|
|
17
|
+
};
|
|
18
|
+
exports.supportedTokens = {
|
|
19
|
+
...normal_1.normalTokens,
|
|
20
|
+
...exports.lpTokens,
|
|
21
|
+
...gear_1.gearTokens,
|
|
22
|
+
};
|
|
25
23
|
exports.tokenDataByNetwork = {
|
|
26
24
|
//
|
|
27
25
|
// MAINNET NETWORK
|
|
@@ -215,32 +213,28 @@ exports.tokenDataByNetwork = {
|
|
|
215
213
|
GEAR: "0x3321F5dA65165042903eDe71617F912942f4E70F",
|
|
216
214
|
},
|
|
217
215
|
};
|
|
218
|
-
exports.tokenSymbolByAddress = (0, mappers_1.objectEntries)(exports.tokenDataByNetwork).reduce(
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}, {});
|
|
222
|
-
|
|
223
|
-
return typeof t === "string" && !!exports.supportedTokens[t];
|
|
224
|
-
};
|
|
216
|
+
exports.tokenSymbolByAddress = (0, mappers_1.objectEntries)(exports.tokenDataByNetwork).reduce((acc, [, tokens]) => ({
|
|
217
|
+
...acc,
|
|
218
|
+
...(0, mappers_1.filterEmptyKeys)((0, mappers_1.keyToLowercase)((0, mappers_1.swapKeyValue)(tokens))),
|
|
219
|
+
}), {});
|
|
220
|
+
const isSupportedToken = (t) => typeof t === "string" && !!exports.supportedTokens[t];
|
|
225
221
|
exports.isSupportedToken = isSupportedToken;
|
|
226
|
-
|
|
227
|
-
return typeof t === "string" && !!exports.lpTokens[t];
|
|
228
|
-
};
|
|
222
|
+
const isLPToken = (t) => typeof t === "string" && !!exports.lpTokens[t];
|
|
229
223
|
exports.isLPToken = isLPToken;
|
|
230
224
|
function getDecimals(token) {
|
|
231
|
-
|
|
225
|
+
let dec = decimals_1.decimals[token];
|
|
232
226
|
if (dec)
|
|
233
227
|
return dec;
|
|
234
228
|
dec = decimals_1.decimals[exports.tokenSymbolByAddress[token.toLowerCase()]];
|
|
235
229
|
if (!dec) {
|
|
236
|
-
throw new Error(
|
|
230
|
+
throw new Error(`Decimals for ${token} not found`);
|
|
237
231
|
}
|
|
238
232
|
return dec;
|
|
239
233
|
}
|
|
240
234
|
exports.getDecimals = getDecimals;
|
|
241
235
|
function extractTokenData(tokenAddress) {
|
|
242
|
-
|
|
243
|
-
|
|
236
|
+
const underlyingSymbol = exports.tokenSymbolByAddress[tokenAddress.toLowerCase()];
|
|
237
|
+
const underlyingDecimals = decimals_1.decimals[underlyingSymbol || ""];
|
|
244
238
|
return [underlyingSymbol, underlyingDecimals];
|
|
245
239
|
}
|
|
246
240
|
exports.extractTokenData = extractTokenData;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BigNumber } from "ethers";
|
|
2
1
|
import { NetworkType } from "../core/chains";
|
|
3
2
|
import { TokenDataPayload } from "../payload/token";
|
|
4
3
|
import { SupportedToken } from "./token";
|
|
@@ -12,14 +11,6 @@ export declare class TokenData {
|
|
|
12
11
|
constructor(payload: TokenDataPayload, symbolReplacements?: SymbolReplacements);
|
|
13
12
|
compareBySymbol(b: TokenData): number;
|
|
14
13
|
}
|
|
15
|
-
export interface TokenBalance {
|
|
16
|
-
id: string;
|
|
17
|
-
balance: BigNumber;
|
|
18
|
-
}
|
|
19
|
-
export interface TokenAllowance {
|
|
20
|
-
id: string;
|
|
21
|
-
allowance: BigNumber;
|
|
22
|
-
}
|
|
23
14
|
export declare const connectors: Record<NetworkType, Array<SupportedToken>>;
|
|
24
15
|
export declare function getConnectors(networkType: NetworkType): string[];
|
|
25
16
|
export {};
|
package/lib/tokens/tokenData.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getConnectors = exports.connectors = exports.TokenData = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const config_1 = require("../config");
|
|
5
|
+
const token_1 = require("./token");
|
|
6
|
+
const defaultSymbolReplacement = {
|
|
7
7
|
dWETH: "dETH",
|
|
8
8
|
WETH: "ETH",
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
class TokenData {
|
|
11
|
+
id;
|
|
12
|
+
symbol;
|
|
13
|
+
address;
|
|
14
|
+
decimals;
|
|
15
|
+
icon;
|
|
16
|
+
constructor(payload, symbolReplacements = defaultSymbolReplacement) {
|
|
14
17
|
this.id = payload.addr.toLowerCase();
|
|
15
18
|
this.address = payload.addr.toLowerCase();
|
|
16
19
|
this.symbol = symbolReplacements[payload.symbol] || payload.symbol;
|
|
17
20
|
this.decimals = payload.decimals;
|
|
18
|
-
this.icon =
|
|
21
|
+
this.icon = `${config_1.STATIC_TOKEN}${payload.symbol?.toLowerCase()}.svg`;
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
compareBySymbol(b) {
|
|
21
24
|
return this.symbol > b.symbol ? 1 : -1;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
25
27
|
exports.TokenData = TokenData;
|
|
26
28
|
exports.connectors = {
|
|
27
29
|
Mainnet: [
|
|
@@ -41,10 +43,10 @@ exports.connectors = {
|
|
|
41
43
|
Goerli: ["WETH", "DAI", "USDC", "WBTC"],
|
|
42
44
|
};
|
|
43
45
|
function getConnectors(networkType) {
|
|
44
|
-
return exports.connectors[networkType].map(
|
|
45
|
-
|
|
46
|
+
return exports.connectors[networkType].map(e => {
|
|
47
|
+
const result = token_1.tokenDataByNetwork[networkType][e];
|
|
46
48
|
if (!result) {
|
|
47
|
-
throw new Error(
|
|
49
|
+
throw new Error(`connector token ${e} not found`);
|
|
48
50
|
}
|
|
49
51
|
return result;
|
|
50
52
|
});
|
package/lib/tokens/yearn.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isYearnLPToken = exports.yearnTokens = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const tradeTypes_1 = require("../pathfinder/tradeTypes");
|
|
5
|
+
const tokenType_1 = require("./tokenType");
|
|
6
6
|
exports.yearnTokens = {
|
|
7
7
|
// YEARN TOKENS
|
|
8
8
|
yvDAI: {
|
|
@@ -91,7 +91,5 @@ exports.yearnTokens = {
|
|
|
91
91
|
],
|
|
92
92
|
},
|
|
93
93
|
};
|
|
94
|
-
|
|
95
|
-
return typeof t === "string" && !!exports.yearnTokens[t];
|
|
96
|
-
};
|
|
94
|
+
const isYearnLPToken = (t) => typeof t === "string" && !!exports.yearnTokens[t];
|
|
97
95
|
exports.isYearnLPToken = isYearnLPToken;
|
package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface__factory.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.AggregatorInterface__factory = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
9
|
{
|
|
10
10
|
anonymous: false,
|
|
11
11
|
inputs: [
|
|
@@ -134,16 +134,13 @@ var _abi = [
|
|
|
134
134
|
type: "function",
|
|
135
135
|
},
|
|
136
136
|
];
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
AggregatorInterface__factory.createInterface = function () {
|
|
137
|
+
class AggregatorInterface__factory {
|
|
138
|
+
static abi = _abi;
|
|
139
|
+
static createInterface() {
|
|
141
140
|
return new ethers_1.utils.Interface(_abi);
|
|
142
|
-
}
|
|
143
|
-
|
|
141
|
+
}
|
|
142
|
+
static connect(address, signerOrProvider) {
|
|
144
143
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return AggregatorInterface__factory;
|
|
148
|
-
}());
|
|
144
|
+
}
|
|
145
|
+
}
|
|
149
146
|
exports.AggregatorInterface__factory = AggregatorInterface__factory;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.AggregatorV2V3Interface__factory = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
9
|
{
|
|
10
10
|
anonymous: false,
|
|
11
11
|
inputs: [
|
|
@@ -245,16 +245,13 @@ var _abi = [
|
|
|
245
245
|
type: "function",
|
|
246
246
|
},
|
|
247
247
|
];
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
AggregatorV2V3Interface__factory.createInterface = function () {
|
|
248
|
+
class AggregatorV2V3Interface__factory {
|
|
249
|
+
static abi = _abi;
|
|
250
|
+
static createInterface() {
|
|
252
251
|
return new ethers_1.utils.Interface(_abi);
|
|
253
|
-
}
|
|
254
|
-
|
|
252
|
+
}
|
|
253
|
+
static connect(address, signerOrProvider) {
|
|
255
254
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return AggregatorV2V3Interface__factory;
|
|
259
|
-
}());
|
|
255
|
+
}
|
|
256
|
+
}
|
|
260
257
|
exports.AggregatorV2V3Interface__factory = AggregatorV2V3Interface__factory;
|