@defisaver/positions-sdk 1.0.11-fluid-dev9 → 1.0.11-fluid-dev11

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.
Files changed (78) hide show
  1. package/.mocharc.json +4 -4
  2. package/.nvmrc +1 -1
  3. package/README.md +69 -69
  4. package/cjs/config/contracts.js +2 -2
  5. package/cjs/fluid/index.js +33 -8
  6. package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
  7. package/esm/config/contracts.js +2 -2
  8. package/esm/fluid/index.js +33 -8
  9. package/esm/helpers/morphoBlueHelpers/index.js +66 -66
  10. package/package.json +54 -54
  11. package/src/aaveV2/index.ts +227 -227
  12. package/src/aaveV3/index.ts +624 -624
  13. package/src/assets/index.ts +60 -60
  14. package/src/chickenBonds/index.ts +123 -123
  15. package/src/compoundV2/index.ts +220 -220
  16. package/src/compoundV3/index.ts +291 -291
  17. package/src/config/contracts.js +1155 -1155
  18. package/src/constants/index.ts +6 -6
  19. package/src/contracts.ts +135 -135
  20. package/src/curveUsd/index.ts +239 -239
  21. package/src/eulerV2/index.ts +303 -303
  22. package/src/exchange/index.ts +17 -17
  23. package/src/fluid/index.ts +1261 -1224
  24. package/src/helpers/aaveHelpers/index.ts +203 -203
  25. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  26. package/src/helpers/compoundHelpers/index.ts +248 -248
  27. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  28. package/src/helpers/eulerHelpers/index.ts +234 -234
  29. package/src/helpers/fluidHelpers/index.ts +294 -294
  30. package/src/helpers/index.ts +11 -11
  31. package/src/helpers/liquityV2Helpers/index.ts +80 -80
  32. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  33. package/src/helpers/makerHelpers/index.ts +94 -94
  34. package/src/helpers/morphoBlueHelpers/index.ts +367 -367
  35. package/src/helpers/sparkHelpers/index.ts +154 -154
  36. package/src/index.ts +52 -52
  37. package/src/liquity/index.ts +116 -116
  38. package/src/liquityV2/index.ts +295 -295
  39. package/src/llamaLend/index.ts +275 -275
  40. package/src/maker/index.ts +117 -117
  41. package/src/markets/aave/index.ts +152 -152
  42. package/src/markets/aave/marketAssets.ts +46 -46
  43. package/src/markets/compound/index.ts +213 -213
  44. package/src/markets/compound/marketsAssets.ts +82 -82
  45. package/src/markets/curveUsd/index.ts +69 -69
  46. package/src/markets/euler/index.ts +26 -26
  47. package/src/markets/fluid/index.ts +2454 -2454
  48. package/src/markets/index.ts +27 -27
  49. package/src/markets/liquityV2/index.ts +54 -54
  50. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  51. package/src/markets/llamaLend/index.ts +235 -235
  52. package/src/markets/morphoBlue/index.ts +895 -895
  53. package/src/markets/spark/index.ts +29 -29
  54. package/src/markets/spark/marketAssets.ts +10 -10
  55. package/src/moneymarket/moneymarketCommonService.ts +80 -80
  56. package/src/morphoAaveV2/index.ts +256 -256
  57. package/src/morphoAaveV3/index.ts +630 -630
  58. package/src/morphoBlue/index.ts +202 -202
  59. package/src/multicall/index.ts +33 -33
  60. package/src/services/priceService.ts +130 -130
  61. package/src/services/utils.ts +59 -59
  62. package/src/setup.ts +8 -8
  63. package/src/spark/index.ts +460 -460
  64. package/src/staking/staking.ts +217 -217
  65. package/src/types/aave.ts +275 -275
  66. package/src/types/chickenBonds.ts +45 -45
  67. package/src/types/common.ts +84 -84
  68. package/src/types/compound.ts +133 -133
  69. package/src/types/curveUsd.ts +119 -119
  70. package/src/types/euler.ts +173 -173
  71. package/src/types/fluid.ts +325 -325
  72. package/src/types/index.ts +11 -11
  73. package/src/types/liquity.ts +30 -30
  74. package/src/types/liquityV2.ts +119 -119
  75. package/src/types/llamaLend.ts +155 -155
  76. package/src/types/maker.ts +50 -50
  77. package/src/types/morphoBlue.ts +194 -194
  78. package/src/types/spark.ts +135 -135
@@ -1147,8 +1147,8 @@ module.exports = {
1147
1147
  "abi": [{ "inputs": [{ "internalType": "address", "name": "_vault", "type": "address" }, { "internalType": "uint256", "name": "_token0Amount", "type": "uint256" }, { "internalType": "uint256", "name": "_token1Amount", "type": "uint256" }, { "internalType": "uint256", "name": "_maxSharesAmount", "type": "uint256" }], "name": "estimateBorrow", "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_vault", "type": "address" }, { "internalType": "uint256", "name": "_token0Amount", "type": "uint256" }, { "internalType": "uint256", "name": "_token1Amount", "type": "uint256" }, { "internalType": "uint256", "name": "_minSharesAmount", "type": "uint256" }], "name": "estimateDeposit", "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_nftId", "type": "uint256" }, { "internalType": "uint256", "name": "_minToken0AmountToAccept", "type": "uint256" }, { "internalType": "uint256", "name": "_minToken1AmountToAccept", "type": "uint256" }], "name": "estimateDexPositionCollateralInOneToken", "outputs": [{ "internalType": "uint256", "name": "collateral", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_nftId", "type": "uint256" }, { "internalType": "uint256", "name": "_maxToken0AmountToPayback", "type": "uint256" }, { "internalType": "uint256", "name": "_maxToken1AmountToPayback", "type": "uint256" }], "name": "estimateDexPositionDebtInOneToken", "outputs": [{ "internalType": "uint256", "name": "debt", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_vault", "type": "address" }, { "internalType": "uint256", "name": "_token0Amount", "type": "uint256" }, { "internalType": "uint256", "name": "_token1Amount", "type": "uint256" }, { "internalType": "uint256", "name": "_minSharesAmount", "type": "uint256" }], "name": "estimatePayback", "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_vault", "type": "address" }, { "internalType": "uint256", "name": "_token0Amount", "type": "uint256" }, { "internalType": "uint256", "name": "_token1Amount", "type": "uint256" }, { "internalType": "uint256", "name": "_maxSharesAmount", "type": "uint256" }], "name": "estimateWithdraw", "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "getAllFTokens", "outputs": [{ "internalType": "address[]", "name": "", "type": "address[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getAllFTokensData", "outputs": [{ "components": [{ "internalType": "address", "name": "tokenAddress", "type": "address" }, { "internalType": "bool", "name": "isNativeUnderlying", "type": "bool" }, { "internalType": "string", "name": "name", "type": "string" }, { "internalType": "string", "name": "symbol", "type": "string" }, { "internalType": "uint256", "name": "decimals", "type": "uint256" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "totalAssets", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupply", "type": "uint256" }, { "internalType": "uint256", "name": "convertToShares", "type": "uint256" }, { "internalType": "uint256", "name": "convertToAssets", "type": "uint256" }, { "internalType": "uint256", "name": "rewardsRate", "type": "uint256" }, { "internalType": "uint256", "name": "supplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawable", "type": "uint256" }, { "internalType": "bool", "name": "modeWithInterest", "type": "bool" }, { "internalType": "uint256", "name": "expandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "expandDuration", "type": "uint256" }], "internalType": "struct FluidView.FTokenData[]", "name": "", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], "name": "getAllUserEarnPositionsWithFTokens", "outputs": [{ "components": [{ "internalType": "uint256", "name": "fTokenShares", "type": "uint256" }, { "internalType": "uint256", "name": "underlyingAssets", "type": "uint256" }, { "internalType": "uint256", "name": "underlyingBalance", "type": "uint256" }, { "internalType": "uint256", "name": "allowance", "type": "uint256" }], "internalType": "struct FluidView.UserEarnPosition[]", "name": "userPositions", "type": "tuple[]" }, { "components": [{ "internalType": "address", "name": "tokenAddress", "type": "address" }, { "internalType": "bool", "name": "isNativeUnderlying", "type": "bool" }, { "internalType": "string", "name": "name", "type": "string" }, { "internalType": "string", "name": "symbol", "type": "string" }, { "internalType": "uint256", "name": "decimals", "type": "uint256" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "totalAssets", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupply", "type": "uint256" }, { "internalType": "uint256", "name": "convertToShares", "type": "uint256" }, { "internalType": "uint256", "name": "convertToAssets", "type": "uint256" }, { "internalType": "uint256", "name": "rewardsRate", "type": "uint256" }, { "internalType": "uint256", "name": "supplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawable", "type": "uint256" }, { "internalType": "bool", "name": "modeWithInterest", "type": "bool" }, { "internalType": "uint256", "name": "expandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "expandDuration", "type": "uint256" }], "internalType": "struct FluidView.FTokenData[]", "name": "fTokensData", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_vault", "type": "address" }], "name": "getDexShareRates", "outputs": [{ "internalType": "uint256", "name": "token0PerSupplyShare", "type": "uint256" }, { "internalType": "uint256", "name": "token1PerSupplyShare", "type": "uint256" }, { "internalType": "uint256", "name": "token0PerBorrowShare", "type": "uint256" }, { "internalType": "uint256", "name": "token1PerBorrowShare", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_fToken", "type": "address" }], "name": "getFTokenData", "outputs": [{ "components": [{ "internalType": "address", "name": "tokenAddress", "type": "address" }, { "internalType": "bool", "name": "isNativeUnderlying", "type": "bool" }, { "internalType": "string", "name": "name", "type": "string" }, { "internalType": "string", "name": "symbol", "type": "string" }, { "internalType": "uint256", "name": "decimals", "type": "uint256" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "totalAssets", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupply", "type": "uint256" }, { "internalType": "uint256", "name": "convertToShares", "type": "uint256" }, { "internalType": "uint256", "name": "convertToAssets", "type": "uint256" }, { "internalType": "uint256", "name": "rewardsRate", "type": "uint256" }, { "internalType": "uint256", "name": "supplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawable", "type": "uint256" }, { "internalType": "bool", "name": "modeWithInterest", "type": "bool" }, { "internalType": "uint256", "name": "expandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "expandDuration", "type": "uint256" }], "internalType": "struct FluidView.FTokenData", "name": "fTokenData", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_nftId", "type": "uint256" }], "name": "getPositionByNftId", "outputs": [{ "components": [{ "internalType": "uint256", "name": "nftId", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "bool", "name": "isLiquidated", "type": "bool" }, { "internalType": "bool", "name": "isSupplyPosition", "type": "bool" }, { "internalType": "uint256", "name": "supply", "type": "uint256" }, { "internalType": "uint256", "name": "borrow", "type": "uint256" }, { "internalType": "uint256", "name": "ratio", "type": "uint256" }, { "internalType": "int256", "name": "tick", "type": "int256" }, { "internalType": "uint256", "name": "tickId", "type": "uint256" }], "internalType": "struct FluidView.UserPosition", "name": "position", "type": "tuple" }, { "components": [{ "internalType": "address", "name": "vault", "type": "address" }, { "internalType": "uint256", "name": "vaultId", "type": "uint256" }, { "internalType": "uint256", "name": "vaultType", "type": "uint256" }, { "internalType": "bool", "name": "isSmartColl", "type": "bool" }, { "internalType": "bool", "name": "isSmartDebt", "type": "bool" }, { "internalType": "address", "name": "supplyToken0", "type": "address" }, { "internalType": "address", "name": "supplyToken1", "type": "address" }, { "internalType": "address", "name": "borrowToken0", "type": "address" }, { "internalType": "address", "name": "borrowToken1", "type": "address" }, { "internalType": "uint256", "name": "supplyToken0Decimals", "type": "uint256" }, { "internalType": "uint256", "name": "supplyToken1Decimals", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken0Decimals", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken1Decimals", "type": "uint256" }, { "internalType": "uint16", "name": "collateralFactor", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationThreshold", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationMaxLimit", "type": "uint16" }, { "internalType": "uint16", "name": "withdrawalGap", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationPenalty", "type": "uint16" }, { "internalType": "uint16", "name": "borrowFee", "type": "uint16" }, { "internalType": "address", "name": "oracle", "type": "address" }, { "internalType": "uint256", "name": "oraclePriceOperate", "type": "uint256" }, { "internalType": "uint256", "name": "oraclePriceLiquidate", "type": "uint256" }, { "internalType": "uint256", "name": "vaultSupplyExchangePrice", "type": "uint256" }, { "internalType": "uint256", "name": "vaultBorrowExchangePrice", "type": "uint256" }, { "internalType": "int256", "name": "supplyRateVault", "type": "int256" }, { "internalType": "int256", "name": "borrowRateVault", "type": "int256" }, { "internalType": "int256", "name": "rewardsOrFeeRateSupply", "type": "int256" }, { "internalType": "int256", "name": "rewardsOrFeeRateBorrow", "type": "int256" }, { "internalType": "uint256", "name": "totalPositions", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupplyVault", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowVault", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawalLimit", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawableUntilLimit", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "baseWithdrawalLimit", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawExpandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawExpandDuration", "type": "uint256" }, { "internalType": "uint256", "name": "borrowLimit", "type": "uint256" }, { "internalType": "uint256", "name": "borrowableUntilLimit", "type": "uint256" }, { "internalType": "uint256", "name": "borrowable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowLimitUtilization", "type": "uint256" }, { "internalType": "uint256", "name": "maxBorrowLimit", "type": "uint256" }, { "internalType": "uint256", "name": "borrowExpandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "borrowExpandDuration", "type": "uint256" }, { "internalType": "uint256", "name": "baseBorrowLimit", "type": "uint256" }, { "internalType": "uint256", "name": "minimumBorrowing", "type": "uint256" }, { "components": [{ "internalType": "address", "name": "dexPool", "type": "address" }, { "internalType": "uint256", "name": "dexId", "type": "uint256" }, { "internalType": "uint256", "name": "fee", "type": "uint256" }, { "internalType": "uint256", "name": "lastStoredPrice", "type": "uint256" }, { "internalType": "uint256", "name": "centerPrice", "type": "uint256" }, { "internalType": "uint256", "name": "token0Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "token1Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupplyShares", "type": "uint256" }, { "internalType": "uint256", "name": "maxSupplyShares", "type": "uint256" }, { "internalType": "uint256", "name": "token0Supplied", "type": "uint256" }, { "internalType": "uint256", "name": "token1Supplied", "type": "uint256" }, { "internalType": "uint256", "name": "sharesWithdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "token0Withdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "token1Withdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "token0PerSupplyShare", "type": "uint256" }, { "internalType": "uint256", "name": "token1PerSupplyShare", "type": "uint256" }, { "internalType": "uint256", "name": "token0SupplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "token1SupplyRate", "type": "uint256" }, { "internalType": "address", "name": "quoteToken", "type": "address" }, { "internalType": "uint256", "name": "quoteTokensPerShare", "type": "uint256" }, { "internalType": "uint256", "name": "supplyToken0Reserves", "type": "uint256" }, { "internalType": "uint256", "name": "supplyToken1Reserves", "type": "uint256" }], "internalType": "struct FluidView.DexSupplyData", "name": "dexSupplyData", "type": "tuple" }, { "components": [{ "internalType": "address", "name": "dexPool", "type": "address" }, { "internalType": "uint256", "name": "dexId", "type": "uint256" }, { "internalType": "uint256", "name": "fee", "type": "uint256" }, { "internalType": "uint256", "name": "lastStoredPrice", "type": "uint256" }, { "internalType": "uint256", "name": "centerPrice", "type": "uint256" }, { "internalType": "uint256", "name": "token0Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "token1Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowShares", "type": "uint256" }, { "internalType": "uint256", "name": "maxBorrowShares", "type": "uint256" }, { "internalType": "uint256", "name": "token0Borrowed", "type": "uint256" }, { "internalType": "uint256", "name": "token1Borrowed", "type": "uint256" }, { "internalType": "uint256", "name": "sharesBorrowable", "type": "uint256" }, { "internalType": "uint256", "name": "token0Borrowable", "type": "uint256" }, { "internalType": "uint256", "name": "token1Borrowable", "type": "uint256" }, { "internalType": "uint256", "name": "token0PerBorrowShare", "type": "uint256" }, { "internalType": "uint256", "name": "token1PerBorrowShare", "type": "uint256" }, { "internalType": "uint256", "name": "token0BorrowRate", "type": "uint256" }, { "internalType": "uint256", "name": "token1BorrowRate", "type": "uint256" }, { "internalType": "address", "name": "quoteToken", "type": "address" }, { "internalType": "uint256", "name": "quoteTokensPerShare", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken0Reserves", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken1Reserves", "type": "uint256" }], "internalType": "struct FluidView.DexBorrowData", "name": "dexBorrowData", "type": "tuple" }], "internalType": "struct FluidView.VaultData", "name": "vault", "type": "tuple" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_nftId", "type": "uint256" }], "name": "getRatio", "outputs": [{ "internalType": "uint256", "name": "ratio", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_fToken", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getUserEarnPosition", "outputs": [{ "components": [{ "internalType": "uint256", "name": "fTokenShares", "type": "uint256" }, { "internalType": "uint256", "name": "underlyingAssets", "type": "uint256" }, { "internalType": "uint256", "name": "underlyingBalance", "type": "uint256" }, { "internalType": "uint256", "name": "allowance", "type": "uint256" }], "internalType": "struct FluidView.UserEarnPosition", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_fToken", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getUserEarnPositionWithFToken", "outputs": [{ "components": [{ "internalType": "uint256", "name": "fTokenShares", "type": "uint256" }, { "internalType": "uint256", "name": "underlyingAssets", "type": "uint256" }, { "internalType": "uint256", "name": "underlyingBalance", "type": "uint256" }, { "internalType": "uint256", "name": "allowance", "type": "uint256" }], "internalType": "struct FluidView.UserEarnPosition", "name": "userPosition", "type": "tuple" }, { "components": [{ "internalType": "address", "name": "tokenAddress", "type": "address" }, { "internalType": "bool", "name": "isNativeUnderlying", "type": "bool" }, { "internalType": "string", "name": "name", "type": "string" }, { "internalType": "string", "name": "symbol", "type": "string" }, { "internalType": "uint256", "name": "decimals", "type": "uint256" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "totalAssets", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupply", "type": "uint256" }, { "internalType": "uint256", "name": "convertToShares", "type": "uint256" }, { "internalType": "uint256", "name": "convertToAssets", "type": "uint256" }, { "internalType": "uint256", "name": "rewardsRate", "type": "uint256" }, { "internalType": "uint256", "name": "supplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawable", "type": "uint256" }, { "internalType": "bool", "name": "modeWithInterest", "type": "bool" }, { "internalType": "uint256", "name": "expandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "expandDuration", "type": "uint256" }], "internalType": "struct FluidView.FTokenData", "name": "fTokenData", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], "name": "getUserNftIds", "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], "name": "getUserNftIdsWithVaultIds", "outputs": [{ "components": [{ "internalType": "uint256", "name": "nftId", "type": "uint256" }, { "internalType": "uint256", "name": "vaultId", "type": "uint256" }, { "internalType": "address", "name": "vaultAddr", "type": "address" }], "internalType": "struct FluidView.NftWithVault[]", "name": "retVal", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], "name": "getUserPositions", "outputs": [{ "components": [{ "internalType": "uint256", "name": "nftId", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "bool", "name": "isLiquidated", "type": "bool" }, { "internalType": "bool", "name": "isSupplyPosition", "type": "bool" }, { "internalType": "uint256", "name": "supply", "type": "uint256" }, { "internalType": "uint256", "name": "borrow", "type": "uint256" }, { "internalType": "uint256", "name": "ratio", "type": "uint256" }, { "internalType": "int256", "name": "tick", "type": "int256" }, { "internalType": "uint256", "name": "tickId", "type": "uint256" }], "internalType": "struct FluidView.UserPosition[]", "name": "positions", "type": "tuple[]" }, { "components": [{ "internalType": "address", "name": "vault", "type": "address" }, { "internalType": "uint256", "name": "vaultId", "type": "uint256" }, { "internalType": "uint256", "name": "vaultType", "type": "uint256" }, { "internalType": "bool", "name": "isSmartColl", "type": "bool" }, { "internalType": "bool", "name": "isSmartDebt", "type": "bool" }, { "internalType": "address", "name": "supplyToken0", "type": "address" }, { "internalType": "address", "name": "supplyToken1", "type": "address" }, { "internalType": "address", "name": "borrowToken0", "type": "address" }, { "internalType": "address", "name": "borrowToken1", "type": "address" }, { "internalType": "uint256", "name": "supplyToken0Decimals", "type": "uint256" }, { "internalType": "uint256", "name": "supplyToken1Decimals", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken0Decimals", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken1Decimals", "type": "uint256" }, { "internalType": "uint16", "name": "collateralFactor", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationThreshold", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationMaxLimit", "type": "uint16" }, { "internalType": "uint16", "name": "withdrawalGap", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationPenalty", "type": "uint16" }, { "internalType": "uint16", "name": "borrowFee", "type": "uint16" }, { "internalType": "address", "name": "oracle", "type": "address" }, { "internalType": "uint256", "name": "oraclePriceOperate", "type": "uint256" }, { "internalType": "uint256", "name": "oraclePriceLiquidate", "type": "uint256" }, { "internalType": "uint256", "name": "vaultSupplyExchangePrice", "type": "uint256" }, { "internalType": "uint256", "name": "vaultBorrowExchangePrice", "type": "uint256" }, { "internalType": "int256", "name": "supplyRateVault", "type": "int256" }, { "internalType": "int256", "name": "borrowRateVault", "type": "int256" }, { "internalType": "int256", "name": "rewardsOrFeeRateSupply", "type": "int256" }, { "internalType": "int256", "name": "rewardsOrFeeRateBorrow", "type": "int256" }, { "internalType": "uint256", "name": "totalPositions", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupplyVault", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowVault", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawalLimit", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawableUntilLimit", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "baseWithdrawalLimit", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawExpandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawExpandDuration", "type": "uint256" }, { "internalType": "uint256", "name": "borrowLimit", "type": "uint256" }, { "internalType": "uint256", "name": "borrowableUntilLimit", "type": "uint256" }, { "internalType": "uint256", "name": "borrowable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowLimitUtilization", "type": "uint256" }, { "internalType": "uint256", "name": "maxBorrowLimit", "type": "uint256" }, { "internalType": "uint256", "name": "borrowExpandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "borrowExpandDuration", "type": "uint256" }, { "internalType": "uint256", "name": "baseBorrowLimit", "type": "uint256" }, { "internalType": "uint256", "name": "minimumBorrowing", "type": "uint256" }, { "components": [{ "internalType": "address", "name": "dexPool", "type": "address" }, { "internalType": "uint256", "name": "dexId", "type": "uint256" }, { "internalType": "uint256", "name": "fee", "type": "uint256" }, { "internalType": "uint256", "name": "lastStoredPrice", "type": "uint256" }, { "internalType": "uint256", "name": "centerPrice", "type": "uint256" }, { "internalType": "uint256", "name": "token0Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "token1Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupplyShares", "type": "uint256" }, { "internalType": "uint256", "name": "maxSupplyShares", "type": "uint256" }, { "internalType": "uint256", "name": "token0Supplied", "type": "uint256" }, { "internalType": "uint256", "name": "token1Supplied", "type": "uint256" }, { "internalType": "uint256", "name": "sharesWithdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "token0Withdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "token1Withdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "token0PerSupplyShare", "type": "uint256" }, { "internalType": "uint256", "name": "token1PerSupplyShare", "type": "uint256" }, { "internalType": "uint256", "name": "token0SupplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "token1SupplyRate", "type": "uint256" }, { "internalType": "address", "name": "quoteToken", "type": "address" }, { "internalType": "uint256", "name": "quoteTokensPerShare", "type": "uint256" }, { "internalType": "uint256", "name": "supplyToken0Reserves", "type": "uint256" }, { "internalType": "uint256", "name": "supplyToken1Reserves", "type": "uint256" }], "internalType": "struct FluidView.DexSupplyData", "name": "dexSupplyData", "type": "tuple" }, { "components": [{ "internalType": "address", "name": "dexPool", "type": "address" }, { "internalType": "uint256", "name": "dexId", "type": "uint256" }, { "internalType": "uint256", "name": "fee", "type": "uint256" }, { "internalType": "uint256", "name": "lastStoredPrice", "type": "uint256" }, { "internalType": "uint256", "name": "centerPrice", "type": "uint256" }, { "internalType": "uint256", "name": "token0Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "token1Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowShares", "type": "uint256" }, { "internalType": "uint256", "name": "maxBorrowShares", "type": "uint256" }, { "internalType": "uint256", "name": "token0Borrowed", "type": "uint256" }, { "internalType": "uint256", "name": "token1Borrowed", "type": "uint256" }, { "internalType": "uint256", "name": "sharesBorrowable", "type": "uint256" }, { "internalType": "uint256", "name": "token0Borrowable", "type": "uint256" }, { "internalType": "uint256", "name": "token1Borrowable", "type": "uint256" }, { "internalType": "uint256", "name": "token0PerBorrowShare", "type": "uint256" }, { "internalType": "uint256", "name": "token1PerBorrowShare", "type": "uint256" }, { "internalType": "uint256", "name": "token0BorrowRate", "type": "uint256" }, { "internalType": "uint256", "name": "token1BorrowRate", "type": "uint256" }, { "internalType": "address", "name": "quoteToken", "type": "address" }, { "internalType": "uint256", "name": "quoteTokensPerShare", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken0Reserves", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken1Reserves", "type": "uint256" }], "internalType": "struct FluidView.DexBorrowData", "name": "dexBorrowData", "type": "tuple" }], "internalType": "struct FluidView.VaultData[]", "name": "vaults", "type": "tuple[]" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_vault", "type": "address" }], "name": "getVaultData", "outputs": [{ "components": [{ "internalType": "address", "name": "vault", "type": "address" }, { "internalType": "uint256", "name": "vaultId", "type": "uint256" }, { "internalType": "uint256", "name": "vaultType", "type": "uint256" }, { "internalType": "bool", "name": "isSmartColl", "type": "bool" }, { "internalType": "bool", "name": "isSmartDebt", "type": "bool" }, { "internalType": "address", "name": "supplyToken0", "type": "address" }, { "internalType": "address", "name": "supplyToken1", "type": "address" }, { "internalType": "address", "name": "borrowToken0", "type": "address" }, { "internalType": "address", "name": "borrowToken1", "type": "address" }, { "internalType": "uint256", "name": "supplyToken0Decimals", "type": "uint256" }, { "internalType": "uint256", "name": "supplyToken1Decimals", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken0Decimals", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken1Decimals", "type": "uint256" }, { "internalType": "uint16", "name": "collateralFactor", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationThreshold", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationMaxLimit", "type": "uint16" }, { "internalType": "uint16", "name": "withdrawalGap", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationPenalty", "type": "uint16" }, { "internalType": "uint16", "name": "borrowFee", "type": "uint16" }, { "internalType": "address", "name": "oracle", "type": "address" }, { "internalType": "uint256", "name": "oraclePriceOperate", "type": "uint256" }, { "internalType": "uint256", "name": "oraclePriceLiquidate", "type": "uint256" }, { "internalType": "uint256", "name": "vaultSupplyExchangePrice", "type": "uint256" }, { "internalType": "uint256", "name": "vaultBorrowExchangePrice", "type": "uint256" }, { "internalType": "int256", "name": "supplyRateVault", "type": "int256" }, { "internalType": "int256", "name": "borrowRateVault", "type": "int256" }, { "internalType": "int256", "name": "rewardsOrFeeRateSupply", "type": "int256" }, { "internalType": "int256", "name": "rewardsOrFeeRateBorrow", "type": "int256" }, { "internalType": "uint256", "name": "totalPositions", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupplyVault", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowVault", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawalLimit", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawableUntilLimit", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "baseWithdrawalLimit", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawExpandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "withdrawExpandDuration", "type": "uint256" }, { "internalType": "uint256", "name": "borrowLimit", "type": "uint256" }, { "internalType": "uint256", "name": "borrowableUntilLimit", "type": "uint256" }, { "internalType": "uint256", "name": "borrowable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowLimitUtilization", "type": "uint256" }, { "internalType": "uint256", "name": "maxBorrowLimit", "type": "uint256" }, { "internalType": "uint256", "name": "borrowExpandPercent", "type": "uint256" }, { "internalType": "uint256", "name": "borrowExpandDuration", "type": "uint256" }, { "internalType": "uint256", "name": "baseBorrowLimit", "type": "uint256" }, { "internalType": "uint256", "name": "minimumBorrowing", "type": "uint256" }, { "components": [{ "internalType": "address", "name": "dexPool", "type": "address" }, { "internalType": "uint256", "name": "dexId", "type": "uint256" }, { "internalType": "uint256", "name": "fee", "type": "uint256" }, { "internalType": "uint256", "name": "lastStoredPrice", "type": "uint256" }, { "internalType": "uint256", "name": "centerPrice", "type": "uint256" }, { "internalType": "uint256", "name": "token0Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "token1Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupplyShares", "type": "uint256" }, { "internalType": "uint256", "name": "maxSupplyShares", "type": "uint256" }, { "internalType": "uint256", "name": "token0Supplied", "type": "uint256" }, { "internalType": "uint256", "name": "token1Supplied", "type": "uint256" }, { "internalType": "uint256", "name": "sharesWithdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "token0Withdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "token1Withdrawable", "type": "uint256" }, { "internalType": "uint256", "name": "token0PerSupplyShare", "type": "uint256" }, { "internalType": "uint256", "name": "token1PerSupplyShare", "type": "uint256" }, { "internalType": "uint256", "name": "token0SupplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "token1SupplyRate", "type": "uint256" }, { "internalType": "address", "name": "quoteToken", "type": "address" }, { "internalType": "uint256", "name": "quoteTokensPerShare", "type": "uint256" }, { "internalType": "uint256", "name": "supplyToken0Reserves", "type": "uint256" }, { "internalType": "uint256", "name": "supplyToken1Reserves", "type": "uint256" }], "internalType": "struct FluidView.DexSupplyData", "name": "dexSupplyData", "type": "tuple" }, { "components": [{ "internalType": "address", "name": "dexPool", "type": "address" }, { "internalType": "uint256", "name": "dexId", "type": "uint256" }, { "internalType": "uint256", "name": "fee", "type": "uint256" }, { "internalType": "uint256", "name": "lastStoredPrice", "type": "uint256" }, { "internalType": "uint256", "name": "centerPrice", "type": "uint256" }, { "internalType": "uint256", "name": "token0Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "token1Utilization", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowShares", "type": "uint256" }, { "internalType": "uint256", "name": "maxBorrowShares", "type": "uint256" }, { "internalType": "uint256", "name": "token0Borrowed", "type": "uint256" }, { "internalType": "uint256", "name": "token1Borrowed", "type": "uint256" }, { "internalType": "uint256", "name": "sharesBorrowable", "type": "uint256" }, { "internalType": "uint256", "name": "token0Borrowable", "type": "uint256" }, { "internalType": "uint256", "name": "token1Borrowable", "type": "uint256" }, { "internalType": "uint256", "name": "token0PerBorrowShare", "type": "uint256" }, { "internalType": "uint256", "name": "token1PerBorrowShare", "type": "uint256" }, { "internalType": "uint256", "name": "token0BorrowRate", "type": "uint256" }, { "internalType": "uint256", "name": "token1BorrowRate", "type": "uint256" }, { "internalType": "address", "name": "quoteToken", "type": "address" }, { "internalType": "uint256", "name": "quoteTokensPerShare", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken0Reserves", "type": "uint256" }, { "internalType": "uint256", "name": "borrowToken1Reserves", "type": "uint256" }], "internalType": "struct FluidView.DexBorrowData", "name": "dexBorrowData", "type": "tuple" }], "internalType": "struct FluidView.VaultData", "name": "vaultData", "type": "tuple" }], "stateMutability": "nonpayable", "type": "function" }],
1148
1148
  "networks": {
1149
1149
  "1": { "address": "0xc8df052bD7A8d76a34c09e758Dff3c6298C0115c" },
1150
- "8453": { "address": "0x5835CaDbA8843CD6d6d55782908351E9c74221aD" },
1151
- "42161": { "address": "0x2d51BB6Ac5c1eC8DD6432e1FF980fC864B626e01" }
1150
+ "8453": { "address": "0x6cd4D6af4F292817eA2A2311F099dF26cd015028" },
1151
+ "42161": { "address": "0xf9e6d5568887ac8eC6fA33B7eefD2A176A958e71" }
1152
1152
  }
1153
1153
  }
1154
1154
  };
@@ -207,6 +207,19 @@ const parseT1MarketData = (web3, data, network, mainnetWeb3) => __awaiter(void 0
207
207
  marketData,
208
208
  };
209
209
  });
210
+ const getMarketRateForDex = (token1PerShare, token0PerShare, rate0, rate1) => {
211
+ const sharesCombined = new Dec(token1PerShare).plus(token0PerShare);
212
+ const rate0PerShare = new Dec(rate0).mul(token0PerShare).div(sharesCombined).toString();
213
+ const rate1PerShare = new Dec(rate1).mul(token1PerShare).div(sharesCombined).toString();
214
+ return new Dec(rate0PerShare).plus(rate1PerShare).toString();
215
+ };
216
+ const getAdditionalMarketRateForDex = (token1PerShare, token0PerShare, incentiveSupplyRate0, incentiveSupplyRate1) => {
217
+ console.log(incentiveSupplyRate0, incentiveSupplyRate1);
218
+ const sharesCombined = new Dec(token1PerShare).plus(token0PerShare);
219
+ const rate0PerShare = incentiveSupplyRate0 ? new Dec(incentiveSupplyRate0).mul(token0PerShare).div(sharesCombined).toString() : 0;
220
+ const rate1PerShare = incentiveSupplyRate1 ? new Dec(incentiveSupplyRate1).mul(token1PerShare).div(sharesCombined).toString() : 0;
221
+ return new Dec(rate0PerShare).plus(rate1PerShare).toString();
222
+ };
210
223
  const parseT2MarketData = (web3, data, network, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
211
224
  const collAsset0 = getAssetInfoByAddress(data.supplyToken0, network);
212
225
  const collAsset1 = getAssetInfoByAddress(data.supplyToken1, network);
@@ -245,15 +258,17 @@ const parseT2MarketData = (web3, data, network, mainnetWeb3) => __awaiter(void 0
245
258
  tokenPerSupplyShare: token1PerSupplyShare,
246
259
  supplyReserves: reservesSupplyToken1,
247
260
  };
248
- if (STAKING_ASSETS.includes(collFirstAssetData.symbol)) {
249
- collFirstAssetData.incentiveSupplyApy = yield getStakingApy(collAsset1.symbol, mainnetWeb3);
250
- collFirstAssetData.incentiveSupplyToken = collAsset1.symbol;
261
+ if (STAKING_ASSETS.includes(collSecondAssetData.symbol)) {
262
+ collSecondAssetData.incentiveSupplyApy = yield getStakingApy(collAsset1.symbol, mainnetWeb3);
263
+ collSecondAssetData.incentiveSupplyToken = collAsset1.symbol;
251
264
  }
265
+ const marketSupplyRate = getMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, supplyRate0, supplyRate1);
266
+ const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, collFirstAssetData.incentiveSupplyApy, collSecondAssetData.incentiveSupplyApy);
252
267
  const borrowRate = new Dec(data.borrowRateVault).div(100).toString();
253
268
  const debtAssetData = {
254
269
  symbol: debtAsset.symbol,
255
- address: debtAsset.address,
256
270
  price: prices[debtAsset.address],
271
+ address: debtAsset.address,
257
272
  totalBorrow: data.totalBorrowVault,
258
273
  canBeBorrowed: true,
259
274
  borrowRate,
@@ -309,7 +324,8 @@ const parseT2MarketData = (web3, data, network, mainnetWeb3) => __awaiter(void 0
309
324
  minimumBorrowing: getEthAmountForDecimals(data.minimumBorrowing, debtAsset.decimals),
310
325
  liquidationMaxLimit,
311
326
  borrowRate,
312
- supplyRate: '0',
327
+ supplyRate: marketSupplyRate,
328
+ incentiveSupplyRate,
313
329
  totalSupplyToken0,
314
330
  totalSupplyToken1,
315
331
  withdrawableToken0,
@@ -382,6 +398,8 @@ const parseT3MarketData = (web3, data, network, mainnetWeb3) => __awaiter(void 0
382
398
  debtAsset1Data.incentiveSupplyApy = yield getStakingApy(debtAsset1.symbol, mainnetWeb3);
383
399
  debtAsset1Data.incentiveSupplyToken = debtAsset1.symbol;
384
400
  }
401
+ const marketBorrowRate = getMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, borrowRate0, borrowRate1);
402
+ const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, debtAsset0Data.incentiveSupplyApy, debtAsset1Data.incentiveSupplyApy);
385
403
  const assetsData = [
386
404
  [collAsset.symbol, collAssetData],
387
405
  [debtAsset0.symbol, debtAsset0Data],
@@ -423,8 +441,9 @@ const parseT3MarketData = (web3, data, network, mainnetWeb3) => __awaiter(void 0
423
441
  withdrawableUntilLimit: getEthAmountForDecimals(data.withdrawableUntilLimit, collAsset.decimals),
424
442
  withdrawable: getEthAmountForDecimals(data.withdrawable, collAsset.decimals),
425
443
  liquidationMaxLimit,
426
- borrowRate: '0',
444
+ borrowRate: marketBorrowRate,
427
445
  supplyRate,
446
+ incentiveBorrowRate,
428
447
  borrowableToken0,
429
448
  borrowableToken1,
430
449
  totalBorrowToken0,
@@ -520,6 +539,10 @@ const parseT4MarketData = (web3, data, network, mainnetWeb3) => __awaiter(void 0
520
539
  debtAsset1Data.incentiveSupplyApy = yield getStakingApy(debtAsset1.symbol, mainnetWeb3);
521
540
  debtAsset1Data.incentiveSupplyToken = debtAsset1.symbol;
522
541
  }
542
+ const marketBorrowRate = getMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, borrowRate0, borrowRate1);
543
+ const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, debtAsset0Data.incentiveSupplyApy, debtAsset1Data.incentiveSupplyApy);
544
+ const marketSupplyRate = getMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, supplyRate0, supplyRate1);
545
+ const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, collAsset0Data.incentiveSupplyApy, collAsset1Data.incentiveSupplyApy);
523
546
  const assetsData = [
524
547
  [collAsset0.symbol, collAsset0Data],
525
548
  [collAsset1.symbol, collAsset1Data],
@@ -564,8 +587,10 @@ const parseT4MarketData = (web3, data, network, mainnetWeb3) => __awaiter(void 0
564
587
  totalSupplyVaultUsd,
565
588
  totalBorrowVaultUsd,
566
589
  liquidationMaxLimit,
567
- borrowRate: '0',
568
- supplyRate: '0',
590
+ borrowRate: marketBorrowRate,
591
+ incentiveBorrowRate,
592
+ supplyRate: marketSupplyRate,
593
+ incentiveSupplyRate,
569
594
  borrowableToken0,
570
595
  borrowableToken1,
571
596
  totalBorrowToken0,
@@ -107,73 +107,73 @@ export const getApyAfterValuesEstimation = (selectedMarket, actions, web3, netwo
107
107
  return { borrowRate, supplyRate };
108
108
  });
109
109
  const API_URL = 'https://blue-api.morpho.org/graphql';
110
- const MARKET_QUERY = `
111
- query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
112
- marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
113
- reallocatableLiquidityAssets
114
- targetBorrowUtilization
115
- loanAsset {
116
- address
117
- decimals
118
- priceUsd
119
- }
120
- state {
121
- liquidityAssets
122
- borrowAssets
123
- supplyAssets
124
- }
125
- publicAllocatorSharedLiquidity {
126
- assets
127
- vault {
128
- address
129
- name
130
- }
131
- allocationMarket {
132
- uniqueKey
133
- loanAsset {
134
- address
135
- }
136
- collateralAsset {
137
- address
138
- }
139
- irmAddress
140
- oracle {
141
- address
142
- }
143
- lltv
144
- }
145
- }
146
- loanAsset {
147
- address
148
- }
149
- collateralAsset {
150
- address
151
- }
152
- oracle {
153
- address
154
- }
155
- irmAddress
156
- lltv
157
- }
158
- }
110
+ const MARKET_QUERY = `
111
+ query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
112
+ marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
113
+ reallocatableLiquidityAssets
114
+ targetBorrowUtilization
115
+ loanAsset {
116
+ address
117
+ decimals
118
+ priceUsd
119
+ }
120
+ state {
121
+ liquidityAssets
122
+ borrowAssets
123
+ supplyAssets
124
+ }
125
+ publicAllocatorSharedLiquidity {
126
+ assets
127
+ vault {
128
+ address
129
+ name
130
+ }
131
+ allocationMarket {
132
+ uniqueKey
133
+ loanAsset {
134
+ address
135
+ }
136
+ collateralAsset {
137
+ address
138
+ }
139
+ irmAddress
140
+ oracle {
141
+ address
142
+ }
143
+ lltv
144
+ }
145
+ }
146
+ loanAsset {
147
+ address
148
+ }
149
+ collateralAsset {
150
+ address
151
+ }
152
+ oracle {
153
+ address
154
+ }
155
+ irmAddress
156
+ lltv
157
+ }
158
+ }
159
159
  `;
160
- const REWARDS_QUERY = `
161
- query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
162
- marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
163
- uniqueKey
164
- state {
165
- rewards {
166
- amountPerSuppliedToken
167
- supplyApr
168
- amountPerBorrowedToken
169
- borrowApr
170
- asset {
171
- address
172
- }
173
- }
174
- }
175
- }
176
- }
160
+ const REWARDS_QUERY = `
161
+ query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
162
+ marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
163
+ uniqueKey
164
+ state {
165
+ rewards {
166
+ amountPerSuppliedToken
167
+ supplyApr
168
+ amountPerBorrowedToken
169
+ borrowApr
170
+ asset {
171
+ address
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
177
  `;
178
178
  /**
179
179
  * Get reallocatable liquidity to a given market and target borrow utilization
package/package.json CHANGED
@@ -1,54 +1,54 @@
1
- {
2
- "name": "@defisaver/positions-sdk",
3
- "version": "1.0.11-fluid-dev9",
4
- "description": "",
5
- "main": "./cjs/index.js",
6
- "module": "./esm/index.js",
7
- "types": "./esm/index.d.ts",
8
- "scripts": {
9
- "build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
10
- "build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
11
- "build": "npm run lint && npm run generate-contracts && npm run build:cjs && npm run build:esm",
12
- "dev": "npm run generate-contracts && tsc -p tsconfig.json --watch",
13
- "lint": "eslint src/ --fix",
14
- "lint-check": "eslint src/",
15
- "generate-contracts": "node scripts/generateContracts.js",
16
- "test": "mocha tests/*",
17
- "test-single": "mocha ./tests/$npm_config_name.ts",
18
- "test:debugger": "mocha --inspect-brk tests/*",
19
- "build-test": "npm run build && npm run test",
20
- "version-bump": "git commit -am \"Version bump to $(npm version patch | cut -c 2-)\""
21
- },
22
- "keywords": [],
23
- "author": "",
24
- "license": "ISC",
25
- "dependencies": {
26
- "@defisaver/tokens": "^1.6.2",
27
- "@ethersproject/bignumber": "^5.7.0",
28
- "@morpho-org/morpho-aave-v3-sdk": "^1.5.3",
29
- "@types/lodash": "^4.17.15",
30
- "@types/memoizee": "^0.4.12",
31
- "decimal.js": "^10.4.3",
32
- "lodash": "^4.17.21",
33
- "memoizee": "^0.4.17"
34
- },
35
- "devDependencies": {
36
- "@defisaver/eslint-config": "^1.0.1",
37
- "@types/chai": "^5.0.0",
38
- "@types/mocha": "^10.0.9",
39
- "@types/web3": "^1.0.20",
40
- "chai": "^4.3.8",
41
- "dotenv": "^16.3.1",
42
- "eslint": "^8.49.0",
43
- "eslint-plugin-import": "^2.31.0",
44
- "mocha": "^10.2.0",
45
- "nock": "^14.0.0",
46
- "ts-node": "^10.9.2",
47
- "typechain": "^8.3.1",
48
- "typechain-target-web3-v1-3mihai3": "^6.0.2",
49
- "typescript": "^5.2.2"
50
- },
51
- "peerDependencies": {
52
- "web3": "^1.10.2"
53
- }
54
- }
1
+ {
2
+ "name": "@defisaver/positions-sdk",
3
+ "version": "1.0.11-fluid-dev11",
4
+ "description": "",
5
+ "main": "./cjs/index.js",
6
+ "module": "./esm/index.js",
7
+ "types": "./esm/index.d.ts",
8
+ "scripts": {
9
+ "build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
10
+ "build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
11
+ "build": "npm run lint && npm run generate-contracts && npm run build:cjs && npm run build:esm",
12
+ "dev": "npm run generate-contracts && tsc -p tsconfig.json --watch",
13
+ "lint": "eslint src/ --fix",
14
+ "lint-check": "eslint src/",
15
+ "generate-contracts": "node scripts/generateContracts.js",
16
+ "test": "mocha tests/*",
17
+ "test-single": "mocha ./tests/$npm_config_name.ts",
18
+ "test:debugger": "mocha --inspect-brk tests/*",
19
+ "build-test": "npm run build && npm run test",
20
+ "version-bump": "git commit -am \"Version bump to $(npm version patch | cut -c 2-)\""
21
+ },
22
+ "keywords": [],
23
+ "author": "",
24
+ "license": "ISC",
25
+ "dependencies": {
26
+ "@defisaver/tokens": "^1.6.2",
27
+ "@ethersproject/bignumber": "^5.7.0",
28
+ "@morpho-org/morpho-aave-v3-sdk": "^1.5.3",
29
+ "@types/lodash": "^4.17.15",
30
+ "@types/memoizee": "^0.4.12",
31
+ "decimal.js": "^10.4.3",
32
+ "lodash": "^4.17.21",
33
+ "memoizee": "^0.4.17"
34
+ },
35
+ "devDependencies": {
36
+ "@defisaver/eslint-config": "^1.0.1",
37
+ "@types/chai": "^5.0.0",
38
+ "@types/mocha": "^10.0.9",
39
+ "@types/web3": "^1.0.20",
40
+ "chai": "^4.3.8",
41
+ "dotenv": "^16.3.1",
42
+ "eslint": "^8.49.0",
43
+ "eslint-plugin-import": "^2.31.0",
44
+ "mocha": "^10.2.0",
45
+ "nock": "^14.0.0",
46
+ "ts-node": "^10.9.2",
47
+ "typechain": "^8.3.1",
48
+ "typechain-target-web3-v1-3mihai3": "^6.0.2",
49
+ "typescript": "^5.2.2"
50
+ },
51
+ "peerDependencies": {
52
+ "web3": "^1.10.2"
53
+ }
54
+ }