@defisaver/positions-sdk 0.0.20 → 0.0.22

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 (99) hide show
  1. package/README.md +63 -0
  2. package/cjs/aaveV2/index.js +9 -4
  3. package/cjs/aaveV3/index.js +9 -4
  4. package/cjs/compoundV2/index.d.ts +1 -0
  5. package/cjs/compoundV2/index.js +15 -8
  6. package/cjs/config/contracts.d.ts +373 -201
  7. package/cjs/config/contracts.js +22 -0
  8. package/cjs/helpers/aaveHelpers/index.js +0 -5
  9. package/cjs/helpers/compoundHelpers/index.js +2 -2
  10. package/cjs/markets/compound/index.d.ts +2 -0
  11. package/cjs/markets/compound/index.js +60 -13
  12. package/cjs/markets/compound/marketsAssets.d.ts +7 -1
  13. package/cjs/markets/compound/marketsAssets.js +12 -2
  14. package/cjs/morphoAaveV2/index.js +4 -3
  15. package/cjs/morphoAaveV3/index.js +9 -4
  16. package/cjs/spark/index.js +9 -4
  17. package/cjs/types/aave.d.ts +0 -5
  18. package/cjs/types/compound.d.ts +6 -4
  19. package/cjs/types/compound.js +1 -0
  20. package/cjs/types/contracts/generated/CUSDCev3.d.ts +441 -0
  21. package/cjs/types/contracts/generated/CUSDCev3.js +5 -0
  22. package/cjs/types/contracts/generated/CompV3USDCBulkerArb.d.ts +41 -0
  23. package/cjs/types/contracts/generated/CompV3USDCBulkerArb.js +5 -0
  24. package/cjs/types/contracts/generated/index.d.ts +2 -0
  25. package/esm/aaveV2/index.js +11 -6
  26. package/esm/aaveV3/index.js +11 -6
  27. package/esm/compoundV2/index.d.ts +1 -0
  28. package/esm/compoundV2/index.js +13 -7
  29. package/esm/config/contracts.d.ts +373 -201
  30. package/esm/config/contracts.js +22 -0
  31. package/esm/helpers/aaveHelpers/index.js +0 -5
  32. package/esm/helpers/compoundHelpers/index.js +2 -2
  33. package/esm/markets/compound/index.d.ts +2 -0
  34. package/esm/markets/compound/index.js +59 -13
  35. package/esm/markets/compound/marketsAssets.d.ts +7 -1
  36. package/esm/markets/compound/marketsAssets.js +11 -1
  37. package/esm/morphoAaveV2/index.js +4 -3
  38. package/esm/morphoAaveV3/index.js +9 -4
  39. package/esm/spark/index.js +11 -6
  40. package/esm/types/aave.d.ts +0 -5
  41. package/esm/types/compound.d.ts +6 -4
  42. package/esm/types/compound.js +1 -0
  43. package/esm/types/contracts/generated/CUSDCev3.d.ts +441 -0
  44. package/esm/types/contracts/generated/CUSDCev3.js +4 -0
  45. package/esm/types/contracts/generated/CompV3USDCBulkerArb.d.ts +41 -0
  46. package/esm/types/contracts/generated/CompV3USDCBulkerArb.js +4 -0
  47. package/esm/types/contracts/generated/index.d.ts +2 -0
  48. package/package.json +40 -40
  49. package/src/aaveV2/index.ts +226 -220
  50. package/src/aaveV3/index.ts +561 -554
  51. package/src/assets/index.ts +60 -60
  52. package/src/chickenBonds/index.ts +123 -123
  53. package/src/compoundV2/index.ts +219 -206
  54. package/src/compoundV3/index.ts +275 -275
  55. package/src/config/contracts.js +673 -651
  56. package/src/constants/index.ts +3 -3
  57. package/src/contracts.ts +100 -100
  58. package/src/curveUsd/index.ts +228 -228
  59. package/src/exchange/index.ts +17 -17
  60. package/src/helpers/aaveHelpers/index.ts +134 -141
  61. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  62. package/src/helpers/compoundHelpers/index.ts +181 -181
  63. package/src/helpers/curveUsdHelpers/index.ts +32 -32
  64. package/src/helpers/index.ts +5 -5
  65. package/src/helpers/makerHelpers/index.ts +94 -94
  66. package/src/helpers/sparkHelpers/index.ts +106 -106
  67. package/src/index.ts +40 -40
  68. package/src/liquity/index.ts +116 -116
  69. package/src/maker/index.ts +101 -101
  70. package/src/markets/aave/index.ts +80 -80
  71. package/src/markets/aave/marketAssets.ts +32 -32
  72. package/src/markets/compound/index.ts +141 -85
  73. package/src/markets/compound/marketsAssets.ts +46 -35
  74. package/src/markets/curveUsd/index.ts +69 -69
  75. package/src/markets/index.ts +3 -3
  76. package/src/markets/spark/index.ts +29 -29
  77. package/src/markets/spark/marketAssets.ts +9 -9
  78. package/src/moneymarket/moneymarketCommonService.ts +75 -75
  79. package/src/morpho/markets.ts +39 -39
  80. package/src/morphoAaveV2/index.ts +255 -254
  81. package/src/morphoAaveV3/index.ts +619 -614
  82. package/src/multicall/index.ts +22 -22
  83. package/src/services/dsrService.ts +15 -15
  84. package/src/services/priceService.ts +21 -21
  85. package/src/services/utils.ts +34 -34
  86. package/src/spark/index.ts +421 -413
  87. package/src/staking/staking.ts +167 -167
  88. package/src/types/aave.ts +256 -261
  89. package/src/types/chickenBonds.ts +45 -45
  90. package/src/types/common.ts +83 -83
  91. package/src/types/compound.ts +128 -122
  92. package/src/types/contracts/generated/CUSDCev3.ts +685 -0
  93. package/src/types/contracts/generated/CompV3USDCBulkerArb.ts +85 -0
  94. package/src/types/contracts/generated/index.ts +2 -0
  95. package/src/types/curveUsd.ts +112 -112
  96. package/src/types/index.ts +6 -6
  97. package/src/types/liquity.ts +30 -30
  98. package/src/types/maker.ts +50 -50
  99. package/src/types/spark.ts +106 -106
@@ -184,6 +184,17 @@ module.exports = {
184
184
  "networks": {
185
185
  "1": {
186
186
  "address": "0xc3d688B66703497DAA19211EEdff47f25384cdc3"
187
+ },
188
+ "42161": {
189
+ "address": "0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf"
190
+ }
191
+ }
192
+ },
193
+ "cUSDCev3": {
194
+ "abi": [{ "inputs": [{ "components": [{ "internalType": "address", "name": "governor", "type": "address" }, { "internalType": "address", "name": "pauseGuardian", "type": "address" }, { "internalType": "address", "name": "baseToken", "type": "address" }, { "internalType": "address", "name": "baseTokenPriceFeed", "type": "address" }, { "internalType": "address", "name": "extensionDelegate", "type": "address" }, { "internalType": "uint64", "name": "supplyKink", "type": "uint64" }, { "internalType": "uint64", "name": "supplyPerYearInterestRateSlopeLow", "type": "uint64" }, { "internalType": "uint64", "name": "supplyPerYearInterestRateSlopeHigh", "type": "uint64" }, { "internalType": "uint64", "name": "supplyPerYearInterestRateBase", "type": "uint64" }, { "internalType": "uint64", "name": "borrowKink", "type": "uint64" }, { "internalType": "uint64", "name": "borrowPerYearInterestRateSlopeLow", "type": "uint64" }, { "internalType": "uint64", "name": "borrowPerYearInterestRateSlopeHigh", "type": "uint64" }, { "internalType": "uint64", "name": "borrowPerYearInterestRateBase", "type": "uint64" }, { "internalType": "uint64", "name": "storeFrontPriceFactor", "type": "uint64" }, { "internalType": "uint64", "name": "trackingIndexScale", "type": "uint64" }, { "internalType": "uint64", "name": "baseTrackingSupplySpeed", "type": "uint64" }, { "internalType": "uint64", "name": "baseTrackingBorrowSpeed", "type": "uint64" }, { "internalType": "uint104", "name": "baseMinForRewards", "type": "uint104" }, { "internalType": "uint104", "name": "baseBorrowMin", "type": "uint104" }, { "internalType": "uint104", "name": "targetReserves", "type": "uint104" }, { "components": [{ "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "address", "name": "priceFeed", "type": "address" }, { "internalType": "uint8", "name": "decimals", "type": "uint8" }, { "internalType": "uint64", "name": "borrowCollateralFactor", "type": "uint64" }, { "internalType": "uint64", "name": "liquidateCollateralFactor", "type": "uint64" }, { "internalType": "uint64", "name": "liquidationFactor", "type": "uint64" }, { "internalType": "uint128", "name": "supplyCap", "type": "uint128" }], "internalType": "struct CometConfiguration.AssetConfig[]", "name": "assetConfigs", "type": "tuple[]" }], "internalType": "struct CometConfiguration.Configuration", "name": "config", "type": "tuple" }], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "Absurd", "type": "error" }, { "inputs": [], "name": "AlreadyInitialized", "type": "error" }, { "inputs": [], "name": "BadAsset", "type": "error" }, { "inputs": [], "name": "BadDecimals", "type": "error" }, { "inputs": [], "name": "BadDiscount", "type": "error" }, { "inputs": [], "name": "BadMinimum", "type": "error" }, { "inputs": [], "name": "BadPrice", "type": "error" }, { "inputs": [], "name": "BorrowCFTooLarge", "type": "error" }, { "inputs": [], "name": "BorrowTooSmall", "type": "error" }, { "inputs": [], "name": "InsufficientReserves", "type": "error" }, { "inputs": [], "name": "InvalidInt104", "type": "error" }, { "inputs": [], "name": "InvalidInt256", "type": "error" }, { "inputs": [], "name": "InvalidUInt104", "type": "error" }, { "inputs": [], "name": "InvalidUInt128", "type": "error" }, { "inputs": [], "name": "InvalidUInt64", "type": "error" }, { "inputs": [], "name": "LiquidateCFTooLarge", "type": "error" }, { "inputs": [], "name": "NegativeNumber", "type": "error" }, { "inputs": [], "name": "NoSelfTransfer", "type": "error" }, { "inputs": [], "name": "NotCollateralized", "type": "error" }, { "inputs": [], "name": "NotForSale", "type": "error" }, { "inputs": [], "name": "NotLiquidatable", "type": "error" }, { "inputs": [], "name": "Paused", "type": "error" }, { "inputs": [], "name": "SupplyCapExceeded", "type": "error" }, { "inputs": [], "name": "TimestampTooLarge", "type": "error" }, { "inputs": [], "name": "TooManyAssets", "type": "error" }, { "inputs": [], "name": "TooMuchSlippage", "type": "error" }, { "inputs": [], "name": "TransferInFailed", "type": "error" }, { "inputs": [], "name": "TransferOutFailed", "type": "error" }, { "inputs": [], "name": "Unauthorized", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "absorber", "type": "address" }, { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "collateralAbsorbed", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "usdValue", "type": "uint256" }], "name": "AbsorbCollateral", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "absorber", "type": "address" }, { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "basePaidOut", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "usdValue", "type": "uint256" }], "name": "AbsorbDebt", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "buyer", "type": "address" }, { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "baseAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "collateralAmount", "type": "uint256" }], "name": "BuyCollateral", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "bool", "name": "supplyPaused", "type": "bool" }, { "indexed": false, "internalType": "bool", "name": "transferPaused", "type": "bool" }, { "indexed": false, "internalType": "bool", "name": "withdrawPaused", "type": "bool" }, { "indexed": false, "internalType": "bool", "name": "absorbPaused", "type": "bool" }, { "indexed": false, "internalType": "bool", "name": "buyPaused", "type": "bool" }], "name": "PauseAction", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "dst", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "Supply", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "dst", "type": "address" }, { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "SupplyCollateral", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "Transfer", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "TransferCollateral", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "src", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "Withdraw", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "src", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "WithdrawCollateral", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "WithdrawReserves", "type": "event" }, { "stateMutability": "payable", "type": "fallback" }, { "inputs": [{ "internalType": "address", "name": "absorber", "type": "address" }, { "internalType": "address[]", "name": "accounts", "type": "address[]" }], "name": "absorb", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "accrueAccount", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "manager", "type": "address" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "approveThis", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "balanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "baseBorrowMin", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "baseMinForRewards", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "baseScale", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "baseToken", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "baseTokenPriceFeed", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "baseTrackingBorrowSpeed", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "baseTrackingSupplySpeed", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "borrowBalanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "borrowKink", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "borrowPerSecondInterestRateBase", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "borrowPerSecondInterestRateSlopeHigh", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "borrowPerSecondInterestRateSlopeLow", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "minAmount", "type": "uint256" }, { "internalType": "uint256", "name": "baseAmount", "type": "uint256" }, { "internalType": "address", "name": "recipient", "type": "address" }], "name": "buyCollateral", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "extensionDelegate", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint8", "name": "i", "type": "uint8" }], "name": "getAssetInfo", "outputs": [{ "components": [{ "internalType": "uint8", "name": "offset", "type": "uint8" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "address", "name": "priceFeed", "type": "address" }, { "internalType": "uint64", "name": "scale", "type": "uint64" }, { "internalType": "uint64", "name": "borrowCollateralFactor", "type": "uint64" }, { "internalType": "uint64", "name": "liquidateCollateralFactor", "type": "uint64" }, { "internalType": "uint64", "name": "liquidationFactor", "type": "uint64" }, { "internalType": "uint128", "name": "supplyCap", "type": "uint128" }], "internalType": "struct CometCore.AssetInfo", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], "name": "getAssetInfoByAddress", "outputs": [{ "components": [{ "internalType": "uint8", "name": "offset", "type": "uint8" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "address", "name": "priceFeed", "type": "address" }, { "internalType": "uint64", "name": "scale", "type": "uint64" }, { "internalType": "uint64", "name": "borrowCollateralFactor", "type": "uint64" }, { "internalType": "uint64", "name": "liquidateCollateralFactor", "type": "uint64" }, { "internalType": "uint64", "name": "liquidationFactor", "type": "uint64" }, { "internalType": "uint128", "name": "supplyCap", "type": "uint128" }], "internalType": "struct CometCore.AssetInfo", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "utilization", "type": "uint256" }], "name": "getBorrowRate", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], "name": "getCollateralReserves", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "priceFeed", "type": "address" }], "name": "getPrice", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getReserves", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "utilization", "type": "uint256" }], "name": "getSupplyRate", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getUtilization", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "governor", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "manager", "type": "address" }], "name": "hasPermission", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "initializeStorage", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "isAbsorbPaused", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "address", "name": "", "type": "address" }], "name": "isAllowed", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "isBorrowCollateralized", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "isBuyPaused", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "isLiquidatable", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "isSupplyPaused", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "isTransferPaused", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "isWithdrawPaused", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "liquidatorPoints", "outputs": [{ "internalType": "uint32", "name": "numAbsorbs", "type": "uint32" }, { "internalType": "uint64", "name": "numAbsorbed", "type": "uint64" }, { "internalType": "uint128", "name": "approxSpend", "type": "uint128" }, { "internalType": "uint32", "name": "_reserved", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "numAssets", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bool", "name": "supplyPaused", "type": "bool" }, { "internalType": "bool", "name": "transferPaused", "type": "bool" }, { "internalType": "bool", "name": "withdrawPaused", "type": "bool" }, { "internalType": "bool", "name": "absorbPaused", "type": "bool" }, { "internalType": "bool", "name": "buyPaused", "type": "bool" }], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "pauseGuardian", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "baseAmount", "type": "uint256" }], "name": "quoteCollateral", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "storeFrontPriceFactor", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "supply", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "supplyFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "supplyKink", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "supplyPerSecondInterestRateBase", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "supplyPerSecondInterestRateSlopeHigh", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "supplyPerSecondInterestRateSlopeLow", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "supplyTo", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "targetReserves", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalBorrow", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "totalsCollateral", "outputs": [{ "internalType": "uint128", "name": "totalSupplyAsset", "type": "uint128" }, { "internalType": "uint128", "name": "_reserved", "type": "uint128" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "trackingIndexScale", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "transfer", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "transferAsset", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "transferAssetFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "transferFrom", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "userBasic", "outputs": [{ "internalType": "int104", "name": "principal", "type": "int104" }, { "internalType": "uint64", "name": "baseTrackingIndex", "type": "uint64" }, { "internalType": "uint64", "name": "baseTrackingAccrued", "type": "uint64" }, { "internalType": "uint16", "name": "assetsIn", "type": "uint16" }, { "internalType": "uint8", "name": "_reserved", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "address", "name": "", "type": "address" }], "name": "userCollateral", "outputs": [{ "internalType": "uint128", "name": "balance", "type": "uint128" }, { "internalType": "uint128", "name": "_reserved", "type": "uint128" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "userNonce", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "withdrawFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "withdrawReserves", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "to", "type": "address" }, { "internalType": "address", "name": "asset", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "withdrawTo", "outputs": [], "stateMutability": "nonpayable", "type": "function" }],
195
+ "networks": {
196
+ "42161": {
197
+ "address": "0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA"
187
198
  }
188
199
  }
189
200
  },
@@ -218,6 +229,9 @@ module.exports = {
218
229
  },
219
230
  "8453": {
220
231
  "address": "0x22591183c0eb7B2Fe07F6F44fd360d1117D07b4f"
232
+ },
233
+ "42161": {
234
+ "address": "0x3A07Bb9eb0d71bf03295a84655d82b00A1450CD6"
221
235
  }
222
236
  }
223
237
  },
@@ -248,6 +262,14 @@ module.exports = {
248
262
  }
249
263
  }
250
264
  },
265
+ "CompV3USDCBulkerArb": {
266
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "admin_", "type": "address" }, { "internalType": "address payable", "name": "wrappedNativeToken_", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "FailedToSendNativeToken", "type": "error" }, { "inputs": [], "name": "InvalidAddress", "type": "error" }, { "inputs": [], "name": "InvalidArgument", "type": "error" }, { "inputs": [], "name": "TransferInFailed", "type": "error" }, { "inputs": [], "name": "TransferOutFailed", "type": "error" }, { "inputs": [], "name": "Unauthorized", "type": "error" }, { "inputs": [], "name": "UnhandledAction", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "oldAdmin", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newAdmin", "type": "address" }], "name": "AdminTransferred", "type": "event" }, { "inputs": [], "name": "ACTION_CLAIM_REWARD", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ACTION_SUPPLY_ASSET", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ACTION_SUPPLY_NATIVE_TOKEN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ACTION_TRANSFER_ASSET", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ACTION_WITHDRAW_ASSET", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ACTION_WITHDRAW_NATIVE_TOKEN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "admin", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32[]", "name": "actions", "type": "bytes32[]" }, { "internalType": "bytes[]", "name": "data", "type": "bytes[]" }], "name": "invoke", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "recipient", "type": "address" }], "name": "sweepNativeToken", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "address", "name": "asset", "type": "address" }], "name": "sweepToken", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newAdmin", "type": "address" }], "name": "transferAdmin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "wrappedNativeToken", "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "stateMutability": "payable", "type": "receive" }],
267
+ "networks": {
268
+ "42161": {
269
+ "address": "0xbdE8F31D2DdDA895264e27DD990faB3DC87b372d"
270
+ }
271
+ }
272
+ },
251
273
  "wstETH": {
252
274
  "abi": [{ "inputs": [{ "internalType": "contract IStETH", "name": "_stETH", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "Transfer", "type": "event" }, { "inputs": [], "name": "DOMAIN_SEPARATOR", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" }], "name": "allowance", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "approve", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "balanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" }], "name": "decreaseAllowance", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_wstETHAmount", "type": "uint256" }], "name": "getStETHByWstETH", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_stETHAmount", "type": "uint256" }], "name": "getWstETHByStETH", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "addedValue", "type": "uint256" }], "name": "increaseAllowance", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "name", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "nonces", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "uint8", "name": "v", "type": "uint8" }, { "internalType": "bytes32", "name": "r", "type": "bytes32" }, { "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "permit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "stETH", "outputs": [{ "internalType": "contract IStETH", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "stEthPerToken", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "symbol", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "tokensPerStEth", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "transfer", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "sender", "type": "address" }, { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "transferFrom", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_wstETHAmount", "type": "uint256" }], "name": "unwrap", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_stETHAmount", "type": "uint256" }], "name": "wrap", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "stateMutability": "payable", "type": "receive" }],
253
275
  "networks": {
@@ -98,10 +98,5 @@ export const aaveAnyGetAggregatedPositionData = (_a) => {
98
98
  }
99
99
  payload.liquidationPrice = calcLeverageLiqPrice(leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
100
100
  }
101
- payload.suppliedEth = new Dec(payload.suppliedUsd).div(assetsData.ETH.price).toString();
102
- payload.borrowedEth = new Dec(payload.borrowedUsd).div(assetsData.ETH.price).toString();
103
- payload.leftToBorrowEth = new Dec(payload.leftToBorrowUsd).div(assetsData.ETH.price).toString();
104
- payload.borrowLimitEth = new Dec(payload.borrowLimitUsd).div(assetsData.ETH.price).toString();
105
- payload.liquidationLimitEth = new Dec(payload.liquidationLimitUsd).div(assetsData.ETH.price).toString();
106
101
  return payload;
107
102
  };
@@ -34,8 +34,8 @@ export const formatBaseData = (data, network, baseAssetPrice) => {
34
34
  totalBorrow, marketLiquidity: new Dec(totalSupply).minus(totalBorrow).toString(), symbol: wethToEth(assetInfo.symbol), priceInBaseAsset: getEthAmountForDecimals(data.price, 8), price: baseAssetPrice, collateralFactor: '0', liquidationRatio: '0', canBeBorrowed: true, canBeSupplied: true, supplyCap: '0', rewardSupplySpeed: getEthAmountForDecimals(data.baseTrackingSupplyRewardsSpeed, 15), rewardBorrowSpeed: getEthAmountForDecimals(data.baseTrackingBorrowRewardsSpeed, 15), minDebt: getEthAmountForDecimals(data.baseBorrowMin, assetInfo.decimals), isBase: true }));
35
35
  };
36
36
  export const getIncentiveApys = (baseData, compPrice) => {
37
- const incentiveSupplyApy = aprToApy((100 * SECONDS_PER_YEAR * +baseData.rewardSupplySpeed * +compPrice) / +baseData.priceInBaseAsset / +baseData.totalSupply).toString();
38
- const incentiveBorrowApy = aprToApy((100 * SECONDS_PER_YEAR * +baseData.rewardBorrowSpeed * +compPrice) / +baseData.priceInBaseAsset / +baseData.totalBorrow).toString();
37
+ const incentiveSupplyApy = aprToApy((100 * SECONDS_PER_YEAR * +baseData.rewardSupplySpeed * +compPrice) / +baseData.price / +baseData.totalSupply).toString();
38
+ const incentiveBorrowApy = aprToApy((100 * SECONDS_PER_YEAR * +baseData.rewardBorrowSpeed * +compPrice) / +baseData.price / +baseData.totalBorrow).toString();
39
39
  return {
40
40
  incentiveSupplyApy,
41
41
  incentiveBorrowApy,
@@ -2,6 +2,7 @@ import { CompoundMarketData } from '../../types';
2
2
  import { NetworkNumber } from '../../types/common';
3
3
  export declare const COMPOUND_V2: CompoundMarketData;
4
4
  export declare const COMPOUND_V3_USDC: (networkId: NetworkNumber) => CompoundMarketData;
5
+ export declare const COMPOUND_V3_USDCe: (networkId: NetworkNumber) => CompoundMarketData;
5
6
  export declare const COMPOUND_V3_ETH: (networkId: NetworkNumber) => CompoundMarketData;
6
7
  export declare const COMPOUND_V3_USDBC: (networkId: NetworkNumber) => CompoundMarketData;
7
8
  export declare const CompoundMarkets: (networkId: NetworkNumber) => {
@@ -9,4 +10,5 @@ export declare const CompoundMarkets: (networkId: NetworkNumber) => {
9
10
  readonly "v3-ETH": CompoundMarketData;
10
11
  readonly "v3-USDC": CompoundMarketData;
11
12
  readonly "v3-USDbC": CompoundMarketData;
13
+ readonly "v3-USDC.e": CompoundMarketData;
12
14
  };
@@ -1,17 +1,47 @@
1
1
  import { getConfigContractAddress } from '../../contracts';
2
2
  import { CompoundVersions } from '../../types';
3
3
  import { NetworkNumber } from '../../types/common';
4
- import { compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCollAssets, v3USDCCollAssets, } from './marketsAssets';
5
- const USDC_BULKER_OPTIONS = {
6
- supply: 2,
7
- withdraw: 5,
8
- };
4
+ import { compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCollAssets, v3USDCCollAssets, v3USDCeCollAssets, } from './marketsAssets';
5
+ const EMPTY_BULKER_OPTIONS = { supply: '', withdraw: '' };
9
6
  const STANDARD_BULKER_OPTIONS = {
10
7
  supply: '0x414354494f4e5f535550504c595f4e41544956455f544f4b454e000000000000',
11
8
  withdraw: '0x414354494f4e5f57495448445241575f4e41544956455f544f4b454e00000000',
12
9
  };
10
+ const BULKER_OPTIONS = {
11
+ [NetworkNumber.Eth]: {
12
+ [CompoundVersions.CompoundV3USDC]: { supply: 2, withdraw: 5 },
13
+ [CompoundVersions.CompoundV3ETH]: STANDARD_BULKER_OPTIONS,
14
+ // Non-existing markets, keeping it because of typescript
15
+ [CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
16
+ [CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
17
+ [CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
18
+ },
19
+ [NetworkNumber.Arb]: {
20
+ [CompoundVersions.CompoundV3USDC]: STANDARD_BULKER_OPTIONS,
21
+ [CompoundVersions.CompoundV3USDCe]: STANDARD_BULKER_OPTIONS,
22
+ // Non-existing markets, keeping it because of typescript
23
+ [CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
24
+ [CompoundVersions.CompoundV3ETH]: EMPTY_BULKER_OPTIONS,
25
+ [CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
26
+ },
27
+ [NetworkNumber.Base]: {
28
+ [CompoundVersions.CompoundV3ETH]: STANDARD_BULKER_OPTIONS,
29
+ [CompoundVersions.CompoundV3USDbC]: STANDARD_BULKER_OPTIONS,
30
+ // Non-existing markets, keeping it because of typescript
31
+ [CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
32
+ [CompoundVersions.CompoundV3USDC]: EMPTY_BULKER_OPTIONS,
33
+ [CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
34
+ },
35
+ [NetworkNumber.Opt]: {
36
+ [CompoundVersions.CompoundV3ETH]: EMPTY_BULKER_OPTIONS,
37
+ [CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
38
+ [CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
39
+ [CompoundVersions.CompoundV3USDC]: EMPTY_BULKER_OPTIONS,
40
+ [CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
41
+ },
42
+ };
13
43
  export const COMPOUND_V2 = {
14
- chainIds: [1],
44
+ chainIds: [NetworkNumber.Eth],
15
45
  label: 'Compound V2',
16
46
  shortLabel: 'v2',
17
47
  value: CompoundVersions.CompoundV2,
@@ -22,11 +52,11 @@ export const COMPOUND_V2 = {
22
52
  secondLabel: '',
23
53
  bulkerName: '',
24
54
  bulkerAddress: '',
25
- bulkerOptions: { supply: '', withdraw: '' },
55
+ bulkerOptions: BULKER_OPTIONS[NetworkNumber.Eth][CompoundVersions.CompoundV2],
26
56
  // icon: SvgAdapter(protocolIcons.compound),
27
57
  };
28
58
  export const COMPOUND_V3_USDC = (networkId) => ({
29
- chainIds: [NetworkNumber.Eth],
59
+ chainIds: [NetworkNumber.Eth, NetworkNumber.Arb],
30
60
  label: 'Compound V3 - USDC',
31
61
  shortLabel: 'v3',
32
62
  value: CompoundVersions.CompoundV3USDC,
@@ -35,9 +65,24 @@ export const COMPOUND_V3_USDC = (networkId) => ({
35
65
  baseMarket: 'cUSDCv3',
36
66
  baseMarketAddress: getConfigContractAddress('cUSDCv3', networkId),
37
67
  secondLabel: 'Market',
38
- bulkerName: 'CompV3USDCBulker',
39
- bulkerAddress: getConfigContractAddress('CompV3USDCBulker', networkId),
40
- bulkerOptions: USDC_BULKER_OPTIONS,
68
+ bulkerName: networkId === NetworkNumber.Arb ? 'CompV3USDCBulkerArb' : 'CompV3USDCBulker',
69
+ bulkerAddress: getConfigContractAddress(networkId === NetworkNumber.Arb ? 'CompV3USDCBulkerArb' : 'CompV3USDCBulker', networkId),
70
+ bulkerOptions: BULKER_OPTIONS[networkId][CompoundVersions.CompoundV3USDC],
71
+ // icon: SvgAdapter(protocolIcons.compoundv3),
72
+ });
73
+ export const COMPOUND_V3_USDCe = (networkId) => ({
74
+ chainIds: [NetworkNumber.Arb],
75
+ label: 'Compound V3 - USDC.e',
76
+ shortLabel: 'v3',
77
+ value: CompoundVersions.CompoundV3USDCe,
78
+ baseAsset: 'USDC.e',
79
+ collAssets: networkId ? v3USDCeCollAssets[networkId] : [],
80
+ baseMarket: 'cUSDCev3',
81
+ baseMarketAddress: getConfigContractAddress('cUSDCev3', networkId),
82
+ secondLabel: 'Market',
83
+ bulkerName: 'CompV3USDCBulkerArb',
84
+ bulkerAddress: getConfigContractAddress('CompV3USDCBulkerArb', networkId),
85
+ bulkerOptions: BULKER_OPTIONS[networkId][CompoundVersions.CompoundV3USDCe],
41
86
  // icon: SvgAdapter(protocolIcons.compoundv3),
42
87
  });
43
88
  export const COMPOUND_V3_ETH = (networkId) => ({
@@ -52,7 +97,7 @@ export const COMPOUND_V3_ETH = (networkId) => ({
52
97
  secondLabel: 'Market',
53
98
  bulkerName: 'CompV3ETHBulker',
54
99
  bulkerAddress: getConfigContractAddress('CompV3ETHBulker', networkId),
55
- bulkerOptions: STANDARD_BULKER_OPTIONS,
100
+ bulkerOptions: BULKER_OPTIONS[networkId][CompoundVersions.CompoundV3ETH],
56
101
  // icon: SvgAdapter(protocolIcons.compoundv3),
57
102
  });
58
103
  export const COMPOUND_V3_USDBC = (networkId) => ({
@@ -67,7 +112,7 @@ export const COMPOUND_V3_USDBC = (networkId) => ({
67
112
  secondLabel: 'Market',
68
113
  bulkerName: 'CompV3USDbCBulker',
69
114
  bulkerAddress: getConfigContractAddress('CompV3USDbCBulker', networkId),
70
- bulkerOptions: STANDARD_BULKER_OPTIONS,
115
+ bulkerOptions: BULKER_OPTIONS[networkId][CompoundVersions.CompoundV3USDbC],
71
116
  // icon: SvgAdapter(protocolIcons.compoundv3),
72
117
  });
73
118
  export const CompoundMarkets = (networkId) => ({
@@ -75,4 +120,5 @@ export const CompoundMarkets = (networkId) => ({
75
120
  [CompoundVersions.CompoundV3ETH]: COMPOUND_V3_ETH(networkId),
76
121
  [CompoundVersions.CompoundV3USDC]: COMPOUND_V3_USDC(networkId),
77
122
  [CompoundVersions.CompoundV3USDbC]: COMPOUND_V3_USDBC(networkId),
123
+ [CompoundVersions.CompoundV3USDCe]: COMPOUND_V3_USDCe(networkId),
78
124
  });
@@ -2,7 +2,13 @@ export declare const compoundV2CollateralAssets: import("@defisaver/tokens/esm/t
2
2
  export declare const v3USDCCollAssets: {
3
3
  readonly 1: readonly ["ETH", "COMP", "WBTC", "UNI", "LINK"];
4
4
  readonly 10: readonly [];
5
- readonly 42161: readonly [];
5
+ readonly 42161: readonly ["ARB", "ETH", "GMX", "WBTC"];
6
+ readonly 8453: readonly [];
7
+ };
8
+ export declare const v3USDCeCollAssets: {
9
+ readonly 1: readonly [];
10
+ readonly 10: readonly [];
11
+ readonly 42161: readonly ["ARB", "ETH", "GMX", "WBTC"];
6
12
  readonly 8453: readonly [];
7
13
  };
8
14
  export declare const v3ETHCollAssets: {
@@ -9,7 +9,17 @@ export const v3USDCCollAssets = {
9
9
  'ETH', 'COMP', 'WBTC', 'UNI', 'LINK',
10
10
  ],
11
11
  [NetworkNumber.Opt]: [],
12
- [NetworkNumber.Arb]: [],
12
+ [NetworkNumber.Arb]: [
13
+ 'ARB', 'ETH', 'GMX', 'WBTC',
14
+ ],
15
+ [NetworkNumber.Base]: [],
16
+ };
17
+ export const v3USDCeCollAssets = {
18
+ [NetworkNumber.Eth]: [],
19
+ [NetworkNumber.Opt]: [],
20
+ [NetworkNumber.Arb]: [
21
+ 'ARB', 'ETH', 'GMX', 'WBTC',
22
+ ],
13
23
  [NetworkNumber.Base]: [],
14
24
  };
15
25
  export const v3ETHCollAssets = {
@@ -117,10 +117,11 @@ export const getMorphoAaveV2AccountBalances = (web3, network, block, addressMapp
117
117
  return balances;
118
118
  }
119
119
  userBalances.forEach((balance) => {
120
- const { symbol, address: assetAddr } = getAssetInfoByAddress(wethToEthByAddress(balance.underlying, network), network);
120
+ const assetAddr = wethToEthByAddress(balance.underlying, network).toLowerCase();
121
+ const { symbol } = getAssetInfoByAddress(assetAddr, network);
121
122
  balances = {
122
- collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr.toLowerCase() : symbol]: new Dec(balance.supplyBalanceInP2P).add(balance.supplyBalanceOnPool).toString() }),
123
- debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr.toLowerCase() : symbol]: new Dec(balance.borrowBalanceInP2P).add(balance.borrowBalanceOnPool).toString() }),
123
+ collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr : symbol]: new Dec(balance.supplyBalanceInP2P).add(balance.supplyBalanceOnPool).toString() }),
124
+ debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr : symbol]: new Dec(balance.borrowBalanceInP2P).add(balance.borrowBalanceOnPool).toString() }),
124
125
  };
125
126
  });
126
127
  return balances;
@@ -252,7 +252,11 @@ export const getMorphoAaveV3AccountBalances = (web3, network, block, addressMapp
252
252
  const selectedMarket = MORPHO_AAVE_V3_ETH(network);
253
253
  // @ts-ignore
254
254
  const lendingPoolContract = createContractWrapper(web3, network, selectedMarket.lendingPool, selectedMarket.lendingPoolAddress);
255
- const _addresses = selectedMarket.assets.map((a) => getAssetInfo(ethToWeth(a), network).address);
255
+ // @ts-ignore
256
+ const protocolDataProviderContract = createContractWrapper(web3, network, selectedMarket.protocolData, selectedMarket.protocolDataAddress);
257
+ const reserveTokens = yield protocolDataProviderContract.methods.getAllReservesTokens().call({}, block);
258
+ const symbols = reserveTokens.map(({ symbol }) => symbol);
259
+ const _addresses = reserveTokens.map(({ tokenAddress }) => tokenAddress);
256
260
  const multicallArray = [
257
261
  ...(_addresses.map((underlyingAddress) => ([
258
262
  {
@@ -292,7 +296,8 @@ export const getMorphoAaveV3AccountBalances = (web3, network, block, addressMapp
292
296
  _addresses.forEach((underlyingAddr, i) => {
293
297
  const currentMulticallIndex = numberOfMultiCalls * i;
294
298
  const morphoMarketData = multicallResponse[currentMulticallIndex][0];
295
- const { symbol, address: assetAddr } = getAssetInfoByAddress(wethToEthByAddress(underlyingAddr, network), network);
299
+ const assetAddr = wethToEthByAddress(underlyingAddr, network).toLowerCase();
300
+ const { symbol } = getAssetInfoByAddress(assetAddr, network);
296
301
  const suppliedP2P = morphoAaveMath.indexMul(multicallResponse[currentMulticallIndex + 1][0], morphoMarketData.indexes.supply.p2pIndex).toString();
297
302
  const suppliedPool = morphoAaveMath.indexMul(multicallResponse[currentMulticallIndex + 2][0], morphoMarketData.indexes.supply.poolIndex).toString();
298
303
  const suppliedTotal = new Dec(suppliedP2P).add(suppliedPool).toString();
@@ -302,8 +307,8 @@ export const getMorphoAaveV3AccountBalances = (web3, network, block, addressMapp
302
307
  const borrowedPool = morphoAaveMath.indexMul(multicallResponse[currentMulticallIndex + 5][0], morphoMarketData.indexes.borrow.poolIndex).toString();
303
308
  const borrowed = new Dec(borrowedP2P).add(borrowedPool).toString();
304
309
  balances = {
305
- collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr.toLowerCase() : symbol]: supplied }),
306
- debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr.toLowerCase() : symbol]: borrowed }),
310
+ collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr : symbol]: supplied }),
311
+ debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr : symbol]: borrowed }),
307
312
  };
308
313
  });
309
314
  return balances;
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import Dec from 'decimal.js';
11
11
  import { assetAmountInEth, getAssetInfo } from '@defisaver/tokens';
12
- import { ethToWeth, getAbiItem, isLayer2Network, wethToEth, } from '../services/utils';
12
+ import { ethToWeth, getAbiItem, isLayer2Network, wethToEth, wethToEthByAddress, } from '../services/utils';
13
13
  import { calculateNetApy, getCbETHApr, getREthApr, getStETHApr, } from '../staking';
14
14
  import { getDsrApy } from '../services/dsrService';
15
- import { SparkIncentiveDataProviderContract, SparkViewContract, getConfigContractAbi, } from '../contracts';
15
+ import { SparkIncentiveDataProviderContract, SparkViewContract, getConfigContractAbi, createContractWrapper, } from '../contracts';
16
16
  import { multicall } from '../multicall';
17
17
  import { sparkGetAggregatedPositionData, sparkIsInIsolationMode } from '../helpers/sparkHelpers';
18
18
  import { calculateBorrowingAssetLimit } from '../moneymarket';
@@ -204,7 +204,11 @@ export const getSparkAccountBalances = (web3, network, block, addressMapping, ad
204
204
  const loanInfoContract = SparkViewContract(web3, network, block);
205
205
  const market = SPARK_V1(network);
206
206
  const marketAddress = market.providerAddress;
207
- const _addresses = market.assets.map(a => getAssetInfo(ethToWeth(a), network).address);
207
+ // @ts-ignore
208
+ const protocolDataProviderContract = createContractWrapper(web3, network, market.protocolData, market.protocolDataAddress);
209
+ const reserveTokens = yield protocolDataProviderContract.methods.getAllReservesTokens().call({}, block);
210
+ const symbols = reserveTokens.map(({ symbol }) => symbol);
211
+ const _addresses = reserveTokens.map(({ tokenAddress }) => tokenAddress);
208
212
  // split addresses in half to avoid gas limit by multicall
209
213
  const middleAddressIndex = Math.floor(_addresses.length / 2);
210
214
  const multicallData = [
@@ -222,10 +226,11 @@ export const getSparkAccountBalances = (web3, network, block, addressMapping, ad
222
226
  const multicallRes = yield multicall(multicallData, web3, network, block);
223
227
  const loanInfo = [...multicallRes[0][0], ...multicallRes[1][0]];
224
228
  loanInfo.forEach((tokenInfo, i) => {
225
- const asset = wethToEth(market.assets[i]);
229
+ const asset = wethToEth(symbols[i]);
230
+ const assetAddr = wethToEthByAddress(_addresses[i], network).toLowerCase();
226
231
  balances = {
227
- collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? getAssetInfo(asset, network).address.toLowerCase() : asset]: tokenInfo.balance.toString() }),
228
- debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? getAssetInfo(asset, network).address.toLowerCase() : asset]: new Dec(tokenInfo.borrowsStable.toString()).add(tokenInfo.borrowsVariable.toString()).toString() }),
232
+ collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr : asset]: tokenInfo.balance.toString() }),
233
+ debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr : asset]: new Dec(tokenInfo.borrowsStable.toString()).add(tokenInfo.borrowsVariable.toString()).toString() }),
229
234
  };
230
235
  });
231
236
  return balances;
@@ -199,16 +199,11 @@ export interface AaveV3IncentiveData {
199
199
  }
200
200
  export interface AaveV3AggregatedPositionData {
201
201
  suppliedUsd: string;
202
- suppliedEth: string;
203
202
  suppliedCollateralUsd: string;
204
203
  borrowedUsd: string;
205
- borrowedEth: string;
206
204
  borrowLimitUsd: string;
207
- borrowLimitEth: string;
208
205
  liquidationLimitUsd: string;
209
- liquidationLimitEth: string;
210
206
  leftToBorrowUsd: string;
211
- leftToBorrowEth: string;
212
207
  ratio: string;
213
208
  collRatio: string;
214
209
  netApy: string;
@@ -2,9 +2,14 @@ import { MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './commo
2
2
  export declare enum CompoundVersions {
3
3
  'CompoundV2' = "v2",
4
4
  'CompoundV3USDC' = "v3-USDC",
5
+ 'CompoundV3USDCe' = "v3-USDC.e",
5
6
  'CompoundV3ETH' = "v3-ETH",
6
7
  'CompoundV3USDbC' = "v3-USDbC"
7
8
  }
9
+ export interface CompoundBulkerOptions {
10
+ supply: number | string;
11
+ withdraw: number | string;
12
+ }
8
13
  export interface CompoundMarketData {
9
14
  chainIds: NetworkNumber[];
10
15
  label: string;
@@ -17,10 +22,7 @@ export interface CompoundMarketData {
17
22
  secondLabel: string;
18
23
  bulkerName: string;
19
24
  bulkerAddress: string;
20
- bulkerOptions: {
21
- supply: string | number;
22
- withdraw: string | number;
23
- };
25
+ bulkerOptions: CompoundBulkerOptions;
24
26
  }
25
27
  export interface CompoundUsedAsset extends MMUsedAsset {
26
28
  collateral: boolean;
@@ -2,6 +2,7 @@ export var CompoundVersions;
2
2
  (function (CompoundVersions) {
3
3
  CompoundVersions["CompoundV2"] = "v2";
4
4
  CompoundVersions["CompoundV3USDC"] = "v3-USDC";
5
+ CompoundVersions["CompoundV3USDCe"] = "v3-USDC.e";
5
6
  CompoundVersions["CompoundV3ETH"] = "v3-ETH";
6
7
  CompoundVersions["CompoundV3USDbC"] = "v3-USDbC";
7
8
  })(CompoundVersions || (CompoundVersions = {}));