@1delta/margin-fetcher 0.0.83 → 0.0.85
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/dist/abis/compound-v2/CollateralToken.d.ts +58 -0
- package/dist/abis/compound-v2/CollateralToken.d.ts.map +1 -0
- package/dist/abis/compound-v2/Comptroller.d.ts +1 -1600
- package/dist/abis/compound-v2/Comptroller.d.ts.map +1 -1
- package/dist/abis/compound-v2/VenusLens.d.ts +907 -0
- package/dist/abis/compound-v2/VenusLens.d.ts.map +1 -0
- package/dist/index.js +1222 -57
- package/dist/index.js.map +1 -1
- package/dist/lending/addresses/compoundV2.d.ts +11 -0
- package/dist/lending/addresses/compoundV2.d.ts.map +1 -0
- package/dist/lending/compound-v2/addresses/lens.d.ts +4 -0
- package/dist/lending/compound-v2/addresses/lens.d.ts.map +1 -0
- package/dist/lending/compound-v2/getters/venus.d.ts +95 -0
- package/dist/lending/compound-v2/getters/venus.d.ts.map +1 -0
- package/dist/lending/compound-v2/publicCallBuild.d.ts +3 -0
- package/dist/lending/compound-v2/publicCallBuild.d.ts.map +1 -0
- package/dist/lending/compound-v2/publicCallParse.d.ts +7 -0
- package/dist/lending/compound-v2/publicCallParse.d.ts.map +1 -0
- package/dist/lending/fetchLender.d.ts.map +1 -1
- package/dist/lending/user-data/abis.d.ts +70 -0
- package/dist/lending/user-data/abis.d.ts.map +1 -1
- package/dist/lending/user-data/compound-v2/index.d.ts +3 -0
- package/dist/lending/user-data/compound-v2/index.d.ts.map +1 -0
- package/dist/lending/user-data/compound-v2/userCallBuild.d.ts +4 -0
- package/dist/lending/user-data/compound-v2/userCallBuild.d.ts.map +1 -0
- package/dist/lending/user-data/compound-v2/userCallParse.d.ts +8 -0
- package/dist/lending/user-data/compound-v2/userCallParse.d.ts.map +1 -0
- package/dist/lending/user-data/fetchUserData.d.ts.map +1 -1
- package/dist/prices/main-prices/fetchOracleData.d.ts.map +1 -1
- package/dist/types/lender/compound-v2-types.d.ts +42 -0
- package/dist/types/lender/compound-v2-types.d.ts.map +1 -0
- package/dist/types/lenderTypes.d.ts +2 -0
- package/dist/types/lenderTypes.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/parsing.d.ts +1 -1
- package/dist/utils/parsing.d.ts.map +1 -1
- package/dist/yields/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6463,6 +6463,29 @@ var AAVE_V3_LENDERS = [
|
|
|
6463
6463
|
"MOONCAKE",
|
|
6464
6464
|
...AAVE_V32_LENDERS
|
|
6465
6465
|
];
|
|
6466
|
+
var COMPOUND_V2_LENDERS = [
|
|
6467
|
+
"COMPOUND_V2",
|
|
6468
|
+
"OVIX",
|
|
6469
|
+
"VENUS",
|
|
6470
|
+
"VENUS_ETH",
|
|
6471
|
+
"VENUS_BNB",
|
|
6472
|
+
"VENUS_BTC",
|
|
6473
|
+
"VENUS_MEME",
|
|
6474
|
+
"VENUS_DEFI",
|
|
6475
|
+
"VENUS_GAMEFI",
|
|
6476
|
+
"VENUS_STABLE",
|
|
6477
|
+
"VENUS_TRON",
|
|
6478
|
+
"VENUS_ETHENA",
|
|
6479
|
+
"VENUS_CURVE",
|
|
6480
|
+
"SEGMENT",
|
|
6481
|
+
"ENCLABS",
|
|
6482
|
+
"ENCLABS_LST",
|
|
6483
|
+
"ENCLABS_PT_USD",
|
|
6484
|
+
"ENCLABS_PT_ETH",
|
|
6485
|
+
"BENQI",
|
|
6486
|
+
"BENQI_AVALANCE_ECOSYSTEM"
|
|
6487
|
+
/* BENQI_AVALANCE_ECOSYSTEM */
|
|
6488
|
+
];
|
|
6466
6489
|
|
|
6467
6490
|
// ../../node_modules/.pnpm/@1delta+data-sdk@0.0.8/node_modules/@1delta/data-sdk/dist/index.mjs
|
|
6468
6491
|
var GLOBAL_CHAIN_DATA_KEY = "__1delta_chain_registry__";
|
|
@@ -6529,6 +6552,8 @@ var compoundV2Reserves = () => getGlobalData2()?.compoundV2Reserves;
|
|
|
6529
6552
|
var compoundV3Pools = () => getGlobalData2()?.compoundV3Pools;
|
|
6530
6553
|
var morphoPools = () => getGlobalData2()?.morphoPools;
|
|
6531
6554
|
var compoundV3BaseData = () => getGlobalData2()?.compoundV3BaseData;
|
|
6555
|
+
var compoundV2Pools = () => getGlobalData2()?.compoundV2Pools;
|
|
6556
|
+
var compoundV2Tokens = () => getGlobalData2()?.compoundV2Tokens;
|
|
6532
6557
|
var initConfig = () => getGlobalData2()?.initConfig;
|
|
6533
6558
|
var { uniq } = lodash;
|
|
6534
6559
|
var COMPOUND_V3_KEY = "COMPOUND_V3";
|
|
@@ -6559,6 +6584,10 @@ function isAaveV32Type(lender) {
|
|
|
6559
6584
|
function isAaveType(lender) {
|
|
6560
6585
|
return [...AAVE_V3_LENDERS, ...AAVE_V2_LENDERS].includes(lender);
|
|
6561
6586
|
}
|
|
6587
|
+
function isCompoundV2Type(lender) {
|
|
6588
|
+
return COMPOUND_V2_LENDERS.includes(lender);
|
|
6589
|
+
}
|
|
6590
|
+
var ENABLED_COMPOUNDS = [Lender.VENUS, Lender.VENUS_ETH];
|
|
6562
6591
|
var getLendersForChain = (c) => {
|
|
6563
6592
|
let lenders = [];
|
|
6564
6593
|
Object.entries(aavePools() ?? {}).forEach(([l, data]) => {
|
|
@@ -6575,6 +6604,10 @@ var getLendersForChain = (c) => {
|
|
|
6575
6604
|
const chains2 = Object.keys(data);
|
|
6576
6605
|
if (chains2.includes(c)) lenders.push(l);
|
|
6577
6606
|
});
|
|
6607
|
+
Object.entries(compoundV2Pools() ?? {}).forEach(([l, data]) => {
|
|
6608
|
+
const chains2 = Object.keys(data);
|
|
6609
|
+
if (chains2.includes(c) && ENABLED_COMPOUNDS.includes(l)) lenders.push(l);
|
|
6610
|
+
});
|
|
6578
6611
|
return lenders;
|
|
6579
6612
|
};
|
|
6580
6613
|
var filterLendersByProtocol = (allLenders, protocolList) => {
|
|
@@ -11809,41 +11842,906 @@ var MorphoLensAbi = [
|
|
|
11809
11842
|
{
|
|
11810
11843
|
inputs: [
|
|
11811
11844
|
{
|
|
11812
|
-
internalType: "bytes32[]",
|
|
11813
|
-
name: "marketsIds",
|
|
11814
|
-
type: "bytes32[]"
|
|
11815
|
-
},
|
|
11816
|
-
{
|
|
11817
|
-
internalType: "address",
|
|
11818
|
-
name: "user",
|
|
11819
|
-
type: "address"
|
|
11820
|
-
},
|
|
11821
|
-
{
|
|
11822
|
-
internalType: "address",
|
|
11823
|
-
name: "morpho",
|
|
11824
|
-
type: "address"
|
|
11845
|
+
internalType: "bytes32[]",
|
|
11846
|
+
name: "marketsIds",
|
|
11847
|
+
type: "bytes32[]"
|
|
11848
|
+
},
|
|
11849
|
+
{
|
|
11850
|
+
internalType: "address",
|
|
11851
|
+
name: "user",
|
|
11852
|
+
type: "address"
|
|
11853
|
+
},
|
|
11854
|
+
{
|
|
11855
|
+
internalType: "address",
|
|
11856
|
+
name: "morpho",
|
|
11857
|
+
type: "address"
|
|
11858
|
+
}
|
|
11859
|
+
],
|
|
11860
|
+
name: "getUserDataCompact",
|
|
11861
|
+
outputs: [
|
|
11862
|
+
{
|
|
11863
|
+
internalType: "bytes",
|
|
11864
|
+
name: "data",
|
|
11865
|
+
type: "bytes"
|
|
11866
|
+
}
|
|
11867
|
+
],
|
|
11868
|
+
stateMutability: "view",
|
|
11869
|
+
type: "function"
|
|
11870
|
+
},
|
|
11871
|
+
{
|
|
11872
|
+
name: "getMarketDataCompact",
|
|
11873
|
+
type: "function",
|
|
11874
|
+
stateMutability: "view",
|
|
11875
|
+
inputs: [
|
|
11876
|
+
{ type: "address", name: "morpho" },
|
|
11877
|
+
{ type: "bytes32[]", name: "marketsIds" }
|
|
11878
|
+
],
|
|
11879
|
+
outputs: [{ type: "bytes", name: "data" }]
|
|
11880
|
+
}
|
|
11881
|
+
];
|
|
11882
|
+
|
|
11883
|
+
// src/lending/addresses/compoundV2.ts
|
|
11884
|
+
var VENUS_LENS = {
|
|
11885
|
+
[Chain.BNB_SMART_CHAIN_MAINNET]: "0xA179d2f1Fd53D15Bc790bE91d5fF4a0108E29621",
|
|
11886
|
+
[Chain.ETHEREUM_MAINNET]: "0x277950603178BDD223eB53B9b7cF5D0053aa3473",
|
|
11887
|
+
[Chain.ARBITRUM_ONE]: "0x53F34FF95367B2A4542461a6A63fD321F8da22AD",
|
|
11888
|
+
[Chain.BASE]: "0x89825677fb4845f5Fc0B227e387455ECa1200058",
|
|
11889
|
+
[Chain.OPBNB_MAINNET]: " 0x2Ed744F6E722aa5E41E67267774b386D244e5e4e",
|
|
11890
|
+
[Chain.OP_MAINNET]: "0x142160A2E699e33af337741f157D96aAd6bC72aA",
|
|
11891
|
+
[Chain.UNICHAIN]: "0xe192aeDBDBd235DBF33Ea1444f2B908Ea3E78419"
|
|
11892
|
+
};
|
|
11893
|
+
function getCompoundV2Comptroller(chainId, lender = Lender.VENUS) {
|
|
11894
|
+
return compoundV2Pools()?.[lender]?.[chainId];
|
|
11895
|
+
}
|
|
11896
|
+
function getCompoundV2CollateralTokens(chainId, lender = Lender.VENUS) {
|
|
11897
|
+
return compoundV2Tokens()?.[lender]?.[chainId];
|
|
11898
|
+
}
|
|
11899
|
+
function getCompoundV2Reserves(chainId, lender = Lender.VENUS) {
|
|
11900
|
+
return compoundV2Reserves()?.[lender]?.[chainId];
|
|
11901
|
+
}
|
|
11902
|
+
function getCompoundV2Lens(chainId, lender) {
|
|
11903
|
+
if (lender.startsWith("VENUS")) return VENUS_LENS[chainId];
|
|
11904
|
+
return zeroAddress;
|
|
11905
|
+
}
|
|
11906
|
+
|
|
11907
|
+
// src/lending/compound-v2/publicCallBuild.ts
|
|
11908
|
+
var buildCompoundV2StyleLenderReserveCall = (chainId, lender) => {
|
|
11909
|
+
const collateralTokens = getCompoundV2CollateralTokens(chainId, lender);
|
|
11910
|
+
const lens = getCompoundV2Lens(chainId, lender);
|
|
11911
|
+
const calls = Object.values(collateralTokens).map((tk) => ({
|
|
11912
|
+
address: lens,
|
|
11913
|
+
name: "vTokenMetadata",
|
|
11914
|
+
params: [tk]
|
|
11915
|
+
}));
|
|
11916
|
+
return calls;
|
|
11917
|
+
};
|
|
11918
|
+
|
|
11919
|
+
// src/lending/compound-v2/getters/venus.ts
|
|
11920
|
+
function readVTokenMetadata(meta) {
|
|
11921
|
+
const pick = (...values) => values.find((v) => v !== void 0);
|
|
11922
|
+
return {
|
|
11923
|
+
vToken: meta.vToken ?? "",
|
|
11924
|
+
exchangeRateCurrent: meta.exchangeRateCurrent ?? 0n,
|
|
11925
|
+
supplyRatePerBlock: pick(meta.supplyRatePerBlock, meta.supplyRatePerBlockOrTimestamp) ?? 0n,
|
|
11926
|
+
borrowRatePerBlock: pick(meta.borrowRatePerBlock, meta.borrowRatePerBlockOrTimestamp) ?? 0n,
|
|
11927
|
+
reserveFactorMantissa: meta.reserveFactorMantissa ?? 0n,
|
|
11928
|
+
supplyCaps: meta.supplyCaps ?? 0n,
|
|
11929
|
+
borrowCaps: meta.borrowCaps ?? 0n,
|
|
11930
|
+
totalBorrows: meta.totalBorrows ?? 0n,
|
|
11931
|
+
totalReserves: meta.totalReserves ?? 0n,
|
|
11932
|
+
totalSupply: meta.totalSupply ?? 0n,
|
|
11933
|
+
totalCash: meta.totalCash ?? 0n,
|
|
11934
|
+
isListed: meta.isListed ?? true,
|
|
11935
|
+
collateralFactorMantissa: meta.collateralFactorMantissa ?? 0n,
|
|
11936
|
+
underlyingAssetAddress: meta.underlyingAssetAddress ?? "",
|
|
11937
|
+
vTokenDecimals: meta.vTokenDecimals ?? 0n,
|
|
11938
|
+
underlyingDecimals: meta.underlyingDecimals ?? 0n,
|
|
11939
|
+
venusSupplySpeed: meta.venusSupplySpeed ?? 0n,
|
|
11940
|
+
venusBorrowSpeed: meta.venusBorrowSpeed ?? 0n,
|
|
11941
|
+
dailySupplyXvs: meta.dailySupplyXvs ?? 0n,
|
|
11942
|
+
dailyBorrowXvs: meta.dailyBorrowXvs ?? 0n,
|
|
11943
|
+
pausedActions: meta.pausedActions ?? 0n,
|
|
11944
|
+
liquidationThresholdMantissa: meta.liquidationThresholdMantissa ?? 0n,
|
|
11945
|
+
liquidationIncentiveMantissa: meta.liquidationIncentiveMantissa ?? 0n,
|
|
11946
|
+
isBorrowAllowed: meta.isBorrowAllowed ?? true,
|
|
11947
|
+
poolId: meta.poolId ?? 0n
|
|
11948
|
+
};
|
|
11949
|
+
}
|
|
11950
|
+
var VenusAction = /* @__PURE__ */ ((VenusAction2) => {
|
|
11951
|
+
VenusAction2[VenusAction2["MINT"] = 0] = "MINT";
|
|
11952
|
+
VenusAction2[VenusAction2["REDEEM"] = 1] = "REDEEM";
|
|
11953
|
+
VenusAction2[VenusAction2["BORROW"] = 2] = "BORROW";
|
|
11954
|
+
VenusAction2[VenusAction2["REPAY"] = 3] = "REPAY";
|
|
11955
|
+
VenusAction2[VenusAction2["SEIZE"] = 4] = "SEIZE";
|
|
11956
|
+
VenusAction2[VenusAction2["LIQUIDATE"] = 5] = "LIQUIDATE";
|
|
11957
|
+
VenusAction2[VenusAction2["TRANSFER"] = 6] = "TRANSFER";
|
|
11958
|
+
VenusAction2[VenusAction2["ENTER_MARKET"] = 7] = "ENTER_MARKET";
|
|
11959
|
+
VenusAction2[VenusAction2["EXIT_MARKET"] = 8] = "EXIT_MARKET";
|
|
11960
|
+
return VenusAction2;
|
|
11961
|
+
})(VenusAction || {});
|
|
11962
|
+
function decodePausedActions(bitmap) {
|
|
11963
|
+
const result = {};
|
|
11964
|
+
for (let i = 0; i <= Object.keys(VenusAction).length / 2 - 1; i++) {
|
|
11965
|
+
const isPaused = (bitmap >> BigInt(i) & 1n) === 1n;
|
|
11966
|
+
result[i] = isPaused;
|
|
11967
|
+
}
|
|
11968
|
+
return result;
|
|
11969
|
+
}
|
|
11970
|
+
|
|
11971
|
+
// src/lending/compound-v2/publicCallParse.ts
|
|
11972
|
+
var C_TOKEN_PRICE_DECIMALS = 18;
|
|
11973
|
+
var RESERVE_MANTISSA_DECIMALS = 18;
|
|
11974
|
+
var getCompoundV2ReservesDataConverter = (lender, chainId, prices, additionalYields, tokenList = {}) => {
|
|
11975
|
+
const assetsToQuery = getCompoundV2Reserves(chainId, lender);
|
|
11976
|
+
const expectedNumberOfCalls = assetsToQuery.length;
|
|
11977
|
+
return [
|
|
11978
|
+
(data) => {
|
|
11979
|
+
if (data.length !== expectedNumberOfCalls) {
|
|
11980
|
+
return void 0;
|
|
11981
|
+
}
|
|
11982
|
+
let returnData = { data: {}, chainId };
|
|
11983
|
+
for (let i = 0; i < assetsToQuery.length; i++) {
|
|
11984
|
+
const asset = tokenList[assetsToQuery[i]];
|
|
11985
|
+
const decs = asset.decimals;
|
|
11986
|
+
const currentEntry = readVTokenMetadata(data[i]);
|
|
11987
|
+
const borrowCollateralFactor = parseRawAmount(
|
|
11988
|
+
currentEntry?.collateralFactorMantissa?.toString(),
|
|
11989
|
+
RESERVE_MANTISSA_DECIMALS
|
|
11990
|
+
);
|
|
11991
|
+
const exchangeRateRaw = currentEntry?.exchangeRateCurrent;
|
|
11992
|
+
const exchangeRateCurrent = parseRawAmount(
|
|
11993
|
+
exchangeRateRaw,
|
|
11994
|
+
C_TOKEN_PRICE_DECIMALS
|
|
11995
|
+
);
|
|
11996
|
+
const totalSupplyUnderlying = Number(parseRawAmount(currentEntry?.totalSupply?.toString(), decs)) * Number(exchangeRateCurrent);
|
|
11997
|
+
const totalDebt = Number(
|
|
11998
|
+
parseRawAmount(currentEntry?.totalBorrows?.toString(), decs)
|
|
11999
|
+
);
|
|
12000
|
+
const price = prices[asset.assetGroup] ?? 0;
|
|
12001
|
+
const pausedActions = decodePausedActions(currentEntry.pausedActions);
|
|
12002
|
+
const allPaused = pausedActions[0 /* MINT */] && pausedActions[2 /* BORROW */] && pausedActions[1 /* REDEEM */] && pausedActions[3 /* REPAY */];
|
|
12003
|
+
returnData.data[asset.address] = {
|
|
12004
|
+
asset,
|
|
12005
|
+
// interest rates
|
|
12006
|
+
depositRate: calculateRateForCompound(
|
|
12007
|
+
currentEntry?.supplyRatePerBlock?.toString(),
|
|
12008
|
+
chainId,
|
|
12009
|
+
Lender.COMPOUND_V2
|
|
12010
|
+
),
|
|
12011
|
+
variableBorrowRate: calculateRateForCompound(
|
|
12012
|
+
currentEntry?.borrowRatePerBlock?.toString(),
|
|
12013
|
+
chainId,
|
|
12014
|
+
Lender.COMPOUND_V2
|
|
12015
|
+
),
|
|
12016
|
+
stableBorrowRate: 0,
|
|
12017
|
+
// deposits
|
|
12018
|
+
totalDebt,
|
|
12019
|
+
totalDebtUSD: totalDebt * price,
|
|
12020
|
+
totalDeposits: totalSupplyUnderlying,
|
|
12021
|
+
totalDepositsUSD: totalSupplyUnderlying * price,
|
|
12022
|
+
totalDebtStable: 0,
|
|
12023
|
+
totalDebtStableUSD: 0,
|
|
12024
|
+
stakingYield: additionalYields.intrinsicYields[asset.assetGroup] ?? 0,
|
|
12025
|
+
config: {
|
|
12026
|
+
[LENDER_MODE_NO_MODE]: {
|
|
12027
|
+
category: LENDER_MODE_NO_MODE,
|
|
12028
|
+
// collateral factors
|
|
12029
|
+
borrowCollateralFactor: Number(borrowCollateralFactor),
|
|
12030
|
+
collateralFactor: Number(borrowCollateralFactor),
|
|
12031
|
+
borrowFactor: 1
|
|
12032
|
+
}
|
|
12033
|
+
},
|
|
12034
|
+
hasStable: false,
|
|
12035
|
+
underlying: currentEntry?.underlyingAssetAddress,
|
|
12036
|
+
// // rewards (TBU)
|
|
12037
|
+
// compSupplySpeed: parseRawAmount(
|
|
12038
|
+
// currentEntry?.venusSupplySpeed?.toString(),
|
|
12039
|
+
// 5,
|
|
12040
|
+
// ),
|
|
12041
|
+
// compBorrowSpeed: parseRawAmount(
|
|
12042
|
+
// currentEntry?.venusBorrowSpeed?.toString(),
|
|
12043
|
+
// 5,
|
|
12044
|
+
// ),
|
|
12045
|
+
isActive: Boolean(currentEntry?.isListed) && !allPaused,
|
|
12046
|
+
collateralActive: Boolean(currentEntry?.isListed),
|
|
12047
|
+
isFrozen: allPaused,
|
|
12048
|
+
rewards: {},
|
|
12049
|
+
state: {
|
|
12050
|
+
exchangeRateCurrent: exchangeRateRaw.toString(),
|
|
12051
|
+
cTokenDecimals: Number(currentEntry?.vTokenDecimals?.toString())
|
|
12052
|
+
},
|
|
12053
|
+
borrowingEnabled: currentEntry?.isBorrowAllowed && !pausedActions[2 /* BORROW */]
|
|
12054
|
+
// // cap
|
|
12055
|
+
// borrowCap: parseRawAmount(currentEntry?.borrowCap?.toString(), decs),
|
|
12056
|
+
};
|
|
12057
|
+
}
|
|
12058
|
+
return returnData;
|
|
12059
|
+
},
|
|
12060
|
+
expectedNumberOfCalls
|
|
12061
|
+
];
|
|
12062
|
+
};
|
|
12063
|
+
|
|
12064
|
+
// src/abis/compound-v2/VenusLens.ts
|
|
12065
|
+
var VenusLensAbi = [
|
|
12066
|
+
{
|
|
12067
|
+
inputs: [
|
|
12068
|
+
{ internalType: "bool", name: "timeBased_", type: "bool" },
|
|
12069
|
+
{ internalType: "uint256", name: "blocksPerYear_", type: "uint256" }
|
|
12070
|
+
],
|
|
12071
|
+
stateMutability: "nonpayable",
|
|
12072
|
+
type: "constructor"
|
|
12073
|
+
},
|
|
12074
|
+
{ inputs: [], name: "InvalidBlocksPerYear", type: "error" },
|
|
12075
|
+
{ inputs: [], name: "InvalidTimeBasedConfiguration", type: "error" },
|
|
12076
|
+
{
|
|
12077
|
+
inputs: [],
|
|
12078
|
+
name: "blocksOrSecondsPerYear",
|
|
12079
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
12080
|
+
stateMutability: "view",
|
|
12081
|
+
type: "function"
|
|
12082
|
+
},
|
|
12083
|
+
{
|
|
12084
|
+
inputs: [
|
|
12085
|
+
{ internalType: "address", name: "poolRegistryAddress", type: "address" }
|
|
12086
|
+
],
|
|
12087
|
+
name: "getAllPools",
|
|
12088
|
+
outputs: [
|
|
12089
|
+
{
|
|
12090
|
+
components: [
|
|
12091
|
+
{ internalType: "string", name: "name", type: "string" },
|
|
12092
|
+
{ internalType: "address", name: "creator", type: "address" },
|
|
12093
|
+
{ internalType: "address", name: "comptroller", type: "address" },
|
|
12094
|
+
{ internalType: "uint256", name: "blockPosted", type: "uint256" },
|
|
12095
|
+
{ internalType: "uint256", name: "timestampPosted", type: "uint256" },
|
|
12096
|
+
{ internalType: "string", name: "category", type: "string" },
|
|
12097
|
+
{ internalType: "string", name: "logoURL", type: "string" },
|
|
12098
|
+
{ internalType: "string", name: "description", type: "string" },
|
|
12099
|
+
{ internalType: "address", name: "priceOracle", type: "address" },
|
|
12100
|
+
{ internalType: "uint256", name: "closeFactor", type: "uint256" },
|
|
12101
|
+
{
|
|
12102
|
+
internalType: "uint256",
|
|
12103
|
+
name: "liquidationIncentive",
|
|
12104
|
+
type: "uint256"
|
|
12105
|
+
},
|
|
12106
|
+
{
|
|
12107
|
+
internalType: "uint256",
|
|
12108
|
+
name: "minLiquidatableCollateral",
|
|
12109
|
+
type: "uint256"
|
|
12110
|
+
},
|
|
12111
|
+
{
|
|
12112
|
+
components: [
|
|
12113
|
+
{ internalType: "address", name: "vToken", type: "address" },
|
|
12114
|
+
{
|
|
12115
|
+
internalType: "uint256",
|
|
12116
|
+
name: "exchangeRateCurrent",
|
|
12117
|
+
type: "uint256"
|
|
12118
|
+
},
|
|
12119
|
+
{
|
|
12120
|
+
internalType: "uint256",
|
|
12121
|
+
name: "supplyRatePerBlockOrTimestamp",
|
|
12122
|
+
type: "uint256"
|
|
12123
|
+
},
|
|
12124
|
+
{
|
|
12125
|
+
internalType: "uint256",
|
|
12126
|
+
name: "borrowRatePerBlockOrTimestamp",
|
|
12127
|
+
type: "uint256"
|
|
12128
|
+
},
|
|
12129
|
+
{
|
|
12130
|
+
internalType: "uint256",
|
|
12131
|
+
name: "reserveFactorMantissa",
|
|
12132
|
+
type: "uint256"
|
|
12133
|
+
},
|
|
12134
|
+
{ internalType: "uint256", name: "supplyCaps", type: "uint256" },
|
|
12135
|
+
{ internalType: "uint256", name: "borrowCaps", type: "uint256" },
|
|
12136
|
+
{
|
|
12137
|
+
internalType: "uint256",
|
|
12138
|
+
name: "totalBorrows",
|
|
12139
|
+
type: "uint256"
|
|
12140
|
+
},
|
|
12141
|
+
{
|
|
12142
|
+
internalType: "uint256",
|
|
12143
|
+
name: "totalReserves",
|
|
12144
|
+
type: "uint256"
|
|
12145
|
+
},
|
|
12146
|
+
{ internalType: "uint256", name: "totalSupply", type: "uint256" },
|
|
12147
|
+
{ internalType: "uint256", name: "totalCash", type: "uint256" },
|
|
12148
|
+
{ internalType: "bool", name: "isListed", type: "bool" },
|
|
12149
|
+
{
|
|
12150
|
+
internalType: "uint256",
|
|
12151
|
+
name: "collateralFactorMantissa",
|
|
12152
|
+
type: "uint256"
|
|
12153
|
+
},
|
|
12154
|
+
{
|
|
12155
|
+
internalType: "address",
|
|
12156
|
+
name: "underlyingAssetAddress",
|
|
12157
|
+
type: "address"
|
|
12158
|
+
},
|
|
12159
|
+
{
|
|
12160
|
+
internalType: "uint256",
|
|
12161
|
+
name: "vTokenDecimals",
|
|
12162
|
+
type: "uint256"
|
|
12163
|
+
},
|
|
12164
|
+
{
|
|
12165
|
+
internalType: "uint256",
|
|
12166
|
+
name: "underlyingDecimals",
|
|
12167
|
+
type: "uint256"
|
|
12168
|
+
},
|
|
12169
|
+
{
|
|
12170
|
+
internalType: "uint256",
|
|
12171
|
+
name: "pausedActions",
|
|
12172
|
+
type: "uint256"
|
|
12173
|
+
}
|
|
12174
|
+
],
|
|
12175
|
+
internalType: "struct PoolLens.VTokenMetadata[]",
|
|
12176
|
+
name: "vTokens",
|
|
12177
|
+
type: "tuple[]"
|
|
12178
|
+
}
|
|
12179
|
+
],
|
|
12180
|
+
internalType: "struct PoolLens.PoolData[]",
|
|
12181
|
+
name: "",
|
|
12182
|
+
type: "tuple[]"
|
|
12183
|
+
}
|
|
12184
|
+
],
|
|
12185
|
+
stateMutability: "view",
|
|
12186
|
+
type: "function"
|
|
12187
|
+
},
|
|
12188
|
+
{
|
|
12189
|
+
inputs: [],
|
|
12190
|
+
name: "getBlockNumberOrTimestamp",
|
|
12191
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
12192
|
+
stateMutability: "view",
|
|
12193
|
+
type: "function"
|
|
12194
|
+
},
|
|
12195
|
+
{
|
|
12196
|
+
inputs: [
|
|
12197
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
12198
|
+
{ internalType: "address", name: "comptrollerAddress", type: "address" }
|
|
12199
|
+
],
|
|
12200
|
+
name: "getPendingRewards",
|
|
12201
|
+
outputs: [
|
|
12202
|
+
{
|
|
12203
|
+
components: [
|
|
12204
|
+
{
|
|
12205
|
+
internalType: "address",
|
|
12206
|
+
name: "distributorAddress",
|
|
12207
|
+
type: "address"
|
|
12208
|
+
},
|
|
12209
|
+
{
|
|
12210
|
+
internalType: "address",
|
|
12211
|
+
name: "rewardTokenAddress",
|
|
12212
|
+
type: "address"
|
|
12213
|
+
},
|
|
12214
|
+
{ internalType: "uint256", name: "totalRewards", type: "uint256" },
|
|
12215
|
+
{
|
|
12216
|
+
components: [
|
|
12217
|
+
{
|
|
12218
|
+
internalType: "address",
|
|
12219
|
+
name: "vTokenAddress",
|
|
12220
|
+
type: "address"
|
|
12221
|
+
},
|
|
12222
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
12223
|
+
],
|
|
12224
|
+
internalType: "struct PoolLens.PendingReward[]",
|
|
12225
|
+
name: "pendingRewards",
|
|
12226
|
+
type: "tuple[]"
|
|
12227
|
+
}
|
|
12228
|
+
],
|
|
12229
|
+
internalType: "struct PoolLens.RewardSummary[]",
|
|
12230
|
+
name: "",
|
|
12231
|
+
type: "tuple[]"
|
|
12232
|
+
}
|
|
12233
|
+
],
|
|
12234
|
+
stateMutability: "view",
|
|
12235
|
+
type: "function"
|
|
12236
|
+
},
|
|
12237
|
+
{
|
|
12238
|
+
inputs: [
|
|
12239
|
+
{ internalType: "address", name: "comptrollerAddress", type: "address" }
|
|
12240
|
+
],
|
|
12241
|
+
name: "getPoolBadDebt",
|
|
12242
|
+
outputs: [
|
|
12243
|
+
{
|
|
12244
|
+
components: [
|
|
12245
|
+
{ internalType: "address", name: "comptroller", type: "address" },
|
|
12246
|
+
{ internalType: "uint256", name: "totalBadDebtUsd", type: "uint256" },
|
|
12247
|
+
{
|
|
12248
|
+
components: [
|
|
12249
|
+
{
|
|
12250
|
+
internalType: "address",
|
|
12251
|
+
name: "vTokenAddress",
|
|
12252
|
+
type: "address"
|
|
12253
|
+
},
|
|
12254
|
+
{ internalType: "uint256", name: "badDebtUsd", type: "uint256" }
|
|
12255
|
+
],
|
|
12256
|
+
internalType: "struct PoolLens.BadDebt[]",
|
|
12257
|
+
name: "badDebts",
|
|
12258
|
+
type: "tuple[]"
|
|
12259
|
+
}
|
|
12260
|
+
],
|
|
12261
|
+
internalType: "struct PoolLens.BadDebtSummary",
|
|
12262
|
+
name: "",
|
|
12263
|
+
type: "tuple"
|
|
12264
|
+
}
|
|
12265
|
+
],
|
|
12266
|
+
stateMutability: "view",
|
|
12267
|
+
type: "function"
|
|
12268
|
+
},
|
|
12269
|
+
{
|
|
12270
|
+
inputs: [
|
|
12271
|
+
{ internalType: "address", name: "poolRegistryAddress", type: "address" },
|
|
12272
|
+
{ internalType: "address", name: "comptroller", type: "address" }
|
|
12273
|
+
],
|
|
12274
|
+
name: "getPoolByComptroller",
|
|
12275
|
+
outputs: [
|
|
12276
|
+
{
|
|
12277
|
+
components: [
|
|
12278
|
+
{ internalType: "string", name: "name", type: "string" },
|
|
12279
|
+
{ internalType: "address", name: "creator", type: "address" },
|
|
12280
|
+
{ internalType: "address", name: "comptroller", type: "address" },
|
|
12281
|
+
{ internalType: "uint256", name: "blockPosted", type: "uint256" },
|
|
12282
|
+
{ internalType: "uint256", name: "timestampPosted", type: "uint256" },
|
|
12283
|
+
{ internalType: "string", name: "category", type: "string" },
|
|
12284
|
+
{ internalType: "string", name: "logoURL", type: "string" },
|
|
12285
|
+
{ internalType: "string", name: "description", type: "string" },
|
|
12286
|
+
{ internalType: "address", name: "priceOracle", type: "address" },
|
|
12287
|
+
{ internalType: "uint256", name: "closeFactor", type: "uint256" },
|
|
12288
|
+
{
|
|
12289
|
+
internalType: "uint256",
|
|
12290
|
+
name: "liquidationIncentive",
|
|
12291
|
+
type: "uint256"
|
|
12292
|
+
},
|
|
12293
|
+
{
|
|
12294
|
+
internalType: "uint256",
|
|
12295
|
+
name: "minLiquidatableCollateral",
|
|
12296
|
+
type: "uint256"
|
|
12297
|
+
},
|
|
12298
|
+
{
|
|
12299
|
+
components: [
|
|
12300
|
+
{ internalType: "address", name: "vToken", type: "address" },
|
|
12301
|
+
{
|
|
12302
|
+
internalType: "uint256",
|
|
12303
|
+
name: "exchangeRateCurrent",
|
|
12304
|
+
type: "uint256"
|
|
12305
|
+
},
|
|
12306
|
+
{
|
|
12307
|
+
internalType: "uint256",
|
|
12308
|
+
name: "supplyRatePerBlockOrTimestamp",
|
|
12309
|
+
type: "uint256"
|
|
12310
|
+
},
|
|
12311
|
+
{
|
|
12312
|
+
internalType: "uint256",
|
|
12313
|
+
name: "borrowRatePerBlockOrTimestamp",
|
|
12314
|
+
type: "uint256"
|
|
12315
|
+
},
|
|
12316
|
+
{
|
|
12317
|
+
internalType: "uint256",
|
|
12318
|
+
name: "reserveFactorMantissa",
|
|
12319
|
+
type: "uint256"
|
|
12320
|
+
},
|
|
12321
|
+
{ internalType: "uint256", name: "supplyCaps", type: "uint256" },
|
|
12322
|
+
{ internalType: "uint256", name: "borrowCaps", type: "uint256" },
|
|
12323
|
+
{
|
|
12324
|
+
internalType: "uint256",
|
|
12325
|
+
name: "totalBorrows",
|
|
12326
|
+
type: "uint256"
|
|
12327
|
+
},
|
|
12328
|
+
{
|
|
12329
|
+
internalType: "uint256",
|
|
12330
|
+
name: "totalReserves",
|
|
12331
|
+
type: "uint256"
|
|
12332
|
+
},
|
|
12333
|
+
{ internalType: "uint256", name: "totalSupply", type: "uint256" },
|
|
12334
|
+
{ internalType: "uint256", name: "totalCash", type: "uint256" },
|
|
12335
|
+
{ internalType: "bool", name: "isListed", type: "bool" },
|
|
12336
|
+
{
|
|
12337
|
+
internalType: "uint256",
|
|
12338
|
+
name: "collateralFactorMantissa",
|
|
12339
|
+
type: "uint256"
|
|
12340
|
+
},
|
|
12341
|
+
{
|
|
12342
|
+
internalType: "address",
|
|
12343
|
+
name: "underlyingAssetAddress",
|
|
12344
|
+
type: "address"
|
|
12345
|
+
},
|
|
12346
|
+
{
|
|
12347
|
+
internalType: "uint256",
|
|
12348
|
+
name: "vTokenDecimals",
|
|
12349
|
+
type: "uint256"
|
|
12350
|
+
},
|
|
12351
|
+
{
|
|
12352
|
+
internalType: "uint256",
|
|
12353
|
+
name: "underlyingDecimals",
|
|
12354
|
+
type: "uint256"
|
|
12355
|
+
},
|
|
12356
|
+
{
|
|
12357
|
+
internalType: "uint256",
|
|
12358
|
+
name: "pausedActions",
|
|
12359
|
+
type: "uint256"
|
|
12360
|
+
}
|
|
12361
|
+
],
|
|
12362
|
+
internalType: "struct PoolLens.VTokenMetadata[]",
|
|
12363
|
+
name: "vTokens",
|
|
12364
|
+
type: "tuple[]"
|
|
12365
|
+
}
|
|
12366
|
+
],
|
|
12367
|
+
internalType: "struct PoolLens.PoolData",
|
|
12368
|
+
name: "",
|
|
12369
|
+
type: "tuple"
|
|
12370
|
+
}
|
|
12371
|
+
],
|
|
12372
|
+
stateMutability: "view",
|
|
12373
|
+
type: "function"
|
|
12374
|
+
},
|
|
12375
|
+
{
|
|
12376
|
+
inputs: [
|
|
12377
|
+
{ internalType: "address", name: "poolRegistryAddress", type: "address" },
|
|
12378
|
+
{
|
|
12379
|
+
components: [
|
|
12380
|
+
{ internalType: "string", name: "name", type: "string" },
|
|
12381
|
+
{ internalType: "address", name: "creator", type: "address" },
|
|
12382
|
+
{ internalType: "address", name: "comptroller", type: "address" },
|
|
12383
|
+
{ internalType: "uint256", name: "blockPosted", type: "uint256" },
|
|
12384
|
+
{ internalType: "uint256", name: "timestampPosted", type: "uint256" }
|
|
12385
|
+
],
|
|
12386
|
+
internalType: "struct PoolRegistryInterface.VenusPool",
|
|
12387
|
+
name: "venusPool",
|
|
12388
|
+
type: "tuple"
|
|
12389
|
+
}
|
|
12390
|
+
],
|
|
12391
|
+
name: "getPoolDataFromVenusPool",
|
|
12392
|
+
outputs: [
|
|
12393
|
+
{
|
|
12394
|
+
components: [
|
|
12395
|
+
{ internalType: "string", name: "name", type: "string" },
|
|
12396
|
+
{ internalType: "address", name: "creator", type: "address" },
|
|
12397
|
+
{ internalType: "address", name: "comptroller", type: "address" },
|
|
12398
|
+
{ internalType: "uint256", name: "blockPosted", type: "uint256" },
|
|
12399
|
+
{ internalType: "uint256", name: "timestampPosted", type: "uint256" },
|
|
12400
|
+
{ internalType: "string", name: "category", type: "string" },
|
|
12401
|
+
{ internalType: "string", name: "logoURL", type: "string" },
|
|
12402
|
+
{ internalType: "string", name: "description", type: "string" },
|
|
12403
|
+
{ internalType: "address", name: "priceOracle", type: "address" },
|
|
12404
|
+
{ internalType: "uint256", name: "closeFactor", type: "uint256" },
|
|
12405
|
+
{
|
|
12406
|
+
internalType: "uint256",
|
|
12407
|
+
name: "liquidationIncentive",
|
|
12408
|
+
type: "uint256"
|
|
12409
|
+
},
|
|
12410
|
+
{
|
|
12411
|
+
internalType: "uint256",
|
|
12412
|
+
name: "minLiquidatableCollateral",
|
|
12413
|
+
type: "uint256"
|
|
12414
|
+
},
|
|
12415
|
+
{
|
|
12416
|
+
components: [
|
|
12417
|
+
{ internalType: "address", name: "vToken", type: "address" },
|
|
12418
|
+
{
|
|
12419
|
+
internalType: "uint256",
|
|
12420
|
+
name: "exchangeRateCurrent",
|
|
12421
|
+
type: "uint256"
|
|
12422
|
+
},
|
|
12423
|
+
{
|
|
12424
|
+
internalType: "uint256",
|
|
12425
|
+
name: "supplyRatePerBlockOrTimestamp",
|
|
12426
|
+
type: "uint256"
|
|
12427
|
+
},
|
|
12428
|
+
{
|
|
12429
|
+
internalType: "uint256",
|
|
12430
|
+
name: "borrowRatePerBlockOrTimestamp",
|
|
12431
|
+
type: "uint256"
|
|
12432
|
+
},
|
|
12433
|
+
{
|
|
12434
|
+
internalType: "uint256",
|
|
12435
|
+
name: "reserveFactorMantissa",
|
|
12436
|
+
type: "uint256"
|
|
12437
|
+
},
|
|
12438
|
+
{ internalType: "uint256", name: "supplyCaps", type: "uint256" },
|
|
12439
|
+
{ internalType: "uint256", name: "borrowCaps", type: "uint256" },
|
|
12440
|
+
{
|
|
12441
|
+
internalType: "uint256",
|
|
12442
|
+
name: "totalBorrows",
|
|
12443
|
+
type: "uint256"
|
|
12444
|
+
},
|
|
12445
|
+
{
|
|
12446
|
+
internalType: "uint256",
|
|
12447
|
+
name: "totalReserves",
|
|
12448
|
+
type: "uint256"
|
|
12449
|
+
},
|
|
12450
|
+
{ internalType: "uint256", name: "totalSupply", type: "uint256" },
|
|
12451
|
+
{ internalType: "uint256", name: "totalCash", type: "uint256" },
|
|
12452
|
+
{ internalType: "bool", name: "isListed", type: "bool" },
|
|
12453
|
+
{
|
|
12454
|
+
internalType: "uint256",
|
|
12455
|
+
name: "collateralFactorMantissa",
|
|
12456
|
+
type: "uint256"
|
|
12457
|
+
},
|
|
12458
|
+
{
|
|
12459
|
+
internalType: "address",
|
|
12460
|
+
name: "underlyingAssetAddress",
|
|
12461
|
+
type: "address"
|
|
12462
|
+
},
|
|
12463
|
+
{
|
|
12464
|
+
internalType: "uint256",
|
|
12465
|
+
name: "vTokenDecimals",
|
|
12466
|
+
type: "uint256"
|
|
12467
|
+
},
|
|
12468
|
+
{
|
|
12469
|
+
internalType: "uint256",
|
|
12470
|
+
name: "underlyingDecimals",
|
|
12471
|
+
type: "uint256"
|
|
12472
|
+
},
|
|
12473
|
+
{
|
|
12474
|
+
internalType: "uint256",
|
|
12475
|
+
name: "pausedActions",
|
|
12476
|
+
type: "uint256"
|
|
12477
|
+
}
|
|
12478
|
+
],
|
|
12479
|
+
internalType: "struct PoolLens.VTokenMetadata[]",
|
|
12480
|
+
name: "vTokens",
|
|
12481
|
+
type: "tuple[]"
|
|
12482
|
+
}
|
|
12483
|
+
],
|
|
12484
|
+
internalType: "struct PoolLens.PoolData",
|
|
12485
|
+
name: "",
|
|
12486
|
+
type: "tuple"
|
|
12487
|
+
}
|
|
12488
|
+
],
|
|
12489
|
+
stateMutability: "view",
|
|
12490
|
+
type: "function"
|
|
12491
|
+
},
|
|
12492
|
+
{
|
|
12493
|
+
inputs: [
|
|
12494
|
+
{ internalType: "address", name: "poolRegistryAddress", type: "address" },
|
|
12495
|
+
{ internalType: "address", name: "asset", type: "address" }
|
|
12496
|
+
],
|
|
12497
|
+
name: "getPoolsSupportedByAsset",
|
|
12498
|
+
outputs: [{ internalType: "address[]", name: "", type: "address[]" }],
|
|
12499
|
+
stateMutability: "view",
|
|
12500
|
+
type: "function"
|
|
12501
|
+
},
|
|
12502
|
+
{
|
|
12503
|
+
inputs: [
|
|
12504
|
+
{ internalType: "address", name: "poolRegistryAddress", type: "address" },
|
|
12505
|
+
{ internalType: "address", name: "comptroller", type: "address" },
|
|
12506
|
+
{ internalType: "address", name: "asset", type: "address" }
|
|
12507
|
+
],
|
|
12508
|
+
name: "getVTokenForAsset",
|
|
12509
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
12510
|
+
stateMutability: "view",
|
|
12511
|
+
type: "function"
|
|
12512
|
+
},
|
|
12513
|
+
{
|
|
12514
|
+
inputs: [],
|
|
12515
|
+
name: "isTimeBased",
|
|
12516
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
12517
|
+
stateMutability: "view",
|
|
12518
|
+
type: "function"
|
|
12519
|
+
},
|
|
12520
|
+
{
|
|
12521
|
+
inputs: [
|
|
12522
|
+
{ internalType: "contract VToken", name: "vToken", type: "address" },
|
|
12523
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
12524
|
+
],
|
|
12525
|
+
name: "vTokenBalances",
|
|
12526
|
+
outputs: [
|
|
12527
|
+
{
|
|
12528
|
+
components: [
|
|
12529
|
+
{ internalType: "address", name: "vToken", type: "address" },
|
|
12530
|
+
{ internalType: "uint256", name: "balanceOf", type: "uint256" },
|
|
12531
|
+
{
|
|
12532
|
+
internalType: "uint256",
|
|
12533
|
+
name: "borrowBalanceCurrent",
|
|
12534
|
+
type: "uint256"
|
|
12535
|
+
},
|
|
12536
|
+
{
|
|
12537
|
+
internalType: "uint256",
|
|
12538
|
+
name: "balanceOfUnderlying",
|
|
12539
|
+
type: "uint256"
|
|
12540
|
+
},
|
|
12541
|
+
{ internalType: "uint256", name: "tokenBalance", type: "uint256" },
|
|
12542
|
+
{ internalType: "uint256", name: "tokenAllowance", type: "uint256" }
|
|
12543
|
+
],
|
|
12544
|
+
internalType: "struct PoolLens.VTokenBalances",
|
|
12545
|
+
name: "",
|
|
12546
|
+
type: "tuple"
|
|
12547
|
+
}
|
|
12548
|
+
],
|
|
12549
|
+
stateMutability: "nonpayable",
|
|
12550
|
+
type: "function"
|
|
12551
|
+
},
|
|
12552
|
+
{
|
|
12553
|
+
inputs: [
|
|
12554
|
+
{ internalType: "contract VToken[]", name: "vTokens", type: "address[]" },
|
|
12555
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
12556
|
+
],
|
|
12557
|
+
name: "vTokenBalancesAll",
|
|
12558
|
+
outputs: [
|
|
12559
|
+
{
|
|
12560
|
+
components: [
|
|
12561
|
+
{ internalType: "address", name: "vToken", type: "address" },
|
|
12562
|
+
{ internalType: "uint256", name: "balanceOf", type: "uint256" },
|
|
12563
|
+
{
|
|
12564
|
+
internalType: "uint256",
|
|
12565
|
+
name: "borrowBalanceCurrent",
|
|
12566
|
+
type: "uint256"
|
|
12567
|
+
},
|
|
12568
|
+
{
|
|
12569
|
+
internalType: "uint256",
|
|
12570
|
+
name: "balanceOfUnderlying",
|
|
12571
|
+
type: "uint256"
|
|
12572
|
+
},
|
|
12573
|
+
{ internalType: "uint256", name: "tokenBalance", type: "uint256" },
|
|
12574
|
+
{ internalType: "uint256", name: "tokenAllowance", type: "uint256" }
|
|
12575
|
+
],
|
|
12576
|
+
internalType: "struct PoolLens.VTokenBalances[]",
|
|
12577
|
+
name: "",
|
|
12578
|
+
type: "tuple[]"
|
|
12579
|
+
}
|
|
12580
|
+
],
|
|
12581
|
+
stateMutability: "nonpayable",
|
|
12582
|
+
type: "function"
|
|
12583
|
+
},
|
|
12584
|
+
{
|
|
12585
|
+
inputs: [
|
|
12586
|
+
{ internalType: "contract VToken", name: "vToken", type: "address" }
|
|
12587
|
+
],
|
|
12588
|
+
name: "vTokenMetadata",
|
|
12589
|
+
outputs: [
|
|
12590
|
+
{
|
|
12591
|
+
components: [
|
|
12592
|
+
{ internalType: "address", name: "vToken", type: "address" },
|
|
12593
|
+
{
|
|
12594
|
+
internalType: "uint256",
|
|
12595
|
+
name: "exchangeRateCurrent",
|
|
12596
|
+
type: "uint256"
|
|
12597
|
+
},
|
|
12598
|
+
{
|
|
12599
|
+
internalType: "uint256",
|
|
12600
|
+
name: "supplyRatePerBlockOrTimestamp",
|
|
12601
|
+
type: "uint256"
|
|
12602
|
+
},
|
|
12603
|
+
{
|
|
12604
|
+
internalType: "uint256",
|
|
12605
|
+
name: "borrowRatePerBlockOrTimestamp",
|
|
12606
|
+
type: "uint256"
|
|
12607
|
+
},
|
|
12608
|
+
{
|
|
12609
|
+
internalType: "uint256",
|
|
12610
|
+
name: "reserveFactorMantissa",
|
|
12611
|
+
type: "uint256"
|
|
12612
|
+
},
|
|
12613
|
+
{ internalType: "uint256", name: "supplyCaps", type: "uint256" },
|
|
12614
|
+
{ internalType: "uint256", name: "borrowCaps", type: "uint256" },
|
|
12615
|
+
{ internalType: "uint256", name: "totalBorrows", type: "uint256" },
|
|
12616
|
+
{ internalType: "uint256", name: "totalReserves", type: "uint256" },
|
|
12617
|
+
{ internalType: "uint256", name: "totalSupply", type: "uint256" },
|
|
12618
|
+
{ internalType: "uint256", name: "totalCash", type: "uint256" },
|
|
12619
|
+
{ internalType: "bool", name: "isListed", type: "bool" },
|
|
12620
|
+
{
|
|
12621
|
+
internalType: "uint256",
|
|
12622
|
+
name: "collateralFactorMantissa",
|
|
12623
|
+
type: "uint256"
|
|
12624
|
+
},
|
|
12625
|
+
{
|
|
12626
|
+
internalType: "address",
|
|
12627
|
+
name: "underlyingAssetAddress",
|
|
12628
|
+
type: "address"
|
|
12629
|
+
},
|
|
12630
|
+
{ internalType: "uint256", name: "vTokenDecimals", type: "uint256" },
|
|
12631
|
+
{
|
|
12632
|
+
internalType: "uint256",
|
|
12633
|
+
name: "underlyingDecimals",
|
|
12634
|
+
type: "uint256"
|
|
12635
|
+
},
|
|
12636
|
+
{ internalType: "uint256", name: "pausedActions", type: "uint256" }
|
|
12637
|
+
],
|
|
12638
|
+
internalType: "struct PoolLens.VTokenMetadata",
|
|
12639
|
+
name: "",
|
|
12640
|
+
type: "tuple"
|
|
12641
|
+
}
|
|
12642
|
+
],
|
|
12643
|
+
stateMutability: "view",
|
|
12644
|
+
type: "function"
|
|
12645
|
+
},
|
|
12646
|
+
{
|
|
12647
|
+
inputs: [
|
|
12648
|
+
{ internalType: "contract VToken[]", name: "vTokens", type: "address[]" }
|
|
12649
|
+
],
|
|
12650
|
+
name: "vTokenMetadataAll",
|
|
12651
|
+
outputs: [
|
|
12652
|
+
{
|
|
12653
|
+
components: [
|
|
12654
|
+
{ internalType: "address", name: "vToken", type: "address" },
|
|
12655
|
+
{
|
|
12656
|
+
internalType: "uint256",
|
|
12657
|
+
name: "exchangeRateCurrent",
|
|
12658
|
+
type: "uint256"
|
|
12659
|
+
},
|
|
12660
|
+
{
|
|
12661
|
+
internalType: "uint256",
|
|
12662
|
+
name: "supplyRatePerBlockOrTimestamp",
|
|
12663
|
+
type: "uint256"
|
|
12664
|
+
},
|
|
12665
|
+
{
|
|
12666
|
+
internalType: "uint256",
|
|
12667
|
+
name: "borrowRatePerBlockOrTimestamp",
|
|
12668
|
+
type: "uint256"
|
|
12669
|
+
},
|
|
12670
|
+
{
|
|
12671
|
+
internalType: "uint256",
|
|
12672
|
+
name: "reserveFactorMantissa",
|
|
12673
|
+
type: "uint256"
|
|
12674
|
+
},
|
|
12675
|
+
{ internalType: "uint256", name: "supplyCaps", type: "uint256" },
|
|
12676
|
+
{ internalType: "uint256", name: "borrowCaps", type: "uint256" },
|
|
12677
|
+
{ internalType: "uint256", name: "totalBorrows", type: "uint256" },
|
|
12678
|
+
{ internalType: "uint256", name: "totalReserves", type: "uint256" },
|
|
12679
|
+
{ internalType: "uint256", name: "totalSupply", type: "uint256" },
|
|
12680
|
+
{ internalType: "uint256", name: "totalCash", type: "uint256" },
|
|
12681
|
+
{ internalType: "bool", name: "isListed", type: "bool" },
|
|
12682
|
+
{
|
|
12683
|
+
internalType: "uint256",
|
|
12684
|
+
name: "collateralFactorMantissa",
|
|
12685
|
+
type: "uint256"
|
|
12686
|
+
},
|
|
12687
|
+
{
|
|
12688
|
+
internalType: "address",
|
|
12689
|
+
name: "underlyingAssetAddress",
|
|
12690
|
+
type: "address"
|
|
12691
|
+
},
|
|
12692
|
+
{ internalType: "uint256", name: "vTokenDecimals", type: "uint256" },
|
|
12693
|
+
{
|
|
12694
|
+
internalType: "uint256",
|
|
12695
|
+
name: "underlyingDecimals",
|
|
12696
|
+
type: "uint256"
|
|
12697
|
+
},
|
|
12698
|
+
{ internalType: "uint256", name: "pausedActions", type: "uint256" }
|
|
12699
|
+
],
|
|
12700
|
+
internalType: "struct PoolLens.VTokenMetadata[]",
|
|
12701
|
+
name: "",
|
|
12702
|
+
type: "tuple[]"
|
|
11825
12703
|
}
|
|
11826
12704
|
],
|
|
11827
|
-
|
|
12705
|
+
stateMutability: "view",
|
|
12706
|
+
type: "function"
|
|
12707
|
+
},
|
|
12708
|
+
{
|
|
12709
|
+
inputs: [
|
|
12710
|
+
{ internalType: "contract VToken", name: "vToken", type: "address" }
|
|
12711
|
+
],
|
|
12712
|
+
name: "vTokenUnderlyingPrice",
|
|
11828
12713
|
outputs: [
|
|
11829
12714
|
{
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
12715
|
+
components: [
|
|
12716
|
+
{ internalType: "address", name: "vToken", type: "address" },
|
|
12717
|
+
{ internalType: "uint256", name: "underlyingPrice", type: "uint256" }
|
|
12718
|
+
],
|
|
12719
|
+
internalType: "struct PoolLens.VTokenUnderlyingPrice",
|
|
12720
|
+
name: "",
|
|
12721
|
+
type: "tuple"
|
|
11833
12722
|
}
|
|
11834
12723
|
],
|
|
11835
12724
|
stateMutability: "view",
|
|
11836
12725
|
type: "function"
|
|
11837
12726
|
},
|
|
11838
12727
|
{
|
|
11839
|
-
name: "getMarketDataCompact",
|
|
11840
|
-
type: "function",
|
|
11841
|
-
stateMutability: "view",
|
|
11842
12728
|
inputs: [
|
|
11843
|
-
{
|
|
11844
|
-
{ type: "bytes32[]", name: "marketsIds" }
|
|
12729
|
+
{ internalType: "contract VToken[]", name: "vTokens", type: "address[]" }
|
|
11845
12730
|
],
|
|
11846
|
-
|
|
12731
|
+
name: "vTokenUnderlyingPriceAll",
|
|
12732
|
+
outputs: [
|
|
12733
|
+
{
|
|
12734
|
+
components: [
|
|
12735
|
+
{ internalType: "address", name: "vToken", type: "address" },
|
|
12736
|
+
{ internalType: "uint256", name: "underlyingPrice", type: "uint256" }
|
|
12737
|
+
],
|
|
12738
|
+
internalType: "struct PoolLens.VTokenUnderlyingPrice[]",
|
|
12739
|
+
name: "",
|
|
12740
|
+
type: "tuple[]"
|
|
12741
|
+
}
|
|
12742
|
+
],
|
|
12743
|
+
stateMutability: "view",
|
|
12744
|
+
type: "function"
|
|
11847
12745
|
}
|
|
11848
12746
|
];
|
|
11849
12747
|
|
|
@@ -11857,6 +12755,8 @@ function buildLenderCall(chainId, lender) {
|
|
|
11857
12755
|
return buildCompoundV3StyleLenderReserveCall(chainId, lender);
|
|
11858
12756
|
if (isInit(lender)) return buildInitStyleLenderReserveCall(chainId);
|
|
11859
12757
|
if (isMorphoType(lender)) return buildMorphoCall(chainId);
|
|
12758
|
+
if (isCompoundV2Type(lender))
|
|
12759
|
+
return buildCompoundV2StyleLenderReserveCall(chainId, lender);
|
|
11860
12760
|
return [];
|
|
11861
12761
|
}
|
|
11862
12762
|
function getLenderDataConverter(lender, chainId, prices, additionalYields, tokenList = {}) {
|
|
@@ -11900,6 +12800,14 @@ function getLenderDataConverter(lender, chainId, prices, additionalYields, token
|
|
|
11900
12800
|
additionalYields,
|
|
11901
12801
|
tokenList
|
|
11902
12802
|
);
|
|
12803
|
+
if (isCompoundV2Type(lender))
|
|
12804
|
+
return getCompoundV2ReservesDataConverter(
|
|
12805
|
+
lender,
|
|
12806
|
+
chainId,
|
|
12807
|
+
prices,
|
|
12808
|
+
additionalYields,
|
|
12809
|
+
tokenList
|
|
12810
|
+
);
|
|
11903
12811
|
return [() => null, 0];
|
|
11904
12812
|
}
|
|
11905
12813
|
var getAbi = (lender) => {
|
|
@@ -11918,6 +12826,7 @@ var getAbi = (lender) => {
|
|
|
11918
12826
|
if (isCompoundV3(lender)) return [...IrgetterAbi, ...CometAbi, ...CometExtAbi];
|
|
11919
12827
|
if (isInit(lender)) return InitLensAbi;
|
|
11920
12828
|
if (isMorphoType(lender)) return MorphoLensAbi;
|
|
12829
|
+
if (isCompoundV2Type(lender)) return VenusLensAbi;
|
|
11921
12830
|
return [];
|
|
11922
12831
|
};
|
|
11923
12832
|
var getLenderPublicData = async (chainId, lenders, prices, additionalYields, multicallRetry2, tokenList = async () => {
|
|
@@ -16524,36 +17433,87 @@ var MorphoBlueAbi = [
|
|
|
16524
17433
|
}
|
|
16525
17434
|
];
|
|
16526
17435
|
|
|
17436
|
+
// src/abis/compound-v2/Comptroller.ts
|
|
17437
|
+
var ComptrollerAbi = [
|
|
17438
|
+
{
|
|
17439
|
+
inputs: [
|
|
17440
|
+
{
|
|
17441
|
+
internalType: "address",
|
|
17442
|
+
name: "account",
|
|
17443
|
+
type: "address"
|
|
17444
|
+
}
|
|
17445
|
+
],
|
|
17446
|
+
name: "getAssetsIn",
|
|
17447
|
+
outputs: [
|
|
17448
|
+
{
|
|
17449
|
+
internalType: "contract CToken[]",
|
|
17450
|
+
name: "",
|
|
17451
|
+
type: "address[]"
|
|
17452
|
+
}
|
|
17453
|
+
],
|
|
17454
|
+
stateMutability: "view",
|
|
17455
|
+
type: "function"
|
|
17456
|
+
}
|
|
17457
|
+
];
|
|
17458
|
+
|
|
17459
|
+
// src/abis/compound-v2/CollateralToken.ts
|
|
17460
|
+
var CompoundV2CollateralToken = [
|
|
17461
|
+
{
|
|
17462
|
+
inputs: [{ internalType: "address", name: "owner", type: "address" }],
|
|
17463
|
+
name: "balanceOf",
|
|
17464
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
17465
|
+
stateMutability: "view",
|
|
17466
|
+
type: "function"
|
|
17467
|
+
},
|
|
17468
|
+
{
|
|
17469
|
+
inputs: [{ internalType: "address", name: "owner", type: "address" }],
|
|
17470
|
+
name: "balanceOfUnderlying",
|
|
17471
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
17472
|
+
stateMutability: "nonpayable",
|
|
17473
|
+
type: "function"
|
|
17474
|
+
},
|
|
17475
|
+
{
|
|
17476
|
+
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
17477
|
+
name: "borrowBalanceCurrent",
|
|
17478
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
17479
|
+
stateMutability: "nonpayable",
|
|
17480
|
+
type: "function"
|
|
17481
|
+
},
|
|
17482
|
+
{
|
|
17483
|
+
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
17484
|
+
name: "borrowBalanceStored",
|
|
17485
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
17486
|
+
stateMutability: "view",
|
|
17487
|
+
type: "function"
|
|
17488
|
+
}
|
|
17489
|
+
];
|
|
17490
|
+
|
|
16527
17491
|
// src/lending/user-data/abis.ts
|
|
16528
17492
|
var getAbi2 = (lender) => {
|
|
16529
|
-
if (isAaveV2Type(lender))
|
|
16530
|
-
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
|
|
16540
|
-
|
|
16541
|
-
if (
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
...
|
|
16549
|
-
];
|
|
16550
|
-
if (isCompoundV3(lender)) return [
|
|
16551
|
-
...CometAbi,
|
|
16552
|
-
...CometExtAbi,
|
|
16553
|
-
...CometRewardsAbi
|
|
16554
|
-
];
|
|
17493
|
+
if (isAaveV2Type(lender))
|
|
17494
|
+
return [
|
|
17495
|
+
...AavePoolAndDataProviderAbi,
|
|
17496
|
+
...VariableDebtTokenAbi,
|
|
17497
|
+
...RewarderAbi,
|
|
17498
|
+
...PullRewardsIncentivesController,
|
|
17499
|
+
...IncentivesControllerAbi,
|
|
17500
|
+
...MultiFeeDistributionAbi
|
|
17501
|
+
];
|
|
17502
|
+
if (isYLDR(lender)) return [...VariableDebtTokenAbi, ...YLDRAbi];
|
|
17503
|
+
if (isAaveV32Type(lender))
|
|
17504
|
+
return [...AavePoolV3UpgradedAbi, ...AaveV3ProtocolDataProviderAbi];
|
|
17505
|
+
if (isAaveV3Type(lender))
|
|
17506
|
+
return [
|
|
17507
|
+
...AavePoolLegacyAbi,
|
|
17508
|
+
...VariableDebtTokenAbi,
|
|
17509
|
+
...AavePoolDataProviderLegacyAbi
|
|
17510
|
+
];
|
|
17511
|
+
if (isCompoundV3(lender))
|
|
17512
|
+
return [...CometAbi, ...CometExtAbi, ...CometRewardsAbi];
|
|
16555
17513
|
if (isMorphoType(lender)) return [...MorphoBlueAbi, ...MorphoLensAbi];
|
|
16556
17514
|
if (isInit(lender)) return InitLensAbi;
|
|
17515
|
+
if (isCompoundV2Type(lender))
|
|
17516
|
+
return [...ComptrollerAbi, ...CompoundV2CollateralToken];
|
|
16557
17517
|
return [];
|
|
16558
17518
|
};
|
|
16559
17519
|
|
|
@@ -17254,6 +18214,125 @@ function createMorphoEntryFromMarketWithLens(balanceInfo, chainId, market, lende
|
|
|
17254
18214
|
};
|
|
17255
18215
|
}
|
|
17256
18216
|
|
|
18217
|
+
// src/lending/user-data/compound-v2/userCallBuild.ts
|
|
18218
|
+
var buildCompoundV2UserCall = (chainId, lender, account, assetsOverride) => {
|
|
18219
|
+
const collateralTokens = getCompoundV2CollateralTokens(chainId, lender);
|
|
18220
|
+
const comptroller = getCompoundV2Comptroller(chainId, lender);
|
|
18221
|
+
let calls = Object.values(collateralTokens).flatMap((tk) => [
|
|
18222
|
+
{
|
|
18223
|
+
address: tk,
|
|
18224
|
+
name: "balanceOfUnderlying",
|
|
18225
|
+
params: [account]
|
|
18226
|
+
},
|
|
18227
|
+
{
|
|
18228
|
+
address: tk,
|
|
18229
|
+
name: "borrowBalanceCurrent",
|
|
18230
|
+
params: [account]
|
|
18231
|
+
}
|
|
18232
|
+
]);
|
|
18233
|
+
calls = [
|
|
18234
|
+
...calls,
|
|
18235
|
+
{
|
|
18236
|
+
address: comptroller,
|
|
18237
|
+
name: "getAssetsIn",
|
|
18238
|
+
params: [account]
|
|
18239
|
+
}
|
|
18240
|
+
];
|
|
18241
|
+
return calls;
|
|
18242
|
+
};
|
|
18243
|
+
|
|
18244
|
+
// src/lending/user-data/compound-v2/userCallParse.ts
|
|
18245
|
+
var getCompoundV2UserDataConverter = (lender, chainId, account, prices, pricesHist, lenderData) => {
|
|
18246
|
+
switch (lender) {
|
|
18247
|
+
default: {
|
|
18248
|
+
const assetsToQuery = Object.keys(lenderData);
|
|
18249
|
+
const vTokens = getCompoundV2CollateralTokens(chainId, lender);
|
|
18250
|
+
const expectedNumberOfCalls = assetsToQuery.length * 2 + 1;
|
|
18251
|
+
return [
|
|
18252
|
+
(data) => {
|
|
18253
|
+
if (data.length !== expectedNumberOfCalls) {
|
|
18254
|
+
return void 0;
|
|
18255
|
+
}
|
|
18256
|
+
const lendingPositions = {};
|
|
18257
|
+
let totalDebt24h = 0;
|
|
18258
|
+
let totalDeposits24h = 0;
|
|
18259
|
+
const asstsIn = data[data.length - 1].map((a) => a.toLowerCase());
|
|
18260
|
+
for (let i = 0; i < assetsToQuery.length; i++) {
|
|
18261
|
+
const asset = assetsToQuery[i];
|
|
18262
|
+
const { dataForAsset, addedDebt, addedDeposits } = createCompoundV2Entry(
|
|
18263
|
+
i,
|
|
18264
|
+
data,
|
|
18265
|
+
asstsIn,
|
|
18266
|
+
vTokens[asset],
|
|
18267
|
+
lenderData[asset].asset,
|
|
18268
|
+
prices,
|
|
18269
|
+
pricesHist,
|
|
18270
|
+
0
|
|
18271
|
+
);
|
|
18272
|
+
if (!dataForAsset) continue;
|
|
18273
|
+
totalDebt24h += addedDebt;
|
|
18274
|
+
totalDeposits24h += addedDeposits;
|
|
18275
|
+
lendingPositions[asset] = dataForAsset;
|
|
18276
|
+
}
|
|
18277
|
+
const payload = {
|
|
18278
|
+
chainId,
|
|
18279
|
+
account,
|
|
18280
|
+
lendingPositions: { "0": lendingPositions },
|
|
18281
|
+
rewards: {}
|
|
18282
|
+
};
|
|
18283
|
+
const userData = createBaseTypeUserState(
|
|
18284
|
+
payload,
|
|
18285
|
+
lenderData,
|
|
18286
|
+
totalDeposits24h,
|
|
18287
|
+
totalDebt24h
|
|
18288
|
+
);
|
|
18289
|
+
return {
|
|
18290
|
+
...payload,
|
|
18291
|
+
...userData
|
|
18292
|
+
};
|
|
18293
|
+
},
|
|
18294
|
+
expectedNumberOfCalls
|
|
18295
|
+
];
|
|
18296
|
+
}
|
|
18297
|
+
}
|
|
18298
|
+
};
|
|
18299
|
+
function createCompoundV2Entry(i, data, assetsIn, vToken, asset, prices, pricesHist, claimableRewards) {
|
|
18300
|
+
const depositsRaw = data[2 * i];
|
|
18301
|
+
const borrowsRaw = data[2 * i + 1];
|
|
18302
|
+
if (depositsRaw === "0" && borrowsRaw === "0") {
|
|
18303
|
+
return {
|
|
18304
|
+
dataForAsset: void 0,
|
|
18305
|
+
addedDeposits: 0,
|
|
18306
|
+
addedDebt: 0
|
|
18307
|
+
};
|
|
18308
|
+
}
|
|
18309
|
+
const assetMeta = asset;
|
|
18310
|
+
const decimals = assetMeta?.decimals ?? 18;
|
|
18311
|
+
const currentATokenBalance = parseRawAmount(depositsRaw, decimals);
|
|
18312
|
+
const currentVariableDebt = parseRawAmount(borrowsRaw, decimals);
|
|
18313
|
+
const key = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset.address, asset.chainId);
|
|
18314
|
+
const price = prices[key] ?? 1;
|
|
18315
|
+
const priceHist = pricesHist?.[key] ?? price;
|
|
18316
|
+
const dataForAsset = {
|
|
18317
|
+
poolId: asset.address,
|
|
18318
|
+
underlying: asset.address,
|
|
18319
|
+
deposits: currentATokenBalance,
|
|
18320
|
+
depositsRaw,
|
|
18321
|
+
debtStable: 0,
|
|
18322
|
+
debt: currentVariableDebt,
|
|
18323
|
+
depositsUSD: Number(currentATokenBalance) * price,
|
|
18324
|
+
debtStableUSD: 0,
|
|
18325
|
+
debtUSD: Number(currentVariableDebt) * price,
|
|
18326
|
+
collateralEnabled: Boolean(assetsIn?.includes(vToken)),
|
|
18327
|
+
claimableRewards
|
|
18328
|
+
};
|
|
18329
|
+
return {
|
|
18330
|
+
dataForAsset,
|
|
18331
|
+
addedDeposits: Number(currentATokenBalance) * priceHist,
|
|
18332
|
+
addedDebt: Number(currentVariableDebt) * priceHist
|
|
18333
|
+
};
|
|
18334
|
+
}
|
|
18335
|
+
|
|
17257
18336
|
// src/lending/user-data/fetchUserData.ts
|
|
17258
18337
|
function buildUserCall(chainId, lender, account, params, assets) {
|
|
17259
18338
|
if (isAaveV2Type(lender))
|
|
@@ -17263,7 +18342,9 @@ function buildUserCall(chainId, lender, account, params, assets) {
|
|
|
17263
18342
|
if (isInit(lender)) return buildInitUserCall(chainId, lender, account);
|
|
17264
18343
|
if (isMorphoType(lender))
|
|
17265
18344
|
return buildMorphoUserCallWithLens(chainId, account, lender, params);
|
|
17266
|
-
|
|
18345
|
+
if (isCompoundV3Type(lender))
|
|
18346
|
+
return buildCompoundV3UserCall(chainId, lender, account, assets);
|
|
18347
|
+
return buildCompoundV2UserCall(chainId, lender, account);
|
|
17267
18348
|
}
|
|
17268
18349
|
function getUserDataConverter(lender, chainId, account, prices, pricesHist, lenderPublicState, params) {
|
|
17269
18350
|
if (isYLDR(lender))
|
|
@@ -17312,7 +18393,16 @@ function getUserDataConverter(lender, chainId, account, prices, pricesHist, lend
|
|
|
17312
18393
|
pricesHist,
|
|
17313
18394
|
lenderPublicState?.data
|
|
17314
18395
|
);
|
|
17315
|
-
|
|
18396
|
+
if (isCompoundV3Type(lender))
|
|
18397
|
+
return getCompoundV3UserDataConverter(
|
|
18398
|
+
lender,
|
|
18399
|
+
chainId,
|
|
18400
|
+
account,
|
|
18401
|
+
prices,
|
|
18402
|
+
pricesHist,
|
|
18403
|
+
lenderPublicState?.data?.[lender]?.data
|
|
18404
|
+
);
|
|
18405
|
+
return getCompoundV2UserDataConverter(
|
|
17316
18406
|
lender,
|
|
17317
18407
|
chainId,
|
|
17318
18408
|
account,
|
|
@@ -17392,7 +18482,7 @@ var baseUrl = "https://raw.githubusercontent.com/1delta-DAO/lender-metadata/main
|
|
|
17392
18482
|
var aavePools2 = baseUrl + "/config/aave-pools.json";
|
|
17393
18483
|
var aaveOracles2 = baseUrl + "/data/aave-oracles.json";
|
|
17394
18484
|
var morphoOracles2 = baseUrl + "/data/morpho-oracles.json";
|
|
17395
|
-
var
|
|
18485
|
+
var compoundV2Pools2 = baseUrl + "/config/compound-v2-pools.json";
|
|
17396
18486
|
var compoundV3Pools2 = baseUrl + "/config/compound-v3-pools.json";
|
|
17397
18487
|
var morphoPools2 = baseUrl + "/config/morpho-pools.json";
|
|
17398
18488
|
var aaveReserves2 = baseUrl + "/data/aave-reserves.json";
|
|
@@ -17447,7 +18537,7 @@ async function fetchLenderMetaFromDirAndInitialize() {
|
|
|
17447
18537
|
async function fetchLenderMetaFromDir() {
|
|
17448
18538
|
const promises = [
|
|
17449
18539
|
aavePools2,
|
|
17450
|
-
|
|
18540
|
+
compoundV2Pools2,
|
|
17451
18541
|
compoundV3Pools2,
|
|
17452
18542
|
// initPools,
|
|
17453
18543
|
morphoPools2,
|
|
@@ -17989,6 +19079,7 @@ var yoeth = "Yield Optimizer ETH::YOETH";
|
|
|
17989
19079
|
var yobtc = "Yield Optimizer BTC::YOBTC";
|
|
17990
19080
|
var yousd = "Yield Optimizer USD::YOUSD";
|
|
17991
19081
|
var yoeur = "Yield Optimizer EUR::yoEUR";
|
|
19082
|
+
var hwhlp = "Hyperwave HLP::hwHLP";
|
|
17992
19083
|
var FeedData = {
|
|
17993
19084
|
WSTETH: "https://eth-api.lido.fi/v1/protocol/steth/apr/sma",
|
|
17994
19085
|
STMATIC: "https://polygon.lido.fi/api/stats",
|
|
@@ -18025,6 +19116,7 @@ var FeedData = {
|
|
|
18025
19116
|
SSUPERUSD: "https://www.superreturn.ai/api/trpc/cmc.getUSDCPrice,rewardBackend.getYield,rewardBackend.getTvlChange?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%2C%221%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%2C%222%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%7D",
|
|
18026
19117
|
HBHYPE: "https://api.hyperbeat.org/api/v1/staking?address=0xCeaD893b162D38e714D82d06a7fe0b0dc3c38E0b",
|
|
18027
19118
|
HLP: "https://api-ui.hyperliquid.xyz/info",
|
|
19119
|
+
HWHLP: "https://api.hyperwavefi.xyz/stats/latest?asset=hwhlp_999",
|
|
18028
19120
|
YO: "https://api.yo.xyz/api/v1/vault/stats"
|
|
18029
19121
|
};
|
|
18030
19122
|
function averageDataLastN(arr, n = 7) {
|
|
@@ -18300,6 +19392,13 @@ var fetchGeneralYields = async () => {
|
|
|
18300
19392
|
}).then((r) => r.text());
|
|
18301
19393
|
return Number(res) ?? 0;
|
|
18302
19394
|
});
|
|
19395
|
+
const hwhlpPromise = safeFetch("HWHLP", async () => {
|
|
19396
|
+
const res = await fetch(FeedData.HWHLP, {
|
|
19397
|
+
method: "GET",
|
|
19398
|
+
headers: { Accept: "application/json" }
|
|
19399
|
+
}).then((r) => r.json());
|
|
19400
|
+
return Number(res.data?.last_annualized_apr ?? 0);
|
|
19401
|
+
});
|
|
18303
19402
|
const csusdlPromise = safeFetch("CSUSDL", async () => {
|
|
18304
19403
|
const res = await fetch(FeedData.MORPHO_VAULTS, {
|
|
18305
19404
|
method: "POST",
|
|
@@ -18428,7 +19527,8 @@ var fetchGeneralYields = async () => {
|
|
|
18428
19527
|
hbhypeData,
|
|
18429
19528
|
pendleData,
|
|
18430
19529
|
hlpData,
|
|
18431
|
-
yoData
|
|
19530
|
+
yoData,
|
|
19531
|
+
hwhlpData
|
|
18432
19532
|
] = await Promise.all([
|
|
18433
19533
|
wstethPromise,
|
|
18434
19534
|
ezethPromise,
|
|
@@ -18467,7 +19567,8 @@ var fetchGeneralYields = async () => {
|
|
|
18467
19567
|
hbhypePromise,
|
|
18468
19568
|
pendlePromise,
|
|
18469
19569
|
hlpPromise,
|
|
18470
|
-
yoPromise
|
|
19570
|
+
yoPromise,
|
|
19571
|
+
hwhlpPromise
|
|
18471
19572
|
]);
|
|
18472
19573
|
const data = {
|
|
18473
19574
|
intrinsicYields: {
|
|
@@ -18505,6 +19606,7 @@ var fetchGeneralYields = async () => {
|
|
|
18505
19606
|
[ssuperusd]: ssuperusdData,
|
|
18506
19607
|
[hbhype]: hbhypeData,
|
|
18507
19608
|
[hlp]: hlpData,
|
|
19609
|
+
[hwhlp]: hwhlpData,
|
|
18508
19610
|
...rtokensData,
|
|
18509
19611
|
...hypeData,
|
|
18510
19612
|
...angleData,
|
|
@@ -20386,6 +21488,7 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
20386
21488
|
const [api3Calls, api3Names] = getApi3Calls(chainId);
|
|
20387
21489
|
const [rwaCalls, rwaNames] = getRWADynamicOracleCalls(chainId);
|
|
20388
21490
|
const [cometCalls, cometNames] = getCometCalls(chainId);
|
|
21491
|
+
const [compoundV2Calls, compoundV2Names] = getCompoundV2Calls(chainId);
|
|
20389
21492
|
const allCalls = [
|
|
20390
21493
|
...chainlinkCalls,
|
|
20391
21494
|
...aaveCalls,
|
|
@@ -20394,6 +21497,7 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
20394
21497
|
...api3Calls,
|
|
20395
21498
|
...rwaCalls,
|
|
20396
21499
|
...cometCalls,
|
|
21500
|
+
...compoundV2Calls,
|
|
20397
21501
|
...morphoCalls
|
|
20398
21502
|
];
|
|
20399
21503
|
const abis = [
|
|
@@ -20404,7 +21508,8 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
20404
21508
|
...Api3OracleAbi,
|
|
20405
21509
|
...RWADynamicOracleAbi,
|
|
20406
21510
|
...ProxyOracleAbi,
|
|
20407
|
-
...CometAbi
|
|
21511
|
+
...CometAbi,
|
|
21512
|
+
...VenusLensAbi
|
|
20408
21513
|
];
|
|
20409
21514
|
const result = await multicallRetry(
|
|
20410
21515
|
chainId,
|
|
@@ -20425,6 +21530,7 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
20425
21530
|
api3: { calls: api3Calls, names: api3Names },
|
|
20426
21531
|
rwa: { calls: rwaCalls, names: rwaNames },
|
|
20427
21532
|
comet: { calls: cometCalls, names: cometNames },
|
|
21533
|
+
compoundV2: { calls: compoundV2Calls, names: compoundV2Names },
|
|
20428
21534
|
morpho: { queries: morphoQueries },
|
|
20429
21535
|
uniswapCalls,
|
|
20430
21536
|
uniswapV3Calls,
|
|
@@ -20449,6 +21555,7 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
20449
21555
|
uniswapCalls,
|
|
20450
21556
|
uniswapV3Calls,
|
|
20451
21557
|
comet,
|
|
21558
|
+
compoundV2,
|
|
20452
21559
|
aaveCalls
|
|
20453
21560
|
}
|
|
20454
21561
|
} of chainResults) {
|
|
@@ -20483,6 +21590,16 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
20483
21590
|
const cometSlice = result.slice(offset, offset + comet.calls.length);
|
|
20484
21591
|
const cometData = parseCometResults(chainId, cometSlice, comet.names);
|
|
20485
21592
|
offset += comet.calls.length;
|
|
21593
|
+
const compoundV2Slice = result.slice(
|
|
21594
|
+
offset,
|
|
21595
|
+
offset + compoundV2.calls.length
|
|
21596
|
+
);
|
|
21597
|
+
const compoundV2Data = parseCompoundV2Results(
|
|
21598
|
+
chainId,
|
|
21599
|
+
compoundV2Slice,
|
|
21600
|
+
compoundV2.names
|
|
21601
|
+
);
|
|
21602
|
+
offset += comet.calls.length;
|
|
20486
21603
|
allPrices = {
|
|
20487
21604
|
...allPrices,
|
|
20488
21605
|
...chainlinkData,
|
|
@@ -20491,7 +21608,8 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
20491
21608
|
...uniswapV3Data,
|
|
20492
21609
|
...api3Data,
|
|
20493
21610
|
...rwaData,
|
|
20494
|
-
...cometData
|
|
21611
|
+
...cometData,
|
|
21612
|
+
...compoundV2Data
|
|
20495
21613
|
};
|
|
20496
21614
|
}
|
|
20497
21615
|
allPrices = { ...otherResults[0], ...allPrices, ...otherResults[1] };
|
|
@@ -20616,6 +21734,53 @@ var parseCometResults = (chainId, data, names) => {
|
|
|
20616
21734
|
}
|
|
20617
21735
|
}
|
|
20618
21736
|
};
|
|
21737
|
+
var getCompoundV2Calls = (chainId) => {
|
|
21738
|
+
switch (chainId) {
|
|
21739
|
+
case Chain.ARBITRUM_ONE: {
|
|
21740
|
+
const names = [
|
|
21741
|
+
"GMX Market ETH/USD::GM [WETH-USDC]",
|
|
21742
|
+
//
|
|
21743
|
+
"GMX Market BTC/USD::GM [WBTC-USDC]"
|
|
21744
|
+
];
|
|
21745
|
+
return [
|
|
21746
|
+
[
|
|
21747
|
+
{
|
|
21748
|
+
address: "0x53F34FF95367B2A4542461a6A63fD321F8da22AD",
|
|
21749
|
+
// lens
|
|
21750
|
+
name: "vTokenUnderlyingPrice",
|
|
21751
|
+
params: [
|
|
21752
|
+
"0x9bb8cEc9C0d46F53b4f2173BB2A0221F66c353cC"
|
|
21753
|
+
//
|
|
21754
|
+
]
|
|
21755
|
+
},
|
|
21756
|
+
{
|
|
21757
|
+
address: "0x53F34FF95367B2A4542461a6A63fD321F8da22AD",
|
|
21758
|
+
name: "vTokenUnderlyingPrice",
|
|
21759
|
+
params: [
|
|
21760
|
+
"0x4f3a73f318C5EA67A86eaaCE24309F29f89900dF"
|
|
21761
|
+
//
|
|
21762
|
+
]
|
|
21763
|
+
}
|
|
21764
|
+
],
|
|
21765
|
+
names
|
|
21766
|
+
];
|
|
21767
|
+
}
|
|
21768
|
+
default:
|
|
21769
|
+
return [[], []];
|
|
21770
|
+
}
|
|
21771
|
+
};
|
|
21772
|
+
var parseCompoundV2Results = (chainId, data, names) => {
|
|
21773
|
+
return Object.assign(
|
|
21774
|
+
{},
|
|
21775
|
+
...data.map((entry, index) => {
|
|
21776
|
+
return {
|
|
21777
|
+
[names[index]]: Number(
|
|
21778
|
+
parseRawAmount(entry?.underlyingPrice ?? "0", 18)
|
|
21779
|
+
)
|
|
21780
|
+
};
|
|
21781
|
+
})
|
|
21782
|
+
);
|
|
21783
|
+
};
|
|
20619
21784
|
var getUniswapV3Calls = (chainId) => {
|
|
20620
21785
|
switch (chainId) {
|
|
20621
21786
|
case Chain.HEMI_NETWORK:
|