@1delta/margin-fetcher 0.0.114 → 0.0.116

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.
@@ -1,48 +1,10 @@
1
1
  export declare const UniswapV3Abi: readonly [{
2
- readonly inputs: readonly [];
3
- readonly name: "protocolFees";
4
- readonly outputs: readonly [{
5
- readonly internalType: "uint128";
6
- readonly name: "token0";
7
- readonly type: "uint128";
8
- }, {
9
- readonly internalType: "uint128";
10
- readonly name: "token1";
11
- readonly type: "uint128";
12
- }];
13
- readonly stateMutability: "view";
14
- readonly type: "function";
15
- }, {
16
2
  readonly inputs: readonly [];
17
3
  readonly name: "slot0";
18
4
  readonly outputs: readonly [{
19
5
  readonly internalType: "uint160";
20
6
  readonly name: "sqrtPriceX96";
21
7
  readonly type: "uint160";
22
- }, {
23
- readonly internalType: "int24";
24
- readonly name: "tick";
25
- readonly type: "int24";
26
- }, {
27
- readonly internalType: "uint16";
28
- readonly name: "observationIndex";
29
- readonly type: "uint16";
30
- }, {
31
- readonly internalType: "uint16";
32
- readonly name: "observationCardinality";
33
- readonly type: "uint16";
34
- }, {
35
- readonly internalType: "uint16";
36
- readonly name: "observationCardinalityNext";
37
- readonly type: "uint16";
38
- }, {
39
- readonly internalType: "uint8";
40
- readonly name: "feeProtocol";
41
- readonly type: "uint8";
42
- }, {
43
- readonly internalType: "bool";
44
- readonly name: "unlocked";
45
- readonly type: "bool";
46
8
  }];
47
9
  readonly stateMutability: "view";
48
10
  readonly type: "function";
@@ -1 +1 @@
1
- {"version":3,"file":"UniV3.d.ts","sourceRoot":"","sources":["../../../src/abis/oracle/UniV3.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Df,CAAA"}
1
+ {"version":3,"file":"UniV3.d.ts","sourceRoot":"","sources":["../../../src/abis/oracle/UniV3.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;EAcf,CAAA"}
package/dist/index.js CHANGED
@@ -6240,7 +6240,7 @@ var IrgetterAbi = [
6240
6240
  }
6241
6241
  ];
6242
6242
 
6243
- // ../../node_modules/.pnpm/@1delta+lender-registry@0.0.10/node_modules/@1delta/lender-registry/dist/index.mjs
6243
+ // ../../node_modules/.pnpm/@1delta+lender-registry@0.0.11/node_modules/@1delta/lender-registry/dist/index.mjs
6244
6244
  var Lender = /* @__PURE__ */ ((Lender22) => {
6245
6245
  Lender22["AAVE_V3"] = "AAVE_V3";
6246
6246
  Lender22["AAVE_V3_PRIME"] = "AAVE_V3_PRIME";
@@ -6348,6 +6348,7 @@ var Lender = /* @__PURE__ */ ((Lender22) => {
6348
6348
  Lender22["ENCLABS_LST"] = "ENCLABS_LST";
6349
6349
  Lender22["ENCLABS_PT_USD"] = "ENCLABS_PT_USD";
6350
6350
  Lender22["ENCLABS_PT_ETH"] = "ENCLABS_PT_ETH";
6351
+ Lender22["ENCLABS_SONIC_ECO"] = "ENCLABS_SONIC_ECO";
6351
6352
  Lender22["BENQI"] = "BENQI";
6352
6353
  Lender22["BENQI_AVALANCE_ECOSYSTEM"] = "BENQI_AVALANCE_ECOSYSTEM";
6353
6354
  Lender22["KEOM"] = "KEOM";
@@ -6492,8 +6493,9 @@ var VENUS_LENDERS = [
6492
6493
  "ENCLABS",
6493
6494
  "ENCLABS_LST",
6494
6495
  "ENCLABS_PT_USD",
6495
- "ENCLABS_PT_ETH"
6496
- /* ENCLABS_PT_ETH */
6496
+ "ENCLABS_PT_ETH",
6497
+ "ENCLABS_SONIC_ECO"
6498
+ /* ENCLABS_SONIC_ECO */
6497
6499
  ];
6498
6500
  var COMPOUND_V2_LENDERS = [
6499
6501
  ...VENUS_LENDERS,
@@ -8272,7 +8274,7 @@ var getAaveV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
8272
8274
  );
8273
8275
  const totalAToken = liquidity + Number(totalStableDebt) + Number(totalVariableDebt);
8274
8276
  const oracleKey = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId);
8275
- const price = prices[oracleKey] ?? 1;
8277
+ const price = prices[oracleKey] ?? 0;
8276
8278
  const totalDepositsUSD = Number(totalAToken) * price;
8277
8279
  const totalDebtUSD = Number(totalVariableDebt) * price;
8278
8280
  resultReserves[asset] = {
@@ -8416,7 +8418,7 @@ var getAaveV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
8416
8418
  decimals
8417
8419
  );
8418
8420
  const liquidity = Number(totalDeposits) - Number(totalDebt) - Number(totalDebtStable);
8419
- const price = prices[toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId)];
8421
+ const price = prices[toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId)] ?? 0;
8420
8422
  resultReserves[asset] = {
8421
8423
  poolId: asset,
8422
8424
  underlying: asset,
@@ -8592,7 +8594,7 @@ function parseYLDRCall(chainId, lender, additionalYields, prices, tokenList) {
8592
8594
  );
8593
8595
  const liquidity = Number(totalAToken) - Number(totalVariableDebt);
8594
8596
  const oracleKey = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId);
8595
- const price = prices[oracleKey] ?? 1;
8597
+ const price = prices[oracleKey] ?? 0;
8596
8598
  const totalDepositsUSD = Number(totalAToken) * price;
8597
8599
  const totalDebtUSD = Number(totalVariableDebt) * price;
8598
8600
  resultReserves[asset] = {
@@ -8713,7 +8715,7 @@ function parseAave32(chainId, lender, prices, additionalYields, tokenList) {
8713
8715
  decimals
8714
8716
  );
8715
8717
  const liquidity = Number(totalDeposits) - Number(totalDebt) - Number(totalDebtStable);
8716
- const price = prices[toOracleKey(assetMeta?.assetGroup)] ?? toGenericPriceKey(asset, chainId);
8718
+ const price = prices[toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId)] ?? 0;
8717
8719
  resultReserves[asset] = {
8718
8720
  poolId: asset,
8719
8721
  underlying: asset,
@@ -8926,7 +8928,7 @@ var getCompoundV3ReservesDataConverter = (lender, chainId, prices, additionalYie
8926
8928
  const decimals2 = assetMeta?.decimals ?? 18;
8927
8929
  const totals = parseRawAmount(resultsTotals[0], decimals2);
8928
8930
  const oracleKey = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId);
8929
- const totalUsd = Number(totals) * (prices[oracleKey] ?? 1);
8931
+ const totalUsd = Number(totals) * (prices[oracleKey] ?? 0);
8930
8932
  result[asset] = {
8931
8933
  poolId: asset,
8932
8934
  underlying: asset,
@@ -21862,24 +21864,6 @@ var ProxyOracleAbi = [
21862
21864
 
21863
21865
  // src/abis/oracle/UniV3.ts
21864
21866
  var UniswapV3Abi = [
21865
- {
21866
- inputs: [],
21867
- name: "protocolFees",
21868
- outputs: [
21869
- {
21870
- internalType: "uint128",
21871
- name: "token0",
21872
- type: "uint128"
21873
- },
21874
- {
21875
- internalType: "uint128",
21876
- name: "token1",
21877
- type: "uint128"
21878
- }
21879
- ],
21880
- stateMutability: "view",
21881
- type: "function"
21882
- },
21883
21867
  {
21884
21868
  inputs: [],
21885
21869
  name: "slot0",
@@ -21888,36 +21872,6 @@ var UniswapV3Abi = [
21888
21872
  internalType: "uint160",
21889
21873
  name: "sqrtPriceX96",
21890
21874
  type: "uint160"
21891
- },
21892
- {
21893
- internalType: "int24",
21894
- name: "tick",
21895
- type: "int24"
21896
- },
21897
- {
21898
- internalType: "uint16",
21899
- name: "observationIndex",
21900
- type: "uint16"
21901
- },
21902
- {
21903
- internalType: "uint16",
21904
- name: "observationCardinality",
21905
- type: "uint16"
21906
- },
21907
- {
21908
- internalType: "uint16",
21909
- name: "observationCardinalityNext",
21910
- type: "uint16"
21911
- },
21912
- {
21913
- internalType: "uint8",
21914
- name: "feeProtocol",
21915
- type: "uint8"
21916
- },
21917
- {
21918
- internalType: "bool",
21919
- name: "unlocked",
21920
- type: "bool"
21921
21875
  }
21922
21876
  ],
21923
21877
  stateMutability: "view",
@@ -21946,6 +21900,8 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
21946
21900
  aaveForks = aaveForks?.filter((a) => a !== Lender.LORE);
21947
21901
  if (chainId === Chain.BNB_SMART_CHAIN_MAINNET)
21948
21902
  aaveForks = aaveForks?.filter((a) => a !== Lender.AVALON_USDX);
21903
+ if (chainId === Chain.MANTA_PACIFIC_MAINNET)
21904
+ aaveForks = aaveForks?.filter((a) => a !== Lender.ZEROLEND);
21949
21905
  const reservesToQuery = aaveForks?.map((a) => ({
21950
21906
  fork: a,
21951
21907
  assets: getAaveAssets(chainId, a)
@@ -22096,7 +22052,11 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
22096
22052
  const uniswapData = parseUniswapV2results(uniswapSlice, chainId);
22097
22053
  offset += uniswapCalls.length;
22098
22054
  const uniswapV3Slice = result.slice(offset, offset + uniswapV3Calls.length);
22099
- const uniswapV3Data = parseUniswapV3results(uniswapV3Slice, chainId);
22055
+ const uniswapV3Data = parseUniswapV3results(
22056
+ uniswapV3Slice,
22057
+ chainId,
22058
+ allPrices
22059
+ );
22100
22060
  offset += uniswapV3Calls.length;
22101
22061
  const api3Slice = result.slice(offset, offset + api3.calls.length);
22102
22062
  const api3Data = parseApi3Results(chainId, api3Slice, api3.names);
@@ -22881,6 +22841,15 @@ var getUniswapV3Calls = (chainId) => {
22881
22841
  params: []
22882
22842
  }
22883
22843
  ];
22844
+ case Chain.BASE:
22845
+ return [
22846
+ //mseth/eth
22847
+ {
22848
+ address: "0x74f72788f4814d7ff3c49b44684aa98eee140c0e",
22849
+ name: "slot0",
22850
+ params: []
22851
+ }
22852
+ ];
22884
22853
  default:
22885
22854
  return [];
22886
22855
  }
@@ -22903,18 +22872,26 @@ function getV3PriceFromSqrt(sqrtPrice, t0d, t1d) {
22903
22872
  );
22904
22873
  return price0to1;
22905
22874
  }
22906
- var parseUniswapV3results = (data, chainId) => {
22875
+ var parseUniswapV3results = (data, chainId, prices) => {
22907
22876
  switch (chainId) {
22908
22877
  case Chain.HEMI_NETWORK: {
22909
22878
  let uniswapData = {};
22910
22879
  if (data.length > 0) {
22911
- const state = data[0];
22912
- const [sqrtPriceX96, , , , , ,] = state;
22880
+ const sqrtPriceX96 = data[0];
22913
22881
  const price = getV3PriceFromSqrt(sqrtPriceX96, 18, 6);
22914
22882
  uniswapData["Hemi::HEMI"] = price;
22915
22883
  }
22916
22884
  return uniswapData;
22917
22885
  }
22886
+ case Chain.BASE: {
22887
+ let uniswapData = {};
22888
+ if (data.length > 0) {
22889
+ const sqrtPriceX96 = data[0];
22890
+ const price = getV3PriceFromSqrt(sqrtPriceX96, 18, 18);
22891
+ uniswapData["Metronome Synth ETH::msETH"] = prices["ETH"] / price;
22892
+ }
22893
+ return uniswapData;
22894
+ }
22918
22895
  default:
22919
22896
  return {};
22920
22897
  }