@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.
- package/README.md +63 -0
- package/cjs/aaveV2/index.js +9 -4
- package/cjs/aaveV3/index.js +9 -4
- package/cjs/compoundV2/index.d.ts +1 -0
- package/cjs/compoundV2/index.js +15 -8
- package/cjs/config/contracts.d.ts +373 -201
- package/cjs/config/contracts.js +22 -0
- package/cjs/helpers/aaveHelpers/index.js +0 -5
- package/cjs/helpers/compoundHelpers/index.js +2 -2
- package/cjs/markets/compound/index.d.ts +2 -0
- package/cjs/markets/compound/index.js +60 -13
- package/cjs/markets/compound/marketsAssets.d.ts +7 -1
- package/cjs/markets/compound/marketsAssets.js +12 -2
- package/cjs/morphoAaveV2/index.js +4 -3
- package/cjs/morphoAaveV3/index.js +9 -4
- package/cjs/spark/index.js +9 -4
- package/cjs/types/aave.d.ts +0 -5
- package/cjs/types/compound.d.ts +6 -4
- package/cjs/types/compound.js +1 -0
- package/cjs/types/contracts/generated/CUSDCev3.d.ts +441 -0
- package/cjs/types/contracts/generated/CUSDCev3.js +5 -0
- package/cjs/types/contracts/generated/CompV3USDCBulkerArb.d.ts +41 -0
- package/cjs/types/contracts/generated/CompV3USDCBulkerArb.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +2 -0
- package/esm/aaveV2/index.js +11 -6
- package/esm/aaveV3/index.js +11 -6
- package/esm/compoundV2/index.d.ts +1 -0
- package/esm/compoundV2/index.js +13 -7
- package/esm/config/contracts.d.ts +373 -201
- package/esm/config/contracts.js +22 -0
- package/esm/helpers/aaveHelpers/index.js +0 -5
- package/esm/helpers/compoundHelpers/index.js +2 -2
- package/esm/markets/compound/index.d.ts +2 -0
- package/esm/markets/compound/index.js +59 -13
- package/esm/markets/compound/marketsAssets.d.ts +7 -1
- package/esm/markets/compound/marketsAssets.js +11 -1
- package/esm/morphoAaveV2/index.js +4 -3
- package/esm/morphoAaveV3/index.js +9 -4
- package/esm/spark/index.js +11 -6
- package/esm/types/aave.d.ts +0 -5
- package/esm/types/compound.d.ts +6 -4
- package/esm/types/compound.js +1 -0
- package/esm/types/contracts/generated/CUSDCev3.d.ts +441 -0
- package/esm/types/contracts/generated/CUSDCev3.js +4 -0
- package/esm/types/contracts/generated/CompV3USDCBulkerArb.d.ts +41 -0
- package/esm/types/contracts/generated/CompV3USDCBulkerArb.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +2 -0
- package/package.json +40 -40
- package/src/aaveV2/index.ts +226 -220
- package/src/aaveV3/index.ts +561 -554
- package/src/assets/index.ts +60 -60
- package/src/chickenBonds/index.ts +123 -123
- package/src/compoundV2/index.ts +219 -206
- package/src/compoundV3/index.ts +275 -275
- package/src/config/contracts.js +673 -651
- package/src/constants/index.ts +3 -3
- package/src/contracts.ts +100 -100
- package/src/curveUsd/index.ts +228 -228
- package/src/exchange/index.ts +17 -17
- package/src/helpers/aaveHelpers/index.ts +134 -141
- package/src/helpers/chickenBondsHelpers/index.ts +23 -23
- package/src/helpers/compoundHelpers/index.ts +181 -181
- package/src/helpers/curveUsdHelpers/index.ts +32 -32
- package/src/helpers/index.ts +5 -5
- package/src/helpers/makerHelpers/index.ts +94 -94
- package/src/helpers/sparkHelpers/index.ts +106 -106
- package/src/index.ts +40 -40
- package/src/liquity/index.ts +116 -116
- package/src/maker/index.ts +101 -101
- package/src/markets/aave/index.ts +80 -80
- package/src/markets/aave/marketAssets.ts +32 -32
- package/src/markets/compound/index.ts +141 -85
- package/src/markets/compound/marketsAssets.ts +46 -35
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/index.ts +3 -3
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +9 -9
- package/src/moneymarket/moneymarketCommonService.ts +75 -75
- package/src/morpho/markets.ts +39 -39
- package/src/morphoAaveV2/index.ts +255 -254
- package/src/morphoAaveV3/index.ts +619 -614
- package/src/multicall/index.ts +22 -22
- package/src/services/dsrService.ts +15 -15
- package/src/services/priceService.ts +21 -21
- package/src/services/utils.ts +34 -34
- package/src/spark/index.ts +421 -413
- package/src/staking/staking.ts +167 -167
- package/src/types/aave.ts +256 -261
- package/src/types/chickenBonds.ts +45 -45
- package/src/types/common.ts +83 -83
- package/src/types/compound.ts +128 -122
- package/src/types/contracts/generated/CUSDCev3.ts +685 -0
- package/src/types/contracts/generated/CompV3USDCBulkerArb.ts +85 -0
- package/src/types/contracts/generated/index.ts +2 -0
- package/src/types/curveUsd.ts +112 -112
- package/src/types/index.ts +6 -6
- package/src/types/liquity.ts +30 -30
- package/src/types/maker.ts +50 -50
- package/src/types/spark.ts +106 -106
package/cjs/config/contracts.js
CHANGED
|
@@ -185,6 +185,17 @@ module.exports = {
|
|
|
185
185
|
"networks": {
|
|
186
186
|
"1": {
|
|
187
187
|
"address": "0xc3d688B66703497DAA19211EEdff47f25384cdc3"
|
|
188
|
+
},
|
|
189
|
+
"42161": {
|
|
190
|
+
"address": "0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"cUSDCev3": {
|
|
195
|
+
"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" }],
|
|
196
|
+
"networks": {
|
|
197
|
+
"42161": {
|
|
198
|
+
"address": "0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA"
|
|
188
199
|
}
|
|
189
200
|
}
|
|
190
201
|
},
|
|
@@ -219,6 +230,9 @@ module.exports = {
|
|
|
219
230
|
},
|
|
220
231
|
"8453": {
|
|
221
232
|
"address": "0x22591183c0eb7B2Fe07F6F44fd360d1117D07b4f"
|
|
233
|
+
},
|
|
234
|
+
"42161": {
|
|
235
|
+
"address": "0x3A07Bb9eb0d71bf03295a84655d82b00A1450CD6"
|
|
222
236
|
}
|
|
223
237
|
}
|
|
224
238
|
},
|
|
@@ -249,6 +263,14 @@ module.exports = {
|
|
|
249
263
|
}
|
|
250
264
|
}
|
|
251
265
|
},
|
|
266
|
+
"CompV3USDCBulkerArb": {
|
|
267
|
+
"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" }],
|
|
268
|
+
"networks": {
|
|
269
|
+
"42161": {
|
|
270
|
+
"address": "0xbdE8F31D2DdDA895264e27DD990faB3DC87b372d"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
252
274
|
"wstETH": {
|
|
253
275
|
"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" }],
|
|
254
276
|
"networks": {
|
|
@@ -114,11 +114,6 @@ const aaveAnyGetAggregatedPositionData = (_a) => {
|
|
|
114
114
|
}
|
|
115
115
|
payload.liquidationPrice = (0, moneymarket_1.calcLeverageLiqPrice)(leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
|
|
116
116
|
}
|
|
117
|
-
payload.suppliedEth = new decimal_js_1.default(payload.suppliedUsd).div(assetsData.ETH.price).toString();
|
|
118
|
-
payload.borrowedEth = new decimal_js_1.default(payload.borrowedUsd).div(assetsData.ETH.price).toString();
|
|
119
|
-
payload.leftToBorrowEth = new decimal_js_1.default(payload.leftToBorrowUsd).div(assetsData.ETH.price).toString();
|
|
120
|
-
payload.borrowLimitEth = new decimal_js_1.default(payload.borrowLimitUsd).div(assetsData.ETH.price).toString();
|
|
121
|
-
payload.liquidationLimitEth = new decimal_js_1.default(payload.liquidationLimitUsd).div(assetsData.ETH.price).toString();
|
|
122
117
|
return payload;
|
|
123
118
|
};
|
|
124
119
|
exports.aaveAnyGetAggregatedPositionData = aaveAnyGetAggregatedPositionData;
|
|
@@ -42,8 +42,8 @@ const formatBaseData = (data, network, baseAssetPrice) => {
|
|
|
42
42
|
};
|
|
43
43
|
exports.formatBaseData = formatBaseData;
|
|
44
44
|
const getIncentiveApys = (baseData, compPrice) => {
|
|
45
|
-
const incentiveSupplyApy = (0, moneymarket_1.aprToApy)((100 * constants_1.SECONDS_PER_YEAR * +baseData.rewardSupplySpeed * +compPrice) / +baseData.
|
|
46
|
-
const incentiveBorrowApy = (0, moneymarket_1.aprToApy)((100 * constants_1.SECONDS_PER_YEAR * +baseData.rewardBorrowSpeed * +compPrice) / +baseData.
|
|
45
|
+
const incentiveSupplyApy = (0, moneymarket_1.aprToApy)((100 * constants_1.SECONDS_PER_YEAR * +baseData.rewardSupplySpeed * +compPrice) / +baseData.price / +baseData.totalSupply).toString();
|
|
46
|
+
const incentiveBorrowApy = (0, moneymarket_1.aprToApy)((100 * constants_1.SECONDS_PER_YEAR * +baseData.rewardBorrowSpeed * +compPrice) / +baseData.price / +baseData.totalBorrow).toString();
|
|
47
47
|
return {
|
|
48
48
|
incentiveSupplyApy,
|
|
49
49
|
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,20 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompoundMarkets = exports.COMPOUND_V3_USDBC = exports.COMPOUND_V3_ETH = exports.COMPOUND_V3_USDC = exports.COMPOUND_V2 = void 0;
|
|
3
|
+
exports.CompoundMarkets = exports.COMPOUND_V3_USDBC = exports.COMPOUND_V3_ETH = exports.COMPOUND_V3_USDCe = exports.COMPOUND_V3_USDC = exports.COMPOUND_V2 = void 0;
|
|
4
4
|
const contracts_1 = require("../../contracts");
|
|
5
5
|
const types_1 = require("../../types");
|
|
6
6
|
const common_1 = require("../../types/common");
|
|
7
7
|
const marketsAssets_1 = require("./marketsAssets");
|
|
8
|
-
const
|
|
9
|
-
supply: 2,
|
|
10
|
-
withdraw: 5,
|
|
11
|
-
};
|
|
8
|
+
const EMPTY_BULKER_OPTIONS = { supply: '', withdraw: '' };
|
|
12
9
|
const STANDARD_BULKER_OPTIONS = {
|
|
13
10
|
supply: '0x414354494f4e5f535550504c595f4e41544956455f544f4b454e000000000000',
|
|
14
11
|
withdraw: '0x414354494f4e5f57495448445241575f4e41544956455f544f4b454e00000000',
|
|
15
12
|
};
|
|
13
|
+
const BULKER_OPTIONS = {
|
|
14
|
+
[common_1.NetworkNumber.Eth]: {
|
|
15
|
+
[types_1.CompoundVersions.CompoundV3USDC]: { supply: 2, withdraw: 5 },
|
|
16
|
+
[types_1.CompoundVersions.CompoundV3ETH]: STANDARD_BULKER_OPTIONS,
|
|
17
|
+
// Non-existing markets, keeping it because of typescript
|
|
18
|
+
[types_1.CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
19
|
+
[types_1.CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
20
|
+
[types_1.CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
|
|
21
|
+
},
|
|
22
|
+
[common_1.NetworkNumber.Arb]: {
|
|
23
|
+
[types_1.CompoundVersions.CompoundV3USDC]: STANDARD_BULKER_OPTIONS,
|
|
24
|
+
[types_1.CompoundVersions.CompoundV3USDCe]: STANDARD_BULKER_OPTIONS,
|
|
25
|
+
// Non-existing markets, keeping it because of typescript
|
|
26
|
+
[types_1.CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
27
|
+
[types_1.CompoundVersions.CompoundV3ETH]: EMPTY_BULKER_OPTIONS,
|
|
28
|
+
[types_1.CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
|
|
29
|
+
},
|
|
30
|
+
[common_1.NetworkNumber.Base]: {
|
|
31
|
+
[types_1.CompoundVersions.CompoundV3ETH]: STANDARD_BULKER_OPTIONS,
|
|
32
|
+
[types_1.CompoundVersions.CompoundV3USDbC]: STANDARD_BULKER_OPTIONS,
|
|
33
|
+
// Non-existing markets, keeping it because of typescript
|
|
34
|
+
[types_1.CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
35
|
+
[types_1.CompoundVersions.CompoundV3USDC]: EMPTY_BULKER_OPTIONS,
|
|
36
|
+
[types_1.CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
37
|
+
},
|
|
38
|
+
[common_1.NetworkNumber.Opt]: {
|
|
39
|
+
[types_1.CompoundVersions.CompoundV3ETH]: EMPTY_BULKER_OPTIONS,
|
|
40
|
+
[types_1.CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
|
|
41
|
+
[types_1.CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
42
|
+
[types_1.CompoundVersions.CompoundV3USDC]: EMPTY_BULKER_OPTIONS,
|
|
43
|
+
[types_1.CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
16
46
|
exports.COMPOUND_V2 = {
|
|
17
|
-
chainIds: [
|
|
47
|
+
chainIds: [common_1.NetworkNumber.Eth],
|
|
18
48
|
label: 'Compound V2',
|
|
19
49
|
shortLabel: 'v2',
|
|
20
50
|
value: types_1.CompoundVersions.CompoundV2,
|
|
@@ -25,11 +55,11 @@ exports.COMPOUND_V2 = {
|
|
|
25
55
|
secondLabel: '',
|
|
26
56
|
bulkerName: '',
|
|
27
57
|
bulkerAddress: '',
|
|
28
|
-
bulkerOptions:
|
|
58
|
+
bulkerOptions: BULKER_OPTIONS[common_1.NetworkNumber.Eth][types_1.CompoundVersions.CompoundV2],
|
|
29
59
|
// icon: SvgAdapter(protocolIcons.compound),
|
|
30
60
|
};
|
|
31
61
|
const COMPOUND_V3_USDC = (networkId) => ({
|
|
32
|
-
chainIds: [common_1.NetworkNumber.Eth],
|
|
62
|
+
chainIds: [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Arb],
|
|
33
63
|
label: 'Compound V3 - USDC',
|
|
34
64
|
shortLabel: 'v3',
|
|
35
65
|
value: types_1.CompoundVersions.CompoundV3USDC,
|
|
@@ -38,12 +68,28 @@ const COMPOUND_V3_USDC = (networkId) => ({
|
|
|
38
68
|
baseMarket: 'cUSDCv3',
|
|
39
69
|
baseMarketAddress: (0, contracts_1.getConfigContractAddress)('cUSDCv3', networkId),
|
|
40
70
|
secondLabel: 'Market',
|
|
41
|
-
bulkerName: 'CompV3USDCBulker',
|
|
42
|
-
bulkerAddress: (0, contracts_1.getConfigContractAddress)('CompV3USDCBulker', networkId),
|
|
43
|
-
bulkerOptions:
|
|
71
|
+
bulkerName: networkId === common_1.NetworkNumber.Arb ? 'CompV3USDCBulkerArb' : 'CompV3USDCBulker',
|
|
72
|
+
bulkerAddress: (0, contracts_1.getConfigContractAddress)(networkId === common_1.NetworkNumber.Arb ? 'CompV3USDCBulkerArb' : 'CompV3USDCBulker', networkId),
|
|
73
|
+
bulkerOptions: BULKER_OPTIONS[networkId][types_1.CompoundVersions.CompoundV3USDC],
|
|
44
74
|
// icon: SvgAdapter(protocolIcons.compoundv3),
|
|
45
75
|
});
|
|
46
76
|
exports.COMPOUND_V3_USDC = COMPOUND_V3_USDC;
|
|
77
|
+
const COMPOUND_V3_USDCe = (networkId) => ({
|
|
78
|
+
chainIds: [common_1.NetworkNumber.Arb],
|
|
79
|
+
label: 'Compound V3 - USDC.e',
|
|
80
|
+
shortLabel: 'v3',
|
|
81
|
+
value: types_1.CompoundVersions.CompoundV3USDCe,
|
|
82
|
+
baseAsset: 'USDC.e',
|
|
83
|
+
collAssets: networkId ? marketsAssets_1.v3USDCeCollAssets[networkId] : [],
|
|
84
|
+
baseMarket: 'cUSDCev3',
|
|
85
|
+
baseMarketAddress: (0, contracts_1.getConfigContractAddress)('cUSDCev3', networkId),
|
|
86
|
+
secondLabel: 'Market',
|
|
87
|
+
bulkerName: 'CompV3USDCBulkerArb',
|
|
88
|
+
bulkerAddress: (0, contracts_1.getConfigContractAddress)('CompV3USDCBulkerArb', networkId),
|
|
89
|
+
bulkerOptions: BULKER_OPTIONS[networkId][types_1.CompoundVersions.CompoundV3USDCe],
|
|
90
|
+
// icon: SvgAdapter(protocolIcons.compoundv3),
|
|
91
|
+
});
|
|
92
|
+
exports.COMPOUND_V3_USDCe = COMPOUND_V3_USDCe;
|
|
47
93
|
const COMPOUND_V3_ETH = (networkId) => ({
|
|
48
94
|
chainIds: [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Base],
|
|
49
95
|
label: 'Compound V3 - ETH',
|
|
@@ -56,7 +102,7 @@ const COMPOUND_V3_ETH = (networkId) => ({
|
|
|
56
102
|
secondLabel: 'Market',
|
|
57
103
|
bulkerName: 'CompV3ETHBulker',
|
|
58
104
|
bulkerAddress: (0, contracts_1.getConfigContractAddress)('CompV3ETHBulker', networkId),
|
|
59
|
-
bulkerOptions:
|
|
105
|
+
bulkerOptions: BULKER_OPTIONS[networkId][types_1.CompoundVersions.CompoundV3ETH],
|
|
60
106
|
// icon: SvgAdapter(protocolIcons.compoundv3),
|
|
61
107
|
});
|
|
62
108
|
exports.COMPOUND_V3_ETH = COMPOUND_V3_ETH;
|
|
@@ -72,7 +118,7 @@ const COMPOUND_V3_USDBC = (networkId) => ({
|
|
|
72
118
|
secondLabel: 'Market',
|
|
73
119
|
bulkerName: 'CompV3USDbCBulker',
|
|
74
120
|
bulkerAddress: (0, contracts_1.getConfigContractAddress)('CompV3USDbCBulker', networkId),
|
|
75
|
-
bulkerOptions:
|
|
121
|
+
bulkerOptions: BULKER_OPTIONS[networkId][types_1.CompoundVersions.CompoundV3USDbC],
|
|
76
122
|
// icon: SvgAdapter(protocolIcons.compoundv3),
|
|
77
123
|
});
|
|
78
124
|
exports.COMPOUND_V3_USDBC = COMPOUND_V3_USDBC;
|
|
@@ -81,5 +127,6 @@ const CompoundMarkets = (networkId) => ({
|
|
|
81
127
|
[types_1.CompoundVersions.CompoundV3ETH]: (0, exports.COMPOUND_V3_ETH)(networkId),
|
|
82
128
|
[types_1.CompoundVersions.CompoundV3USDC]: (0, exports.COMPOUND_V3_USDC)(networkId),
|
|
83
129
|
[types_1.CompoundVersions.CompoundV3USDbC]: (0, exports.COMPOUND_V3_USDBC)(networkId),
|
|
130
|
+
[types_1.CompoundVersions.CompoundV3USDCe]: (0, exports.COMPOUND_V3_USDCe)(networkId),
|
|
84
131
|
});
|
|
85
132
|
exports.CompoundMarkets = CompoundMarkets;
|
|
@@ -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: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.v3USDCCollAssets = exports.compoundV2CollateralAssets = void 0;
|
|
3
|
+
exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.compoundV2CollateralAssets = void 0;
|
|
4
4
|
const tokens_1 = require("@defisaver/tokens");
|
|
5
5
|
const common_1 = require("../../types/common");
|
|
6
6
|
exports.compoundV2CollateralAssets = [
|
|
@@ -12,7 +12,17 @@ exports.v3USDCCollAssets = {
|
|
|
12
12
|
'ETH', 'COMP', 'WBTC', 'UNI', 'LINK',
|
|
13
13
|
],
|
|
14
14
|
[common_1.NetworkNumber.Opt]: [],
|
|
15
|
-
[common_1.NetworkNumber.Arb]: [
|
|
15
|
+
[common_1.NetworkNumber.Arb]: [
|
|
16
|
+
'ARB', 'ETH', 'GMX', 'WBTC',
|
|
17
|
+
],
|
|
18
|
+
[common_1.NetworkNumber.Base]: [],
|
|
19
|
+
};
|
|
20
|
+
exports.v3USDCeCollAssets = {
|
|
21
|
+
[common_1.NetworkNumber.Eth]: [],
|
|
22
|
+
[common_1.NetworkNumber.Opt]: [],
|
|
23
|
+
[common_1.NetworkNumber.Arb]: [
|
|
24
|
+
'ARB', 'ETH', 'GMX', 'WBTC',
|
|
25
|
+
],
|
|
16
26
|
[common_1.NetworkNumber.Base]: [],
|
|
17
27
|
};
|
|
18
28
|
exports.v3ETHCollAssets = {
|
|
@@ -124,10 +124,11 @@ const getMorphoAaveV2AccountBalances = (web3, network, block, addressMapping, ad
|
|
|
124
124
|
return balances;
|
|
125
125
|
}
|
|
126
126
|
userBalances.forEach((balance) => {
|
|
127
|
-
const
|
|
127
|
+
const assetAddr = (0, utils_1.wethToEthByAddress)(balance.underlying, network).toLowerCase();
|
|
128
|
+
const { symbol } = (0, tokens_1.getAssetInfoByAddress)(assetAddr, network);
|
|
128
129
|
balances = {
|
|
129
|
-
collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr
|
|
130
|
-
debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr
|
|
130
|
+
collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr : symbol]: new decimal_js_1.default(balance.supplyBalanceInP2P).add(balance.supplyBalanceOnPool).toString() }),
|
|
131
|
+
debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr : symbol]: new decimal_js_1.default(balance.borrowBalanceInP2P).add(balance.borrowBalanceOnPool).toString() }),
|
|
131
132
|
};
|
|
132
133
|
});
|
|
133
134
|
return balances;
|
|
@@ -259,7 +259,11 @@ const getMorphoAaveV3AccountBalances = (web3, network, block, addressMapping, ad
|
|
|
259
259
|
const selectedMarket = (0, aave_1.MORPHO_AAVE_V3_ETH)(network);
|
|
260
260
|
// @ts-ignore
|
|
261
261
|
const lendingPoolContract = (0, contracts_1.createContractWrapper)(web3, network, selectedMarket.lendingPool, selectedMarket.lendingPoolAddress);
|
|
262
|
-
|
|
262
|
+
// @ts-ignore
|
|
263
|
+
const protocolDataProviderContract = (0, contracts_1.createContractWrapper)(web3, network, selectedMarket.protocolData, selectedMarket.protocolDataAddress);
|
|
264
|
+
const reserveTokens = yield protocolDataProviderContract.methods.getAllReservesTokens().call({}, block);
|
|
265
|
+
const symbols = reserveTokens.map(({ symbol }) => symbol);
|
|
266
|
+
const _addresses = reserveTokens.map(({ tokenAddress }) => tokenAddress);
|
|
263
267
|
const multicallArray = [
|
|
264
268
|
...(_addresses.map((underlyingAddress) => ([
|
|
265
269
|
{
|
|
@@ -299,7 +303,8 @@ const getMorphoAaveV3AccountBalances = (web3, network, block, addressMapping, ad
|
|
|
299
303
|
_addresses.forEach((underlyingAddr, i) => {
|
|
300
304
|
const currentMulticallIndex = numberOfMultiCalls * i;
|
|
301
305
|
const morphoMarketData = multicallResponse[currentMulticallIndex][0];
|
|
302
|
-
const
|
|
306
|
+
const assetAddr = (0, utils_1.wethToEthByAddress)(underlyingAddr, network).toLowerCase();
|
|
307
|
+
const { symbol } = (0, tokens_1.getAssetInfoByAddress)(assetAddr, network);
|
|
303
308
|
const suppliedP2P = morphoAaveMath.indexMul(multicallResponse[currentMulticallIndex + 1][0], morphoMarketData.indexes.supply.p2pIndex).toString();
|
|
304
309
|
const suppliedPool = morphoAaveMath.indexMul(multicallResponse[currentMulticallIndex + 2][0], morphoMarketData.indexes.supply.poolIndex).toString();
|
|
305
310
|
const suppliedTotal = new decimal_js_1.default(suppliedP2P).add(suppliedPool).toString();
|
|
@@ -309,8 +314,8 @@ const getMorphoAaveV3AccountBalances = (web3, network, block, addressMapping, ad
|
|
|
309
314
|
const borrowedPool = morphoAaveMath.indexMul(multicallResponse[currentMulticallIndex + 5][0], morphoMarketData.indexes.borrow.poolIndex).toString();
|
|
310
315
|
const borrowed = new decimal_js_1.default(borrowedP2P).add(borrowedPool).toString();
|
|
311
316
|
balances = {
|
|
312
|
-
collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr
|
|
313
|
-
debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr
|
|
317
|
+
collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr : symbol]: supplied }),
|
|
318
|
+
debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr : symbol]: borrowed }),
|
|
314
319
|
};
|
|
315
320
|
});
|
|
316
321
|
return balances;
|
package/cjs/spark/index.js
CHANGED
|
@@ -212,7 +212,11 @@ const getSparkAccountBalances = (web3, network, block, addressMapping, address)
|
|
|
212
212
|
const loanInfoContract = (0, contracts_1.SparkViewContract)(web3, network, block);
|
|
213
213
|
const market = (0, spark_1.SPARK_V1)(network);
|
|
214
214
|
const marketAddress = market.providerAddress;
|
|
215
|
-
|
|
215
|
+
// @ts-ignore
|
|
216
|
+
const protocolDataProviderContract = (0, contracts_1.createContractWrapper)(web3, network, market.protocolData, market.protocolDataAddress);
|
|
217
|
+
const reserveTokens = yield protocolDataProviderContract.methods.getAllReservesTokens().call({}, block);
|
|
218
|
+
const symbols = reserveTokens.map(({ symbol }) => symbol);
|
|
219
|
+
const _addresses = reserveTokens.map(({ tokenAddress }) => tokenAddress);
|
|
216
220
|
// split addresses in half to avoid gas limit by multicall
|
|
217
221
|
const middleAddressIndex = Math.floor(_addresses.length / 2);
|
|
218
222
|
const multicallData = [
|
|
@@ -230,10 +234,11 @@ const getSparkAccountBalances = (web3, network, block, addressMapping, address)
|
|
|
230
234
|
const multicallRes = yield (0, multicall_1.multicall)(multicallData, web3, network, block);
|
|
231
235
|
const loanInfo = [...multicallRes[0][0], ...multicallRes[1][0]];
|
|
232
236
|
loanInfo.forEach((tokenInfo, i) => {
|
|
233
|
-
const asset = (0, utils_1.wethToEth)(
|
|
237
|
+
const asset = (0, utils_1.wethToEth)(symbols[i]);
|
|
238
|
+
const assetAddr = (0, utils_1.wethToEthByAddress)(_addresses[i], network).toLowerCase();
|
|
234
239
|
balances = {
|
|
235
|
-
collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ?
|
|
236
|
-
debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ?
|
|
240
|
+
collateral: Object.assign(Object.assign({}, balances.collateral), { [addressMapping ? assetAddr : asset]: tokenInfo.balance.toString() }),
|
|
241
|
+
debt: Object.assign(Object.assign({}, balances.debt), { [addressMapping ? assetAddr : asset]: new decimal_js_1.default(tokenInfo.borrowsStable.toString()).add(tokenInfo.borrowsVariable.toString()).toString() }),
|
|
237
242
|
};
|
|
238
243
|
});
|
|
239
244
|
return balances;
|
package/cjs/types/aave.d.ts
CHANGED
|
@@ -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;
|
package/cjs/types/compound.d.ts
CHANGED
|
@@ -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;
|
package/cjs/types/compound.js
CHANGED
|
@@ -5,6 +5,7 @@ var CompoundVersions;
|
|
|
5
5
|
(function (CompoundVersions) {
|
|
6
6
|
CompoundVersions["CompoundV2"] = "v2";
|
|
7
7
|
CompoundVersions["CompoundV3USDC"] = "v3-USDC";
|
|
8
|
+
CompoundVersions["CompoundV3USDCe"] = "v3-USDC.e";
|
|
8
9
|
CompoundVersions["CompoundV3ETH"] = "v3-ETH";
|
|
9
10
|
CompoundVersions["CompoundV3USDbC"] = "v3-USDbC";
|
|
10
11
|
})(CompoundVersions || (exports.CompoundVersions = CompoundVersions = {}));
|