@defisaver/positions-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/aaveV2/index.d.ts +9 -0
- package/cjs/aaveV2/index.js +184 -0
- package/cjs/aaveV3/index.d.ts +33 -0
- package/cjs/aaveV3/index.js +395 -0
- package/cjs/assets/index.d.ts +4 -0
- package/cjs/assets/index.js +54 -0
- package/cjs/chickenBonds/index.d.ts +3 -0
- package/cjs/chickenBonds/index.js +24 -0
- package/cjs/compoundV2/index.d.ts +21 -0
- package/cjs/compoundV2/index.js +168 -0
- package/cjs/compoundV3/index.d.ts +37 -0
- package/cjs/compoundV3/index.js +208 -0
- package/cjs/config/contracts.d.ts +3028 -0
- package/cjs/config/contracts.js +596 -0
- package/cjs/constants/index.d.ts +4 -0
- package/cjs/constants/index.js +7 -0
- package/cjs/contracts.d.ts +40 -0
- package/cjs/contracts.js +65 -0
- package/cjs/curveUsd/index.d.ts +7 -0
- package/cjs/curveUsd/index.js +199 -0
- package/cjs/exchange/index.d.ts +3 -0
- package/cjs/exchange/index.js +23 -0
- package/cjs/helpers/aaveHelpers/index.d.ts +37 -0
- package/cjs/helpers/aaveHelpers/index.js +118 -0
- package/cjs/helpers/compoundHelpers/index.d.ts +20 -0
- package/cjs/helpers/compoundHelpers/index.js +141 -0
- package/cjs/helpers/curveUsdHelpers/index.d.ts +8 -0
- package/cjs/helpers/curveUsdHelpers/index.js +42 -0
- package/cjs/helpers/index.d.ts +5 -0
- package/cjs/helpers/index.js +31 -0
- package/cjs/helpers/makerHelpers/index.d.ts +5 -0
- package/cjs/helpers/makerHelpers/index.js +100 -0
- package/cjs/helpers/sparkHelpers/index.d.ts +21 -0
- package/cjs/helpers/sparkHelpers/index.js +96 -0
- package/cjs/index.d.ts +19 -0
- package/cjs/index.js +64 -0
- package/cjs/liquity/index.d.ts +7 -0
- package/cjs/liquity/index.js +103 -0
- package/cjs/maker/index.d.ts +5 -0
- package/cjs/maker/index.js +103 -0
- package/cjs/markets/aave/index.d.ts +12 -0
- package/cjs/markets/aave/index.js +76 -0
- package/cjs/markets/aave/marketAssets.d.ts +9 -0
- package/cjs/markets/aave/marketAssets.js +31 -0
- package/cjs/markets/compound/index.d.ts +12 -0
- package/cjs/markets/compound/index.js +85 -0
- package/cjs/markets/compound/marketsAssets.d.ts +19 -0
- package/cjs/markets/compound/marketsAssets.js +35 -0
- package/cjs/markets/curveUsd/index.d.ts +10 -0
- package/cjs/markets/curveUsd/index.js +47 -0
- package/cjs/markets/index.d.ts +4 -0
- package/cjs/markets/index.js +11 -0
- package/cjs/markets/spark/index.d.ts +9 -0
- package/cjs/markets/spark/index.js +31 -0
- package/cjs/markets/spark/marketAssets.d.ts +6 -0
- package/cjs/markets/spark/marketAssets.js +12 -0
- package/cjs/moneymarket/index.d.ts +1 -0
- package/cjs/moneymarket/index.js +17 -0
- package/cjs/moneymarket/moneymarketCommonService.d.ts +12 -0
- package/cjs/moneymarket/moneymarketCommonService.js +83 -0
- package/cjs/morphoAaveV2/index.d.ts +7 -0
- package/cjs/morphoAaveV2/index.js +209 -0
- package/cjs/morphoAaveV3/index.d.ts +7 -0
- package/cjs/morphoAaveV3/index.js +442 -0
- package/cjs/multicall/index.d.ts +3 -0
- package/cjs/multicall/index.js +31 -0
- package/cjs/services/dsrService.d.ts +3 -0
- package/cjs/services/dsrService.js +28 -0
- package/cjs/services/utils.d.ts +16 -0
- package/cjs/services/utils.js +41 -0
- package/cjs/spark/index.d.ts +34 -0
- package/cjs/spark/index.js +337 -0
- package/cjs/staking/index.d.ts +1 -0
- package/cjs/staking/index.js +17 -0
- package/cjs/staking/staking.d.ts +15 -0
- package/cjs/staking/staking.js +162 -0
- package/cjs/types/aave.d.ts +229 -0
- package/cjs/types/aave.js +10 -0
- package/cjs/types/common.d.ts +77 -0
- package/cjs/types/common.js +10 -0
- package/cjs/types/compound.d.ts +109 -0
- package/cjs/types/compound.js +10 -0
- package/cjs/types/contracts/generated/AaveLendingPoolV2.d.ts +312 -0
- package/cjs/types/contracts/generated/AaveLendingPoolV2.js +5 -0
- package/cjs/types/contracts/generated/AaveLoanInfoV2.d.ts +137 -0
- package/cjs/types/contracts/generated/AaveLoanInfoV2.js +5 -0
- package/cjs/types/contracts/generated/AaveProtocolDataProvider.d.ts +110 -0
- package/cjs/types/contracts/generated/AaveProtocolDataProvider.js +5 -0
- package/cjs/types/contracts/generated/AaveUiIncentiveDataProviderV3.d.ts +196 -0
- package/cjs/types/contracts/generated/AaveUiIncentiveDataProviderV3.js +5 -0
- package/cjs/types/contracts/generated/AaveV3LendingPool.d.ts +429 -0
- package/cjs/types/contracts/generated/AaveV3LendingPool.js +5 -0
- package/cjs/types/contracts/generated/AaveV3PoolAddressesProvider.d.ts +169 -0
- package/cjs/types/contracts/generated/AaveV3PoolAddressesProvider.js +5 -0
- package/cjs/types/contracts/generated/AaveV3ProtocolDataProvider.d.ts +131 -0
- package/cjs/types/contracts/generated/AaveV3ProtocolDataProvider.js +5 -0
- package/cjs/types/contracts/generated/AaveV3View.d.ts +301 -0
- package/cjs/types/contracts/generated/AaveV3View.js +5 -0
- package/cjs/types/contracts/generated/BalanceScanner.d.ts +37 -0
- package/cjs/types/contracts/generated/BalanceScanner.js +5 -0
- package/cjs/types/contracts/generated/CETHv3.d.ts +441 -0
- package/cjs/types/contracts/generated/CETHv3.js +5 -0
- package/cjs/types/contracts/generated/CUSDCv3.d.ts +441 -0
- package/cjs/types/contracts/generated/CUSDCv3.js +5 -0
- package/cjs/types/contracts/generated/CUSDbCv3.d.ts +441 -0
- package/cjs/types/contracts/generated/CUSDbCv3.js +5 -0
- package/cjs/types/contracts/generated/CbEth.d.ts +20 -0
- package/cjs/types/contracts/generated/CbEth.js +5 -0
- package/cjs/types/contracts/generated/ChickenBondsView.d.ts +67 -0
- package/cjs/types/contracts/generated/ChickenBondsView.js +5 -0
- package/cjs/types/contracts/generated/CollSurplusPool.d.ts +85 -0
- package/cjs/types/contracts/generated/CollSurplusPool.js +5 -0
- package/cjs/types/contracts/generated/CompV3ETHBulker.d.ts +45 -0
- package/cjs/types/contracts/generated/CompV3ETHBulker.js +5 -0
- package/cjs/types/contracts/generated/CompV3USDCBulker.d.ts +31 -0
- package/cjs/types/contracts/generated/CompV3USDCBulker.js +5 -0
- package/cjs/types/contracts/generated/CompV3USDbCBulker.d.ts +41 -0
- package/cjs/types/contracts/generated/CompV3USDbCBulker.js +5 -0
- package/cjs/types/contracts/generated/CompV3View.d.ts +249 -0
- package/cjs/types/contracts/generated/CompV3View.js +5 -0
- package/cjs/types/contracts/generated/CompoundLoanInfo.d.ts +128 -0
- package/cjs/types/contracts/generated/CompoundLoanInfo.js +5 -0
- package/cjs/types/contracts/generated/Comptroller.d.ts +317 -0
- package/cjs/types/contracts/generated/Comptroller.js +5 -0
- package/cjs/types/contracts/generated/CrvUSDETHAmm.d.ts +139 -0
- package/cjs/types/contracts/generated/CrvUSDETHAmm.js +5 -0
- package/cjs/types/contracts/generated/CrvUSDETHController.d.ts +204 -0
- package/cjs/types/contracts/generated/CrvUSDETHController.js +5 -0
- package/cjs/types/contracts/generated/CrvUSDFactory.d.ts +117 -0
- package/cjs/types/contracts/generated/CrvUSDFactory.js +5 -0
- package/cjs/types/contracts/generated/CrvUSDView.d.ts +209 -0
- package/cjs/types/contracts/generated/CrvUSDView.js +5 -0
- package/cjs/types/contracts/generated/CrvUSDWBTCAmm.d.ts +139 -0
- package/cjs/types/contracts/generated/CrvUSDWBTCAmm.js +5 -0
- package/cjs/types/contracts/generated/CrvUSDWBTCController.d.ts +204 -0
- package/cjs/types/contracts/generated/CrvUSDWBTCController.js +5 -0
- package/cjs/types/contracts/generated/CrvUSDwstETHAmm.d.ts +139 -0
- package/cjs/types/contracts/generated/CrvUSDwstETHAmm.js +5 -0
- package/cjs/types/contracts/generated/CrvUSDwstETHController.d.ts +204 -0
- package/cjs/types/contracts/generated/CrvUSDwstETHController.js +5 -0
- package/cjs/types/contracts/generated/Erc20.d.ts +119 -0
- package/cjs/types/contracts/generated/Erc20.js +5 -0
- package/cjs/types/contracts/generated/GHO.d.ts +136 -0
- package/cjs/types/contracts/generated/GHO.js +5 -0
- package/cjs/types/contracts/generated/GhoDiscountRateStrategy.d.ts +25 -0
- package/cjs/types/contracts/generated/GhoDiscountRateStrategy.js +5 -0
- package/cjs/types/contracts/generated/IAToken.d.ts +21 -0
- package/cjs/types/contracts/generated/IAToken.js +5 -0
- package/cjs/types/contracts/generated/IVariableDebtToken.d.ts +21 -0
- package/cjs/types/contracts/generated/IVariableDebtToken.js +5 -0
- package/cjs/types/contracts/generated/LendingPoolAddressesProvider.d.ts +135 -0
- package/cjs/types/contracts/generated/LendingPoolAddressesProvider.js +5 -0
- package/cjs/types/contracts/generated/Lido.d.ts +38 -0
- package/cjs/types/contracts/generated/Lido.js +5 -0
- package/cjs/types/contracts/generated/LiquityActivePool.d.ts +21 -0
- package/cjs/types/contracts/generated/LiquityActivePool.js +5 -0
- package/cjs/types/contracts/generated/LiquityView.d.ts +51 -0
- package/cjs/types/contracts/generated/LiquityView.js +5 -0
- package/cjs/types/contracts/generated/McdDog.d.ts +134 -0
- package/cjs/types/contracts/generated/McdDog.js +5 -0
- package/cjs/types/contracts/generated/McdJug.d.ts +50 -0
- package/cjs/types/contracts/generated/McdJug.js +5 -0
- package/cjs/types/contracts/generated/McdSpotter.d.ts +27 -0
- package/cjs/types/contracts/generated/McdSpotter.js +5 -0
- package/cjs/types/contracts/generated/McdVat.d.ts +78 -0
- package/cjs/types/contracts/generated/McdVat.js +5 -0
- package/cjs/types/contracts/generated/McdView.d.ts +61 -0
- package/cjs/types/contracts/generated/McdView.js +5 -0
- package/cjs/types/contracts/generated/MorphoAaveV2Proxy.d.ts +418 -0
- package/cjs/types/contracts/generated/MorphoAaveV2Proxy.js +5 -0
- package/cjs/types/contracts/generated/MorphoAaveV2View.d.ts +274 -0
- package/cjs/types/contracts/generated/MorphoAaveV2View.js +5 -0
- package/cjs/types/contracts/generated/MorphoAaveV3ProxyEthMarket.d.ts +202 -0
- package/cjs/types/contracts/generated/MorphoAaveV3ProxyEthMarket.js +5 -0
- package/cjs/types/contracts/generated/Pot.d.ts +49 -0
- package/cjs/types/contracts/generated/Pot.js +5 -0
- package/cjs/types/contracts/generated/PriceFeed.d.ts +61 -0
- package/cjs/types/contracts/generated/PriceFeed.js +5 -0
- package/cjs/types/contracts/generated/REth.d.ts +20 -0
- package/cjs/types/contracts/generated/REth.js +5 -0
- package/cjs/types/contracts/generated/SparkIncentiveDataProvider.d.ts +200 -0
- package/cjs/types/contracts/generated/SparkIncentiveDataProvider.js +5 -0
- package/cjs/types/contracts/generated/SparkLendingPool.d.ts +420 -0
- package/cjs/types/contracts/generated/SparkLendingPool.js +5 -0
- package/cjs/types/contracts/generated/SparkPoolAddressesProvider.d.ts +169 -0
- package/cjs/types/contracts/generated/SparkPoolAddressesProvider.js +5 -0
- package/cjs/types/contracts/generated/SparkProtocolDataProvider.d.ts +132 -0
- package/cjs/types/contracts/generated/SparkProtocolDataProvider.js +5 -0
- package/cjs/types/contracts/generated/SparkView.d.ts +300 -0
- package/cjs/types/contracts/generated/SparkView.js +5 -0
- package/cjs/types/contracts/generated/TroveManager.d.ts +346 -0
- package/cjs/types/contracts/generated/TroveManager.js +5 -0
- package/cjs/types/contracts/generated/UniMulticall.d.ts +55 -0
- package/cjs/types/contracts/generated/UniMulticall.js +5 -0
- package/cjs/types/contracts/generated/WstETH.d.ts +65 -0
- package/cjs/types/contracts/generated/WstETH.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +57 -0
- package/cjs/types/contracts/generated/index.js +2 -0
- package/cjs/types/contracts/generated/types.d.ts +54 -0
- package/cjs/types/contracts/generated/types.js +2 -0
- package/cjs/types/curveUsd.d.ts +101 -0
- package/cjs/types/curveUsd.js +17 -0
- package/cjs/types/index.d.ts +6 -0
- package/cjs/types/index.js +22 -0
- package/cjs/types/liquity.d.ts +28 -0
- package/cjs/types/liquity.js +18 -0
- package/cjs/types/maker.d.ts +49 -0
- package/cjs/types/maker.js +2 -0
- package/cjs/types/spark.d.ts +100 -0
- package/cjs/types/spark.js +7 -0
- package/esm/aaveV2/index.d.ts +9 -0
- package/esm/aaveV2/index.js +174 -0
- package/esm/aaveV3/index.d.ts +33 -0
- package/esm/aaveV3/index.js +382 -0
- package/esm/assets/index.d.ts +4 -0
- package/esm/assets/index.js +49 -0
- package/esm/chickenBonds/index.d.ts +3 -0
- package/esm/chickenBonds/index.js +20 -0
- package/esm/compoundV2/index.d.ts +21 -0
- package/esm/compoundV2/index.js +157 -0
- package/esm/compoundV3/index.d.ts +37 -0
- package/esm/compoundV3/index.js +198 -0
- package/esm/config/contracts.d.ts +3028 -0
- package/esm/config/contracts.js +595 -0
- package/esm/constants/index.d.ts +4 -0
- package/esm/constants/index.js +4 -0
- package/esm/contracts.d.ts +40 -0
- package/esm/contracts.js +55 -0
- package/esm/curveUsd/index.d.ts +7 -0
- package/esm/curveUsd/index.js +189 -0
- package/esm/exchange/index.d.ts +3 -0
- package/esm/exchange/index.js +19 -0
- package/esm/helpers/aaveHelpers/index.d.ts +37 -0
- package/esm/helpers/aaveHelpers/index.js +101 -0
- package/esm/helpers/compoundHelpers/index.d.ts +20 -0
- package/esm/helpers/compoundHelpers/index.js +130 -0
- package/esm/helpers/curveUsdHelpers/index.d.ts +8 -0
- package/esm/helpers/curveUsdHelpers/index.js +35 -0
- package/esm/helpers/index.d.ts +5 -0
- package/esm/helpers/index.js +5 -0
- package/esm/helpers/makerHelpers/index.d.ts +5 -0
- package/esm/helpers/makerHelpers/index.js +92 -0
- package/esm/helpers/sparkHelpers/index.d.ts +21 -0
- package/esm/helpers/sparkHelpers/index.js +84 -0
- package/esm/index.d.ts +19 -0
- package/esm/index.js +19 -0
- package/esm/liquity/index.d.ts +7 -0
- package/esm/liquity/index.js +95 -0
- package/esm/maker/index.d.ts +5 -0
- package/esm/maker/index.js +95 -0
- package/esm/markets/aave/index.d.ts +12 -0
- package/esm/markets/aave/index.js +70 -0
- package/esm/markets/aave/marketAssets.d.ts +9 -0
- package/esm/markets/aave/marketAssets.js +28 -0
- package/esm/markets/compound/index.d.ts +12 -0
- package/esm/markets/compound/index.js +78 -0
- package/esm/markets/compound/marketsAssets.d.ts +19 -0
- package/esm/markets/compound/marketsAssets.js +32 -0
- package/esm/markets/curveUsd/index.d.ts +10 -0
- package/esm/markets/curveUsd/index.js +40 -0
- package/esm/markets/index.d.ts +4 -0
- package/esm/markets/index.js +4 -0
- package/esm/markets/spark/index.d.ts +9 -0
- package/esm/markets/spark/index.js +26 -0
- package/esm/markets/spark/marketAssets.d.ts +6 -0
- package/esm/markets/spark/marketAssets.js +9 -0
- package/esm/moneymarket/index.d.ts +1 -0
- package/esm/moneymarket/index.js +1 -0
- package/esm/moneymarket/moneymarketCommonService.d.ts +12 -0
- package/esm/moneymarket/moneymarketCommonService.js +70 -0
- package/esm/morphoAaveV2/index.d.ts +7 -0
- package/esm/morphoAaveV2/index.js +199 -0
- package/esm/morphoAaveV3/index.d.ts +7 -0
- package/esm/morphoAaveV3/index.js +432 -0
- package/esm/multicall/index.d.ts +3 -0
- package/esm/multicall/index.js +27 -0
- package/esm/services/dsrService.d.ts +3 -0
- package/esm/services/dsrService.js +21 -0
- package/esm/services/utils.d.ts +16 -0
- package/esm/services/utils.js +21 -0
- package/esm/spark/index.d.ts +34 -0
- package/esm/spark/index.js +326 -0
- package/esm/staking/index.d.ts +1 -0
- package/esm/staking/index.js +1 -0
- package/esm/staking/staking.d.ts +15 -0
- package/esm/staking/staking.js +147 -0
- package/esm/types/aave.d.ts +229 -0
- package/esm/types/aave.js +7 -0
- package/esm/types/common.d.ts +77 -0
- package/esm/types/common.js +7 -0
- package/esm/types/compound.d.ts +109 -0
- package/esm/types/compound.js +7 -0
- package/esm/types/contracts/generated/AaveLendingPoolV2.d.ts +312 -0
- package/esm/types/contracts/generated/AaveLendingPoolV2.js +4 -0
- package/esm/types/contracts/generated/AaveLoanInfoV2.d.ts +137 -0
- package/esm/types/contracts/generated/AaveLoanInfoV2.js +4 -0
- package/esm/types/contracts/generated/AaveProtocolDataProvider.d.ts +110 -0
- package/esm/types/contracts/generated/AaveProtocolDataProvider.js +4 -0
- package/esm/types/contracts/generated/AaveUiIncentiveDataProviderV3.d.ts +196 -0
- package/esm/types/contracts/generated/AaveUiIncentiveDataProviderV3.js +4 -0
- package/esm/types/contracts/generated/AaveV3LendingPool.d.ts +429 -0
- package/esm/types/contracts/generated/AaveV3LendingPool.js +4 -0
- package/esm/types/contracts/generated/AaveV3PoolAddressesProvider.d.ts +169 -0
- package/esm/types/contracts/generated/AaveV3PoolAddressesProvider.js +4 -0
- package/esm/types/contracts/generated/AaveV3ProtocolDataProvider.d.ts +131 -0
- package/esm/types/contracts/generated/AaveV3ProtocolDataProvider.js +4 -0
- package/esm/types/contracts/generated/AaveV3View.d.ts +301 -0
- package/esm/types/contracts/generated/AaveV3View.js +4 -0
- package/esm/types/contracts/generated/BalanceScanner.d.ts +37 -0
- package/esm/types/contracts/generated/BalanceScanner.js +4 -0
- package/esm/types/contracts/generated/CETHv3.d.ts +441 -0
- package/esm/types/contracts/generated/CETHv3.js +4 -0
- package/esm/types/contracts/generated/CUSDCv3.d.ts +441 -0
- package/esm/types/contracts/generated/CUSDCv3.js +4 -0
- package/esm/types/contracts/generated/CUSDbCv3.d.ts +441 -0
- package/esm/types/contracts/generated/CUSDbCv3.js +4 -0
- package/esm/types/contracts/generated/CbEth.d.ts +20 -0
- package/esm/types/contracts/generated/CbEth.js +4 -0
- package/esm/types/contracts/generated/ChickenBondsView.d.ts +67 -0
- package/esm/types/contracts/generated/ChickenBondsView.js +4 -0
- package/esm/types/contracts/generated/CollSurplusPool.d.ts +85 -0
- package/esm/types/contracts/generated/CollSurplusPool.js +4 -0
- package/esm/types/contracts/generated/CompV3ETHBulker.d.ts +45 -0
- package/esm/types/contracts/generated/CompV3ETHBulker.js +4 -0
- package/esm/types/contracts/generated/CompV3USDCBulker.d.ts +31 -0
- package/esm/types/contracts/generated/CompV3USDCBulker.js +4 -0
- package/esm/types/contracts/generated/CompV3USDbCBulker.d.ts +41 -0
- package/esm/types/contracts/generated/CompV3USDbCBulker.js +4 -0
- package/esm/types/contracts/generated/CompV3View.d.ts +249 -0
- package/esm/types/contracts/generated/CompV3View.js +4 -0
- package/esm/types/contracts/generated/CompoundLoanInfo.d.ts +128 -0
- package/esm/types/contracts/generated/CompoundLoanInfo.js +4 -0
- package/esm/types/contracts/generated/Comptroller.d.ts +317 -0
- package/esm/types/contracts/generated/Comptroller.js +4 -0
- package/esm/types/contracts/generated/CrvUSDETHAmm.d.ts +139 -0
- package/esm/types/contracts/generated/CrvUSDETHAmm.js +4 -0
- package/esm/types/contracts/generated/CrvUSDETHController.d.ts +204 -0
- package/esm/types/contracts/generated/CrvUSDETHController.js +4 -0
- package/esm/types/contracts/generated/CrvUSDFactory.d.ts +117 -0
- package/esm/types/contracts/generated/CrvUSDFactory.js +4 -0
- package/esm/types/contracts/generated/CrvUSDView.d.ts +209 -0
- package/esm/types/contracts/generated/CrvUSDView.js +4 -0
- package/esm/types/contracts/generated/CrvUSDWBTCAmm.d.ts +139 -0
- package/esm/types/contracts/generated/CrvUSDWBTCAmm.js +4 -0
- package/esm/types/contracts/generated/CrvUSDWBTCController.d.ts +204 -0
- package/esm/types/contracts/generated/CrvUSDWBTCController.js +4 -0
- package/esm/types/contracts/generated/CrvUSDwstETHAmm.d.ts +139 -0
- package/esm/types/contracts/generated/CrvUSDwstETHAmm.js +4 -0
- package/esm/types/contracts/generated/CrvUSDwstETHController.d.ts +204 -0
- package/esm/types/contracts/generated/CrvUSDwstETHController.js +4 -0
- package/esm/types/contracts/generated/Erc20.d.ts +119 -0
- package/esm/types/contracts/generated/Erc20.js +4 -0
- package/esm/types/contracts/generated/GHO.d.ts +136 -0
- package/esm/types/contracts/generated/GHO.js +4 -0
- package/esm/types/contracts/generated/GhoDiscountRateStrategy.d.ts +25 -0
- package/esm/types/contracts/generated/GhoDiscountRateStrategy.js +4 -0
- package/esm/types/contracts/generated/IAToken.d.ts +21 -0
- package/esm/types/contracts/generated/IAToken.js +4 -0
- package/esm/types/contracts/generated/IVariableDebtToken.d.ts +21 -0
- package/esm/types/contracts/generated/IVariableDebtToken.js +4 -0
- package/esm/types/contracts/generated/LendingPoolAddressesProvider.d.ts +135 -0
- package/esm/types/contracts/generated/LendingPoolAddressesProvider.js +4 -0
- package/esm/types/contracts/generated/Lido.d.ts +38 -0
- package/esm/types/contracts/generated/Lido.js +4 -0
- package/esm/types/contracts/generated/LiquityActivePool.d.ts +21 -0
- package/esm/types/contracts/generated/LiquityActivePool.js +4 -0
- package/esm/types/contracts/generated/LiquityView.d.ts +51 -0
- package/esm/types/contracts/generated/LiquityView.js +4 -0
- package/esm/types/contracts/generated/McdDog.d.ts +134 -0
- package/esm/types/contracts/generated/McdDog.js +4 -0
- package/esm/types/contracts/generated/McdJug.d.ts +50 -0
- package/esm/types/contracts/generated/McdJug.js +4 -0
- package/esm/types/contracts/generated/McdSpotter.d.ts +27 -0
- package/esm/types/contracts/generated/McdSpotter.js +4 -0
- package/esm/types/contracts/generated/McdVat.d.ts +78 -0
- package/esm/types/contracts/generated/McdVat.js +4 -0
- package/esm/types/contracts/generated/McdView.d.ts +61 -0
- package/esm/types/contracts/generated/McdView.js +4 -0
- package/esm/types/contracts/generated/MorphoAaveV2Proxy.d.ts +418 -0
- package/esm/types/contracts/generated/MorphoAaveV2Proxy.js +4 -0
- package/esm/types/contracts/generated/MorphoAaveV2View.d.ts +274 -0
- package/esm/types/contracts/generated/MorphoAaveV2View.js +4 -0
- package/esm/types/contracts/generated/MorphoAaveV3ProxyEthMarket.d.ts +202 -0
- package/esm/types/contracts/generated/MorphoAaveV3ProxyEthMarket.js +4 -0
- package/esm/types/contracts/generated/Pot.d.ts +49 -0
- package/esm/types/contracts/generated/Pot.js +4 -0
- package/esm/types/contracts/generated/PriceFeed.d.ts +61 -0
- package/esm/types/contracts/generated/PriceFeed.js +4 -0
- package/esm/types/contracts/generated/REth.d.ts +20 -0
- package/esm/types/contracts/generated/REth.js +4 -0
- package/esm/types/contracts/generated/SparkIncentiveDataProvider.d.ts +200 -0
- package/esm/types/contracts/generated/SparkIncentiveDataProvider.js +4 -0
- package/esm/types/contracts/generated/SparkLendingPool.d.ts +420 -0
- package/esm/types/contracts/generated/SparkLendingPool.js +4 -0
- package/esm/types/contracts/generated/SparkPoolAddressesProvider.d.ts +169 -0
- package/esm/types/contracts/generated/SparkPoolAddressesProvider.js +4 -0
- package/esm/types/contracts/generated/SparkProtocolDataProvider.d.ts +132 -0
- package/esm/types/contracts/generated/SparkProtocolDataProvider.js +4 -0
- package/esm/types/contracts/generated/SparkView.d.ts +300 -0
- package/esm/types/contracts/generated/SparkView.js +4 -0
- package/esm/types/contracts/generated/TroveManager.d.ts +346 -0
- package/esm/types/contracts/generated/TroveManager.js +4 -0
- package/esm/types/contracts/generated/UniMulticall.d.ts +55 -0
- package/esm/types/contracts/generated/UniMulticall.js +4 -0
- package/esm/types/contracts/generated/WstETH.d.ts +65 -0
- package/esm/types/contracts/generated/WstETH.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +57 -0
- package/esm/types/contracts/generated/index.js +1 -0
- package/esm/types/contracts/generated/types.d.ts +54 -0
- package/esm/types/contracts/generated/types.js +1 -0
- package/esm/types/curveUsd.d.ts +101 -0
- package/esm/types/curveUsd.js +14 -0
- package/esm/types/index.d.ts +6 -0
- package/esm/types/index.js +6 -0
- package/esm/types/liquity.d.ts +28 -0
- package/esm/types/liquity.js +15 -0
- package/esm/types/maker.d.ts +49 -0
- package/esm/types/maker.js +1 -0
- package/esm/types/spark.d.ts +100 -0
- package/esm/types/spark.js +4 -0
- package/package.json +40 -0
- package/src/aaveV2/index.ts +219 -0
- package/src/aaveV3/index.ts +538 -0
- package/src/assets/index.ts +61 -0
- package/src/chickenBonds/index.ts +20 -0
- package/src/compoundV2/index.ts +207 -0
- package/src/compoundV3/index.ts +259 -0
- package/src/config/contracts.js +595 -0
- package/src/constants/index.ts +4 -0
- package/src/contracts.ts +95 -0
- package/src/curveUsd/index.ts +229 -0
- package/src/exchange/index.ts +17 -0
- package/src/helpers/aaveHelpers/index.ts +138 -0
- package/src/helpers/compoundHelpers/index.ts +178 -0
- package/src/helpers/curveUsdHelpers/index.ts +33 -0
- package/src/helpers/index.ts +5 -0
- package/src/helpers/makerHelpers/index.ts +95 -0
- package/src/helpers/sparkHelpers/index.ts +119 -0
- package/src/index.ts +40 -0
- package/src/liquity/index.ts +104 -0
- package/src/maker/index.ts +102 -0
- package/src/markets/aave/index.ts +80 -0
- package/src/markets/aave/marketAssets.ts +33 -0
- package/src/markets/compound/index.ts +86 -0
- package/src/markets/compound/marketsAssets.ts +36 -0
- package/src/markets/curveUsd/index.ts +43 -0
- package/src/markets/index.ts +4 -0
- package/src/markets/spark/index.ts +30 -0
- package/src/markets/spark/marketAssets.ts +10 -0
- package/src/moneymarket/index.ts +1 -0
- package/src/moneymarket/moneymarketCommonService.ts +76 -0
- package/src/morpho/markets.ts +39 -0
- package/src/morphoAaveV2/index.ts +253 -0
- package/src/morphoAaveV3/index.ts +615 -0
- package/src/multicall/index.ts +23 -0
- package/src/services/dsrService.ts +16 -0
- package/src/services/utils.ts +35 -0
- package/src/spark/index.ts +414 -0
- package/src/staking/index.ts +1 -0
- package/src/staking/staking.ts +157 -0
- package/src/types/aave.ts +256 -0
- package/src/types/common.ts +84 -0
- package/src/types/compound.ts +122 -0
- package/src/types/contracts/generated/AaveLendingPoolV2.ts +510 -0
- package/src/types/contracts/generated/AaveLoanInfoV2.ts +175 -0
- package/src/types/contracts/generated/AaveProtocolDataProvider.ts +152 -0
- package/src/types/contracts/generated/AaveUiIncentiveDataProviderV3.ts +254 -0
- package/src/types/contracts/generated/AaveV3LendingPool.ts +805 -0
- package/src/types/contracts/generated/AaveV3PoolAddressesProvider.ts +340 -0
- package/src/types/contracts/generated/AaveV3ProtocolDataProvider.ts +186 -0
- package/src/types/contracts/generated/AaveV3View.ts +402 -0
- package/src/types/contracts/generated/BalanceScanner.ts +71 -0
- package/src/types/contracts/generated/CETHv3.ts +685 -0
- package/src/types/contracts/generated/CUSDCv3.ts +688 -0
- package/src/types/contracts/generated/CUSDbCv3.ts +685 -0
- package/src/types/contracts/generated/CbEth.ts +37 -0
- package/src/types/contracts/generated/ChickenBondsView.ts +90 -0
- package/src/types/contracts/generated/CollSurplusPool.ts +185 -0
- package/src/types/contracts/generated/CompV3ETHBulker.ts +93 -0
- package/src/types/contracts/generated/CompV3USDCBulker.ts +63 -0
- package/src/types/contracts/generated/CompV3USDbCBulker.ts +85 -0
- package/src/types/contracts/generated/CompV3View.ts +325 -0
- package/src/types/contracts/generated/CompoundLoanInfo.ts +160 -0
- package/src/types/contracts/generated/Comptroller.ts +727 -0
- package/src/types/contracts/generated/CrvUSDETHAmm.ts +286 -0
- package/src/types/contracts/generated/CrvUSDETHController.ts +397 -0
- package/src/types/contracts/generated/CrvUSDFactory.ts +242 -0
- package/src/types/contracts/generated/CrvUSDView.ts +277 -0
- package/src/types/contracts/generated/CrvUSDWBTCAmm.ts +286 -0
- package/src/types/contracts/generated/CrvUSDWBTCController.ts +397 -0
- package/src/types/contracts/generated/CrvUSDwstETHAmm.ts +286 -0
- package/src/types/contracts/generated/CrvUSDwstETHController.ts +397 -0
- package/src/types/contracts/generated/Erc20.ts +216 -0
- package/src/types/contracts/generated/GHO.ts +274 -0
- package/src/types/contracts/generated/GhoDiscountRateStrategy.ts +48 -0
- package/src/types/contracts/generated/IAToken.ts +39 -0
- package/src/types/contracts/generated/IVariableDebtToken.ts +39 -0
- package/src/types/contracts/generated/LendingPoolAddressesProvider.ts +308 -0
- package/src/types/contracts/generated/Lido.ts +65 -0
- package/src/types/contracts/generated/LiquityActivePool.ts +39 -0
- package/src/types/contracts/generated/LiquityView.ts +66 -0
- package/src/types/contracts/generated/McdDog.ts +217 -0
- package/src/types/contracts/generated/McdJug.ts +86 -0
- package/src/types/contracts/generated/McdSpotter.ts +43 -0
- package/src/types/contracts/generated/McdVat.ts +170 -0
- package/src/types/contracts/generated/McdView.ts +100 -0
- package/src/types/contracts/generated/MorphoAaveV2Proxy.ts +870 -0
- package/src/types/contracts/generated/MorphoAaveV2View.ts +330 -0
- package/src/types/contracts/generated/MorphoAaveV3ProxyEthMarket.ts +338 -0
- package/src/types/contracts/generated/Pot.ts +88 -0
- package/src/types/contracts/generated/PriceFeed.ts +127 -0
- package/src/types/contracts/generated/REth.ts +37 -0
- package/src/types/contracts/generated/SparkIncentiveDataProvider.ts +264 -0
- package/src/types/contracts/generated/SparkLendingPool.ts +760 -0
- package/src/types/contracts/generated/SparkPoolAddressesProvider.ts +340 -0
- package/src/types/contracts/generated/SparkProtocolDataProvider.ts +188 -0
- package/src/types/contracts/generated/SparkView.ts +400 -0
- package/src/types/contracts/generated/TroveManager.ts +760 -0
- package/src/types/contracts/generated/UniMulticall.ts +83 -0
- package/src/types/contracts/generated/WstETH.ts +141 -0
- package/src/types/contracts/generated/index.ts +60 -0
- package/src/types/contracts/generated/types.ts +73 -0
- package/src/types/curveUsd.ts +111 -0
- package/src/types/index.ts +6 -0
- package/src/types/liquity.ts +30 -0
- package/src/types/maker.ts +51 -0
- package/src/types/spark.ts +107 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import Dec from 'decimal.js';
|
|
13
|
+
import { getAssetsTotal } from '../../moneymarket';
|
|
14
|
+
export const getCrvUsdAggregatedData = (_a) => {
|
|
15
|
+
var { loanExists, usedAssets, network, selectedMarket } = _a, rest = __rest(_a, ["loanExists", "usedAssets", "network", "selectedMarket"]);
|
|
16
|
+
const _supplied = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ supplied }) => supplied); // this is wrong if we are in soft-liquidations
|
|
17
|
+
const _borrowed = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowed }) => borrowed);
|
|
18
|
+
const _suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
|
|
19
|
+
const _borrowedUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
|
|
20
|
+
const ratio = loanExists
|
|
21
|
+
? new Dec(_suppliedUsd)
|
|
22
|
+
.dividedBy(_borrowedUsd)
|
|
23
|
+
.times(100)
|
|
24
|
+
.toString()
|
|
25
|
+
: '0';
|
|
26
|
+
// we don't have borrowLimitUsd here
|
|
27
|
+
return {
|
|
28
|
+
ratio,
|
|
29
|
+
supplied: _supplied,
|
|
30
|
+
suppliedUsd: _suppliedUsd,
|
|
31
|
+
borrowedUsd: _borrowedUsd,
|
|
32
|
+
borrowed: _borrowed,
|
|
33
|
+
safetyRatio: ratio,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Web3 from 'web3';
|
|
2
|
+
import { Blockish, NetworkNumber } from '../../types/common';
|
|
3
|
+
import { IlkInfo } from '../../types';
|
|
4
|
+
export declare const getUnclaimedCollateral: (web3: Web3, network: NetworkNumber, urn: string, ilk: string) => Promise<string>;
|
|
5
|
+
export declare const getCollateralInfo: (ilk: string, web3: Web3, network: NetworkNumber, block?: Blockish) => Promise<IlkInfo>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import Dec from 'decimal.js';
|
|
11
|
+
import { McdDogContract, McdJugContract, McdSpotterContract, McdVatContract, } from '../../contracts';
|
|
12
|
+
import { multicall } from '../../multicall';
|
|
13
|
+
import { SECONDS_PER_YEAR } from '../../constants';
|
|
14
|
+
import { bytesToString } from '../../services/utils';
|
|
15
|
+
export const getUnclaimedCollateral = (web3, network, urn, ilk) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const vatContract = McdVatContract(web3, network);
|
|
17
|
+
const coll = yield vatContract.methods.gem(ilk, urn).call();
|
|
18
|
+
return coll;
|
|
19
|
+
});
|
|
20
|
+
export const getCollateralInfo = (ilk, web3, network, block = 'latest') => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
const spotterContract = McdSpotterContract(web3, network);
|
|
22
|
+
const vatContract = McdVatContract(web3, network);
|
|
23
|
+
const dogContract = McdDogContract(web3, network);
|
|
24
|
+
const jugContract = McdJugContract(web3, network);
|
|
25
|
+
const multicallData = [
|
|
26
|
+
{
|
|
27
|
+
target: spotterContract.options.address,
|
|
28
|
+
abiItem: spotterContract.options.jsonInterface.find(({ name }) => name === 'par'),
|
|
29
|
+
params: [],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
target: spotterContract.options.address,
|
|
33
|
+
abiItem: spotterContract.options.jsonInterface.find(({ name }) => name === 'ilks'),
|
|
34
|
+
params: [ilk],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
target: vatContract.options.address,
|
|
38
|
+
abiItem: vatContract.options.jsonInterface.find(({ name }) => name === 'ilks'),
|
|
39
|
+
params: [ilk],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
target: jugContract.options.address,
|
|
43
|
+
abiItem: jugContract.options.jsonInterface.find(({ name }) => name === 'ilks'),
|
|
44
|
+
params: [ilk],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
target: jugContract.options.address,
|
|
48
|
+
abiItem: jugContract.options.jsonInterface.find(({ name }) => name === 'drip'),
|
|
49
|
+
params: [ilk],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
target: dogContract.options.address,
|
|
53
|
+
abiItem: dogContract.options.jsonInterface.find(({ name }) => name === 'chop'),
|
|
54
|
+
params: [ilk],
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
const multiRes = yield multicall(multicallData, web3, network, block);
|
|
58
|
+
const par = new Dec(multiRes[0][0].toString()).div(1e27).toString();
|
|
59
|
+
const mat = new Dec(multiRes[1][1].toString()).div(1e27).toString();
|
|
60
|
+
const art = new Dec(multiRes[2][0].toString()).toString();
|
|
61
|
+
const rate = new Dec(multiRes[2][1].toString()).toString();
|
|
62
|
+
const spot = new Dec(multiRes[2][2].toString()).div(1e27).toString();
|
|
63
|
+
const line = new Dec(multiRes[2][3].toString()).div(1e45).toString();
|
|
64
|
+
const dust = new Dec(multiRes[2][1].toString()).div(1e45).toString();
|
|
65
|
+
const duty = new Dec(multiRes[3][0].toString()).toString();
|
|
66
|
+
const futureRate = new Dec(multiRes[4][0].toString()).toString();
|
|
67
|
+
const chop = new Dec(multiRes[5][0].toString()).div(1e18).toString();
|
|
68
|
+
const stabilityFee = new Dec(duty.toString())
|
|
69
|
+
.div(1e27)
|
|
70
|
+
.pow(SECONDS_PER_YEAR)
|
|
71
|
+
.minus(1)
|
|
72
|
+
.mul(100)
|
|
73
|
+
.toNumber();
|
|
74
|
+
const liquidationFee = new Dec(chop).mul(100).sub(100).toString();
|
|
75
|
+
const globalDebtCurrent = new Dec(art).div(1e18).mul(new Dec(futureRate).div(1e27)).toString();
|
|
76
|
+
const globalDebtCeiling = line;
|
|
77
|
+
const creatableDebt = new Dec(globalDebtCeiling).sub(globalDebtCurrent).toString();
|
|
78
|
+
return {
|
|
79
|
+
ilkLabel: bytesToString(ilk),
|
|
80
|
+
currentRate: rate,
|
|
81
|
+
futureRate,
|
|
82
|
+
minDebt: dust,
|
|
83
|
+
globalDebtCurrent,
|
|
84
|
+
globalDebtCeiling,
|
|
85
|
+
assetPrice: new Dec(spot).times(par).times(mat).toString(),
|
|
86
|
+
liqRatio: mat,
|
|
87
|
+
liqPercent: +mat * 100,
|
|
88
|
+
stabilityFee,
|
|
89
|
+
liquidationFee: new Dec(liquidationFee).lt(0) ? '0' : liquidationFee,
|
|
90
|
+
creatableDebt,
|
|
91
|
+
};
|
|
92
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SparkAggregatedPositionData, SparkAssetsData, SparkHelperCommon, SparkUsedAssets } from '../../types';
|
|
2
|
+
export declare const sparkIsInIsolationMode: ({ usedAssets, assetsData }: {
|
|
3
|
+
usedAssets: SparkUsedAssets;
|
|
4
|
+
assetsData: SparkAssetsData;
|
|
5
|
+
}) => boolean;
|
|
6
|
+
export declare const sparkGetCollSuppliedAssets: ({ usedAssets }: {
|
|
7
|
+
usedAssets: SparkUsedAssets;
|
|
8
|
+
}) => import("../../types").SparkUsedAsset[];
|
|
9
|
+
export declare const sparkGetSuppliableAssets: ({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => {
|
|
10
|
+
symbol: string;
|
|
11
|
+
canBeCollateral: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const sparkGetSuppliableAsCollAssets: ({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => {
|
|
14
|
+
symbol: string;
|
|
15
|
+
canBeCollateral: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
export declare const sparkGetEmodeMutableProps: ({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon, _asset: string) => {
|
|
18
|
+
liquidationRatio: string;
|
|
19
|
+
collateralFactor: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const sparkGetAggregatedPositionData: ({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => SparkAggregatedPositionData;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import Dec from 'decimal.js';
|
|
13
|
+
import { calcLeverageLiqPrice, getAssetsTotal, isLeveragedPos } from '../../moneymarket';
|
|
14
|
+
import { calculateNetApy } from '../../staking';
|
|
15
|
+
import { wethToEth } from '../../services/utils';
|
|
16
|
+
export const sparkIsInIsolationMode = ({ usedAssets, assetsData }) => Object.values(usedAssets).some(({ symbol, collateral }) => collateral && assetsData[symbol].isIsolated);
|
|
17
|
+
export const sparkGetCollSuppliedAssets = ({ usedAssets }) => Object.values(usedAssets).filter(({ isSupplied, collateral }) => isSupplied && collateral);
|
|
18
|
+
export const sparkGetSuppliableAssets = (_a) => {
|
|
19
|
+
var { usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network } = _a, rest = __rest(_a, ["usedAssets", "eModeCategory", "eModeCategories", "assetsData", "selectedMarket", "network"]);
|
|
20
|
+
const data = Object.assign({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network }, rest);
|
|
21
|
+
const collAccountAssets = sparkGetCollSuppliedAssets(data);
|
|
22
|
+
const marketAssets = Object.values(assetsData);
|
|
23
|
+
if (sparkIsInIsolationMode(data)) {
|
|
24
|
+
const collAsset = collAccountAssets[0].symbol;
|
|
25
|
+
return marketAssets.filter(d => d.canBeSupplied).map(({ symbol }) => ({ symbol, canBeCollateral: symbol === collAsset }));
|
|
26
|
+
}
|
|
27
|
+
return marketAssets.filter(d => d.canBeSupplied).map(({ symbol, isIsolated }) => ({ symbol, canBeCollateral: !isIsolated }));
|
|
28
|
+
};
|
|
29
|
+
export const sparkGetSuppliableAsCollAssets = (_a) => {
|
|
30
|
+
var { usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network } = _a, rest = __rest(_a, ["usedAssets", "eModeCategory", "eModeCategories", "assetsData", "selectedMarket", "network"]);
|
|
31
|
+
return sparkGetSuppliableAssets(Object.assign({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network }, rest)).filter(({ canBeCollateral }) => canBeCollateral);
|
|
32
|
+
};
|
|
33
|
+
export const sparkGetEmodeMutableProps = (_a, _asset) => {
|
|
34
|
+
var _b;
|
|
35
|
+
var { usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network } = _a, rest = __rest(_a, ["usedAssets", "eModeCategory", "eModeCategories", "assetsData", "selectedMarket", "network"]);
|
|
36
|
+
const data = Object.assign({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network }, rest);
|
|
37
|
+
const asset = wethToEth(_asset);
|
|
38
|
+
const canSupplyAsColl = sparkGetSuppliableAsCollAssets(data).some(({ symbol }) => symbol === asset);
|
|
39
|
+
if (!canSupplyAsColl) {
|
|
40
|
+
return ({ liquidationRatio: '0', collateralFactor: '0' });
|
|
41
|
+
}
|
|
42
|
+
const assetData = assetsData[asset];
|
|
43
|
+
if (eModeCategory === 0
|
|
44
|
+
|| assetData.eModeCategory !== eModeCategory
|
|
45
|
+
|| new Dec(((_b = assetData === null || assetData === void 0 ? void 0 : assetData.eModeCategoryData) === null || _b === void 0 ? void 0 : _b.collateralFactor) || 0).eq(0)) {
|
|
46
|
+
const { liquidationRatio, collateralFactor } = assetData;
|
|
47
|
+
return ({ liquidationRatio, collateralFactor });
|
|
48
|
+
}
|
|
49
|
+
const { liquidationRatio, collateralFactor } = assetData.eModeCategoryData;
|
|
50
|
+
return ({ liquidationRatio, collateralFactor });
|
|
51
|
+
};
|
|
52
|
+
export const sparkGetAggregatedPositionData = (_a) => {
|
|
53
|
+
var { usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network } = _a, rest = __rest(_a, ["usedAssets", "eModeCategory", "eModeCategories", "assetsData", "selectedMarket", "network"]);
|
|
54
|
+
const data = Object.assign({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network }, rest);
|
|
55
|
+
const payload = {};
|
|
56
|
+
payload.suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
|
|
57
|
+
payload.suppliedCollateralUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ suppliedUsd }) => suppliedUsd);
|
|
58
|
+
payload.borrowedUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
|
|
59
|
+
payload.borrowLimitUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ symbol, suppliedUsd }) => new Dec(suppliedUsd).mul(sparkGetEmodeMutableProps(data, symbol).collateralFactor));
|
|
60
|
+
payload.liquidationLimitUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ symbol, suppliedUsd }) => new Dec(suppliedUsd).mul(sparkGetEmodeMutableProps(data, symbol).liquidationRatio));
|
|
61
|
+
const leftToBorrowUsd = new Dec(payload.borrowLimitUsd).sub(payload.borrowedUsd);
|
|
62
|
+
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
63
|
+
payload.ratio = +payload.suppliedUsd ? new Dec(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
64
|
+
payload.collRatio = +payload.suppliedUsd ? new Dec(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
65
|
+
const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy(usedAssets, assetsData);
|
|
66
|
+
payload.netApy = netApy;
|
|
67
|
+
payload.incentiveUsd = incentiveUsd;
|
|
68
|
+
payload.totalInterestUsd = totalInterestUsd;
|
|
69
|
+
payload.liqRatio = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
|
|
70
|
+
payload.liqPercent = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
71
|
+
const { leveragedType, leveragedAsset } = isLeveragedPos(usedAssets);
|
|
72
|
+
payload.leveragedType = leveragedType;
|
|
73
|
+
if (leveragedType !== '') {
|
|
74
|
+
payload.leveragedAsset = leveragedAsset;
|
|
75
|
+
let assetPrice = data.assetsData[leveragedAsset].price; // TODO sparkPrice or price??
|
|
76
|
+
if (leveragedType === 'lsd-leverage') {
|
|
77
|
+
// Treat ETH like a stablecoin in a long stETH position
|
|
78
|
+
payload.leveragedLsdAssetRatio = new Dec(assetsData[leveragedAsset].price).div(assetsData.ETH.price).toDP(18).toString();
|
|
79
|
+
assetPrice = new Dec(assetPrice).div(assetsData.ETH.price).toString();
|
|
80
|
+
}
|
|
81
|
+
payload.liquidationPrice = calcLeverageLiqPrice(leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
|
|
82
|
+
}
|
|
83
|
+
return payload;
|
|
84
|
+
};
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as aaveV3 from './aaveV3';
|
|
2
|
+
import * as morphoAaveV3 from './morphoAaveV3';
|
|
3
|
+
import * as aaveV2 from './aaveV2';
|
|
4
|
+
import * as morphoAaveV2 from './morphoAaveV2';
|
|
5
|
+
import * as compoundV3 from './compoundV3';
|
|
6
|
+
import * as compoundV2 from './compoundV2';
|
|
7
|
+
import * as spark from './spark';
|
|
8
|
+
import * as curveUsd from './curveUsd';
|
|
9
|
+
import * as liquity from './liquity';
|
|
10
|
+
import * as maker from './maker';
|
|
11
|
+
import * as staking from './staking';
|
|
12
|
+
import * as multicall from './multicall';
|
|
13
|
+
import * as moneymarket from './moneymarket';
|
|
14
|
+
import * as markets from './markets';
|
|
15
|
+
import * as helpers from './helpers';
|
|
16
|
+
import * as chickenBonds from './chickenBonds';
|
|
17
|
+
import * as exchange from './exchange';
|
|
18
|
+
export * from './types';
|
|
19
|
+
export { aaveV2, aaveV3, morphoAaveV2, morphoAaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, maker, chickenBonds, exchange, staking, multicall, moneymarket, markets, helpers, };
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as aaveV3 from './aaveV3';
|
|
2
|
+
import * as morphoAaveV3 from './morphoAaveV3';
|
|
3
|
+
import * as aaveV2 from './aaveV2';
|
|
4
|
+
import * as morphoAaveV2 from './morphoAaveV2';
|
|
5
|
+
import * as compoundV3 from './compoundV3';
|
|
6
|
+
import * as compoundV2 from './compoundV2';
|
|
7
|
+
import * as spark from './spark';
|
|
8
|
+
import * as curveUsd from './curveUsd';
|
|
9
|
+
import * as liquity from './liquity';
|
|
10
|
+
import * as maker from './maker';
|
|
11
|
+
import * as staking from './staking';
|
|
12
|
+
import * as multicall from './multicall';
|
|
13
|
+
import * as moneymarket from './moneymarket';
|
|
14
|
+
import * as markets from './markets';
|
|
15
|
+
import * as helpers from './helpers';
|
|
16
|
+
import * as chickenBonds from './chickenBonds';
|
|
17
|
+
import * as exchange from './exchange';
|
|
18
|
+
export * from './types';
|
|
19
|
+
export { aaveV2, aaveV3, morphoAaveV2, morphoAaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, maker, chickenBonds, exchange, staking, multicall, moneymarket, markets, helpers, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Web3 from 'web3';
|
|
2
|
+
import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
|
+
import { LiquityTroveInfo } from '../types';
|
|
4
|
+
export declare const LIQUITY_NORMAL_MODE_RATIO = 110;
|
|
5
|
+
export declare const LIQUITY_RECOVERY_MODE_RATIO = 150;
|
|
6
|
+
export declare const getLiquityAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress) => Promise<PositionBalances>;
|
|
7
|
+
export declare const getLiquityTroveInfo: (web3: Web3, network: NetworkNumber, address: string) => Promise<LiquityTroveInfo>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import Dec from 'decimal.js';
|
|
11
|
+
import { assetAmountInEth, getAssetInfo } from '@defisaver/tokens';
|
|
12
|
+
import { LiquityActivePoolContract, LiquityCollSurplusPoolContract, LiquityPriceFeedContract, LiquityTroveManagerContract, LiquityViewContract, } from '../contracts';
|
|
13
|
+
import { multicall } from '../multicall';
|
|
14
|
+
import { LIQUITY_TROVE_STATUS_ENUM } from '../types';
|
|
15
|
+
export const LIQUITY_NORMAL_MODE_RATIO = 110; // MCR
|
|
16
|
+
export const LIQUITY_RECOVERY_MODE_RATIO = 150; // CCR
|
|
17
|
+
export const getLiquityAccountBalances = (web3, network, block, addressMapping, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
let balances = {
|
|
19
|
+
collateral: {},
|
|
20
|
+
debt: {},
|
|
21
|
+
};
|
|
22
|
+
if (!address) {
|
|
23
|
+
return balances;
|
|
24
|
+
}
|
|
25
|
+
const viewContract = LiquityViewContract(web3, network, block);
|
|
26
|
+
const troveInfo = yield viewContract.methods.getTroveInfo(address).call({}, block);
|
|
27
|
+
balances = {
|
|
28
|
+
collateral: {
|
|
29
|
+
[addressMapping ? getAssetInfo('ETH', network).address.toLowerCase() : 'ETH']: troveInfo[1],
|
|
30
|
+
},
|
|
31
|
+
debt: {
|
|
32
|
+
[addressMapping ? getAssetInfo('LUSD', network).address.toLowerCase() : 'LUSD']: troveInfo[2],
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
return balances;
|
|
36
|
+
});
|
|
37
|
+
export const getLiquityTroveInfo = (web3, network, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
const viewContract = LiquityViewContract(web3, network);
|
|
39
|
+
const collSurplusPoolContract = LiquityCollSurplusPoolContract(web3, network);
|
|
40
|
+
const troveManagerContract = LiquityTroveManagerContract(web3, network);
|
|
41
|
+
const priceFeedContract = LiquityPriceFeedContract(web3, network);
|
|
42
|
+
const activePoolContract = LiquityActivePoolContract(web3, network);
|
|
43
|
+
const multicallData = [
|
|
44
|
+
{
|
|
45
|
+
target: viewContract.options.address,
|
|
46
|
+
abiItem: viewContract.options.jsonInterface.find(({ name }) => name === 'getTroveInfo'),
|
|
47
|
+
params: [address],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
target: collSurplusPoolContract.options.address,
|
|
51
|
+
abiItem: collSurplusPoolContract.options.jsonInterface.find(({ name }) => name === 'getCollateral'),
|
|
52
|
+
params: [address],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
target: troveManagerContract.options.address,
|
|
56
|
+
abiItem: troveManagerContract.options.jsonInterface.find(({ name }) => name === 'getBorrowingRateWithDecay'),
|
|
57
|
+
params: [],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
target: priceFeedContract.options.address,
|
|
61
|
+
abiItem: priceFeedContract.options.jsonInterface.find(({ name }) => name === 'fetchPrice'),
|
|
62
|
+
params: [],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
target: activePoolContract.options.address,
|
|
66
|
+
abiItem: activePoolContract.options.jsonInterface.find(({ name }) => name === 'getETH'),
|
|
67
|
+
params: [],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
target: activePoolContract.options.address,
|
|
71
|
+
abiItem: activePoolContract.options.jsonInterface.find(({ name }) => name === 'getLUSDDebt'),
|
|
72
|
+
params: [],
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
const multiRes = yield multicall(multicallData, web3, network);
|
|
76
|
+
const recoveryMode = multiRes[0][6];
|
|
77
|
+
const totalETH = multiRes[4][0];
|
|
78
|
+
const totalLUSD = multiRes[5][0];
|
|
79
|
+
const payload = {
|
|
80
|
+
troveStatus: LIQUITY_TROVE_STATUS_ENUM[+multiRes[0][0].toString()],
|
|
81
|
+
collateral: assetAmountInEth(multiRes[0][1]),
|
|
82
|
+
debtInAsset: assetAmountInEth(multiRes[0][2]),
|
|
83
|
+
TCRatio: assetAmountInEth(multiRes[0][4]),
|
|
84
|
+
recoveryMode,
|
|
85
|
+
claimableCollateral: assetAmountInEth(multiRes[1][0]),
|
|
86
|
+
borrowingRateWithDecay: assetAmountInEth(multiRes[2][0]),
|
|
87
|
+
assetPrice: assetAmountInEth(multiRes[3][0]),
|
|
88
|
+
totalETH,
|
|
89
|
+
totalLUSD,
|
|
90
|
+
minCollateralRatio: recoveryMode ? LIQUITY_RECOVERY_MODE_RATIO : LIQUITY_NORMAL_MODE_RATIO,
|
|
91
|
+
priceForRecovery: new Dec(recoveryMode ? LIQUITY_RECOVERY_MODE_RATIO : LIQUITY_NORMAL_MODE_RATIO).mul(totalLUSD).div(totalETH).div(100)
|
|
92
|
+
.toString(),
|
|
93
|
+
};
|
|
94
|
+
return payload;
|
|
95
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Web3 from 'web3';
|
|
2
|
+
import { Blockish, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
|
+
import { CdpData } from '../types';
|
|
4
|
+
export declare const getMakerAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, cdpId: string) => Promise<PositionBalances>;
|
|
5
|
+
export declare const getMakerCdpData: (web3: Web3, network: NetworkNumber, cdpId: string) => Promise<CdpData>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import Dec from 'decimal.js';
|
|
11
|
+
import { assetAmountInEth, getAssetInfo, ilkToAsset } from '@defisaver/tokens';
|
|
12
|
+
import { McdViewContract } from '../contracts';
|
|
13
|
+
import { makerHelpers } from '../helpers';
|
|
14
|
+
import { wethToEth } from '../services/utils';
|
|
15
|
+
export const getMakerAccountBalances = (web3, network, block, addressMapping, cdpId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
let balances = {
|
|
17
|
+
collateral: {},
|
|
18
|
+
debt: {},
|
|
19
|
+
};
|
|
20
|
+
if (!cdpId) {
|
|
21
|
+
return balances;
|
|
22
|
+
}
|
|
23
|
+
const viewContract = McdViewContract(web3, network, block);
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const cdpInfo = yield viewContract.methods.getCdpInfo(cdpId).call({}, block);
|
|
26
|
+
const ilkInfo = yield makerHelpers.getCollateralInfo(cdpInfo.ilk, web3, network, block);
|
|
27
|
+
const asset = wethToEth(ilkToAsset(cdpInfo.ilk));
|
|
28
|
+
balances = {
|
|
29
|
+
collateral: {
|
|
30
|
+
[addressMapping ? getAssetInfo(asset, network).address.toLowerCase() : asset]: asset === 'WBTC' ? new Dec(cdpInfo.collateral).div(1e10).floor().toString() : cdpInfo.collateral,
|
|
31
|
+
},
|
|
32
|
+
debt: {
|
|
33
|
+
[addressMapping ? getAssetInfo('DAI', network).address.toLowerCase() : 'DAI']: new Dec(cdpInfo.debt).times(ilkInfo.currentRate).div(1e27).floor()
|
|
34
|
+
.toString(),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
return balances;
|
|
38
|
+
});
|
|
39
|
+
export const getMakerCdpData = (web3, network, cdpId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const viewContract = McdViewContract(web3, network);
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
const cdpInfo = yield viewContract.methods.getCdpInfo(cdpId).call();
|
|
43
|
+
const [ilkInfo, coll] = yield Promise.all([
|
|
44
|
+
makerHelpers.getCollateralInfo(cdpInfo.ilk, web3, network),
|
|
45
|
+
makerHelpers.getUnclaimedCollateral(web3, network, cdpInfo.urn, cdpInfo.ilk),
|
|
46
|
+
]);
|
|
47
|
+
const asset = ilkToAsset(cdpInfo.ilk);
|
|
48
|
+
const collateralUsd = new Dec(cdpInfo.collateral).mul(ilkInfo.assetPrice).floor().toString();
|
|
49
|
+
const debt = new Dec(cdpInfo.debt).times(ilkInfo.currentRate).div(1e27).floor()
|
|
50
|
+
.toString();
|
|
51
|
+
const futureDebt = new Dec(cdpInfo.debt).times(ilkInfo.futureRate).div(1e27).floor()
|
|
52
|
+
.toString(); // after drip
|
|
53
|
+
const debtDripDelta = assetAmountInEth(new Dec(futureDebt).sub(debt).toString(), 'DAI');
|
|
54
|
+
const liquidationPrice = new Dec(debt).times(ilkInfo.liqRatio).div(cdpInfo.collateral).toString();
|
|
55
|
+
let ratio = new Dec(cdpInfo.collateral).times(ilkInfo.assetPrice).div(debt).times(100)
|
|
56
|
+
.toString();
|
|
57
|
+
if (new Dec(debt).eq(0))
|
|
58
|
+
ratio = '0';
|
|
59
|
+
const debtTooLow = new Dec(debt).gt(0) && new Dec(assetAmountInEth(debt, 'DAI')).lt(ilkInfo.minDebt);
|
|
60
|
+
const par = '1';
|
|
61
|
+
return {
|
|
62
|
+
owner: cdpInfo.owner,
|
|
63
|
+
userAddress: cdpInfo.userAddr,
|
|
64
|
+
id: cdpId,
|
|
65
|
+
urn: cdpInfo.urn,
|
|
66
|
+
type: 'mcd',
|
|
67
|
+
ilk: cdpInfo.ilk,
|
|
68
|
+
ilkLabel: ilkInfo.ilkLabel,
|
|
69
|
+
asset,
|
|
70
|
+
collateral: assetAmountInEth(cdpInfo.collateral, `MCD-${asset}`),
|
|
71
|
+
collateralUsd: assetAmountInEth(collateralUsd, `MCD-${asset}`),
|
|
72
|
+
futureDebt: assetAmountInEth(futureDebt, 'DAI'),
|
|
73
|
+
debtDai: assetAmountInEth(debt, 'DAI'),
|
|
74
|
+
debtUsd: assetAmountInEth(debt, 'DAI'),
|
|
75
|
+
debtInAsset: assetAmountInEth(debt, 'DAI'),
|
|
76
|
+
debtAssetPrice: par,
|
|
77
|
+
debtAssetMarketPrice: par,
|
|
78
|
+
liquidationPrice,
|
|
79
|
+
ratio,
|
|
80
|
+
liqRatio: ilkInfo.liqRatio.toString(),
|
|
81
|
+
liqPercent: parseFloat(ilkInfo.liqPercent.toString()),
|
|
82
|
+
assetPrice: ilkInfo.assetPrice,
|
|
83
|
+
daiLabel: 'DAI',
|
|
84
|
+
debtAsset: 'DAI',
|
|
85
|
+
unclaimedCollateral: assetAmountInEth(coll, asset),
|
|
86
|
+
debtTooLow,
|
|
87
|
+
minDebt: ilkInfo.minDebt,
|
|
88
|
+
stabilityFee: ilkInfo.stabilityFee,
|
|
89
|
+
creatableDebt: ilkInfo.creatableDebt,
|
|
90
|
+
globalDebtCeiling: ilkInfo.globalDebtCeiling,
|
|
91
|
+
globalDebtCurrent: ilkInfo.globalDebtCurrent,
|
|
92
|
+
liquidationFee: ilkInfo.liquidationFee,
|
|
93
|
+
lastUpdated: Date.now(),
|
|
94
|
+
};
|
|
95
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AaveMarketInfo, MorphoAaveV2MarketInfo, MorphoAaveV3MarketInfo } from '../../types';
|
|
2
|
+
import { NetworkNumber } from '../../types/common';
|
|
3
|
+
export declare const AAVE_V2: AaveMarketInfo;
|
|
4
|
+
export declare const AAVE_V3: (networkId: NetworkNumber) => AaveMarketInfo;
|
|
5
|
+
export declare const MORPHO_AAVE_V2: MorphoAaveV2MarketInfo;
|
|
6
|
+
export declare const MORPHO_AAVE_V3_ETH: (networkId?: NetworkNumber) => MorphoAaveV3MarketInfo;
|
|
7
|
+
export declare const AaveMarkets: (networkId: NetworkNumber) => {
|
|
8
|
+
readonly v2default: AaveMarketInfo;
|
|
9
|
+
readonly v3default: AaveMarketInfo;
|
|
10
|
+
readonly morphoAaveV3Eth: MorphoAaveV3MarketInfo;
|
|
11
|
+
readonly morphoAaveV2: MorphoAaveV2MarketInfo;
|
|
12
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { getConfigContractAddress } from '../../contracts';
|
|
2
|
+
import { AaveVersions, } from '../../types';
|
|
3
|
+
import { NetworkNumber } from '../../types/common';
|
|
4
|
+
import { aaveV2AssetsDefaultMarket, aaveV3AssetsDefaultMarket, morphoAaveV2AssetDefaultMarket, morphoAaveV3AssetEthMarket, } from './marketAssets';
|
|
5
|
+
export const AAVE_V2 = {
|
|
6
|
+
chainIds: [1],
|
|
7
|
+
label: 'Aave v2',
|
|
8
|
+
shortLabel: 'v2',
|
|
9
|
+
value: AaveVersions.AaveV2,
|
|
10
|
+
url: 'default',
|
|
11
|
+
assets: aaveV2AssetsDefaultMarket,
|
|
12
|
+
provider: 'LendingPoolAddressesProvider',
|
|
13
|
+
providerAddress: getConfigContractAddress('LendingPoolAddressesProvider', 1),
|
|
14
|
+
lendingPool: 'AaveLendingPoolV2',
|
|
15
|
+
lendingPoolAddress: getConfigContractAddress('AaveLendingPoolV2', 1),
|
|
16
|
+
protocolData: 'AaveProtocolDataProvider',
|
|
17
|
+
protocolDataAddress: getConfigContractAddress('AaveProtocolDataProvider', 1),
|
|
18
|
+
// icon: SvgAdapter(protocolIcons.aave),
|
|
19
|
+
protocolName: 'aave',
|
|
20
|
+
};
|
|
21
|
+
export const AAVE_V3 = (networkId) => ({
|
|
22
|
+
chainIds: [NetworkNumber.Eth, NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base],
|
|
23
|
+
label: 'Aave v3',
|
|
24
|
+
shortLabel: 'v3',
|
|
25
|
+
value: AaveVersions.AaveV3,
|
|
26
|
+
url: 'default',
|
|
27
|
+
assets: networkId ? aaveV3AssetsDefaultMarket[networkId] : [],
|
|
28
|
+
provider: 'AaveV3PoolAddressesProvider',
|
|
29
|
+
providerAddress: getConfigContractAddress('AaveV3PoolAddressesProvider', networkId),
|
|
30
|
+
lendingPool: 'AaveV3LendingPool',
|
|
31
|
+
lendingPoolAddress: getConfigContractAddress('AaveV3LendingPool', networkId),
|
|
32
|
+
protocolData: 'AaveV3ProtocolDataProvider',
|
|
33
|
+
protocolDataAddress: getConfigContractAddress('AaveV3ProtocolDataProvider', networkId),
|
|
34
|
+
// icon: SvgAdapter(protocolIcons.aave),
|
|
35
|
+
protocolName: 'aave',
|
|
36
|
+
});
|
|
37
|
+
export const MORPHO_AAVE_V2 = {
|
|
38
|
+
chainIds: [1],
|
|
39
|
+
label: 'Morpho-Aave V2',
|
|
40
|
+
shortLabel: 'morpho-aave-v2',
|
|
41
|
+
value: AaveVersions.MorphoAaveV2,
|
|
42
|
+
url: '',
|
|
43
|
+
assets: morphoAaveV2AssetDefaultMarket,
|
|
44
|
+
providerAddress: getConfigContractAddress('LendingPoolAddressesProvider', 1),
|
|
45
|
+
lendingPoolAddress: getConfigContractAddress('MorphoAaveV2Proxy', 1),
|
|
46
|
+
// icon: SvgAdapter(protocolIcons.morpho),
|
|
47
|
+
protocolName: 'morpho',
|
|
48
|
+
};
|
|
49
|
+
export const MORPHO_AAVE_V3_ETH = (networkId = NetworkNumber.Eth) => ({
|
|
50
|
+
chainIds: [1],
|
|
51
|
+
label: 'Morpho-Aave V3',
|
|
52
|
+
shortLabel: 'morpho-aave-v3',
|
|
53
|
+
subVersionLabel: 'ETH Optimizer',
|
|
54
|
+
value: AaveVersions.MorphoAaveV3Eth,
|
|
55
|
+
url: 'eth-optimizer',
|
|
56
|
+
assets: morphoAaveV3AssetEthMarket,
|
|
57
|
+
providerAddress: getConfigContractAddress('AaveV3PoolAddressesProvider', networkId),
|
|
58
|
+
protocolData: 'AaveV3ProtocolDataProvider',
|
|
59
|
+
protocolDataAddress: getConfigContractAddress('AaveV3ProtocolDataProvider', networkId),
|
|
60
|
+
lendingPool: 'MorphoAaveV3ProxyEthMarket',
|
|
61
|
+
lendingPoolAddress: getConfigContractAddress('MorphoAaveV3ProxyEthMarket', 1),
|
|
62
|
+
// icon: SvgAdapter(protocolIcons.morpho),
|
|
63
|
+
protocolName: 'morpho',
|
|
64
|
+
});
|
|
65
|
+
export const AaveMarkets = (networkId) => ({
|
|
66
|
+
[AaveVersions.AaveV2]: AAVE_V2,
|
|
67
|
+
[AaveVersions.AaveV3]: AAVE_V3(networkId),
|
|
68
|
+
[AaveVersions.MorphoAaveV3Eth]: MORPHO_AAVE_V3_ETH(networkId),
|
|
69
|
+
[AaveVersions.MorphoAaveV2]: MORPHO_AAVE_V2,
|
|
70
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const aaveV2AssetsDefaultMarket: readonly ["AAVE", "BAL", "BAT", "BUSD", "CRV", "DAI", "ENJ", "ETH", "GUSD", "LINK", "MANA", "MKR", "REN", "SNX", "SUSD", "TUSD", "UNI", "USDC", "USDT", "WBTC", "YFI", "xSUSHI", "ZRX", "RAI", "AMPL", "DPI", "USDP", "RENFIL", "FRAX", "FEI", "stETH", "ENS", "UST", "CVX", "1INCH", "LUSD"];
|
|
2
|
+
export declare const morphoAaveV2AssetDefaultMarket: string[];
|
|
3
|
+
export declare const morphoAaveV3AssetEthMarket: string[];
|
|
4
|
+
export declare const aaveV3AssetsDefaultMarket: {
|
|
5
|
+
readonly 1: readonly ["WBTC", "ETH", "wstETH", "USDC", "DAI", "LINK", "AAVE", "cbETH", "USDT", "rETH", "LUSD", "UNI", "MKR", "SNX", "BAL", "LDO", "CRV", "ENS", "1INCH", "GHO", "FRAX", "RPL", "sDAI"];
|
|
6
|
+
readonly 10: readonly ["DAI", "USDC.e", "USDT", "SUSD", "AAVE", "LINK", "WBTC", "ETH", "OP", "wstETH", "LUSD", "MAI", "rETH"];
|
|
7
|
+
readonly 42161: readonly ["ETH", "DAI", "EURS", "USDC", "USDT", "AAVE", "LINK", "WBTC", "wstETH", "MAI", "rETH", "LUSD", "USDC.e", "FRAX", "ARB"];
|
|
8
|
+
readonly 8453: readonly ["ETH", "USDbC", "cbETH"];
|
|
9
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// TODO generate this file automatically
|
|
2
|
+
import { NetworkNumber } from '../../types/common';
|
|
3
|
+
export const aaveV2AssetsDefaultMarket = [
|
|
4
|
+
'AAVE', 'BAL', 'BAT', 'BUSD', 'CRV', 'DAI', 'ENJ', 'ETH', 'GUSD', 'LINK', 'MANA', 'MKR',
|
|
5
|
+
'REN', 'SNX', 'SUSD', 'TUSD', 'UNI', 'USDC', 'USDT', 'WBTC', 'YFI', 'xSUSHI', 'ZRX', 'RAI',
|
|
6
|
+
'AMPL', 'DPI', 'USDP', 'RENFIL', 'FRAX', 'FEI', 'stETH', 'ENS', 'UST', 'CVX', '1INCH', 'LUSD',
|
|
7
|
+
];
|
|
8
|
+
export const morphoAaveV2AssetDefaultMarket = [
|
|
9
|
+
'ETH', 'stETH', 'USDC', 'WBTC', 'USDT', 'DAI', 'CRV',
|
|
10
|
+
];
|
|
11
|
+
export const morphoAaveV3AssetEthMarket = [
|
|
12
|
+
'ETH', 'wstETH', 'DAI', 'USDC', 'WBTC', 'rETH', 'cbETH',
|
|
13
|
+
];
|
|
14
|
+
export const aaveV3AssetsDefaultMarket = {
|
|
15
|
+
[NetworkNumber.Eth]: [
|
|
16
|
+
'WBTC', 'ETH', 'wstETH', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'UNI', 'MKR', 'SNX', 'BAL',
|
|
17
|
+
'LDO', 'CRV', 'ENS', '1INCH', 'GHO', 'FRAX', 'RPL', 'sDAI',
|
|
18
|
+
],
|
|
19
|
+
[NetworkNumber.Opt]: [
|
|
20
|
+
'DAI', 'USDC.e', 'USDT', 'SUSD', 'AAVE', 'LINK', 'WBTC', 'ETH', 'OP', 'wstETH', 'LUSD', 'MAI', 'rETH',
|
|
21
|
+
],
|
|
22
|
+
[NetworkNumber.Arb]: [
|
|
23
|
+
'ETH', 'DAI', 'EURS', 'USDC', 'USDT', 'AAVE', 'LINK', 'WBTC', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC.e', 'FRAX', 'ARB',
|
|
24
|
+
],
|
|
25
|
+
[NetworkNumber.Base]: [
|
|
26
|
+
'ETH', 'USDbC', 'cbETH',
|
|
27
|
+
],
|
|
28
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CompoundMarketData } from '../../types';
|
|
2
|
+
import { NetworkNumber } from '../../types/common';
|
|
3
|
+
export declare const COMPOUND_V2: CompoundMarketData;
|
|
4
|
+
export declare const COMPOUND_V3_USDC: (networkId: NetworkNumber) => CompoundMarketData;
|
|
5
|
+
export declare const COMPOUND_V3_ETH: (networkId: NetworkNumber) => CompoundMarketData;
|
|
6
|
+
export declare const COMPOUND_V3_USDBC: (networkId: NetworkNumber) => CompoundMarketData;
|
|
7
|
+
export declare const CompoundMarkets: (networkId: NetworkNumber) => {
|
|
8
|
+
readonly v2: CompoundMarketData;
|
|
9
|
+
readonly "v3-ETH": CompoundMarketData;
|
|
10
|
+
readonly "v3-USDC": CompoundMarketData;
|
|
11
|
+
readonly "v3-USDbC": CompoundMarketData;
|
|
12
|
+
};
|