@gearbox-protocol/sdk 3.0.0-next.7 → 3.0.0-next.70
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/contracts/index.sol +29 -4
- package/lib/apy/curveAPY.js +2 -1
- package/lib/apy/index.d.ts +2 -2
- package/lib/apy/yearnAPY.js +1 -1
- package/lib/core/assets.d.ts +4 -4
- package/lib/core/assets.js +28 -17
- package/lib/core/creditAccount.d.ts +32 -8
- package/lib/core/creditAccount.js +101 -44
- package/lib/core/creditAccount.spec.js +693 -10
- package/lib/core/creditManager.d.ts +12 -3
- package/lib/core/creditManager.js +43 -10
- package/lib/core/events.js +14 -14
- package/lib/core/gauge.d.ts +26 -0
- package/lib/core/gauge.js +63 -0
- package/lib/core/gaugeMath.d.ts +40 -0
- package/lib/core/gaugeMath.js +108 -0
- package/lib/core/gaugeMath.spec.d.ts +1 -0
- package/lib/core/gaugeMath.spec.js +388 -0
- package/lib/core/{pool/data.d.ts → pool.d.ts} +17 -10
- package/lib/core/{pool/data.js → pool.js} +66 -24
- package/lib/core/strategy.d.ts +4 -3
- package/lib/core/strategy.js +15 -14
- package/lib/core/strategy.spec.js +68 -3
- package/lib/core/trade.d.ts +12 -29
- package/lib/core/trade.js +33 -82
- package/lib/core/transactions.d.ts +65 -3
- package/lib/core/transactions.js +162 -105
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/parsers/abstractParser.js +1 -2
- package/lib/parsers/convexBaseRewardPoolAdapterParser.js +10 -8
- package/lib/parsers/convexBaseRewardPoolAdapterParser.spec.js +9 -6
- package/lib/parsers/convexBoosterAdapterParser.js +6 -6
- package/lib/parsers/convexBoosterAdapterParser.spec.js +4 -4
- package/lib/parsers/creditFacadeParser.d.ts +2 -1
- package/lib/parsers/creditFacadeParser.js +40 -5
- package/lib/parsers/creditFacadeParser.spec.js +3 -4
- package/lib/parsers/curveAdapterParser.js +10 -11
- package/lib/parsers/curveAdapterParser.spec.js +6 -2
- package/lib/parsers/lidoAdapterParser.js +3 -2
- package/lib/parsers/lidoAdapterParser.spec.js +2 -2
- package/lib/parsers/txParser.d.ts +1 -1
- package/lib/parsers/txParser.js +9 -3
- package/lib/parsers/uniV2AdapterParser.js +5 -4
- package/lib/parsers/uniV2AdapterParser.spec.js +3 -2
- package/lib/parsers/uniV3AdapterParser.js +9 -7
- package/lib/parsers/uniV3AdapterParser.spec.js +3 -2
- package/lib/parsers/wstETHAdapterParser.js +6 -4
- package/lib/parsers/wstETHAdapterParser.spec.js +4 -4
- package/lib/parsers/yearnAdapterParser.spec.js +4 -4
- package/lib/parsers/yearnV2AdapterParser.js +13 -3
- package/lib/pathfinder/core.d.ts +8 -9
- package/lib/pathfinder/pathOptions.d.ts +2 -1
- package/lib/pathfinder/pathOptions.js +20 -1
- package/lib/pathfinder/pathOptions.spec.js +2 -2
- package/lib/pathfinder/pathfinder.d.ts +38 -10
- package/lib/pathfinder/pathfinder.js +53 -34
- package/lib/pathfinder/pathfinder.spec.js +7 -3
- package/lib/payload/creditAccount.d.ts +3 -4
- package/lib/payload/gauge.d.ts +12 -0
- package/lib/payload/pool.d.ts +6 -1
- package/lib/types/IAaveV2_LendingPoolAdapter.d.ts +171 -0
- package/lib/types/IAaveV2_WrappedATokenAdapter.d.ts +290 -0
- package/lib/types/IBalancerV2Vault.sol/IBalancerV2Vault.d.ts +308 -0
- package/lib/types/IBalancerV2Vault.sol/IBalancerV2VaultGetters.d.ts +112 -0
- package/lib/types/IBalancerV2Vault.sol/index.d.ts +2 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter.d.ts +466 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents.d.ts +43 -0
- package/lib/types/{ILidoV1Adapter.sol/ILidoV1AdapterEvents.d.ts → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions.d.ts} +6 -18
- package/lib/types/IBalancerV2VaultAdapter.sol/index.d.ts +3 -0
- package/lib/types/IBotListV3.sol/IBotListV3.d.ts +286 -0
- package/lib/types/IBotListV3.sol/IBotListV3Events.d.ts +103 -0
- package/lib/types/IBotListV3.sol/index.d.ts +2 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter.d.ts +216 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions.d.ts +27 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/index.d.ts +2 -0
- package/lib/types/IContractsRegister.sol/IContractsRegister.d.ts +128 -0
- package/lib/types/IContractsRegister.sol/IContractsRegisterEvents.d.ts +50 -0
- package/lib/types/IContractsRegister.sol/index.d.ts +2 -0
- package/lib/types/IControllerTimelockV3.sol/IControllerTimelockV3.d.ts +504 -0
- package/lib/types/IControllerTimelockV3.sol/IControllerTimelockV3Events.d.ts +82 -0
- package/lib/types/IControllerTimelockV3.sol/index.d.ts +2 -0
- package/lib/types/IConvexToken.d.ts +9 -1
- package/lib/types/IConvexV1BaseRewardPoolAdapter.d.ts +46 -30
- package/lib/types/{IConvexV1BoosterAdapter.d.ts → IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter.d.ts} +40 -21
- package/lib/types/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapterEvents.d.ts +43 -0
- package/lib/types/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapterEvents.js +2 -0
- package/lib/types/IConvexV1BoosterAdapter.sol/index.d.ts +2 -0
- package/lib/types/IConvexV1BoosterAdapter.sol/index.js +2 -0
- package/lib/types/ICreditConfiguratorV3.sol/ICreditConfiguratorV3.d.ts +716 -0
- package/lib/types/ICreditConfiguratorV3.sol/ICreditConfiguratorV3.js +2 -0
- package/lib/types/ICreditConfiguratorV3.sol/ICreditConfiguratorV3Events.d.ts +275 -0
- package/lib/types/ICreditConfiguratorV3.sol/ICreditConfiguratorV3Events.js +2 -0
- package/lib/types/ICreditConfiguratorV3.sol/index.d.ts +2 -0
- package/lib/types/ICreditConfiguratorV3.sol/index.js +2 -0
- package/lib/types/ICreditFacadeV2.sol/ICreditFacadeV2Extended.d.ts +7 -11
- package/lib/types/ICreditFacadeV3.sol/ICreditFacadeV3.d.ts +201 -94
- package/lib/types/ICreditFacadeV3.sol/ICreditFacadeV3Events.d.ts +31 -33
- package/lib/types/ICreditFacadeV3Multicall.d.ts +91 -60
- package/lib/types/ICreditManagerV3.sol/ICreditManagerV3.d.ts +360 -98
- package/lib/types/ICurveV1Adapter.d.ts +41 -105
- package/lib/types/ICurveV1_2AssetsAdapter.d.ts +41 -105
- package/lib/types/ICurveV1_3AssetsAdapter.d.ts +41 -105
- package/lib/types/ICurveV1_4AssetsAdapter.d.ts +41 -105
- package/lib/types/IDataCompressorV2_10.d.ts +44 -36
- package/lib/types/IDataCompressorV3_00.d.ts +141 -37
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2.d.ts +339 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2.js +2 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2Events.d.ts +61 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2Events.js +2 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2Exceptions.d.ts +27 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2Exceptions.js +2 -0
- package/lib/types/IDegenNFTV2.sol/index.d.ts +3 -0
- package/lib/types/IDegenNFTV2.sol/index.js +2 -0
- package/lib/types/IERC165.d.ts +42 -0
- package/lib/types/IERC165.js +2 -0
- package/lib/types/{draft-IERC20Permit.sol/IERC20Permit.d.ts → IERC20Permit.d.ts} +1 -1
- package/lib/types/IERC20Permit.js +2 -0
- package/lib/types/IERC20ZapperDeposits.d.ts +117 -0
- package/lib/types/IERC20ZapperDeposits.js +2 -0
- package/lib/types/IERC4626Adapter.d.ts +238 -0
- package/lib/types/IERC4626Adapter.js +2 -0
- package/lib/types/IERC721.d.ts +220 -0
- package/lib/types/IERC721.js +2 -0
- package/lib/types/IERC721Metadata.d.ts +244 -0
- package/lib/types/IERC721Metadata.js +2 -0
- package/lib/types/IETHZapperDeposits.d.ts +66 -0
- package/lib/types/IETHZapperDeposits.js +2 -0
- package/lib/types/IGasPricer.d.ts +44 -0
- package/lib/types/IGasPricer.js +2 -0
- package/lib/types/IGaugeV3.sol/IGaugeV3.d.ts +366 -0
- package/lib/types/IGaugeV3.sol/IGaugeV3.js +2 -0
- package/lib/types/IGaugeV3.sol/IGaugeV3Events.d.ts +114 -0
- package/lib/types/IGaugeV3.sol/IGaugeV3Events.js +2 -0
- package/lib/types/IGaugeV3.sol/index.d.ts +2 -0
- package/lib/types/IGaugeV3.sol/index.js +2 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3.d.ts +408 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3.js +2 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3Events.d.ts +117 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3Events.js +2 -0
- package/lib/types/IGearStakingV3.sol/index.d.ts +2 -0
- package/lib/types/IGearStakingV3.sol/index.js +2 -0
- package/lib/types/ILPPriceFeed.sol/ILPPriceFeed.d.ts +285 -0
- package/lib/types/ILPPriceFeed.sol/ILPPriceFeed.js +2 -0
- package/lib/types/ILPPriceFeed.sol/ILPPriceFeedEvents.d.ts +54 -0
- package/lib/types/ILPPriceFeed.sol/ILPPriceFeedEvents.js +2 -0
- package/lib/types/ILPPriceFeed.sol/ILPPriceFeedExceptions.d.ts +27 -0
- package/lib/types/ILPPriceFeed.sol/ILPPriceFeedExceptions.js +2 -0
- package/lib/types/ILPPriceFeed.sol/index.d.ts +3 -0
- package/lib/types/ILPPriceFeed.sol/index.js +2 -0
- package/lib/types/{ILidoV1Adapter.sol/ILidoV1Adapter.d.ts → ILidoV1Adapter.d.ts} +13 -48
- package/lib/types/ILidoV1Adapter.js +2 -0
- package/lib/types/ILinearInterestRateModelV3.d.ts +120 -0
- package/lib/types/ILinearInterestRateModelV3.js +2 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3.d.ts +473 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3.js +2 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3Events.d.ts +113 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3Events.js +2 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/index.d.ts +2 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/index.js +2 -0
- package/lib/types/IPoolV3.sol/IPoolV3.d.ts +43 -11
- package/lib/types/IPoolV3.sol/index.d.ts +0 -1
- package/lib/types/IPriceFeed.sol/IPriceFeed.d.ts +109 -0
- package/lib/types/IPriceFeed.sol/IPriceFeed.js +2 -0
- package/lib/types/IPriceFeed.sol/IUpdatablePriceFeed.d.ts +133 -0
- package/lib/types/IPriceFeed.sol/IUpdatablePriceFeed.js +2 -0
- package/lib/types/IPriceFeed.sol/index.d.ts +2 -0
- package/lib/types/IPriceFeed.sol/index.js +2 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2.d.ts +166 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2.js +2 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Events.d.ts +43 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Events.js +2 -0
- package/lib/types/{ILidoV1Adapter.sol/ILidoV1AdapterExceptions.d.ts → IPriceOracle.sol/IPriceOracleV2Exceptions.d.ts} +3 -3
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Exceptions.js +2 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Ext.d.ts +182 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Ext.js +2 -0
- package/lib/types/IPriceOracle.sol/index.d.ts +4 -0
- package/lib/types/IPriceOracle.sol/index.js +2 -0
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3.d.ts +272 -0
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3.js +2 -0
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3Events.d.ts +79 -0
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3Events.js +2 -0
- package/lib/types/IPriceOracleV3.sol/index.d.ts +2 -0
- package/lib/types/IPriceOracleV3.sol/index.js +2 -0
- package/lib/types/IUniswapV2Adapter.sol/IUniswapV2Adapter.d.ts +10 -9
- package/lib/types/IUniswapV3Adapter.sol/IUniswapV3Adapter.d.ts +27 -21
- package/lib/types/IVotingContractV3.d.ts +74 -0
- package/lib/types/IVotingContractV3.js +2 -0
- package/lib/types/IYearnV2Adapter.d.ts +22 -22
- package/lib/types/IZapper.d.ts +125 -0
- package/lib/types/IZapper.js +2 -0
- package/lib/types/IZapperRegister.d.ts +62 -0
- package/lib/types/IZapperRegister.js +2 -0
- package/lib/types/IwstETHV1Adapter.d.ts +17 -17
- package/lib/types/factories/AddressProvider__factory.d.ts +1 -1
- package/lib/types/factories/AddressProvider__factory.js +1 -1
- package/lib/types/factories/Claimable__factory.d.ts +1 -1
- package/lib/types/factories/Claimable__factory.js +1 -1
- package/lib/types/factories/IAaveV2_LendingPoolAdapter__factory.d.ts +158 -0
- package/lib/types/factories/IAaveV2_LendingPoolAdapter__factory.js +215 -0
- package/lib/types/factories/IAaveV2_WrappedATokenAdapter__factory.d.ts +252 -0
- package/lib/types/factories/IAaveV2_WrappedATokenAdapter__factory.js +341 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2VaultGetters__factory.d.ts +78 -0
- package/lib/types/factories/{ZapperBase__factory.js → IBalancerV2Vault.sol/IBalancerV2VaultGetters__factory.js} +54 -31
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2Vault__factory.d.ts +360 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2Vault__factory.js +475 -0
- package/lib/types/factories/IBalancerV2Vault.sol/index.d.ts +2 -0
- package/lib/types/factories/IBalancerV2Vault.sol/index.js +10 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents__factory.d.ts +23 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents__factory.js +38 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions__factory.d.ts +12 -0
- package/lib/types/factories/{ILidoV1Adapter.sol/ILidoV1AdapterExceptions__factory.js → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions__factory.js} +4 -4
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter__factory.d.ts +514 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter__factory.js +675 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/index.d.ts +3 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/index.js +12 -0
- package/lib/types/factories/IBotListV3.sol/IBotListV3Events__factory.d.ts +103 -0
- package/lib/types/factories/IBotListV3.sol/IBotListV3Events__factory.js +138 -0
- package/lib/types/factories/IBotListV3.sol/IBotListV3__factory.d.ts +315 -0
- package/lib/types/factories/IBotListV3.sol/IBotListV3__factory.js +416 -0
- package/lib/types/factories/IBotListV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IBotListV3.sol/index.js +10 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter__factory.d.ts +196 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter__factory.js +267 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions__factory.d.ts +16 -0
- package/lib/types/factories/{ILidoV1Adapter.sol/ILidoV1AdapterEvents__factory.js → ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions__factory.js} +6 -8
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/index.d.ts +2 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/index.js +10 -0
- package/lib/types/factories/IContractsRegister.sol/IContractsRegisterEvents__factory.d.ts +28 -0
- package/lib/types/factories/IContractsRegister.sol/IContractsRegisterEvents__factory.js +45 -0
- package/lib/types/factories/IContractsRegister.sol/IContractsRegister__factory.d.ts +134 -0
- package/lib/types/factories/IContractsRegister.sol/IContractsRegister__factory.js +186 -0
- package/lib/types/factories/IContractsRegister.sol/index.d.ts +2 -0
- package/lib/types/factories/IContractsRegister.sol/index.js +10 -0
- package/lib/types/factories/IControllerTimelockV3.sol/IControllerTimelockV3Events__factory.d.ts +73 -0
- package/lib/types/factories/IControllerTimelockV3.sol/IControllerTimelockV3Events__factory.js +101 -0
- package/lib/types/factories/IControllerTimelockV3.sol/IControllerTimelockV3__factory.d.ts +427 -0
- package/lib/types/factories/IControllerTimelockV3.sol/IControllerTimelockV3__factory.js +556 -0
- package/lib/types/factories/IControllerTimelockV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IControllerTimelockV3.sol/index.js +10 -0
- package/lib/types/factories/IConvexToken__factory.d.ts +10 -0
- package/lib/types/factories/IConvexToken__factory.js +13 -0
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.d.ts +38 -6
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.js +48 -6
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapterEvents__factory.d.ts +23 -0
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapterEvents__factory.js +38 -0
- package/lib/types/factories/{IConvexV1BoosterAdapter__factory.d.ts → IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter__factory.d.ts} +26 -3
- package/lib/types/factories/{IConvexV1BoosterAdapter__factory.js → IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter__factory.js} +31 -2
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/index.d.ts +2 -0
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/index.js +10 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/ICreditConfiguratorV3Events__factory.d.ts +273 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/ICreditConfiguratorV3Events__factory.js +357 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/ICreditConfiguratorV3__factory.d.ts +605 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/ICreditConfiguratorV3__factory.js +785 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/index.d.ts +2 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/index.js +10 -0
- package/lib/types/factories/ICreditFacadeV2.sol/ICreditFacadeV2Extended__factory.d.ts +0 -4
- package/lib/types/factories/ICreditFacadeV2.sol/ICreditFacadeV2Extended__factory.js +0 -5
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3Events__factory.d.ts +19 -24
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3Events__factory.js +21 -27
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3__factory.d.ts +151 -72
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3__factory.js +189 -85
- package/lib/types/factories/ICreditFacadeV3Multicall__factory.d.ts +77 -43
- package/lib/types/factories/ICreditFacadeV3Multicall__factory.js +96 -54
- package/lib/types/factories/ICreditManagerV3.sol/ICreditManagerV3__factory.d.ts +339 -147
- package/lib/types/factories/ICreditManagerV3.sol/ICreditManagerV3__factory.js +427 -180
- package/lib/types/factories/ICurveV1Adapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1Adapter__factory.js +14 -91
- package/lib/types/factories/ICurveV1_2AssetsAdapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1_2AssetsAdapter__factory.js +14 -91
- package/lib/types/factories/ICurveV1_3AssetsAdapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1_3AssetsAdapter__factory.js +14 -91
- package/lib/types/factories/ICurveV1_4AssetsAdapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1_4AssetsAdapter__factory.js +14 -91
- package/lib/types/factories/IDataCompressorV2_10__factory.d.ts +110 -54
- package/lib/types/factories/IDataCompressorV2_10__factory.js +138 -68
- package/lib/types/factories/IDataCompressorV3_00__factory.d.ts +379 -79
- package/lib/types/factories/IDataCompressorV3_00__factory.js +481 -100
- package/lib/types/factories/IDegenNFTV2.sol/IDegenNFTV2Events__factory.d.ts +38 -0
- package/lib/types/factories/IDegenNFTV2.sol/IDegenNFTV2Events__factory.js +58 -0
- package/lib/types/factories/IDegenNFTV2.sol/IDegenNFTV2Exceptions__factory.d.ts +24 -0
- package/lib/types/factories/IDegenNFTV2.sol/IDegenNFTV2Exceptions__factory.js +39 -0
- package/lib/types/factories/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3__factory.d.ts → IDegenNFTV2.sol/IDegenNFTV2__factory.d.ts} +190 -180
- package/lib/types/factories/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3__factory.js → IDegenNFTV2.sol/IDegenNFTV2__factory.js} +212 -195
- package/lib/types/factories/IDegenNFTV2.sol/index.d.ts +3 -0
- package/lib/types/factories/IDegenNFTV2.sol/index.js +12 -0
- package/lib/types/factories/IERC165__factory.d.ts +22 -0
- package/lib/types/factories/IERC165__factory.js +38 -0
- package/lib/types/factories/{draft-IERC20Permit.sol/IERC20Permit__factory.d.ts → IERC20Permit__factory.d.ts} +1 -1
- package/lib/types/factories/IERC20ZapperDeposits__factory.d.ts +120 -0
- package/lib/types/factories/IERC20ZapperDeposits__factory.js +165 -0
- package/lib/types/factories/IERC4626Adapter__factory.d.ts +220 -0
- package/lib/types/factories/IERC4626Adapter__factory.js +297 -0
- package/lib/types/factories/IERC721Metadata__factory.d.ts +262 -0
- package/lib/types/factories/IERC721Metadata__factory.js +349 -0
- package/lib/types/factories/IERC721__factory.d.ts +228 -0
- package/lib/types/factories/IERC721__factory.js +304 -0
- package/lib/types/factories/IETHZapperDeposits__factory.d.ts +40 -0
- package/lib/types/factories/{AaveV2_WrappedAToken.sol/IWrappedATokenEvents__factory.js → IETHZapperDeposits__factory.js} +18 -25
- package/lib/types/factories/IGasPricer__factory.d.ts +22 -0
- package/lib/types/factories/IGasPricer__factory.js +38 -0
- package/lib/types/factories/IGaugeV3.sol/IGaugeV3Events__factory.d.ts +118 -0
- package/lib/types/factories/IGaugeV3.sol/IGaugeV3Events__factory.js +157 -0
- package/lib/types/factories/IGaugeV3.sol/IGaugeV3__factory.d.ts +342 -0
- package/lib/types/factories/IGaugeV3.sol/IGaugeV3__factory.js +448 -0
- package/lib/types/factories/IGaugeV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IGaugeV3.sol/index.js +10 -0
- package/lib/types/factories/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events__factory.d.ts → IGearStakingV3.sol/IGearStakingV3Events__factory.d.ts} +33 -63
- package/lib/types/factories/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events__factory.js → IGearStakingV3.sol/IGearStakingV3Events__factory.js} +34 -70
- package/lib/types/factories/IGearStakingV3.sol/IGearStakingV3__factory.d.ts +504 -0
- package/lib/types/factories/IGearStakingV3.sol/IGearStakingV3__factory.js +660 -0
- package/lib/types/factories/IGearStakingV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IGearStakingV3.sol/index.js +10 -0
- package/lib/types/factories/ILPPriceFeed.sol/ILPPriceFeedEvents__factory.d.ts +33 -0
- package/lib/types/factories/ILPPriceFeed.sol/ILPPriceFeedEvents__factory.js +51 -0
- package/lib/types/factories/ILPPriceFeed.sol/ILPPriceFeedExceptions__factory.d.ts +24 -0
- package/lib/types/factories/ILPPriceFeed.sol/ILPPriceFeedExceptions__factory.js +39 -0
- package/lib/types/factories/ILPPriceFeed.sol/ILPPriceFeed__factory.d.ts +257 -0
- package/lib/types/factories/ILPPriceFeed.sol/ILPPriceFeed__factory.js +339 -0
- package/lib/types/factories/ILPPriceFeed.sol/index.d.ts +3 -0
- package/lib/types/factories/ILPPriceFeed.sol/index.js +12 -0
- package/lib/types/factories/{ILidoV1Adapter.sol/ILidoV1Adapter__factory.d.ts → ILidoV1Adapter__factory.d.ts} +7 -37
- package/lib/types/factories/{ILidoV1Adapter.sol/ILidoV1Adapter__factory.js → ILidoV1Adapter__factory.js} +8 -46
- package/lib/types/factories/ILinearInterestRateModelV3__factory.d.ts +98 -0
- package/lib/types/factories/ILinearInterestRateModelV3__factory.js +136 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3Events__factory.d.ts +103 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3Events__factory.js +140 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3__factory.d.ts +441 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3__factory.js +580 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/index.js +10 -0
- package/lib/types/factories/IPoolV3.sol/IPoolV3__factory.d.ts +62 -14
- package/lib/types/factories/IPoolV3.sol/IPoolV3__factory.js +79 -17
- package/lib/types/factories/IPoolV3.sol/index.d.ts +0 -1
- package/lib/types/factories/IPoolV3.sol/index.js +1 -3
- package/lib/types/factories/{IPoolV3.sol/IPoolBase__factory.d.ts → IPriceFeed.sol/IPriceFeed__factory.d.ts} +39 -35
- package/lib/types/factories/{IPoolV3.sol/IPoolBase__factory.js → IPriceFeed.sol/IPriceFeed__factory.js} +40 -35
- package/lib/types/factories/IPriceFeed.sol/IUpdatablePriceFeed__factory.d.ts +104 -0
- package/lib/types/factories/IPriceFeed.sol/IUpdatablePriceFeed__factory.js +143 -0
- package/lib/types/factories/IPriceFeed.sol/index.d.ts +2 -0
- package/lib/types/factories/IPriceFeed.sol/index.js +10 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Events__factory.d.ts +23 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Events__factory.js +38 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Exceptions__factory.d.ts +20 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Exceptions__factory.js +34 -0
- package/lib/types/factories/{IAToken__factory.d.ts → IPriceOracle.sol/IPriceOracleV2Ext__factory.d.ts} +98 -99
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Ext__factory.js +267 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2__factory.d.ts +183 -0
- package/lib/types/factories/{IAToken__factory.js → IPriceOracle.sol/IPriceOracleV2__factory.js} +94 -112
- package/lib/types/factories/IPriceOracle.sol/index.d.ts +4 -0
- package/lib/types/factories/IPriceOracle.sol/index.js +14 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3Events__factory.d.ts +78 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3Events__factory.js +106 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3__factory.d.ts +326 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3__factory.js +433 -0
- package/lib/types/factories/IPriceOracleV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IPriceOracleV3.sol/index.js +10 -0
- package/lib/types/factories/IUniswapV2Adapter.sol/IUniswapV2Adapter__factory.d.ts +5 -1
- package/lib/types/factories/IUniswapV2Adapter.sol/IUniswapV2Adapter__factory.js +6 -1
- package/lib/types/factories/IUniswapV3Adapter.sol/IUniswapV3Adapter__factory.d.ts +12 -4
- package/lib/types/factories/IUniswapV3Adapter.sol/IUniswapV3Adapter__factory.js +14 -4
- package/lib/types/factories/IVotingContractV3__factory.d.ts +44 -0
- package/lib/types/factories/IVotingContractV3__factory.js +65 -0
- package/lib/types/factories/IYearnV2Adapter__factory.d.ts +21 -13
- package/lib/types/factories/IYearnV2Adapter__factory.js +27 -15
- package/lib/types/factories/IZapperRegister__factory.d.ts +42 -0
- package/lib/types/factories/IZapperRegister__factory.js +64 -0
- package/lib/types/factories/{WERC20ZapperBase__factory.d.ts → IZapper__factory.d.ts} +52 -64
- package/lib/types/factories/{WERC20ZapperBase__factory.js → IZapper__factory.js} +58 -74
- package/lib/types/factories/IwstETHV1Adapter__factory.d.ts +12 -4
- package/lib/types/factories/IwstETHV1Adapter__factory.js +16 -4
- package/lib/types/factories/SafeERC20__factory.d.ts +1 -1
- package/lib/types/factories/SafeERC20__factory.js +1 -1
- package/lib/types/factories/index.d.ts +32 -14
- package/lib/types/factories/index.js +49 -26
- package/lib/types/factories/{IRouter__factory.d.ts → interfaces/IRouter__factory.d.ts} +75 -6
- package/lib/types/factories/{IRouter__factory.js → interfaces/IRouter__factory.js} +96 -6
- package/lib/types/factories/interfaces/index.d.ts +1 -0
- package/lib/types/factories/interfaces/index.js +8 -0
- package/lib/types/index.d.ts +141 -46
- package/lib/types/index.js +109 -38
- package/lib/types/{IRouter.d.ts → interfaces/IRouter.d.ts} +48 -35
- package/lib/types/interfaces/IRouter.js +2 -0
- package/lib/types/interfaces/index.d.ts +1 -0
- package/lib/types/interfaces/index.js +2 -0
- package/lib/utils/formatter.d.ts +0 -3
- package/lib/utils/formatter.js +1 -67
- package/lib/utils/math.d.ts +2 -0
- package/lib/utils/math.js +2 -0
- package/lib/utils/types.d.ts +1 -0
- package/lib/watchers/creditAccountWatcher.d.ts +3 -2
- package/lib/watchers/creditAccountWatcher.js +19 -13
- package/lib/watchers/creditAccountWatcher.spec.js +18 -18
- package/lib/watchers/creditManagerWatcher.d.ts +5 -3
- package/lib/watchers/creditManagerWatcher.js +32 -10
- package/lib/watchers/creditManagerWatcher.spec.js +12 -4
- package/package.json +10 -9
- package/contracts/IRouter.sol +0 -100
- package/lib/core/pool/index.d.ts +0 -1
- package/lib/core/pool/index.js +0 -17
- package/lib/types/AaveV2_WrappedAToken.sol/IWrappedATokenEvents.d.ts +0 -60
- package/lib/types/AaveV2_WrappedAToken.sol/WrappedAToken.d.ts +0 -332
- package/lib/types/AaveV2_WrappedAToken.sol/index.d.ts +0 -2
- package/lib/types/ERC20.d.ts +0 -198
- package/lib/types/IAToken.d.ts +0 -182
- package/lib/types/ILendingPool.d.ts +0 -140
- package/lib/types/ILidoV1Adapter.sol/index.d.ts +0 -3
- package/lib/types/IPoolV3.sol/IPoolBase.d.ts +0 -102
- package/lib/types/IWithdrawalManagerV3.sol/IWithdrawalManagerV3.d.ts +0 -370
- package/lib/types/IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events.d.ts +0 -133
- package/lib/types/IWithdrawalManagerV3.sol/index.d.ts +0 -2
- package/lib/types/WATokenZapper.d.ts +0 -134
- package/lib/types/WERC20ZapperBase.d.ts +0 -134
- package/lib/types/WETHZapper.d.ts +0 -122
- package/lib/types/WstETHZapper.d.ts +0 -134
- package/lib/types/ZapperBase.d.ts +0 -70
- package/lib/types/draft-IERC20Permit.sol/index.d.ts +0 -1
- package/lib/types/factories/AaveV2_WrappedAToken.sol/IWrappedATokenEvents__factory.d.ts +0 -48
- package/lib/types/factories/AaveV2_WrappedAToken.sol/WrappedAToken__factory.d.ts +0 -397
- package/lib/types/factories/AaveV2_WrappedAToken.sol/WrappedAToken__factory.js +0 -535
- package/lib/types/factories/AaveV2_WrappedAToken.sol/index.d.ts +0 -2
- package/lib/types/factories/AaveV2_WrappedAToken.sol/index.js +0 -10
- package/lib/types/factories/ERC20__factory.d.ts +0 -239
- package/lib/types/factories/ERC20__factory.js +0 -328
- package/lib/types/factories/ILendingPool__factory.d.ts +0 -134
- package/lib/types/factories/ILendingPool__factory.js +0 -183
- package/lib/types/factories/ILidoV1Adapter.sol/ILidoV1AdapterEvents__factory.d.ts +0 -18
- package/lib/types/factories/ILidoV1Adapter.sol/ILidoV1AdapterExceptions__factory.d.ts +0 -12
- package/lib/types/factories/ILidoV1Adapter.sol/index.d.ts +0 -3
- package/lib/types/factories/ILidoV1Adapter.sol/index.js +0 -12
- package/lib/types/factories/IWithdrawalManagerV3.sol/index.d.ts +0 -2
- package/lib/types/factories/IWithdrawalManagerV3.sol/index.js +0 -10
- package/lib/types/factories/WATokenZapper__factory.d.ts +0 -161
- package/lib/types/factories/WATokenZapper__factory.js +0 -227
- package/lib/types/factories/WETHZapper__factory.d.ts +0 -138
- package/lib/types/factories/WETHZapper__factory.js +0 -198
- package/lib/types/factories/WstETHZapper__factory.d.ts +0 -161
- package/lib/types/factories/WstETHZapper__factory.js +0 -227
- package/lib/types/factories/ZapperBase__factory.d.ts +0 -60
- package/lib/types/factories/draft-IERC20Permit.sol/index.d.ts +0 -1
- package/lib/types/factories/draft-IERC20Permit.sol/index.js +0 -8
- /package/lib/{types/AaveV2_WrappedAToken.sol/IWrappedATokenEvents.js → payload/gauge.js} +0 -0
- /package/lib/types/{AaveV2_WrappedAToken.sol/WrappedAToken.js → IAaveV2_LendingPoolAdapter.js} +0 -0
- /package/lib/types/{AaveV2_WrappedAToken.sol/index.js → IAaveV2_WrappedATokenAdapter.js} +0 -0
- /package/lib/types/{ERC20.js → IBalancerV2Vault.sol/IBalancerV2Vault.js} +0 -0
- /package/lib/types/{IAToken.js → IBalancerV2Vault.sol/IBalancerV2VaultGetters.js} +0 -0
- /package/lib/types/{ILidoV1Adapter.sol → IBalancerV2Vault.sol}/index.js +0 -0
- /package/lib/types/{IConvexV1BoosterAdapter.js → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter.js} +0 -0
- /package/lib/types/{ILendingPool.js → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents.js} +0 -0
- /package/lib/types/{ILidoV1Adapter.sol/ILidoV1Adapter.js → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions.js} +0 -0
- /package/lib/types/{IWithdrawalManagerV3.sol → IBalancerV2VaultAdapter.sol}/index.js +0 -0
- /package/lib/types/{ILidoV1Adapter.sol/ILidoV1AdapterEvents.js → IBotListV3.sol/IBotListV3.js} +0 -0
- /package/lib/types/{ILidoV1Adapter.sol/ILidoV1AdapterExceptions.js → IBotListV3.sol/IBotListV3Events.js} +0 -0
- /package/lib/types/{draft-IERC20Permit.sol → IBotListV3.sol}/index.js +0 -0
- /package/lib/types/{IPoolV3.sol/IPoolBase.js → ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter.js} +0 -0
- /package/lib/types/{IRouter.js → ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions.js} +0 -0
- /package/lib/types/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3.js → ICompoundV2_CTokenAdapter.sol/index.js} +0 -0
- /package/lib/types/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events.js → IContractsRegister.sol/IContractsRegister.js} +0 -0
- /package/lib/types/{WATokenZapper.js → IContractsRegister.sol/IContractsRegisterEvents.js} +0 -0
- /package/lib/types/{WERC20ZapperBase.js → IContractsRegister.sol/index.js} +0 -0
- /package/lib/types/{WETHZapper.js → IControllerTimelockV3.sol/IControllerTimelockV3.js} +0 -0
- /package/lib/types/{WstETHZapper.js → IControllerTimelockV3.sol/IControllerTimelockV3Events.js} +0 -0
- /package/lib/types/{ZapperBase.js → IControllerTimelockV3.sol/index.js} +0 -0
- /package/lib/types/{draft-IERC20Permit.sol/IERC20Permit.js → IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter.js} +0 -0
- /package/lib/types/factories/{draft-IERC20Permit.sol/IERC20Permit__factory.js → IERC20Permit__factory.js} +0 -0
|
@@ -42,14 +42,79 @@ describe("Strategy test", () => {
|
|
|
42
42
|
const result = lidoStrategy.maxAPY(53203, 10 * Number(sdk_gov_1.LEVERAGE_DECIMALS), pools["0x1"].borrowRate);
|
|
43
43
|
(0, chai_1.expect)(result).to.be.eq(284143);
|
|
44
44
|
});
|
|
45
|
-
it("liquidationPrice calculation is correct", () => {
|
|
45
|
+
it("liquidationPrice: calculation is correct", () => {
|
|
46
46
|
const result = strategy_1.Strategy.liquidationPrice({
|
|
47
47
|
liquidationThresholds,
|
|
48
48
|
prices,
|
|
49
49
|
borrowed: (0, formatter_1.toBN)("350", sdk_gov_1.decimals.WETH),
|
|
50
50
|
underlyingToken: sdk_gov_1.tokenDataByNetwork.Mainnet.WETH,
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
targetToken: sdk_gov_1.tokenDataByNetwork.Mainnet.STETH,
|
|
52
|
+
assets: {
|
|
53
|
+
[sdk_gov_1.tokenDataByNetwork.Mainnet.STETH.toLowerCase()]: {
|
|
54
|
+
balance: (0, formatter_1.toBN)("400", sdk_gov_1.decimals.STETH),
|
|
55
|
+
token: sdk_gov_1.tokenDataByNetwork.Mainnet.STETH,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
(0, chai_1.expect)(Number((0, formatter_1.toSignificant)(result, sdk_gov_1.WAD_DECIMALS_POW)).toFixed(3)).to.be.eq("0.992");
|
|
60
|
+
});
|
|
61
|
+
it("liquidationPrice: zero result when debt is compensated", () => {
|
|
62
|
+
const result = strategy_1.Strategy.liquidationPrice({
|
|
63
|
+
liquidationThresholds,
|
|
64
|
+
prices,
|
|
65
|
+
borrowed: (0, formatter_1.toBN)("350", sdk_gov_1.decimals.WETH),
|
|
66
|
+
underlyingToken: sdk_gov_1.tokenDataByNetwork.Mainnet.WETH,
|
|
67
|
+
targetToken: sdk_gov_1.tokenDataByNetwork.Mainnet.STETH,
|
|
68
|
+
assets: {
|
|
69
|
+
[sdk_gov_1.tokenDataByNetwork.Mainnet.STETH.toLowerCase()]: {
|
|
70
|
+
balance: (0, formatter_1.toBN)("400", sdk_gov_1.decimals.STETH),
|
|
71
|
+
token: sdk_gov_1.tokenDataByNetwork.Mainnet.STETH,
|
|
72
|
+
},
|
|
73
|
+
[sdk_gov_1.tokenDataByNetwork.Mainnet.WETH.toLowerCase()]: {
|
|
74
|
+
balance: (0, formatter_1.toBN)("350", sdk_gov_1.decimals.WETH),
|
|
75
|
+
token: sdk_gov_1.tokenDataByNetwork.Mainnet.WETH,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
(0, chai_1.expect)(Number((0, formatter_1.toSignificant)(result, sdk_gov_1.WAD_DECIMALS_POW)).toFixed(3)).to.be.eq("0.000");
|
|
80
|
+
});
|
|
81
|
+
it("liquidationPrice: zero result when debt is overcompensated", () => {
|
|
82
|
+
const result = strategy_1.Strategy.liquidationPrice({
|
|
83
|
+
liquidationThresholds,
|
|
84
|
+
prices,
|
|
85
|
+
borrowed: (0, formatter_1.toBN)("350", sdk_gov_1.decimals.WETH),
|
|
86
|
+
underlyingToken: sdk_gov_1.tokenDataByNetwork.Mainnet.WETH,
|
|
87
|
+
targetToken: sdk_gov_1.tokenDataByNetwork.Mainnet.STETH,
|
|
88
|
+
assets: {
|
|
89
|
+
[sdk_gov_1.tokenDataByNetwork.Mainnet.STETH.toLowerCase()]: {
|
|
90
|
+
balance: (0, formatter_1.toBN)("400", sdk_gov_1.decimals.STETH),
|
|
91
|
+
token: sdk_gov_1.tokenDataByNetwork.Mainnet.STETH,
|
|
92
|
+
},
|
|
93
|
+
[sdk_gov_1.tokenDataByNetwork.Mainnet.WETH.toLowerCase()]: {
|
|
94
|
+
balance: (0, formatter_1.toBN)("450", sdk_gov_1.decimals.WETH),
|
|
95
|
+
token: sdk_gov_1.tokenDataByNetwork.Mainnet.WETH,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
(0, chai_1.expect)(Number((0, formatter_1.toSignificant)(result, sdk_gov_1.WAD_DECIMALS_POW)).toFixed(3)).to.be.eq("0.000");
|
|
100
|
+
});
|
|
101
|
+
it("liquidationPrice: zero result when debt is not compensated", () => {
|
|
102
|
+
const result = strategy_1.Strategy.liquidationPrice({
|
|
103
|
+
liquidationThresholds,
|
|
104
|
+
prices,
|
|
105
|
+
borrowed: (0, formatter_1.toBN)("450", sdk_gov_1.decimals.WETH),
|
|
106
|
+
underlyingToken: sdk_gov_1.tokenDataByNetwork.Mainnet.WETH,
|
|
107
|
+
targetToken: sdk_gov_1.tokenDataByNetwork.Mainnet.STETH,
|
|
108
|
+
assets: {
|
|
109
|
+
[sdk_gov_1.tokenDataByNetwork.Mainnet.STETH.toLowerCase()]: {
|
|
110
|
+
balance: (0, formatter_1.toBN)("400", sdk_gov_1.decimals.STETH),
|
|
111
|
+
token: sdk_gov_1.tokenDataByNetwork.Mainnet.STETH,
|
|
112
|
+
},
|
|
113
|
+
[sdk_gov_1.tokenDataByNetwork.Mainnet.WETH.toLowerCase()]: {
|
|
114
|
+
balance: (0, formatter_1.toBN)("100", sdk_gov_1.decimals.WETH),
|
|
115
|
+
token: sdk_gov_1.tokenDataByNetwork.Mainnet.WETH,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
53
118
|
});
|
|
54
119
|
(0, chai_1.expect)(Number((0, formatter_1.toSignificant)(result, sdk_gov_1.WAD_DECIMALS_POW)).toFixed(3)).to.be.eq("0.992");
|
|
55
120
|
});
|
package/lib/core/trade.d.ts
CHANGED
|
@@ -1,56 +1,39 @@
|
|
|
1
1
|
import { SupportedContract } from "@gearbox-protocol/sdk-gov";
|
|
2
|
-
import { Signer } from "ethers";
|
|
3
2
|
import { MultiCall, PathFinderResult, SwapOperation } from "../pathfinder/core";
|
|
4
|
-
import { ICreditFacadeV2 } from "../types";
|
|
5
3
|
import { CreditManagerData } from "./creditManager";
|
|
6
|
-
import { EVMTx } from "./eventOrTx";
|
|
7
4
|
interface Info {
|
|
8
5
|
name: string;
|
|
9
6
|
contractAddress: string;
|
|
10
7
|
creditManager: string;
|
|
11
8
|
}
|
|
12
|
-
export
|
|
13
|
-
adapter: Info;
|
|
14
|
-
tradePath: PathFinderResult;
|
|
15
|
-
creditFacade: string;
|
|
16
|
-
tokenFrom: string;
|
|
17
|
-
tokenTo: string;
|
|
18
|
-
sourceAmount: bigint;
|
|
19
|
-
expectedAmount: bigint;
|
|
20
|
-
swapType: SwapOperation;
|
|
21
|
-
swapName: TradeOperations;
|
|
22
|
-
}
|
|
23
|
-
export type TradeOperations = "farmWithdraw" | "farmDeposit" | "swap" | "unknownOperation";
|
|
9
|
+
export type TradeOperations = "farmWithdraw" | "farmDeposit" | "swap";
|
|
24
10
|
export interface GetTradesProps {
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
tokenIn: string;
|
|
12
|
+
tokenOut: string;
|
|
27
13
|
amount: bigint;
|
|
28
14
|
results: Array<PathFinderResult>;
|
|
29
15
|
creditManager: CreditManagerData;
|
|
30
16
|
currentContracts: Record<SupportedContract, string>;
|
|
17
|
+
swapOperation: SwapOperation;
|
|
18
|
+
swapName: TradeOperations;
|
|
31
19
|
}
|
|
32
20
|
export declare class Trade {
|
|
33
21
|
readonly helper: Info;
|
|
34
22
|
readonly tradePath: PathFinderResult;
|
|
35
|
-
readonly
|
|
36
|
-
readonly swapType: SwapOperation;
|
|
23
|
+
readonly swapOperation: SwapOperation;
|
|
37
24
|
readonly sourceAmount: bigint;
|
|
38
|
-
readonly
|
|
25
|
+
readonly minExpectedAmount: bigint;
|
|
26
|
+
readonly averageExpectedAmount: bigint;
|
|
39
27
|
readonly rate: bigint;
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
28
|
+
readonly tokenIn: string;
|
|
29
|
+
readonly tokenOut: string;
|
|
42
30
|
readonly operationName: TradeOperations;
|
|
43
|
-
constructor(
|
|
31
|
+
private constructor();
|
|
44
32
|
getName(): string;
|
|
45
|
-
execute(signer: Signer): Promise<EVMTx>;
|
|
46
33
|
toString(): string;
|
|
47
|
-
static getTrades({
|
|
48
|
-
static getOperationName(tokenInAddress: string, tokenOutAddress: string): TradeOperations;
|
|
34
|
+
static getTrades({ tokenIn, tokenOut, amount, results, creditManager, currentContracts, swapOperation, swapName, }: GetTradesProps): Trade[];
|
|
49
35
|
static getCallInfo(calls: Array<MultiCall>, creditManager: string, currentContracts: Record<SupportedContract, string>): Info[];
|
|
50
36
|
private static getContractSymbol;
|
|
51
|
-
static getTradeId(trade: Trade): string;
|
|
52
37
|
static sortTrades(trades: Array<Trade>, swapStrategy: string): Trade[];
|
|
53
|
-
static executeMulticallPath(creditFacade: string | ICreditFacadeV2, signer: Signer, calls: Array<MultiCall>): Promise<import("ethers").ContractTransaction>;
|
|
54
|
-
private static executeOnCreditFacade;
|
|
55
38
|
}
|
|
56
39
|
export {};
|
package/lib/core/trade.js
CHANGED
|
@@ -4,108 +4,73 @@ exports.Trade = void 0;
|
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
5
|
const txParser_1 = require("../parsers/txParser");
|
|
6
6
|
const core_1 = require("../pathfinder/core");
|
|
7
|
-
const types_1 = require("../types");
|
|
8
|
-
const formatter_1 = require("../utils/formatter");
|
|
9
|
-
const transactions_1 = require("./transactions");
|
|
10
|
-
const OPERATION_NAMES = {
|
|
11
|
-
farmWithdraw: "Farm withdraw",
|
|
12
|
-
farmDeposit: "Farm deposit",
|
|
13
|
-
swap: "Swap",
|
|
14
|
-
unknownOperation: "Unknown operation",
|
|
15
|
-
};
|
|
16
7
|
class Trade {
|
|
17
8
|
helper;
|
|
18
9
|
tradePath;
|
|
19
|
-
|
|
20
|
-
swapType;
|
|
10
|
+
swapOperation;
|
|
21
11
|
sourceAmount;
|
|
22
|
-
|
|
12
|
+
minExpectedAmount;
|
|
13
|
+
averageExpectedAmount;
|
|
23
14
|
rate;
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
tokenIn;
|
|
16
|
+
tokenOut;
|
|
26
17
|
operationName;
|
|
27
18
|
constructor(props) {
|
|
28
19
|
this.helper = props.adapter;
|
|
29
20
|
this.tradePath = props.tradePath;
|
|
30
|
-
this.
|
|
31
|
-
this.swapType = props.swapType;
|
|
21
|
+
this.swapOperation = props.swapOperation;
|
|
32
22
|
this.sourceAmount = props.sourceAmount;
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
23
|
+
this.minExpectedAmount = props.minExpectedAmount;
|
|
24
|
+
this.averageExpectedAmount = props.averageExpectedAmount;
|
|
25
|
+
this.rate = (sdk_gov_1.WAD * props.minExpectedAmount) / props.sourceAmount;
|
|
26
|
+
this.tokenIn = props.tokenIn;
|
|
27
|
+
this.tokenOut = props.tokenOut;
|
|
37
28
|
this.operationName = props.swapName;
|
|
38
29
|
}
|
|
39
30
|
getName() {
|
|
40
31
|
return this.helper.name;
|
|
41
32
|
}
|
|
42
|
-
async execute(signer) {
|
|
43
|
-
const receipt = await Trade.executeMulticallPath(this.creditFacade, signer, this.tradePath.calls);
|
|
44
|
-
return new transactions_1.TXSwap({
|
|
45
|
-
txHash: receipt.hash,
|
|
46
|
-
protocol: this.helper.contractAddress,
|
|
47
|
-
operation: OPERATION_NAMES[this.operationName],
|
|
48
|
-
amountFrom: this.sourceAmount,
|
|
49
|
-
amountTo: this.expectedAmount,
|
|
50
|
-
tokenFrom: this.tokenFrom,
|
|
51
|
-
tokenTo: this.tokenTo,
|
|
52
|
-
creditManager: this.helper.creditManager,
|
|
53
|
-
timestamp: 0,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
33
|
toString() {
|
|
57
|
-
const symbolFrom = sdk_gov_1.tokenSymbolByAddress[this.
|
|
58
|
-
const symbolTo = sdk_gov_1.tokenSymbolByAddress[this.
|
|
34
|
+
const symbolFrom = sdk_gov_1.tokenSymbolByAddress[this.tokenIn.toLowerCase()];
|
|
35
|
+
const symbolTo = sdk_gov_1.tokenSymbolByAddress[this.tokenOut.toLowerCase()];
|
|
59
36
|
if (!symbolFrom)
|
|
60
|
-
throw new Error(`Unknown token: ${this.
|
|
37
|
+
throw new Error(`Unknown token: ${this.tokenIn}`);
|
|
61
38
|
if (!symbolTo)
|
|
62
|
-
throw new Error(`Unknown token: ${this.
|
|
39
|
+
throw new Error(`Unknown token: ${this.tokenOut}`);
|
|
63
40
|
const decimalsFrom = sdk_gov_1.decimals[symbolFrom];
|
|
64
41
|
const decimalsTo = sdk_gov_1.decimals[symbolTo];
|
|
65
|
-
return `${this.operationName} ${(0,
|
|
42
|
+
return `${this.operationName} ${(0, sdk_gov_1.formatBN)(this.sourceAmount, decimalsFrom)} ${symbolFrom} ⇒ ${(0, sdk_gov_1.formatBN)(this.minExpectedAmount, decimalsTo)} ${symbolTo} on ${this.helper.name}`;
|
|
66
43
|
}
|
|
67
|
-
static getTrades({
|
|
44
|
+
static getTrades({ tokenIn, tokenOut, amount, results, creditManager, currentContracts, swapOperation, swapName, }) {
|
|
68
45
|
const trades = results.reduce((acc, tradePath) => {
|
|
69
46
|
const { calls } = tradePath;
|
|
70
47
|
const callInfo = Trade.getCallInfo(calls, creditManager.address, currentContracts);
|
|
71
48
|
const trade = new Trade({
|
|
72
49
|
tradePath,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
50
|
+
adapter: callInfo[0] || {
|
|
51
|
+
name: "unknown",
|
|
52
|
+
contractAddress: calls[0]?.target || "",
|
|
53
|
+
creditManager: creditManager.address,
|
|
54
|
+
},
|
|
55
|
+
swapOperation,
|
|
76
56
|
sourceAmount: amount,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
57
|
+
minExpectedAmount: tradePath.minAmount,
|
|
58
|
+
averageExpectedAmount: tradePath.amount,
|
|
59
|
+
tokenIn,
|
|
60
|
+
tokenOut,
|
|
61
|
+
swapName,
|
|
81
62
|
});
|
|
82
63
|
acc.push(trade);
|
|
83
64
|
return acc;
|
|
84
65
|
}, []);
|
|
85
66
|
return trades;
|
|
86
67
|
}
|
|
87
|
-
static getOperationName(tokenInAddress, tokenOutAddress) {
|
|
88
|
-
const tokenInSymbol = sdk_gov_1.tokenSymbolByAddress[tokenInAddress];
|
|
89
|
-
const tokenOutSymbol = sdk_gov_1.tokenSymbolByAddress[tokenOutAddress];
|
|
90
|
-
const tokenInIsLp = (0, sdk_gov_1.isLPToken)(tokenInSymbol);
|
|
91
|
-
const tokenOutIsLp = (0, sdk_gov_1.isLPToken)(tokenOutSymbol);
|
|
92
|
-
if (!tokenInSymbol)
|
|
93
|
-
throw new Error(`Unknown token: ${tokenInAddress}`);
|
|
94
|
-
if (!tokenOutSymbol)
|
|
95
|
-
throw new Error(`Unknown token: ${tokenOutAddress}`);
|
|
96
|
-
if (tokenInIsLp && !tokenOutIsLp)
|
|
97
|
-
return "farmWithdraw";
|
|
98
|
-
if (!tokenInIsLp && tokenOutIsLp)
|
|
99
|
-
return "farmDeposit";
|
|
100
|
-
if (!tokenInIsLp && !tokenOutIsLp)
|
|
101
|
-
return "swap";
|
|
102
|
-
return "unknownOperation";
|
|
103
|
-
}
|
|
104
68
|
static getCallInfo(calls, creditManager, currentContracts) {
|
|
105
69
|
const callAdapters = calls.reduce((acc, call) => {
|
|
106
70
|
const contractSymbol = this.getContractSymbol(call.target.toLowerCase());
|
|
107
|
-
if (!(0, sdk_gov_1.isSupportedContract)(contractSymbol))
|
|
71
|
+
if (!(0, sdk_gov_1.isSupportedContract)(contractSymbol)) {
|
|
108
72
|
return acc;
|
|
73
|
+
}
|
|
109
74
|
const { name } = sdk_gov_1.contractParams[contractSymbol];
|
|
110
75
|
const contractAddress = currentContracts[contractSymbol];
|
|
111
76
|
acc.push({
|
|
@@ -126,34 +91,20 @@ class Trade {
|
|
|
126
91
|
return undefined;
|
|
127
92
|
}
|
|
128
93
|
}
|
|
129
|
-
static getTradeId(trade) {
|
|
130
|
-
return `${trade.getName()}:${trade.expectedAmount.toString()}`;
|
|
131
|
-
}
|
|
132
94
|
static sortTrades(trades, swapStrategy) {
|
|
133
95
|
if (trades.length === 0)
|
|
134
96
|
return [];
|
|
135
|
-
const {
|
|
97
|
+
const { swapOperation } = trades[0];
|
|
136
98
|
const sorted = [...trades].sort((a, b) => {
|
|
137
99
|
const aSelected = a.getName().toLowerCase().search(swapStrategy.toLowerCase()) >= 0;
|
|
138
100
|
const bSelected = b.getName().toLowerCase().search(swapStrategy.toLowerCase()) >= 0;
|
|
139
101
|
if ((aSelected && bSelected) || (!aSelected && !bSelected)) {
|
|
140
|
-
const sign = a.
|
|
141
|
-
return
|
|
102
|
+
const sign = a.minExpectedAmount > b.minExpectedAmount ? -1 : 1;
|
|
103
|
+
return swapOperation === core_1.SwapOperation.EXACT_INPUT ? sign : -sign;
|
|
142
104
|
}
|
|
143
105
|
return aSelected ? -1 : 1;
|
|
144
106
|
});
|
|
145
107
|
return sorted;
|
|
146
108
|
}
|
|
147
|
-
static async executeMulticallPath(creditFacade, signer, calls) {
|
|
148
|
-
if (calls.length < 1)
|
|
149
|
-
throw new Error("No path to execute");
|
|
150
|
-
const safeCreditFacade = typeof creditFacade === "string"
|
|
151
|
-
? types_1.ICreditFacadeV2__factory.connect(creditFacade, signer)
|
|
152
|
-
: creditFacade;
|
|
153
|
-
return this.executeOnCreditFacade(calls, safeCreditFacade);
|
|
154
|
-
}
|
|
155
|
-
static async executeOnCreditFacade(calls, creditFacade) {
|
|
156
|
-
return creditFacade.multicall(calls);
|
|
157
|
-
}
|
|
158
109
|
}
|
|
159
110
|
exports.Trade = Trade;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SupportedContract } from "@gearbox-protocol/sdk-gov";
|
|
2
|
+
import { Asset } from "./assets";
|
|
2
3
|
import { EVMTx, EVMTxProps } from "./eventOrTx";
|
|
3
4
|
export interface TxSerialized {
|
|
4
|
-
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens";
|
|
5
|
+
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens" | "TxUpdateQuota" | "TxGaugeStake" | "TxGaugeUnstake" | "TxGaugeClaim" | "TxGaugeVote" | "TxWithdrawCollateral";
|
|
5
6
|
content: string;
|
|
6
7
|
}
|
|
7
8
|
export declare class TxSerializer {
|
|
@@ -133,9 +134,7 @@ export declare class TxClaimReward extends EVMTx {
|
|
|
133
134
|
toString(): string;
|
|
134
135
|
serialize(): TxSerialized;
|
|
135
136
|
}
|
|
136
|
-
type TxClaimNFTProps = EVMTxProps;
|
|
137
137
|
export declare class TxClaimNFT extends EVMTx {
|
|
138
|
-
constructor(opts: TxClaimNFTProps);
|
|
139
138
|
toString(): string;
|
|
140
139
|
serialize(): TxSerialized;
|
|
141
140
|
}
|
|
@@ -190,4 +189,67 @@ export declare class TxEnableTokens extends EVMTx {
|
|
|
190
189
|
toString(): string;
|
|
191
190
|
serialize(): TxSerialized;
|
|
192
191
|
}
|
|
192
|
+
interface TxUpdateQuotaProps extends EVMTxProps {
|
|
193
|
+
updatedQuotas: Array<Asset>;
|
|
194
|
+
underlyingToken: string;
|
|
195
|
+
creditManager: string;
|
|
196
|
+
}
|
|
197
|
+
export declare class TxUpdateQuota extends EVMTx {
|
|
198
|
+
readonly updatedQuotas: Array<Asset>;
|
|
199
|
+
readonly underlyingToken: string;
|
|
200
|
+
readonly creditManager: string;
|
|
201
|
+
constructor(opts: TxUpdateQuotaProps);
|
|
202
|
+
toString(): string;
|
|
203
|
+
serialize(): TxSerialized;
|
|
204
|
+
}
|
|
205
|
+
interface TxGaugeStakeProps extends EVMTxProps {
|
|
206
|
+
amount: bigint;
|
|
207
|
+
}
|
|
208
|
+
export declare class TxGaugeStake extends EVMTx {
|
|
209
|
+
readonly amount: bigint;
|
|
210
|
+
constructor(opts: TxGaugeStakeProps);
|
|
211
|
+
toString(): string;
|
|
212
|
+
serialize(): TxSerialized;
|
|
213
|
+
}
|
|
214
|
+
interface TxGaugeUnstakeProps extends EVMTxProps {
|
|
215
|
+
amount: bigint;
|
|
216
|
+
}
|
|
217
|
+
export declare class TxGaugeUnstake extends EVMTx {
|
|
218
|
+
readonly amount: bigint;
|
|
219
|
+
constructor(opts: TxGaugeUnstakeProps);
|
|
220
|
+
toString(): string;
|
|
221
|
+
serialize(): TxSerialized;
|
|
222
|
+
}
|
|
223
|
+
export declare class TxGaugeClaim extends EVMTx {
|
|
224
|
+
toString(): string;
|
|
225
|
+
serialize(): TxSerialized;
|
|
226
|
+
}
|
|
227
|
+
interface TxGaugeVoteProps extends EVMTxProps {
|
|
228
|
+
tokens: Array<{
|
|
229
|
+
token: string;
|
|
230
|
+
}>;
|
|
231
|
+
}
|
|
232
|
+
export declare class TxGaugeVote extends EVMTx {
|
|
233
|
+
readonly tokens: Array<{
|
|
234
|
+
token: string;
|
|
235
|
+
}>;
|
|
236
|
+
constructor(opts: TxGaugeVoteProps);
|
|
237
|
+
toString(): string;
|
|
238
|
+
serialize(): TxSerialized;
|
|
239
|
+
}
|
|
240
|
+
interface WithdrawCollateralProps extends EVMTxProps {
|
|
241
|
+
amount: bigint;
|
|
242
|
+
token: string;
|
|
243
|
+
to: string;
|
|
244
|
+
creditManager: string;
|
|
245
|
+
}
|
|
246
|
+
export declare class TxWithdrawCollateral extends EVMTx {
|
|
247
|
+
readonly amount: bigint;
|
|
248
|
+
readonly token: string;
|
|
249
|
+
readonly to: string;
|
|
250
|
+
readonly creditManager: string;
|
|
251
|
+
constructor(opts: WithdrawCollateralProps);
|
|
252
|
+
toString(): string;
|
|
253
|
+
serialize(): TxSerialized;
|
|
254
|
+
}
|
|
193
255
|
export {};
|