@defisaver/positions-sdk 0.0.201-fluid-dev → 0.0.201-fluid-dev-2

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 (42) hide show
  1. package/cjs/config/contracts.d.ts +11 -5
  2. package/cjs/config/contracts.js +4 -2
  3. package/cjs/fluid/index.d.ts +1 -0
  4. package/cjs/fluid/index.js +65 -12
  5. package/cjs/markets/fluid/index.d.ts +8 -10
  6. package/cjs/markets/fluid/index.js +466 -77
  7. package/cjs/markets/index.d.ts +1 -1
  8. package/cjs/markets/index.js +3 -1
  9. package/cjs/morphoBlue/index.js +1 -2
  10. package/cjs/multicall/index.d.ts +1 -0
  11. package/cjs/multicall/index.js +8 -1
  12. package/cjs/services/utils.d.ts +1 -0
  13. package/cjs/services/utils.js +3 -1
  14. package/cjs/types/contracts/generated/FluidView.d.ts +125 -41
  15. package/cjs/types/fluid.d.ts +16 -1
  16. package/cjs/types/fluid.js +3 -0
  17. package/esm/config/contracts.d.ts +11 -5
  18. package/esm/config/contracts.js +4 -2
  19. package/esm/fluid/index.d.ts +1 -0
  20. package/esm/fluid/index.js +65 -13
  21. package/esm/markets/fluid/index.d.ts +8 -10
  22. package/esm/markets/fluid/index.js +460 -71
  23. package/esm/markets/index.d.ts +1 -1
  24. package/esm/markets/index.js +1 -1
  25. package/esm/morphoBlue/index.js +1 -2
  26. package/esm/multicall/index.d.ts +1 -0
  27. package/esm/multicall/index.js +6 -0
  28. package/esm/services/utils.d.ts +1 -0
  29. package/esm/services/utils.js +1 -0
  30. package/esm/types/contracts/generated/FluidView.d.ts +125 -41
  31. package/esm/types/fluid.d.ts +16 -1
  32. package/esm/types/fluid.js +3 -0
  33. package/package.json +5 -3
  34. package/src/config/contracts.js +4 -2
  35. package/src/fluid/index.ts +69 -12
  36. package/src/markets/fluid/index.ts +467 -74
  37. package/src/markets/index.ts +1 -1
  38. package/src/morphoBlue/index.ts +1 -3
  39. package/src/multicall/index.ts +10 -1
  40. package/src/services/utils.ts +3 -1
  41. package/src/types/contracts/generated/FluidView.ts +159 -79
  42. package/src/types/fluid.ts +15 -0
@@ -7608,6 +7608,11 @@ export namespace FluidView {
7608
7608
  }[];
7609
7609
  name: string;
7610
7610
  outputs: {
7611
+ components: {
7612
+ internalType: string;
7613
+ name: string;
7614
+ type: string;
7615
+ }[];
7611
7616
  internalType: string;
7612
7617
  name: string;
7613
7618
  type: string;
@@ -7622,11 +7627,6 @@ export namespace FluidView {
7622
7627
  }[];
7623
7628
  name: string;
7624
7629
  outputs: {
7625
- components: {
7626
- internalType: string;
7627
- name: string;
7628
- type: string;
7629
- }[];
7630
7630
  internalType: string;
7631
7631
  name: string;
7632
7632
  type: string;
@@ -7639,6 +7639,12 @@ export namespace FluidView {
7639
7639
  "1": {
7640
7640
  address: string;
7641
7641
  };
7642
+ "8453": {
7643
+ address: string;
7644
+ };
7645
+ "42161": {
7646
+ address: string;
7647
+ };
7642
7648
  };
7643
7649
  export { networks_85 as networks };
7644
7650
  }
@@ -1107,9 +1107,11 @@ module.exports = {
1107
1107
  }
1108
1108
  },
1109
1109
  "FluidView": {
1110
- "abi": [{ "inputs": [], "name": "feedRegistry", "outputs": [{ "internalType": "contract IFeedRegistry", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_tokenAddr", "type": "address" }], "name": "getAaveTokenPriceInETH", "outputs": [{ "internalType": "uint256", "name": "price", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_tokenAddr", "type": "address" }], "name": "getAaveTokenPriceInUSD", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_tokenAddr", "type": "address" }], "name": "getAaveV3TokenPriceInETH", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_tokenAddr", "type": "address" }], "name": "getAaveV3TokenPriceInUSD", "outputs": [{ "internalType": "uint256", "name": "price", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_inputTokenAddr", "type": "address" }], "name": "getAddrForChainlinkOracle", "outputs": [{ "internalType": "address", "name": "tokenAddrForChainlinkUsage", "type": "address" }], "stateMutability": "pure", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_inputTokenAddr", "type": "address" }], "name": "getChainlinkPriceInETH", "outputs": [{ "internalType": "int256", "name": "chainlinkPriceInETH", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_inputTokenAddr", "type": "address" }, { "internalType": "bool", "name": "_useFallback", "type": "bool" }], "name": "getChainlinkPriceInUSD", "outputs": [{ "internalType": "int256", "name": "chainlinkPriceInUSD", "type": "int256" }], "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": "priceOfSupplyToken0InUSD", "type": "uint256" }, { "internalType": "uint256", "name": "priceOfSupplyToken1InUSD", "type": "uint256" }, { "internalType": "uint256", "name": "priceOfBorrowToken0InUSD", "type": "uint256" }, { "internalType": "uint256", "name": "priceOfBorrowToken1InUSD", "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" }], "internalType": "struct FluidView.VaultData", "name": "vault", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_inputTokenAddr", "type": "address" }], "name": "getPriceInETH", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_inputTokenAddr", "type": "address" }], "name": "getPriceInUSD", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "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": "_inputTokenAddr", "type": "address" }, { "internalType": "uint80", "name": "_roundId", "type": "uint80" }, { "internalType": "contract IAggregatorV3", "name": "aggregator", "type": "address" }], "name": "getRoundInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "updateTimestamp", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_inputTokenAddr", "type": "address" }, { "internalType": "uint80", "name": "_roundId", "type": "uint80" }], "name": "getRoundInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "updateTimestamp", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_tokenAddr", "type": "address" }], "name": "getSparkTokenPriceInETH", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_tokenAddr", "type": "address" }], "name": "getSparkTokenPriceInUSD", "outputs": [{ "internalType": "uint256", "name": "price", "type": "uint256" }], "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": "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": "priceOfSupplyToken0InUSD", "type": "uint256" }, { "internalType": "uint256", "name": "priceOfSupplyToken1InUSD", "type": "uint256" }, { "internalType": "uint256", "name": "priceOfBorrowToken0InUSD", "type": "uint256" }, { "internalType": "uint256", "name": "priceOfBorrowToken1InUSD", "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" }], "internalType": "struct FluidView.VaultData[]", "name": "vaults", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256[]", "name": "_ids", "type": "uint256[]" }, { "internalType": "bool", "name": "_fetchAll", "type": "bool" }], "name": "getVaultAddresses", "outputs": [{ "internalType": "address[]", "name": "", "type": "address[]" }], "stateMutability": "view", "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": "priceOfSupplyToken0InUSD", "type": "uint256" }, { "internalType": "uint256", "name": "priceOfSupplyToken1InUSD", "type": "uint256" }, { "internalType": "uint256", "name": "priceOfBorrowToken0InUSD", "type": "uint256" }, { "internalType": "uint256", "name": "priceOfBorrowToken1InUSD", "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" }], "internalType": "struct FluidView.VaultData", "name": "vaultData", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "int256", "name": "_btcPrice", "type": "int256" }], "name": "getWBtcPrice", "outputs": [{ "internalType": "int256", "name": "wBtcPrice", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "int256", "name": "_stEthPrice", "type": "int256" }], "name": "getWStEthPrice", "outputs": [{ "internalType": "int256", "name": "wStEthPrice", "type": "int256" }], "stateMutability": "view", "type": "function" }],
1110
+ "abi": [{ "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": "_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" }], "internalType": "struct FluidView.VaultData", "name": "vault", "type": "tuple" }], "stateMutability": "view", "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" }], "internalType": "struct FluidView.VaultData[]", "name": "vaults", "type": "tuple[]" }], "stateMutability": "view", "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" }], "internalType": "struct FluidView.VaultData", "name": "vaultData", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
1111
1111
  "networks": {
1112
- "1": { "address": "0xBAc6dc3edB72Bc705Ab4e31F2a2151Fe06550D9B" }
1112
+ "1": { "address": "0xf8e3bbf7c95057be1fD5E741a9ADb73E956dC724" },
1113
+ "8453": { "address": "0x5835CaDbA8843CD6d6d55782908351E9c74221aD" },
1114
+ "42161": { "address": "0x2d51BB6Ac5c1eC8DD6432e1FF980fC864B626e01" }
1113
1115
  }
1114
1116
  }
1115
1117
  };
@@ -36,3 +36,4 @@ export declare const getFluidPositionWithMarket: (web3: Web3, network: NetworkNu
36
36
  userData: FluidVaultData;
37
37
  marketData: FluidMarketData;
38
38
  }>;
39
+ export declare const getAllFluidMarketDataChunked: (network: NetworkNumber, web3: Web3) => Promise<FluidMarketData[]>;
@@ -12,13 +12,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getFluidPositionWithMarket = exports.getFluidPosition = exports.getFluidVaultIdsForUser = exports.getFluidMarketData = exports.EMPTY_FLUID_DATA = exports.EMPTY_USED_ASSET = void 0;
15
+ exports.getAllFluidMarketDataChunked = exports.getFluidPositionWithMarket = exports.getFluidPosition = exports.getFluidVaultIdsForUser = exports.getFluidMarketData = exports.EMPTY_FLUID_DATA = exports.EMPTY_USED_ASSET = void 0;
16
16
  const decimal_js_1 = __importDefault(require("decimal.js"));
17
17
  const tokens_1 = require("@defisaver/tokens");
18
+ const common_1 = require("../types/common");
18
19
  const types_1 = require("../types");
19
20
  const contracts_1 = require("../contracts");
20
21
  const utils_1 = require("../services/utils");
21
22
  const fluidHelpers_1 = require("../helpers/fluidHelpers");
23
+ const multicall_1 = require("../multicall");
24
+ const fluid_1 = require("../markets/fluid");
25
+ const constants_1 = require("../constants");
26
+ const priceService_1 = require("../services/priceService");
22
27
  exports.EMPTY_USED_ASSET = {
23
28
  isSupplied: false,
24
29
  isBorrowed: false,
@@ -38,37 +43,67 @@ const parseVaultType = (vaultType) => {
38
43
  default: return types_1.FluidVaultType.Unknown;
39
44
  }
40
45
  };
41
- const parseMarketData = (data) => {
46
+ const parseMarketData = (web3, data, network) => __awaiter(void 0, void 0, void 0, function* () {
42
47
  const collAsset = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0);
43
48
  const debtAsset = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0);
49
+ const supplyRate = new decimal_js_1.default(data.supplyRateVault).div(100).toString();
50
+ const borrowRate = new decimal_js_1.default(data.borrowRateVault).div(100).toString();
51
+ const oracleScaleFactor = new decimal_js_1.default(27).add(debtAsset.decimals).sub(collAsset.decimals).toString();
52
+ const oracleScale = new decimal_js_1.default(10).pow(oracleScaleFactor).toString();
53
+ const oraclePrice = new decimal_js_1.default(data.oraclePriceOperate).div(oracleScale).toString();
54
+ const isTokenUSDA = debtAsset.symbol === 'USDA';
55
+ const isMainnet = (0, utils_1.isMainnetNetwork)(network);
56
+ const loanTokenFeedAddress = (0, priceService_1.getChainlinkAssetAddress)(debtAsset.symbol, network);
57
+ let loanTokenPrice;
58
+ if (debtAsset.symbol === 'wstETH') {
59
+ // need to handle wstETH for l2s inside getWstETHPrice
60
+ loanTokenPrice = yield (0, priceService_1.getWstETHPrice)(web3);
61
+ }
62
+ else if (isMainnet) {
63
+ const feedRegistryContract = (0, contracts_1.FeedRegistryContract)(web3, common_1.NetworkNumber.Eth);
64
+ loanTokenPrice = isTokenUSDA ? '100000000' : yield feedRegistryContract.methods.latestAnswer(loanTokenFeedAddress, constants_1.USD_QUOTE).call();
65
+ }
66
+ else {
67
+ // Currently only base network is supported
68
+ const feedRegistryContract = (0, contracts_1.DFSFeedRegistryContract)(web3, network);
69
+ const roundPriceData = isTokenUSDA ? { answer: '100000000' } : yield feedRegistryContract.methods.latestRoundData(loanTokenFeedAddress, constants_1.USD_QUOTE).call();
70
+ loanTokenPrice = roundPriceData.answer;
71
+ }
72
+ const debtPriceParsed = new decimal_js_1.default(loanTokenPrice).div(1e8).toString();
44
73
  const collAssetData = {
45
74
  symbol: collAsset.symbol,
46
75
  address: collAsset.address,
47
- price: (0, utils_1.getEthAmountForDecimals)(data.priceOfSupplyToken0InUSD, 8),
76
+ price: new decimal_js_1.default(debtPriceParsed).mul(oraclePrice).toString(),
48
77
  totalSupply: data.totalSupplyVault,
49
78
  totalBorrow: data.totalBorrowVault,
50
79
  canBeSupplied: true,
51
80
  canBeBorrowed: false,
52
- supplyRate: new decimal_js_1.default(data.supplyRateVault).div(100).toString(),
81
+ supplyRate,
53
82
  borrowRate: '0',
54
83
  };
55
84
  const debtAssetData = {
56
85
  symbol: debtAsset.symbol,
57
86
  address: debtAsset.address,
58
- price: (0, utils_1.getEthAmountForDecimals)(data.priceOfBorrowToken0InUSD, 8),
87
+ price: debtPriceParsed,
59
88
  totalSupply: data.totalSupplyVault,
60
89
  totalBorrow: data.totalBorrowVault,
61
90
  canBeSupplied: false,
62
91
  canBeBorrowed: true,
63
92
  supplyRate: '0',
64
- borrowRate: new decimal_js_1.default(data.borrowRateVault).div(100).toString(),
93
+ borrowRate,
65
94
  };
66
95
  const assetsData = {
67
96
  [collAsset.symbol]: collAssetData,
68
97
  [debtAsset.symbol]: debtAssetData,
69
98
  };
99
+ const marketInfo = (0, fluid_1.getFluidMarketInfoById)(+data.vaultId, network);
100
+ const totalSupplyVault = (0, utils_1.getEthAmountForDecimals)(data.totalSupplyVault, collAsset.decimals);
101
+ const totalBorrowVault = (0, utils_1.getEthAmountForDecimals)(data.totalBorrowVault, debtAsset.decimals);
102
+ const liqRatio = new decimal_js_1.default(data.liquidationThreshold).div(100).toString();
103
+ const liqFactor = new decimal_js_1.default(data.liquidationThreshold).div(10000).toString();
70
104
  const marketData = {
71
105
  vaultId: +data.vaultId,
106
+ vaultValue: marketInfo === null || marketInfo === void 0 ? void 0 : marketInfo.value,
72
107
  isSmartColl: data.isSmartColl,
73
108
  isSmartDebt: data.isSmartDebt,
74
109
  marketAddress: data.vault,
@@ -76,12 +111,16 @@ const parseMarketData = (data) => {
76
111
  oracle: data.oracle,
77
112
  liquidationPenaltyPercent: new decimal_js_1.default(data.liquidationPenalty).div(100).toString(),
78
113
  collFactor: new decimal_js_1.default(data.collateralFactor).div(10000).toString(),
79
- liquidationRatio: new decimal_js_1.default(data.liquidationThreshold).div(100).toString(),
114
+ liquidationRatio: liqRatio,
115
+ liqFactor,
116
+ minRatio: new decimal_js_1.default(1).div(liqFactor).mul(100).toString(),
80
117
  collAsset0: collAsset.symbol,
81
118
  debtAsset0: debtAsset.symbol,
82
119
  totalPositions: data.totalPositions,
83
- totalSupplyVault: (0, utils_1.getEthAmountForDecimals)(data.totalSupplyVault, collAsset.decimals),
84
- totalBorrowVault: (0, utils_1.getEthAmountForDecimals)(data.totalBorrowVault, debtAsset.decimals),
120
+ totalSupplyVault,
121
+ totalBorrowVault,
122
+ totalSupplyVaultUsd: new decimal_js_1.default(totalSupplyVault).mul(collAssetData.price).toString(),
123
+ totalBorrowVaultUsd: new decimal_js_1.default(totalSupplyVault).mul(debtAssetData.price).toString(),
85
124
  withdrawalLimit: (0, utils_1.getEthAmountForDecimals)(data.withdrawalLimit, collAsset.decimals),
86
125
  withdrawableUntilLimit: (0, utils_1.getEthAmountForDecimals)(data.withdrawableUntilLimit, collAsset.decimals),
87
126
  withdrawable: (0, utils_1.getEthAmountForDecimals)(data.withdrawable, collAsset.decimals),
@@ -92,12 +131,14 @@ const parseMarketData = (data) => {
92
131
  maxBorrowLimit: (0, utils_1.getEthAmountForDecimals)(data.maxBorrowLimit, debtAsset.decimals),
93
132
  baseBorrowLimit: (0, utils_1.getEthAmountForDecimals)(data.baseBorrowLimit, debtAsset.decimals),
94
133
  minimumBorrowing: (0, utils_1.getEthAmountForDecimals)(data.minimumBorrowing, debtAsset.decimals),
134
+ borrowRate,
135
+ supplyRate,
95
136
  };
96
137
  return {
97
138
  assetsData,
98
139
  marketData,
99
140
  };
100
- };
141
+ });
101
142
  exports.EMPTY_FLUID_DATA = {
102
143
  usedAssets: {},
103
144
  suppliedUsd: '0',
@@ -135,7 +176,7 @@ const parseUserData = (userPositionData, vaultData) => {
135
176
  const getFluidMarketData = (web3, network, market) => __awaiter(void 0, void 0, void 0, function* () {
136
177
  const view = (0, contracts_1.FluidViewContract)(web3, network);
137
178
  const data = yield view.methods.getVaultData(market.marketAddress).call();
138
- return parseMarketData(data);
179
+ return parseMarketData(web3, data, network);
139
180
  });
140
181
  exports.getFluidMarketData = getFluidMarketData;
141
182
  const getFluidVaultIdsForUser = (web3, network, user) => __awaiter(void 0, void 0, void 0, function* () {
@@ -153,7 +194,7 @@ exports.getFluidPosition = getFluidPosition;
153
194
  const getFluidPositionWithMarket = (web3, network, vaultId) => __awaiter(void 0, void 0, void 0, function* () {
154
195
  const view = (0, contracts_1.FluidViewContract)(web3, network);
155
196
  const data = yield view.methods.getPositionByNftId(vaultId).call();
156
- const marketData = parseMarketData(data.vault);
197
+ const marketData = yield parseMarketData(web3, data.vault, network);
157
198
  const userData = parseUserData(data.position, marketData);
158
199
  return {
159
200
  userData,
@@ -161,3 +202,15 @@ const getFluidPositionWithMarket = (web3, network, vaultId) => __awaiter(void 0,
161
202
  };
162
203
  });
163
204
  exports.getFluidPositionWithMarket = getFluidPositionWithMarket;
205
+ const getAllFluidMarketDataChunked = (network, web3) => __awaiter(void 0, void 0, void 0, function* () {
206
+ const versions = (0, fluid_1.getFluidVersionsDataForNetwork)(network);
207
+ const view = (0, contracts_1.FluidViewContract)(web3, network);
208
+ const calls = versions.map((version) => ({
209
+ target: view.options.address,
210
+ abiItem: view.options.jsonInterface.find((item) => item.name === 'getVaultData'),
211
+ params: [version.marketAddress],
212
+ }));
213
+ const data = yield (0, multicall_1.chunkAndMulticall)(calls, 10, 'latest', web3, network);
214
+ return Promise.all(data.map((item, i) => __awaiter(void 0, void 0, void 0, function* () { return parseMarketData(web3, item.vaultData, network); })));
215
+ });
216
+ exports.getAllFluidMarketDataChunked = getAllFluidMarketDataChunked;
@@ -6,8 +6,6 @@ export declare const WSTETH_ETH_3: (networkId?: NetworkNumber) => FluidMarketInf
6
6
  export declare const WSTETH_USDC_4: (networkId?: NetworkNumber) => FluidMarketInfo;
7
7
  export declare const WSTETH_USDT_5: (networkId?: NetworkNumber) => FluidMarketInfo;
8
8
  export declare const WEETH_WSTETH_6: (networkId?: NetworkNumber) => FluidMarketInfo;
9
- export declare const SUSDE_USDC_7: (networkId?: NetworkNumber) => FluidMarketInfo;
10
- export declare const SUSDE_USDT_8: (networkId?: NetworkNumber) => FluidMarketInfo;
11
9
  export declare const WEETH_USDC_9: (networkId?: NetworkNumber) => FluidMarketInfo;
12
10
  export declare const WEETH_USDT_10: (networkId?: NetworkNumber) => FluidMarketInfo;
13
11
  export declare const ETH_USDC_11: (networkId?: NetworkNumber) => FluidMarketInfo;
@@ -32,7 +30,6 @@ export declare const CBBTC_USDC_29: (networkId?: NetworkNumber) => FluidMarketIn
32
30
  export declare const CBBTC_USDT_30: (networkId?: NetworkNumber) => FluidMarketInfo;
33
31
  export declare const ETH_CBBTC_31: (networkId?: NetworkNumber) => FluidMarketInfo;
34
32
  export declare const WEETH_CBBTC_32: (networkId?: NetworkNumber) => FluidMarketInfo;
35
- export declare const WSTETH_CBBTC_33: (networkId?: NetworkNumber) => FluidMarketInfo;
36
33
  export declare const WSTETH_ETH_WSTETH_ETH_44: (networkId?: NetworkNumber) => FluidMarketInfo;
37
34
  export declare const ETH_USDC_USDT_45: (networkId?: NetworkNumber) => FluidMarketInfo;
38
35
  export declare const WSTETH_USDC_USDT_46: (networkId?: NetworkNumber) => FluidMarketInfo;
@@ -48,14 +45,15 @@ export declare const WSTETH_GHO_55: (networkId?: NetworkNumber) => FluidMarketIn
48
45
  export declare const SUSDE_GHO_56: (networkId?: NetworkNumber) => FluidMarketInfo;
49
46
  export declare const WEETH_GHO_57: (networkId?: NetworkNumber) => FluidMarketInfo;
50
47
  export declare const SUSDS_GHO_58: (networkId?: NetworkNumber) => FluidMarketInfo;
51
- export declare const WBTC_GHO_59: (networkId?: NetworkNumber) => FluidMarketInfo;
52
- export declare const CBBTC_GHO_60: (networkId?: NetworkNumber) => FluidMarketInfo;
53
48
  export declare const GHO_USDC_GHO_USDC_61: (networkId?: NetworkNumber) => FluidMarketInfo;
54
49
  export declare const WEETH_ETH_WSTETH_74: (networkId?: NetworkNumber) => FluidMarketInfo;
55
50
  export declare const USDC_ETH_USDC_ETH_77: (networkId?: NetworkNumber) => FluidMarketInfo;
56
51
  export declare const RSETH_ETH_WSTETH_78: (networkId?: NetworkNumber) => FluidMarketInfo;
57
52
  export declare const RSETH_WSTETH_79: (networkId?: NetworkNumber) => FluidMarketInfo;
58
53
  export declare const WEETHS_ETH_WSTETH_80: (networkId?: NetworkNumber) => FluidMarketInfo;
54
+ export declare const SUSDE_USDT_USDT_92: (networkId?: NetworkNumber) => FluidMarketInfo;
55
+ export declare const USDE_USDT_USDT_93: (networkId?: NetworkNumber) => FluidMarketInfo;
56
+ export declare const LBTC_CBBTC_WBTC_97: (networkId?: NetworkNumber) => FluidMarketInfo;
59
57
  export declare const ETH_USDC_1_ARB: (networkId?: NetworkNumber) => FluidMarketInfo;
60
58
  export declare const ETH_USDT_2_ARB: (networkId?: NetworkNumber) => FluidMarketInfo;
61
59
  export declare const WSTETH_USDC_3_ARB: (networkId?: NetworkNumber) => FluidMarketInfo;
@@ -92,8 +90,6 @@ export declare const FluidMarkets: (networkId: NetworkNumber) => {
92
90
  WSTETH_USDC_4: FluidMarketInfo;
93
91
  WSTETH_USDT_5: FluidMarketInfo;
94
92
  WEETH_WSTETH_6: FluidMarketInfo;
95
- SUSDE_USDC_7: FluidMarketInfo;
96
- SUSDE_USDT_8: FluidMarketInfo;
97
93
  WEETH_USDC_9: FluidMarketInfo;
98
94
  WEETH_USDT_10: FluidMarketInfo;
99
95
  ETH_USDC_11: FluidMarketInfo;
@@ -118,7 +114,6 @@ export declare const FluidMarkets: (networkId: NetworkNumber) => {
118
114
  CBBTC_USDT_30: FluidMarketInfo;
119
115
  ETH_CBBTC_31: FluidMarketInfo;
120
116
  WEETH_CBBTC_32: FluidMarketInfo;
121
- WSTETH_CBBTC_33: FluidMarketInfo;
122
117
  WSTETH_ETH_WSTETH_ETH_44: FluidMarketInfo;
123
118
  ETH_USDC_USDT_45: FluidMarketInfo;
124
119
  WSTETH_USDC_USDT_46: FluidMarketInfo;
@@ -134,14 +129,15 @@ export declare const FluidMarkets: (networkId: NetworkNumber) => {
134
129
  SUSDE_GHO_56: FluidMarketInfo;
135
130
  WEETH_GHO_57: FluidMarketInfo;
136
131
  SUSDS_GHO_58: FluidMarketInfo;
137
- WBTC_GHO_59: FluidMarketInfo;
138
- CBBTC_GHO_60: FluidMarketInfo;
139
132
  GHO_USDC_GHO_USDC_61: FluidMarketInfo;
140
133
  WEETH_ETH_WSTETH_74: FluidMarketInfo;
141
134
  USDC_ETH_USDC_ETH_77: FluidMarketInfo;
142
135
  RSETH_ETH_WSTETH_78: FluidMarketInfo;
143
136
  RSETH_WSTETH_79: FluidMarketInfo;
144
137
  WEETHS_ETH_WSTETH_80: FluidMarketInfo;
138
+ SUSDE_USDT_USDT_92: FluidMarketInfo;
139
+ USDE_USDT_USDT_93: FluidMarketInfo;
140
+ LBTC_CBBTC_WBTC_97: FluidMarketInfo;
145
141
  ETH_USDC_1_ARB: FluidMarketInfo;
146
142
  ETH_USDT_2_ARB: FluidMarketInfo;
147
143
  WSTETH_USDC_3_ARB: FluidMarketInfo;
@@ -172,3 +168,5 @@ export declare const FluidMarkets: (networkId: NetworkNumber) => {
172
168
  WEETH_CBBTC_15_BASE: FluidMarketInfo;
173
169
  WSTETH_CBBTC_16_BASE: FluidMarketInfo;
174
170
  };
171
+ export declare const getFluidVersionsDataForNetwork: (network: NetworkNumber) => FluidMarketInfo[];
172
+ export declare const getFluidMarketInfoById: (vaultId: number, network?: NetworkNumber) => FluidMarketInfo | undefined;