@defisaver/positions-sdk 2.1.104 → 2.1.106-sgho-dev

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 (53) hide show
  1. package/cjs/aaveV3/index.d.ts +3 -0
  2. package/cjs/aaveV3/index.js +7 -2
  3. package/cjs/aaveV3/sgho.d.ts +18 -0
  4. package/cjs/aaveV3/sgho.js +95 -0
  5. package/cjs/aaveV4/index.js +53 -20
  6. package/cjs/claiming/aaveV3.d.ts +1 -1
  7. package/cjs/claiming/aaveV3.js +3 -4
  8. package/cjs/claiming/index.d.ts +1 -2
  9. package/cjs/claiming/index.js +1 -3
  10. package/cjs/config/contracts.d.ts +0 -214
  11. package/cjs/config/contracts.js +1 -6
  12. package/cjs/helpers/morphoBlueHelpers/index.d.ts +0 -1
  13. package/cjs/helpers/morphoBlueHelpers/index.js +27 -32
  14. package/cjs/portfolio/index.js +0 -27
  15. package/cjs/types/aaveV4.d.ts +9 -0
  16. package/cjs/types/claiming.d.ts +1 -13
  17. package/cjs/types/claiming.js +0 -2
  18. package/cjs/types/morphoBlue.d.ts +2 -3
  19. package/esm/aaveV3/index.d.ts +3 -0
  20. package/esm/aaveV3/index.js +5 -1
  21. package/esm/aaveV3/sgho.d.ts +18 -0
  22. package/esm/aaveV3/sgho.js +88 -0
  23. package/esm/aaveV4/index.js +53 -20
  24. package/esm/claiming/aaveV3.d.ts +1 -1
  25. package/esm/claiming/aaveV3.js +3 -4
  26. package/esm/claiming/index.d.ts +1 -2
  27. package/esm/claiming/index.js +1 -2
  28. package/esm/config/contracts.d.ts +0 -214
  29. package/esm/config/contracts.js +0 -4
  30. package/esm/helpers/morphoBlueHelpers/index.d.ts +0 -1
  31. package/esm/helpers/morphoBlueHelpers/index.js +27 -31
  32. package/esm/portfolio/index.js +0 -27
  33. package/esm/types/aaveV4.d.ts +9 -0
  34. package/esm/types/claiming.d.ts +1 -13
  35. package/esm/types/claiming.js +0 -2
  36. package/esm/types/morphoBlue.d.ts +2 -3
  37. package/package.json +2 -2
  38. package/src/aaveV3/index.ts +7 -1
  39. package/src/aaveV3/sgho.ts +100 -0
  40. package/src/aaveV4/index.ts +48 -20
  41. package/src/claiming/aaveV3.ts +2 -3
  42. package/src/claiming/index.ts +0 -2
  43. package/src/config/contracts.ts +0 -4
  44. package/src/helpers/morphoBlueHelpers/index.ts +29 -32
  45. package/src/portfolio/index.ts +0 -25
  46. package/src/types/aaveV4.ts +9 -0
  47. package/src/types/claiming.ts +0 -15
  48. package/src/types/morphoBlue.ts +2 -3
  49. package/cjs/claiming/morphoBlue.d.ts +0 -5
  50. package/cjs/claiming/morphoBlue.js +0 -113
  51. package/esm/claiming/morphoBlue.d.ts +0 -5
  52. package/esm/claiming/morphoBlue.js +0 -105
  53. package/src/claiming/morphoBlue.ts +0 -119
@@ -2,8 +2,7 @@
2
2
  /* eslint-disable */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.LiquityView = exports.crvUSDFactory = exports.crvUSDView = exports.crvUSDsfrxETHAmm = exports.crvUSDtBTCAmm = exports.crvUSDWBTCAmm = exports.crvUSDETHAmm = exports.crvUSDwstETHAmm = exports.crvUSDsfrxETHController = exports.crvUSDtBTCController = exports.crvUSDWBTCController = exports.crvUSDETHController = exports.crvUSDwstETHController = exports.SparkProtocolDataProvider = exports.SparkPoolAddressesProvider = exports.SparkLendingPool = exports.SparkIncentiveDataProvider = exports.SparkView = exports.Pot = exports.IAToken = exports.IVariableDebtToken = exports.Comptroller = exports.CompoundLoanInfo = exports.AaveLendingPoolV2 = exports.AaveProtocolDataProvider = exports.LendingPoolAddressesProvider = exports.AaveLoanInfoV2 = exports.wstETH = exports.CompV3BulkerL2 = exports.CompV3BulkerMainnetETH = exports.CompV3BulkerMainnetUSDC = exports.CompV3View = exports.cWstETHv3 = exports.cUSDSv3 = exports.cUSDTv3 = exports.cETHv3 = exports.cUSDbCv3 = exports.cUSDCev3 = exports.cUSDCv3 = exports.AaveUiIncentiveDataProviderV3 = exports.AaveV3EtherfiProtocolDataProvider = exports.AaveV3LidoProtocolDataProvider = exports.AaveV3ProtocolDataProvider = exports.AaveV3EtherfiLendingPool = exports.AaveV3LidoLendingPool = exports.AaveV3LendingPool = exports.AaveV3EtherfiPoolAddressesProvider = exports.AaveV3LidoPoolAddressesProvider = exports.AaveV3PoolAddressesProvider = exports.AaveV3View = void 0;
5
- exports.YearnV3Vault = exports.SkySavings = exports.SparkSavingsVault = exports.MakerDsr = exports.YearnView = exports.YearnVault = exports.MorphoVault = exports.StkAAVE = exports.LiquityV2sBoldVault = exports.LiquityV2ActivePool = exports.AaveRewardsController = exports.MorphoDistributor = exports.SparkRewardsController = exports.SparkAirdrop = exports.UUPS = exports.LiquityStabilityPool = exports.LiquityLQTYStaking = exports.AaveUmbrellaView = exports.Erc4626 = exports.Erc20 = exports.AaveIncentivesController = exports.McdCdpManager = exports.McdGetCdps = exports.FluidView = exports.LiquityV2StabilityPool = exports.EulerV2View = exports.LiquityV2TroveNFT = exports.LiquityV2CollSurplusPool = exports.LiquityV2View = exports.LiquityV2LegacyView = exports.LlamaLendControllerAbi = exports.LlamaLendView = exports.DFSFeedRegistry = exports.FeedRegistry = exports.MorphoBlueView = exports.WeETHPriceFeed = exports.WstETHPriceFeed = exports.USDCPriceFeed = exports.BTCPriceFeed = exports.ETHPriceFeed = exports.COMPPriceFeed = exports.McdDog = exports.McdJug = exports.McdVat = exports.McdSpotter = exports.McdView = exports.LiquityActivePool = exports.PriceFeed = exports.TroveManager = exports.CollSurplusPool = void 0;
6
- exports.AaveV4View = void 0;
5
+ exports.AaveV4View = exports.YearnV3Vault = exports.SkySavings = exports.SparkSavingsVault = exports.MakerDsr = exports.YearnView = exports.YearnVault = exports.MorphoVault = exports.StkAAVE = exports.LiquityV2sBoldVault = exports.LiquityV2ActivePool = exports.AaveRewardsController = exports.SparkRewardsController = exports.SparkAirdrop = exports.UUPS = exports.LiquityStabilityPool = exports.LiquityLQTYStaking = exports.AaveUmbrellaView = exports.Erc4626 = exports.Erc20 = exports.AaveIncentivesController = exports.McdCdpManager = exports.McdGetCdps = exports.FluidView = exports.LiquityV2StabilityPool = exports.EulerV2View = exports.LiquityV2TroveNFT = exports.LiquityV2CollSurplusPool = exports.LiquityV2View = exports.LiquityV2LegacyView = exports.LlamaLendControllerAbi = exports.LlamaLendView = exports.DFSFeedRegistry = exports.FeedRegistry = exports.MorphoBlueView = exports.WeETHPriceFeed = exports.WstETHPriceFeed = exports.USDCPriceFeed = exports.BTCPriceFeed = exports.ETHPriceFeed = exports.COMPPriceFeed = exports.McdDog = exports.McdJug = exports.McdVat = exports.McdSpotter = exports.McdView = exports.LiquityActivePool = exports.PriceFeed = exports.TroveManager = exports.CollSurplusPool = void 0;
7
6
  exports.AaveV3View = {
8
7
  "abi": [{ "inputs": [], "name": "AAVE_REFERRAL_CODE", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_umbrella", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getAdditionalUmbrellaStakingData", "outputs": [{ "components": [{ "internalType": "address", "name": "stkToken", "type": "address" }, { "internalType": "uint256", "name": "totalShares", "type": "uint256" }, { "internalType": "address", "name": "stkUnderlyingToken", "type": "address" }, { "internalType": "address", "name": "aToken", "type": "address" }, { "internalType": "uint256", "name": "cooldownPeriod", "type": "uint256" }, { "internalType": "uint256", "name": "unstakeWindow", "type": "uint256" }, { "internalType": "uint256", "name": "stkTokenToWaTokenRate", "type": "uint256" }, { "internalType": "uint256", "name": "waTokenToATokenRate", "type": "uint256" }, { "internalType": "uint256[]", "name": "rewardsEmissionRates", "type": "uint256[]" }, { "internalType": "uint256", "name": "userCooldownAmount", "type": "uint256" }, { "internalType": "uint256", "name": "userEndOfCooldown", "type": "uint256" }, { "internalType": "uint256", "name": "userWithdrawalWindow", "type": "uint256" }], "internalType": "struct AaveV3View.UmbrellaStkData[]", "name": "retVal", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }], "name": "getAllEmodes", "outputs": [{ "components": [{ "internalType": "uint16", "name": "ltv", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationThreshold", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationBonus", "type": "uint16" }, { "internalType": "uint128", "name": "collateralBitmap", "type": "uint128" }, { "internalType": "bool", "name": "isolated", "type": "bool" }, { "internalType": "string", "name": "label", "type": "string" }, { "internalType": "uint128", "name": "borrowableBitmap", "type": "uint128" }, { "internalType": "uint128", "name": "ltvzeroBitmap", "type": "uint128" }], "internalType": "struct DataTypes.EModeCategoryNew[]", "name": "emodesData", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "components": [{ "internalType": "address", "name": "reserveAddress", "type": "address" }, { "internalType": "uint256", "name": "liquidityAdded", "type": "uint256" }, { "internalType": "uint256", "name": "liquidityTaken", "type": "uint256" }, { "internalType": "bool", "name": "isDebtAsset", "type": "bool" }], "internalType": "struct AaveV3View.LiquidityChangeParams[]", "name": "_reserveParams", "type": "tuple[]" }], "name": "getApyAfterValuesEstimation", "outputs": [{ "components": [{ "internalType": "address", "name": "reserveAddress", "type": "address" }, { "internalType": "uint256", "name": "supplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "variableBorrowRate", "type": "uint256" }], "internalType": "struct AaveV3View.EstimatedRates[]", "name": "", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_tokenAddr", "type": "address" }], "name": "getAssetPrice", "outputs": [{ "internalType": "uint256", "name": "price", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getCollFactors", "outputs": [{ "internalType": "uint256[]", "name": "collFactors", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "emodeCategory", "type": "uint256" }, { "internalType": "contract IPoolV3", "name": "lendingPool", "type": "address" }], "name": "getEModeCollateralFactor", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_asset", "type": "address" }, { "internalType": "address", "name": "_eoa", "type": "address" }, { "internalType": "address", "name": "_proxy", "type": "address" }, { "internalType": "address", "name": "_market", "type": "address" }], "name": "getEOAApprovalsAndBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "address", "name": "aToken", "type": "address" }, { "internalType": "address", "name": "variableDebtToken", "type": "address" }, { "internalType": "uint256", "name": "assetApproval", "type": "uint256" }, { "internalType": "uint256", "name": "aTokenApproval", "type": "uint256" }, { "internalType": "uint256", "name": "variableDebtDelegation", "type": "uint256" }, { "internalType": "uint256", "name": "borrowedVariableAmount", "type": "uint256" }, { "internalType": "uint256", "name": "eoaBalance", "type": "uint256" }, { "internalType": "uint256", "name": "aTokenBalance", "type": "uint256" }], "internalType": "struct AaveV3View.EOAApprovalData", "name": "approvalData", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_eoa", "type": "address" }, { "internalType": "address", "name": "_proxy", "type": "address" }, { "internalType": "address", "name": "_market", "type": "address" }], "name": "getEOAApprovalsAndBalancesForAllTokens", "outputs": [{ "components": [{ "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "address", "name": "aToken", "type": "address" }, { "internalType": "address", "name": "variableDebtToken", "type": "address" }, { "internalType": "uint256", "name": "assetApproval", "type": "uint256" }, { "internalType": "uint256", "name": "aTokenApproval", "type": "uint256" }, { "internalType": "uint256", "name": "variableDebtDelegation", "type": "uint256" }, { "internalType": "uint256", "name": "borrowedVariableAmount", "type": "uint256" }, { "internalType": "uint256", "name": "eoaBalance", "type": "uint256" }, { "internalType": "uint256", "name": "aTokenBalance", "type": "uint256" }], "internalType": "struct AaveV3View.EOAApprovalData[]", "name": "approvalData", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "contract IPoolV3", "name": "_lendingPool", "type": "address" }, { "internalType": "uint8", "name": "_id", "type": "uint8" }], "name": "getEmodeData", "outputs": [{ "components": [{ "internalType": "uint16", "name": "ltv", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationThreshold", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationBonus", "type": "uint16" }, { "internalType": "uint128", "name": "collateralBitmap", "type": "uint128" }, { "internalType": "bool", "name": "isolated", "type": "bool" }, { "internalType": "string", "name": "label", "type": "string" }, { "internalType": "uint128", "name": "borrowableBitmap", "type": "uint128" }, { "internalType": "uint128", "name": "ltvzeroBitmap", "type": "uint128" }], "internalType": "struct DataTypes.EModeCategoryNew", "name": "emodeData", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address[]", "name": "_tokenAddresses", "type": "address[]" }], "name": "getFullTokensInfo", "outputs": [{ "components": [{ "internalType": "address", "name": "aTokenAddress", "type": "address" }, { "internalType": "address", "name": "underlyingTokenAddress", "type": "address" }, { "internalType": "uint16", "name": "assetId", "type": "uint16" }, { "internalType": "uint256", "name": "supplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "borrowRateVariable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowRateStable", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupply", "type": "uint256" }, { "internalType": "uint256", "name": "availableLiquidity", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrow", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowVar", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowStab", "type": "uint256" }, { "internalType": "uint256", "name": "collateralFactor", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationRatio", "type": "uint256" }, { "internalType": "uint256", "name": "price", "type": "uint256" }, { "internalType": "uint256", "name": "supplyCap", "type": "uint256" }, { "internalType": "uint256", "name": "borrowCap", "type": "uint256" }, { "internalType": "uint256", "name": "emodeCategory", "type": "uint256" }, { "internalType": "uint256", "name": "debtCeilingForIsolationMode", "type": "uint256" }, { "internalType": "uint256", "name": "isolationModeTotalDebt", "type": "uint256" }, { "internalType": "bool", "name": "usageAsCollateralEnabled", "type": "bool" }, { "internalType": "bool", "name": "borrowingEnabled", "type": "bool" }, { "internalType": "bool", "name": "stableBorrowRateEnabled", "type": "bool" }, { "internalType": "bool", "name": "isolationModeBorrowingEnabled", "type": "bool" }, { "internalType": "bool", "name": "isSiloedForBorrowing", "type": "bool" }, { "internalType": "uint256", "name": "eModeCollateralFactor", "type": "uint256" }, { "internalType": "bool", "name": "isFlashLoanEnabled", "type": "bool" }, { "internalType": "uint16", "name": "ltv", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationThreshold", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationBonus", "type": "uint16" }, { "internalType": "address", "name": "priceSource", "type": "address" }, { "internalType": "string", "name": "label", "type": "string" }, { "internalType": "bool", "name": "isActive", "type": "bool" }, { "internalType": "bool", "name": "isPaused", "type": "bool" }, { "internalType": "bool", "name": "isFrozen", "type": "bool" }, { "internalType": "address", "name": "debtTokenAddress", "type": "address" }], "internalType": "struct AaveV3View.TokenInfoFull[]", "name": "tokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getHealthFactor", "outputs": [{ "internalType": "uint256", "name": "healthFactor", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getLoanData", "outputs": [{ "components": [{ "internalType": "address", "name": "user", "type": "address" }, { "internalType": "uint128", "name": "ratio", "type": "uint128" }, { "internalType": "uint256", "name": "eMode", "type": "uint256" }, { "internalType": "address[]", "name": "collAddr", "type": "address[]" }, { "internalType": "bool[]", "name": "enabledAsColl", "type": "bool[]" }, { "internalType": "address[]", "name": "borrowAddr", "type": "address[]" }, { "internalType": "uint256[]", "name": "collAmounts", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrowStableAmounts", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrowVariableAmounts", "type": "uint256[]" }, { "internalType": "uint16", "name": "ltv", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationThreshold", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationBonus", "type": "uint16" }, { "internalType": "address", "name": "priceSource", "type": "address" }, { "internalType": "string", "name": "label", "type": "string" }], "internalType": "struct AaveV3View.LoanData", "name": "data", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address[]", "name": "_users", "type": "address[]" }], "name": "getLoanDataArr", "outputs": [{ "components": [{ "internalType": "address", "name": "user", "type": "address" }, { "internalType": "uint128", "name": "ratio", "type": "uint128" }, { "internalType": "uint256", "name": "eMode", "type": "uint256" }, { "internalType": "address[]", "name": "collAddr", "type": "address[]" }, { "internalType": "bool[]", "name": "enabledAsColl", "type": "bool[]" }, { "internalType": "address[]", "name": "borrowAddr", "type": "address[]" }, { "internalType": "uint256[]", "name": "collAmounts", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrowStableAmounts", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrowVariableAmounts", "type": "uint256[]" }, { "internalType": "uint16", "name": "ltv", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationThreshold", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationBonus", "type": "uint16" }, { "internalType": "address", "name": "priceSource", "type": "address" }, { "internalType": "string", "name": "label", "type": "string" }], "internalType": "struct AaveV3View.LoanData[]", "name": "loans", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getPrices", "outputs": [{ "internalType": "uint256[]", "name": "prices", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getRatio", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address[]", "name": "_users", "type": "address[]" }], "name": "getRatios", "outputs": [{ "internalType": "uint256[]", "name": "ratios", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getSafetyRatio", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_tokenAddr", "type": "address" }], "name": "getTokenInfoFull", "outputs": [{ "components": [{ "internalType": "address", "name": "aTokenAddress", "type": "address" }, { "internalType": "address", "name": "underlyingTokenAddress", "type": "address" }, { "internalType": "uint16", "name": "assetId", "type": "uint16" }, { "internalType": "uint256", "name": "supplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "borrowRateVariable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowRateStable", "type": "uint256" }, { "internalType": "uint256", "name": "totalSupply", "type": "uint256" }, { "internalType": "uint256", "name": "availableLiquidity", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrow", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowVar", "type": "uint256" }, { "internalType": "uint256", "name": "totalBorrowStab", "type": "uint256" }, { "internalType": "uint256", "name": "collateralFactor", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationRatio", "type": "uint256" }, { "internalType": "uint256", "name": "price", "type": "uint256" }, { "internalType": "uint256", "name": "supplyCap", "type": "uint256" }, { "internalType": "uint256", "name": "borrowCap", "type": "uint256" }, { "internalType": "uint256", "name": "emodeCategory", "type": "uint256" }, { "internalType": "uint256", "name": "debtCeilingForIsolationMode", "type": "uint256" }, { "internalType": "uint256", "name": "isolationModeTotalDebt", "type": "uint256" }, { "internalType": "bool", "name": "usageAsCollateralEnabled", "type": "bool" }, { "internalType": "bool", "name": "borrowingEnabled", "type": "bool" }, { "internalType": "bool", "name": "stableBorrowRateEnabled", "type": "bool" }, { "internalType": "bool", "name": "isolationModeBorrowingEnabled", "type": "bool" }, { "internalType": "bool", "name": "isSiloedForBorrowing", "type": "bool" }, { "internalType": "uint256", "name": "eModeCollateralFactor", "type": "uint256" }, { "internalType": "bool", "name": "isFlashLoanEnabled", "type": "bool" }, { "internalType": "uint16", "name": "ltv", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationThreshold", "type": "uint16" }, { "internalType": "uint16", "name": "liquidationBonus", "type": "uint16" }, { "internalType": "address", "name": "priceSource", "type": "address" }, { "internalType": "string", "name": "label", "type": "string" }, { "internalType": "bool", "name": "isActive", "type": "bool" }, { "internalType": "bool", "name": "isPaused", "type": "bool" }, { "internalType": "bool", "name": "isFrozen", "type": "bool" }, { "internalType": "address", "name": "debtTokenAddress", "type": "address" }], "internalType": "struct AaveV3View.TokenInfoFull", "name": "_tokenInfo", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address[]", "name": "_tokenAddresses", "type": "address[]" }], "name": "getTokensInfo", "outputs": [{ "components": [{ "internalType": "address", "name": "aTokenAddress", "type": "address" }, { "internalType": "address", "name": "underlyingTokenAddress", "type": "address" }, { "internalType": "uint256", "name": "collateralFactor", "type": "uint256" }, { "internalType": "uint256", "name": "price", "type": "uint256" }], "internalType": "struct AaveV3View.TokenInfo[]", "name": "tokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "isBorrowAllowed", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "pure", "type": "function" }],
9
8
  "networks": {
@@ -1267,10 +1266,6 @@ exports.SparkRewardsController = {
1267
1266
  }
1268
1267
  }
1269
1268
  };
1270
- exports.MorphoDistributor = {
1271
- "abi": [{ "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "uint256", "name": "initialTimelock", "type": "uint256" }, { "internalType": "bytes32", "name": "initialRoot", "type": "bytes32" }, { "internalType": "bytes32", "name": "initialIpfsHash", "type": "bytes32" }], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "acceptRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "address", "name": "reward", "type": "address" }, { "internalType": "uint256", "name": "claimable", "type": "uint256" }, { "internalType": "bytes32[]", "name": "proof", "type": "bytes32[]" }], "name": "claim", "outputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "address", "name": "reward", "type": "address" }], "name": "claimed", "outputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ipfsHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "isUpdater", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingRoot", "outputs": [{ "internalType": "bytes32", "name": "root", "type": "bytes32" }, { "internalType": "bytes32", "name": "ipfsHash", "type": "bytes32" }, { "internalType": "uint256", "name": "validAt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "revokePendingRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "root", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "setOwner", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "newRoot", "type": "bytes32" }, { "internalType": "bytes32", "name": "newIpfsHash", "type": "bytes32" }], "name": "setRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "updater", "type": "address" }, { "internalType": "bool", "name": "active", "type": "bool" }], "name": "setRootUpdater", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "newTimelock", "type": "uint256" }], "name": "setTimelock", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "newRoot", "type": "bytes32" }, { "internalType": "bytes32", "name": "newIpfsHash", "type": "bytes32" }], "name": "submitRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "timelock", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
1272
- "networks": {}
1273
- };
1274
1269
  exports.AaveRewardsController = {
1275
1270
  "abi": [{ "inputs": [{ "internalType": "address[]", "name": "assets", "type": "address[]" }, { "internalType": "address", "name": "user", "type": "address" }], "name": "getAllUserRewards", "outputs": [{ "internalType": "address[]", "name": "rewardsList", "type": "address[]" }, { "internalType": "uint256[]", "name": "unclaimedAmounts", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }],
1276
1271
  "networks": {
@@ -56,4 +56,3 @@ export declare const getRewardsForMarket: (marketId: string, network?: NetworkNu
56
56
  supplyApy: string;
57
57
  borrowApy: string;
58
58
  }>;
59
- export declare const getMorphoUnderlyingSymbol: (_symbol: string) => string;
@@ -12,7 +12,7 @@ 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.getMorphoUnderlyingSymbol = exports.getRewardsForMarket = exports.getReallocation = exports.getLiquidityToAllocate = exports.getReallocatableLiquidity = exports.getApyAfterValuesEstimation = exports.getBorrowRate = exports.getSupplyRate = exports.getMorphoBlueAggregatedPositionData = void 0;
15
+ exports.getRewardsForMarket = exports.getReallocation = exports.getLiquidityToAllocate = exports.getReallocatableLiquidity = exports.getApyAfterValuesEstimation = exports.getBorrowRate = exports.getSupplyRate = exports.getMorphoBlueAggregatedPositionData = void 0;
16
16
  const decimal_js_1 = __importDefault(require("decimal.js"));
17
17
  const tokens_1 = require("@defisaver/tokens");
18
18
  const moneymarket_1 = require("../../moneymarket");
@@ -138,12 +138,13 @@ const getApyAfterValuesEstimation = (selectedMarket, actions, provider, network)
138
138
  return { borrowRate, supplyRate };
139
139
  });
140
140
  exports.getApyAfterValuesEstimation = getApyAfterValuesEstimation;
141
- const API_URL = 'https://blue-api.morpho.org/graphql';
141
+ const API_URL = 'https://api.morpho.org/graphql';
142
+ // Morpho Blue ACRM (Adaptive Curve IRM) always targets 90% utilization — protocol constant
143
+ const ACRM_TARGET_UTILIZATION = '900000000000000000';
142
144
  const MARKET_QUERY = `
143
- query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
144
- marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
145
+ query MarketByUniqueKey($marketId: String!, $chainId: Int!) {
146
+ marketById(marketId: $marketId, chainId: $chainId) {
145
147
  reallocatableLiquidityAssets
146
- targetBorrowUtilization
147
148
  loanAsset {
148
149
  address
149
150
  decimals
@@ -160,8 +161,8 @@ const MARKET_QUERY = `
160
161
  address
161
162
  name
162
163
  }
163
- allocationMarket {
164
- uniqueKey
164
+ withdrawMarket {
165
+ marketId
165
166
  loanAsset {
166
167
  address
167
168
  }
@@ -185,14 +186,14 @@ const MARKET_QUERY = `
185
186
  address
186
187
  }
187
188
  irmAddress
188
- lltv
189
+ lltv
189
190
  }
190
191
  }
191
192
  `;
192
193
  const REWARDS_QUERY = `
193
- query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
194
- marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
195
- uniqueKey
194
+ query MarketByUniqueKey($marketId: String!, $chainId: Int!) {
195
+ marketById(marketId: $marketId, chainId: $chainId) {
196
+ marketId
196
197
  state {
197
198
  rewards {
198
199
  amountPerSuppliedToken
@@ -221,17 +222,17 @@ const getReallocatableLiquidity = (marketId_1, ...args_1) => __awaiter(void 0, [
221
222
  headers: { 'Content-Type': 'application/json' },
222
223
  body: JSON.stringify({
223
224
  query: MARKET_QUERY,
224
- variables: { uniqueKey: marketId, chainId: network },
225
+ variables: { marketId, chainId: network },
225
226
  }),
226
227
  signal: AbortSignal.timeout(utils_1.LONGER_TIMEOUT),
227
228
  });
228
229
  const data = yield response.json();
229
- const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketByUniqueKey;
230
+ const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketById;
230
231
  if (!marketData)
231
232
  throw new Error('Market data not found');
232
233
  return {
233
234
  reallocatableLiquidity: marketData.reallocatableLiquidityAssets,
234
- targetBorrowUtilization: marketData.targetBorrowUtilization,
235
+ targetBorrowUtilization: ACRM_TARGET_UTILIZATION,
235
236
  };
236
237
  }
237
238
  catch (error) {
@@ -285,12 +286,12 @@ const getReallocation = (market_1, assetsData_1, amountToBorrow_1, ...args_1) =>
285
286
  headers: { 'Content-Type': 'application/json' },
286
287
  body: JSON.stringify({
287
288
  query: MARKET_QUERY,
288
- variables: { uniqueKey: marketId, chainId: network },
289
+ variables: { marketId, chainId: network },
289
290
  }),
290
291
  signal: AbortSignal.timeout(utils_1.LONGER_TIMEOUT),
291
292
  });
292
293
  const data = yield response.json();
293
- const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketByUniqueKey;
294
+ const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketById;
294
295
  if (!marketData)
295
296
  throw new Error('Market data not found');
296
297
  const loanAssetInfo = (0, tokens_1.getAssetInfoByAddress)(loanToken, network);
@@ -300,9 +301,9 @@ const getReallocation = (market_1, assetsData_1, amountToBorrow_1, ...args_1) =>
300
301
  const newTotalBorrowAssets = new decimal_js_1.default(totalBorrowWei).add(amountToBorrow).toString();
301
302
  const newUtil = new decimal_js_1.default(newTotalBorrowAssets).div(totalSupplyWei).toString();
302
303
  const newUtilScaled = new decimal_js_1.default(newUtil).mul(1e18).toString();
303
- if (new decimal_js_1.default(newUtilScaled).lt(marketData.targetBorrowUtilization))
304
+ if (new decimal_js_1.default(newUtilScaled).lt(ACRM_TARGET_UTILIZATION))
304
305
  return { vaults: [], withdrawals: [] };
305
- const liquidityToAllocate = (0, exports.getLiquidityToAllocate)(amountToBorrow, totalBorrowWei, totalSupplyWei, marketData.targetBorrowUtilization, marketData.reallocatableLiquidityAssets);
306
+ const liquidityToAllocate = (0, exports.getLiquidityToAllocate)(amountToBorrow, totalBorrowWei, totalSupplyWei, ACRM_TARGET_UTILIZATION, marketData.reallocatableLiquidityAssets);
306
307
  const vaultTotalAssets = marketData.publicAllocatorSharedLiquidity.reduce((acc, item) => {
307
308
  const vaultAddress = item.vault.address;
308
309
  acc[vaultAddress] = new decimal_js_1.default(acc[vaultAddress] || '0').add(item.assets).toString();
@@ -324,14 +325,14 @@ const getReallocation = (market_1, assetsData_1, amountToBorrow_1, ...args_1) =>
324
325
  totalReallocated = new decimal_js_1.default(totalReallocated).add(amountToTake).toString();
325
326
  const withdrawal = [
326
327
  [
327
- item.allocationMarket.loanAsset.address,
328
- (_b = item.allocationMarket.collateralAsset) === null || _b === void 0 ? void 0 : _b.address,
329
- (_c = item.allocationMarket.oracle) === null || _c === void 0 ? void 0 : _c.address,
330
- item.allocationMarket.irmAddress,
331
- item.allocationMarket.lltv,
328
+ item.withdrawMarket.loanAsset.address,
329
+ (_b = item.withdrawMarket.collateralAsset) === null || _b === void 0 ? void 0 : _b.address,
330
+ (_c = item.withdrawMarket.oracle) === null || _c === void 0 ? void 0 : _c.address,
331
+ item.withdrawMarket.irmAddress,
332
+ item.withdrawMarket.lltv,
332
333
  ],
333
334
  amountToTake.toString(),
334
- item.allocationMarket.uniqueKey,
335
+ item.withdrawMarket.marketId,
335
336
  ];
336
337
  if (!withdrawalsPerVault[vaultAddress]) {
337
338
  withdrawalsPerVault[vaultAddress] = [];
@@ -359,11 +360,11 @@ const getRewardsForMarket = (marketId_1, ...args_1) => __awaiter(void 0, [market
359
360
  headers: { 'Content-Type': 'application/json' },
360
361
  body: JSON.stringify({
361
362
  query: REWARDS_QUERY,
362
- variables: { uniqueKey: marketId, chainId: network },
363
+ variables: { marketId, chainId: network },
363
364
  }),
364
365
  });
365
366
  const data = yield response.json();
366
- const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketByUniqueKey;
367
+ const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketById;
367
368
  if (!marketData)
368
369
  throw new Error('Market data not found');
369
370
  const morphoAssetInfo = (0, tokens_1.getAssetInfo)('MORPHO');
@@ -373,9 +374,3 @@ const getRewardsForMarket = (marketId_1, ...args_1) => __awaiter(void 0, [market
373
374
  return { supplyApy: (0, moneymarket_1.aprToApy)(supplyAprPercent), borrowApy: (0, moneymarket_1.aprToApy)(borrowAprPercent) };
374
375
  });
375
376
  exports.getRewardsForMarket = getRewardsForMarket;
376
- const getMorphoUnderlyingSymbol = (_symbol) => {
377
- if (_symbol === 'MORPHO Legacy')
378
- return 'MORPHO';
379
- return (0, utils_1.wethToEth)(_symbol);
380
- };
381
- exports.getMorphoUnderlyingSymbol = getMorphoUnderlyingSymbol;
@@ -37,7 +37,6 @@ const umbrella_1 = require("../umbrella");
37
37
  const aaveV3_2 = require("../claiming/aaveV3");
38
38
  const compV3_1 = require("../claiming/compV3");
39
39
  const spark_2 = require("../claiming/spark");
40
- const morphoBlue_2 = require("../claiming/morphoBlue");
41
40
  const king_1 = require("../claiming/king");
42
41
  const ethena_1 = require("../claiming/ethena");
43
42
  const aaveV4_1 = require("../aaveV4");
@@ -45,7 +44,6 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
45
44
  return __awaiter(this, arguments, void 0, function* (provider, network, defaultProvider, addresses, isSim = false) {
46
45
  const isMainnet = network === common_1.NetworkNumber.Eth;
47
46
  const isFluidSupported = [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Arb, common_1.NetworkNumber.Base, common_1.NetworkNumber.Plasma].includes(network);
48
- const isMorphoRewardsSupported = [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Base].includes(network);
49
47
  const morphoMarkets = Object.values((0, markets_1.MorphoBlueMarkets)(network)).filter((market) => market.chainIds.includes(network));
50
48
  const compoundV3Markets = Object.values((0, markets_1.CompoundMarkets)(network)).filter((market) => market.chainIds.includes(network) && market.value !== types_1.CompoundVersions.CompoundV2);
51
49
  const sparkMarkets = Object.values((0, markets_1.SparkMarkets)(network)).filter((market) => market.chainIds.includes(network));
@@ -133,7 +131,6 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
133
131
  spark: {},
134
132
  spk: {},
135
133
  king: {},
136
- morpho: {},
137
134
  ethena: {},
138
135
  };
139
136
  }
@@ -343,30 +340,6 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
343
340
  rewardsData[address.toLowerCase()].aaveV3 = { error: `Error fetching Aave V3 rewards data for address ${address}`, data: null };
344
341
  }
345
342
  }))).flat(),
346
- // Batch Morpho Blue rewards
347
- (() => __awaiter(this, void 0, void 0, function* () {
348
- if (!isMorphoRewardsSupported)
349
- return;
350
- try {
351
- const morphoRewards = yield (0, morphoBlue_2.fetchMorphoBlueRewards)(client, network, addresses);
352
- for (const address of addresses) {
353
- const lowerAddress = address.toLowerCase();
354
- rewardsData[lowerAddress].morpho = {
355
- error: '',
356
- data: morphoRewards[lowerAddress] || [],
357
- };
358
- }
359
- }
360
- catch (error) {
361
- console.error('Error fetching Morpho Blue rewards data in batch:', error);
362
- for (const address of addresses) {
363
- rewardsData[address.toLowerCase()].morpho = {
364
- error: 'Error fetching Morpho Blue rewards data in batch',
365
- data: null,
366
- };
367
- }
368
- }
369
- }))(),
370
343
  // Batch Spark Airdrop rewards
371
344
  (() => __awaiter(this, void 0, void 0, function* () {
372
345
  try {
@@ -74,6 +74,8 @@ export interface AaveV4ReserveAssetOnChain {
74
74
  }
75
75
  export interface AaveV4ReserveAssetData {
76
76
  symbol: string;
77
+ /** Underlying token decimals as reported on-chain (independent of `@defisaver/tokens`). */
78
+ decimals: number;
77
79
  underlying: EthAddress;
78
80
  hub: EthAddress;
79
81
  hubName: string;
@@ -119,6 +121,11 @@ export interface AaveV4ReserveAssetData {
119
121
  hubLiquidity: string;
120
122
  premiumMultiplier: string;
121
123
  liquidityFee: string;
124
+ /**
125
+ * True when the underlying token is missing from `@defisaver/tokens` (placeholder `?` asset).
126
+ * The reserve is kept for read-only display, but amounts are zeroed and all actions are disabled.
127
+ */
128
+ isUnsupported?: boolean;
122
129
  }
123
130
  export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
124
131
  export interface AaveV4UsedReserveAsset {
@@ -138,6 +145,8 @@ export interface AaveV4UsedReserveAsset {
138
145
  isBorrowed: boolean;
139
146
  collateral: boolean;
140
147
  collateralFactor: number;
148
+ /** True when the underlying token is missing from `@defisaver/tokens` (placeholder `?` asset). */
149
+ isUnsupported?: boolean;
141
150
  }
142
151
  export interface AaveV4AggregatedPositionData {
143
152
  suppliedUsd: string;
@@ -8,8 +8,6 @@ export declare enum ClaimType {
8
8
  COMPOUND_V3_COMP = "COMPOUND_V3_COMP",
9
9
  /** Rewards from Spark (wstETH only for now) */
10
10
  SPARK_REWARDS = "SPARK_REWARDS",
11
- /** Rewards from Morpho */
12
- MORPHO = "MORPHO",
13
11
  /** Rewards from King (prev LTR^2 - received for weETH holding) */
14
12
  KING_REWARDS = "KING_REWARDS",
15
13
  /** Spark Airdrop */
@@ -57,16 +55,6 @@ export type KingRewardsClaimableToken = _ClaimableTokenPartial & {
57
55
  merkleProofs: string[];
58
56
  };
59
57
  };
60
- export type MorphoClaimableToken = _ClaimableTokenPartial & {
61
- claimType: ClaimType.MORPHO;
62
- additionalClaimFields: {
63
- originalAmount: string;
64
- merkleProofs: string[];
65
- distributor: EthAddress;
66
- isLegacy: boolean;
67
- txData: string;
68
- };
69
- };
70
58
  export type CompoundV3CompClaimableToken = _ClaimableTokenPartial & {
71
59
  claimType: ClaimType.COMPOUND_V3_COMP;
72
60
  additionalClaimFields: {
@@ -93,5 +81,5 @@ export type SparkWstEthRewardsClaimableToken = _ClaimableTokenPartial & {
93
81
  export type EthenaAirdropClaimableToken = _ClaimableTokenPartial & {
94
82
  claimType: ClaimType.ETHENA_AIRDROP;
95
83
  };
96
- export type ClaimableToken = AaveRewardsClaimableToken | AaveMeritRewardsClaimableToken | CompoundV3CompClaimableToken | MorphoClaimableToken | SparkRewardsClaimableToken | KingRewardsClaimableToken | SparkAirdropClaimableToken | SparkWstEthRewardsClaimableToken | EthenaAirdropClaimableToken;
84
+ export type ClaimableToken = AaveRewardsClaimableToken | AaveMeritRewardsClaimableToken | CompoundV3CompClaimableToken | SparkRewardsClaimableToken | KingRewardsClaimableToken | SparkAirdropClaimableToken | SparkWstEthRewardsClaimableToken | EthenaAirdropClaimableToken;
97
85
  export {};
@@ -11,8 +11,6 @@ var ClaimType;
11
11
  ClaimType["COMPOUND_V3_COMP"] = "COMPOUND_V3_COMP";
12
12
  /** Rewards from Spark (wstETH only for now) */
13
13
  ClaimType["SPARK_REWARDS"] = "SPARK_REWARDS";
14
- /** Rewards from Morpho */
15
- ClaimType["MORPHO"] = "MORPHO";
16
14
  /** Rewards from King (prev LTR^2 - received for weETH holding) */
17
15
  ClaimType["KING_REWARDS"] = "KING_REWARDS";
18
16
  /** Spark Airdrop */
@@ -189,12 +189,12 @@ export interface MorphoBlueAllocationMarket {
189
189
  };
190
190
  irmAddress: string;
191
191
  lltv: string;
192
- uniqueKey: string;
192
+ marketId: string;
193
193
  }
194
194
  export interface MorphoBluePublicAllocatorItem {
195
195
  vault: MorphoBlueVault;
196
196
  assets: string;
197
- allocationMarket: MorphoBlueAllocationMarket;
197
+ withdrawMarket: MorphoBlueAllocationMarket;
198
198
  }
199
199
  export interface MorphoBlueAllocatorMarketState {
200
200
  borrowAssets: string;
@@ -202,7 +202,6 @@ export interface MorphoBlueAllocatorMarketState {
202
202
  }
203
203
  export interface MorphoBlueRealloactionMarketData {
204
204
  reallocatableLiquidityAssets: string;
205
- targetBorrowUtilization: string;
206
205
  publicAllocatorSharedLiquidity: MorphoBluePublicAllocatorItem[];
207
206
  state: MorphoBlueAllocatorMarketState;
208
207
  }
@@ -46,5 +46,8 @@ export declare const getStakeAaveData: (provider: Client, network: NetworkNumber
46
46
  stkGhoBalance: string;
47
47
  ghoMeritApy: string;
48
48
  stkAaveApy: string;
49
+ sgho: import("./sgho").SghoData;
49
50
  }>;
50
51
  export { getMeritCampaigns, getMerkleCampaigns, };
52
+ export { getSghoData } from './sgho';
53
+ export type { SghoData, SghoUserData } from './sgho';
@@ -19,6 +19,7 @@ import { IncentiveKind, NetworkNumber, } from '../types/common';
19
19
  import { getViemProvider, setViemBlockNumber } from '../services/viem';
20
20
  import { getMeritCampaigns } from './merit';
21
21
  import { getAaveUnderlyingSymbol, getMerkleCampaigns } from './merkl';
22
+ import { getSghoData } from './sgho';
22
23
  import { SECONDS_PER_YEAR } from '../constants';
23
24
  export const aaveV3EmodeCategoriesMapping = (extractedState, usedAssets) => {
24
25
  const { eModeCategoriesData } = extractedState;
@@ -502,13 +503,14 @@ export const getStakeAaveData = (provider, network, address) => __awaiter(void 0
502
503
  const AaveIncentivesController = AaveIncentivesControllerViem(provider, network);
503
504
  const stkAAVE = StkAAVEViem(provider, network);
504
505
  const stkGHO = createViemContractFromConfigFunc('Erc20', stkGhoAddress)(provider, network);
505
- const [aaveRewardsBalance, emissionsPerSecond, stkAAVEBalance, stkAAVETotalSupply, stkGHOBalance, ghoMeritApy] = yield Promise.all([
506
+ const [aaveRewardsBalance, emissionsPerSecond, stkAAVEBalance, stkAAVETotalSupply, stkGHOBalance, ghoMeritApy, sgho] = yield Promise.all([
506
507
  AaveIncentivesController.read.getRewardsBalance([REWARDABLE_ASSETS, address]),
507
508
  stkAAVE.read.assets([stkAaveAddress]),
508
509
  stkAAVE.read.balanceOf([address]),
509
510
  stkAAVE.read.totalSupply(),
510
511
  stkGHO.read.balanceOf([address]),
511
512
  fetchYearlyMeritApyForStakingGho(),
513
+ getSghoData(network, address),
512
514
  ]);
513
515
  const stkAaveApy = new Dec(assetAmountInEth(emissionsPerSecond[0].toString(), 'GHO') || 0).mul(SECONDS_PER_YEAR).mul(100).div(assetAmountInEth(stkAAVETotalSupply.toString(), 'stkAAVE'))
514
516
  .toString();
@@ -521,6 +523,8 @@ export const getStakeAaveData = (provider, network, address) => __awaiter(void 0
521
523
  stkGhoBalance: assetAmountInEth(stkGHOBalance.toString(), 'GHO'),
522
524
  ghoMeritApy,
523
525
  stkAaveApy,
526
+ sgho,
524
527
  };
525
528
  });
526
529
  export { getMeritCampaigns, getMerkleCampaigns, };
530
+ export { getSghoData } from './sgho';
@@ -0,0 +1,18 @@
1
+ import { EthAddress, NetworkNumber } from '../types/common';
2
+ export interface SghoUserData {
3
+ shares: string;
4
+ balance: string;
5
+ maxDeposit: string;
6
+ maxWithdraw: string;
7
+ underlyingBalance: string;
8
+ }
9
+ export interface SghoData {
10
+ totalAssets: string;
11
+ totalSupply: string;
12
+ supplyCap: string;
13
+ /** Target savings rate as an APY percent (e.g. "4.25" for 4.25%). */
14
+ targetRate: string;
15
+ paused: boolean;
16
+ user: SghoUserData;
17
+ }
18
+ export declare const getSghoData: (network: NetworkNumber, address?: EthAddress) => Promise<SghoData>;
@@ -0,0 +1,88 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import Dec from 'decimal.js';
11
+ import { NetworkNumber } from '../types/common';
12
+ import { DEFAULT_TIMEOUT } from '../services/utils';
13
+ import { ZERO_ADDRESS } from '../constants';
14
+ const EMPTY_SGHO_DATA = {
15
+ totalAssets: '0',
16
+ totalSupply: '0',
17
+ supplyCap: '0',
18
+ targetRate: '0',
19
+ paused: false,
20
+ user: {
21
+ shares: '0',
22
+ balance: '0',
23
+ maxDeposit: '0',
24
+ maxWithdraw: '0',
25
+ underlyingBalance: '0',
26
+ },
27
+ };
28
+ const SGHO_VAULT_QUERY = `query SghoVault($request: SghoVaultRequest!) {
29
+ value: sghoVault(request: $request) {
30
+ totalAssets { amount { value } }
31
+ totalSupply { value }
32
+ supplyCap { amount { value } }
33
+ targetRate { value }
34
+ paused
35
+ user {
36
+ shares { amount { value } }
37
+ balance { amount { value } }
38
+ maxDeposit { amount { value } }
39
+ maxWithdraw { amount { value } }
40
+ underlyingBalance { amount { value } }
41
+ }
42
+ }
43
+ }`;
44
+ const tokenAmountValue = (entry) => { var _a, _b; return ((_b = (_a = entry === null || entry === void 0 ? void 0 : entry.amount) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) || '0'; };
45
+ const decimalValue = (entry) => { var _a; return ((_a = entry === null || entry === void 0 ? void 0 : entry.value) === null || _a === void 0 ? void 0 : _a.toString()) || '0'; };
46
+ // Aave returns the rate as a ratio (e.g. 0.0425); consumers display/compound it as a percent (4.25).
47
+ const percentValue = (entry) => ((entry === null || entry === void 0 ? void 0 : entry.value) != null ? new Dec(entry.value).mul(100).toString() : '0');
48
+ export const getSghoData = (network_1, ...args_1) => __awaiter(void 0, [network_1, ...args_1], void 0, function* (network, address = ZERO_ADDRESS) {
49
+ var _a, _b, _c, _d, _e, _f;
50
+ if (network !== NetworkNumber.Eth)
51
+ return EMPTY_SGHO_DATA;
52
+ try {
53
+ const res = yield fetch('https://api.v3.aave.com/graphql', {
54
+ method: 'POST',
55
+ headers: { 'Content-Type': 'application/json' },
56
+ body: JSON.stringify({
57
+ operationName: 'SghoVault',
58
+ query: SGHO_VAULT_QUERY,
59
+ variables: { request: { chainId: 1, user: address } },
60
+ }),
61
+ signal: AbortSignal.timeout(DEFAULT_TIMEOUT),
62
+ });
63
+ if (!res.ok)
64
+ throw new Error(`Aave SghoVault request failed: ${res.status}`);
65
+ const body = yield res.json();
66
+ const data = (_a = body === null || body === void 0 ? void 0 : body.data) === null || _a === void 0 ? void 0 : _a.value;
67
+ if (!data)
68
+ throw new Error('Aave SghoVault response missing data');
69
+ return {
70
+ totalAssets: tokenAmountValue(data.totalAssets),
71
+ totalSupply: decimalValue(data.totalSupply),
72
+ supplyCap: tokenAmountValue(data.supplyCap),
73
+ targetRate: percentValue(data.targetRate),
74
+ paused: !!data.paused,
75
+ user: {
76
+ shares: tokenAmountValue((_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.shares),
77
+ balance: tokenAmountValue((_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.balance),
78
+ maxDeposit: tokenAmountValue((_d = data === null || data === void 0 ? void 0 : data.user) === null || _d === void 0 ? void 0 : _d.maxDeposit),
79
+ maxWithdraw: tokenAmountValue((_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.maxWithdraw),
80
+ underlyingBalance: tokenAmountValue((_f = data === null || data === void 0 ? void 0 : data.user) === null || _f === void 0 ? void 0 : _f.underlyingBalance),
81
+ },
82
+ };
83
+ }
84
+ catch (e) {
85
+ console.error('External API Failure: Failed to fetch Aave sGHO vault data', e);
86
+ return EMPTY_SGHO_DATA;
87
+ }
88
+ });