@1delta/margin-fetcher 0.0.36 → 0.0.37
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/lending/aave-v2-type/misc.d.ts +3 -9
- package/dist/lending/aave-v2-type/misc.d.ts.map +1 -1
- package/dist/lending/addresses/contracts.d.ts +0 -1
- package/dist/lending/addresses/contracts.d.ts.map +1 -1
- package/dist/lending/addresses/contracts.js +0 -17
- package/dist/lending/meta/index.js +1 -1
- package/dist/prices/main-prices/fetchOracleData.d.ts.map +1 -1
- package/dist/prices/main-prices/fetchOracleData.js +5 -3
- package/dist/utils/constants.d.ts +0 -23
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +4 -23
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -5
- package/dist/yields/index.d.ts.map +1 -1
- package/dist/yields/index.js +17 -1
- package/package.json +2 -2
- package/src/lending/addresses/contracts.ts +0 -20
- package/src/lending/meta/index.ts +1 -1
- package/src/prices/main-prices/fetchOracleData.ts +9 -3
- package/src/utils/constants.ts +43 -61
- package/src/utils/index.ts +0 -6
- package/src/yields/index.ts +18 -0
- package/test/flashLiquidity.test.ts +27 -20
- package/test/lenderData.test.ts +7 -4
- package/test/mainPrices.test.ts +3 -10
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const AURELIUS_REWARD_ASSETS: {
|
|
2
|
+
chainId: string;
|
|
3
3
|
decimals: number;
|
|
4
4
|
name: string;
|
|
5
5
|
address: string;
|
|
6
6
|
symbol: string;
|
|
7
|
-
}
|
|
8
|
-
chainId: Chain;
|
|
9
|
-
address: string;
|
|
10
|
-
decimals: number;
|
|
11
|
-
symbol: string;
|
|
12
|
-
name: string;
|
|
13
|
-
})[];
|
|
7
|
+
}[];
|
|
14
8
|
//# sourceMappingURL=misc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v2-type/misc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v2-type/misc.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB;;;;;;GASlC,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Lender } from "@1delta/lender-registry";
|
|
2
|
-
export declare function getAaveTypeOracleAddress(chainId: string, lender: Lender): any;
|
|
3
2
|
export declare function getAaveTypeIncentivesControllerAddress(chainId: string, lender: Lender): any;
|
|
4
3
|
export declare function getAaveTypeMultiFeeDistribution(chainId: string, lender: Lender): any;
|
|
5
4
|
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/lending/addresses/contracts.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/lending/addresses/contracts.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,wBAAgB,sCAAsC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAgBrF;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAM9E"}
|
|
@@ -6,23 +6,6 @@ import { addressesMeridianCore } from "./meridian";
|
|
|
6
6
|
import { addressesTakoTakoCore } from "./takotako";
|
|
7
7
|
import { zeroAddress } from "viem";
|
|
8
8
|
import { Lender } from "@1delta/lender-registry";
|
|
9
|
-
export function getAaveTypeOracleAddress(chainId, lender) {
|
|
10
|
-
switch (lender) {
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
case Lender.AAVE_V2: return addressesAaveV2Core.AaveOracle[chainId];
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
case Lender.AAVE_V3: return addressesAaveCore.AaveOracle[chainId];
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
case Lender.LENDLE: return addressesLendleCore.AaveOracle[chainId];
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
case Lender.AURELIUS: return addressesAureliusCore.AaveOracle[chainId];
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
case Lender.MERIDIAN: return addressesMeridianCore.AaveOracle[chainId];
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
case Lender.TAKOTAKO: return addressesTakoTakoCore.AaveOracle[chainId];
|
|
23
|
-
default: return zeroAddress;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
9
|
export function getAaveTypeIncentivesControllerAddress(chainId, lender) {
|
|
27
10
|
switch (lender) {
|
|
28
11
|
// @ts-ignore
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { initializeChainData, initializeLenderData } from '@1delta/data-sdk';
|
|
2
|
-
const baseUrl = 'https://raw.githubusercontent.com/1delta-DAO/lender-metadata/
|
|
2
|
+
const baseUrl = 'https://raw.githubusercontent.com/1delta-DAO/lender-metadata/main';
|
|
3
3
|
const aavePools = baseUrl + '/config/aave-pools.json';
|
|
4
4
|
const aaveOracles = baseUrl + '/data/aave-oracles.json';
|
|
5
5
|
const morphoOracles = baseUrl + '/data/morpho-oracles.json';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchOracleData.d.ts","sourceRoot":"","sources":["../../../src/prices/main-prices/fetchOracleData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchOracleData.d.ts","sourceRoot":"","sources":["../../../src/prices/main-prices/fetchOracleData.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AASvC,UAAU,UAAU;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAID;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,MAAM,EAAE,EAClB,eAAe;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAC5C,QAAO;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAA;CAAO,KACrD,OAAO,CAAC,UAAU,CAqMpB,CAAA;AAuDD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,UAiBZ"}
|
|
@@ -12,7 +12,7 @@ import { chainlinkOracles, getChainLinkKeys, ChainlinkAggregatorIndexes, } from
|
|
|
12
12
|
import { fetchDefillamaData } from '../defillama';
|
|
13
13
|
import { fetchPendlePrices } from '../pendle';
|
|
14
14
|
import { getAavesForChain } from '../../utils';
|
|
15
|
-
import { formatAavePrice, formatMorphoPrice, parseRawAmount } from '../../utils/parsing';
|
|
15
|
+
import { formatAavePrice, formatMorphoPrice, parseRawAmount, } from '../../utils/parsing';
|
|
16
16
|
import { ProxyOracleAbi } from '../../abis/oracle/ProxyOracle';
|
|
17
17
|
import { multicallRetry } from '@1delta/providers';
|
|
18
18
|
import { UniswapV3Abi } from '../../abis/oracle/UniV3';
|
|
@@ -360,13 +360,15 @@ const parseMorphoResults = (chainId, data, queries, donePrices = {}, list = {})
|
|
|
360
360
|
const collateralPrice = donePrices[oracleIdCollateral] ?? prices[oracleIdCollateral];
|
|
361
361
|
const priceDebtToCollateral = formatMorphoPrice(d.toString(), loanAssetDecimals, collateralAssetDecimals);
|
|
362
362
|
if (debtPrice) {
|
|
363
|
-
if (!prices[oracleIdCollateral])
|
|
363
|
+
if (!prices[oracleIdCollateral]) {
|
|
364
364
|
prices[oracleIdCollateral] = priceDebtToCollateral * debtPrice;
|
|
365
|
+
}
|
|
365
366
|
}
|
|
366
367
|
else {
|
|
367
368
|
if (collateralPrice) {
|
|
368
|
-
if (!prices[oracleId])
|
|
369
|
+
if (!prices[oracleId]) {
|
|
369
370
|
prices[oracleId] = collateralPrice / priceDebtToCollateral;
|
|
371
|
+
}
|
|
370
372
|
}
|
|
371
373
|
}
|
|
372
374
|
});
|
|
@@ -4,27 +4,4 @@
|
|
|
4
4
|
export declare const MULTICALL_ADDRESS: {
|
|
5
5
|
[c: string]: string;
|
|
6
6
|
};
|
|
7
|
-
/**
|
|
8
|
-
* 1Delta Composer Addresses
|
|
9
|
-
*/
|
|
10
|
-
export declare const COMPOSERS: {
|
|
11
|
-
"42161": string;
|
|
12
|
-
"10": string;
|
|
13
|
-
"137": string;
|
|
14
|
-
"8453": string;
|
|
15
|
-
"146": string;
|
|
16
|
-
"43111": string;
|
|
17
|
-
"167000": string;
|
|
18
|
-
"1088": string;
|
|
19
|
-
"100": string;
|
|
20
|
-
"43114": string;
|
|
21
|
-
"34443": string;
|
|
22
|
-
"534352": string;
|
|
23
|
-
"1116": string;
|
|
24
|
-
"250": string;
|
|
25
|
-
"56": string;
|
|
26
|
-
"5000": string;
|
|
27
|
-
"59144": string;
|
|
28
|
-
"81457": string;
|
|
29
|
-
};
|
|
30
7
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAwCA;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAsCpD,CAAA"}
|
package/dist/utils/constants.js
CHANGED
|
@@ -32,6 +32,8 @@ const REDSTONE_MULTICALL_ADDRESS = '0xd57B52452a0FDfE3ff8e0A40Bd10D00D0bfe0723';
|
|
|
32
32
|
const MANTA_MULTICALL_ADDRESS = '0x52dFC0D9960F11A9Ca9FF616e791B91188446a60';
|
|
33
33
|
const ZORA_MULTICALL_ADDRESS = '0xA51c76bEE6746cB487a7e9312E43e2b8f4A37C15';
|
|
34
34
|
const CORE_MULTICALL_ADDRESS = '0xFe9F82D820757787895Da00B1dBD35c3B8b04894';
|
|
35
|
+
const MORPH_MULTICALL_ADDRESS = '0xAcD82113982479B25E7c1D09858F0130921Dbbca';
|
|
36
|
+
const TELOS_MULTICALL_ADDRESS = '0x5d6b0f5335ec95cD2aB7E52f2A0750dd86502435';
|
|
35
37
|
/**
|
|
36
38
|
* Uniswap Interface Multicall
|
|
37
39
|
*/
|
|
@@ -70,28 +72,7 @@ export const MULTICALL_ADDRESS = {
|
|
|
70
72
|
[Chain.BOB]: BOB_MULTICALL_ADDRESS,
|
|
71
73
|
[Chain.ZERO_NETWORK]: ZERO_MULTICALL_ADDRESS,
|
|
72
74
|
[Chain.SAGA]: SAGA_MULTICALL_ADDRESS,
|
|
75
|
+
[Chain.MORPH]: MORPH_MULTICALL_ADDRESS,
|
|
76
|
+
[Chain.TELOS_EVM_MAINNET]: TELOS_MULTICALL_ADDRESS,
|
|
73
77
|
[Chain.WORLD_CHAIN]: WORLDCHAIN_MULTICALL_ADDRESS,
|
|
74
78
|
};
|
|
75
|
-
/**
|
|
76
|
-
* 1Delta Composer Addresses
|
|
77
|
-
*/
|
|
78
|
-
export const COMPOSERS = {
|
|
79
|
-
[Chain.ARBITRUM_ONE]: "0x05f3f58716a88A52493Be45aA0871c55b3748f18",
|
|
80
|
-
[Chain.OP_MAINNET]: "0xCDef0A216fcEF809258aA4f341dB1A5aB296ea72",
|
|
81
|
-
[Chain.POLYGON_MAINNET]: "0xFd245e732b40b6BF2038e42b476bD06580585326",
|
|
82
|
-
[Chain.BASE]: "0xB7ea94340e65CC68d1274aE483dfBE593fD6f21e",
|
|
83
|
-
[Chain.SONIC_MAINNET]: "0x8E24CfC19c6C00c524353CB8816f5f1c2F33c201",
|
|
84
|
-
[Chain.HEMI_NETWORK]: "0x79f4061BF049c5c6CAC6bfe2415c2460815F4ac7",
|
|
85
|
-
[Chain.TAIKO_ALETHIA]: "0x594cE4B82A81930cC637f1A59afdFb0D70054232",
|
|
86
|
-
[Chain.METIS_ANDROMEDA_MAINNET]: "0xCe434378adacC51d54312c872113D687Ac19B516",
|
|
87
|
-
[Chain.GNOSIS]: "0xcb6eb8df68153cebf60e1872273ef52075a5c297",
|
|
88
|
-
[Chain.AVALANCHE_C_CHAIN]: '0x8E24CfC19c6C00c524353CB8816f5f1c2F33c201',
|
|
89
|
-
[Chain.MODE]: '0x8E24CfC19c6C00c524353CB8816f5f1c2F33c201',
|
|
90
|
-
[Chain.SCROLL]: '0x8E24CfC19c6C00c524353CB8816f5f1c2F33c201',
|
|
91
|
-
[Chain.CORE_BLOCKCHAIN_MAINNET]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
92
|
-
[Chain.FANTOM_OPERA]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
93
|
-
[Chain.BNB_SMART_CHAIN_MAINNET]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
94
|
-
[Chain.MANTLE]: "0x5c019a146758287c614fe654caec1ba1caf05f4e",
|
|
95
|
-
[Chain.LINEA]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
96
|
-
[Chain.BLAST]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
97
|
-
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export declare const filterLendersByProtocol: (allLenders: string[], protocolLis
|
|
|
15
15
|
export declare const getAavesForChain: () => {
|
|
16
16
|
[c: string]: string[];
|
|
17
17
|
};
|
|
18
|
-
export declare const getComposerAddress: (chainId: string) => string;
|
|
19
18
|
export declare const getLenderAssets: (chainId: string | number | undefined, lendingProtocol?: Lender) => string[];
|
|
20
19
|
export declare function isMultiMarket(lender: string): boolean;
|
|
21
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EAEP,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EAEP,MAAM,yBAAyB,CAAA;AAahC,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,WAE1C;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,WAE9C;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,yBAEpC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,WAE1C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,WAE1C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,WAE1C;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,yBAEpC;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,WAE3C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,WAExC;AAED,eAAO,MAAM,kBAAkB,GAAI,GAAG,MAAM,aA0B3C,CAAA;AAED,sCAAsC;AACtC,eAAO,MAAM,uBAAuB,GAClC,YAAY,MAAM,EAAE,EACpB,eAAe,MAAM,EAAE,KACtB,MAAM,EAaR,CAAA;AAED,mCAAmC;AACnC,eAAO,MAAM,gBAAgB;;CAS5B,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,GAAG,MAAM,GAAG,SAAS,EACpC,wBAAgC,KAC/B,MAAM,EAOR,CAAA;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,WAE3C"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AAVE_V2_LENDERS, AAVE_V3_LENDERS, Lender, AAVE_V32_LENDERS, } from '@1delta/lender-registry';
|
|
2
2
|
import { uniq } from 'lodash';
|
|
3
|
-
import { COMPOSERS } from './constants';
|
|
4
|
-
import { zeroAddress } from 'viem';
|
|
5
3
|
import { aavePools, aaveReserves, compoundV3Pools, compoundV3Reserves, initConfig, morphoPools, } from '@1delta/data-sdk';
|
|
6
4
|
const COMPOUND_V3_KEY = 'COMPOUND_V3';
|
|
7
5
|
export function isCompoundV3(lender) {
|
|
@@ -79,9 +77,6 @@ export const getAavesForChain = () => {
|
|
|
79
77
|
});
|
|
80
78
|
return lenders;
|
|
81
79
|
};
|
|
82
|
-
export const getComposerAddress = (chainId) => {
|
|
83
|
-
return COMPOSERS[chainId] ?? zeroAddress;
|
|
84
|
-
};
|
|
85
80
|
export const getLenderAssets = (chainId, lendingProtocol = Lender.AAVE_V3) => {
|
|
86
81
|
if (!chainId)
|
|
87
82
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/yields/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/yields/index.ts"],"names":[],"mappings":"AAqGA,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,qBAAqB,EAAE,GAAG,CAAA;IAC1B,oBAAoB,EAAE,GAAG,CAAA;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;IACxD,aAAa,EAAE;QACb,CAAC,OAAO,EAAE,MAAM,GAAG;YACjB,CAAC,MAAM,EAAE,MAAM,GAAG;gBAAE,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAAA;aAAE,CAAA;SACzD,CAAA;KACF,CAAA;CACF;AAcD,eAAO,MAAM,kBAAkB,uCA+c9B,CAAA"}
|
package/dist/yields/index.js
CHANGED
|
@@ -30,6 +30,7 @@ const ethZero = 'ETH0::ETH0';
|
|
|
30
30
|
const usdThree = 'Web 3 Dollar::USD3';
|
|
31
31
|
const jitoSol = 'Jito Staked SOL::JitoSOL';
|
|
32
32
|
const thBill = 'Theo Short Duration US Treasury Fund::THBILL';
|
|
33
|
+
const ssuperusd = 'SuperReturn sSuperUSD::SSUPERUSD';
|
|
33
34
|
const FeedData = {
|
|
34
35
|
WSTETH: 'https://eth-api.lido.fi/v1/protocol/steth/apr/sma',
|
|
35
36
|
STMATIC: 'https://polygon.lido.fi/api/stats',
|
|
@@ -63,6 +64,7 @@ const FeedData = {
|
|
|
63
64
|
JITOSOL: 'https://www.jito.network/api/getJitoPoolStats/',
|
|
64
65
|
THBILL: 'https://thbill-api.theo.xyz/snapshots',
|
|
65
66
|
YEARN_KATANA: 'https://katana-apr-service.vercel.app/api/vaults',
|
|
67
|
+
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',
|
|
66
68
|
};
|
|
67
69
|
const LenderAPIs = {
|
|
68
70
|
MERIDIAN: 'https://omnidex.bmaa3ajd1gjri.eu-west-2.cs.amazonlightsail.com/lending_yields',
|
|
@@ -145,6 +147,18 @@ export const fetchGeneralYields = async () => {
|
|
|
145
147
|
return 0;
|
|
146
148
|
}
|
|
147
149
|
});
|
|
150
|
+
const ssuperusdPromise = safeFetch('SSUPERUSD', async () => {
|
|
151
|
+
try {
|
|
152
|
+
const res = await fetch(FeedData.SSUPERUSD, {
|
|
153
|
+
method: 'GET',
|
|
154
|
+
headers: { Accept: 'application/json', 'User-Agent': '1delta/yields' },
|
|
155
|
+
}).then((r) => r.json());
|
|
156
|
+
return apyToAprPercent(res?.[1]?.result.data.json ?? 0);
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
return 0;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
148
162
|
const rsethPromise = safeFetch('RSETH', async () => {
|
|
149
163
|
const res = await fetch(FeedData.RSETH).then((r) => r.json());
|
|
150
164
|
return apyToAprPercent(res.totalAPY);
|
|
@@ -380,7 +394,7 @@ export const fetchGeneralYields = async () => {
|
|
|
380
394
|
},
|
|
381
395
|
})));
|
|
382
396
|
});
|
|
383
|
-
const [wstethData, ezethData, rethData, weethData, stmaticData, methData, maticXdata, susdeData, meridianData, savaxData, cbethData, rsethData, trumaticData, rtokensData, hypeData, osEthData, ethXData, pufEthData, angleData, susdsData, srUsdData, yusdData, rlpData, wstusrData, csusdlData, sdeusdData, rswethData, ynethxData, ethZeroData, usdZeroPlusData, jitoSolData, thBillData, yearnKatanaData,] = await Promise.all([
|
|
397
|
+
const [wstethData, ezethData, rethData, weethData, stmaticData, methData, maticXdata, susdeData, meridianData, savaxData, cbethData, rsethData, trumaticData, rtokensData, hypeData, osEthData, ethXData, pufEthData, angleData, susdsData, srUsdData, yusdData, rlpData, wstusrData, csusdlData, sdeusdData, rswethData, ynethxData, ethZeroData, usdZeroPlusData, jitoSolData, thBillData, yearnKatanaData, ssuperusdData,] = await Promise.all([
|
|
384
398
|
wstethPromise,
|
|
385
399
|
ezethPromise,
|
|
386
400
|
rethPromise,
|
|
@@ -414,6 +428,7 @@ export const fetchGeneralYields = async () => {
|
|
|
414
428
|
jitoSolPromise,
|
|
415
429
|
thbillPromise,
|
|
416
430
|
yearnKatanaPromise,
|
|
431
|
+
ssuperusdPromise,
|
|
417
432
|
]);
|
|
418
433
|
const data = {
|
|
419
434
|
intrinsicYields: {
|
|
@@ -448,6 +463,7 @@ export const fetchGeneralYields = async () => {
|
|
|
448
463
|
[pufEth]: pufEthData,
|
|
449
464
|
[jitoSol]: jitoSolData,
|
|
450
465
|
[thBill]: thBillData,
|
|
466
|
+
[ssuperusd]: ssuperusdData,
|
|
451
467
|
...rtokensData,
|
|
452
468
|
...hypeData,
|
|
453
469
|
...angleData,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1delta/margin-fetcher",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@types/async-retry": "^1.4.9",
|
|
18
18
|
"async-retry": "^1.3.3",
|
|
19
19
|
"typescript": "^5.9.2",
|
|
20
|
-
"@1delta/providers": "0.0.
|
|
20
|
+
"@1delta/providers": "0.0.14"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc",
|
|
@@ -7,26 +7,6 @@ import { addressesTakoTakoCore } from "./takotako";
|
|
|
7
7
|
import { zeroAddress } from "viem";
|
|
8
8
|
import { Lender } from "@1delta/lender-registry";
|
|
9
9
|
|
|
10
|
-
export function getAaveTypeOracleAddress(chainId: string, lender: Lender) {
|
|
11
|
-
switch (lender) {
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
case Lender.AAVE_V2: return addressesAaveV2Core.AaveOracle[chainId]
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
case Lender.AAVE_V3: return addressesAaveCore.AaveOracle[chainId]
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
case Lender.LENDLE: return addressesLendleCore.AaveOracle[chainId]
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
case Lender.AURELIUS: return addressesAureliusCore.AaveOracle[chainId]
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
case Lender.MERIDIAN: return addressesMeridianCore.AaveOracle[chainId]
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
case Lender.TAKOTAKO: return addressesTakoTakoCore.AaveOracle[chainId]
|
|
24
|
-
default: return zeroAddress
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
10
|
export function getAaveTypeIncentivesControllerAddress(chainId: string, lender: Lender) {
|
|
31
11
|
switch (lender) {
|
|
32
12
|
// @ts-ignore
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { initializeChainData, initializeLenderData } from '@1delta/data-sdk'
|
|
2
2
|
|
|
3
3
|
const baseUrl =
|
|
4
|
-
'https://raw.githubusercontent.com/1delta-DAO/lender-metadata/
|
|
4
|
+
'https://raw.githubusercontent.com/1delta-DAO/lender-metadata/main'
|
|
5
5
|
const aavePools = baseUrl + '/config/aave-pools.json'
|
|
6
6
|
const aaveOracles = baseUrl + '/data/aave-oracles.json'
|
|
7
7
|
const morphoOracles = baseUrl + '/data/morpho-oracles.json'
|
|
@@ -17,7 +17,11 @@ import {
|
|
|
17
17
|
import { fetchDefillamaData } from '../defillama'
|
|
18
18
|
import { fetchPendlePrices } from '../pendle'
|
|
19
19
|
import { getAavesForChain } from '../../utils'
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
formatAavePrice,
|
|
22
|
+
formatMorphoPrice,
|
|
23
|
+
parseRawAmount,
|
|
24
|
+
} from '../../utils/parsing'
|
|
21
25
|
import { ProxyOracleAbi } from '../../abis/oracle/ProxyOracle'
|
|
22
26
|
import { multicallRetry } from '@1delta/providers'
|
|
23
27
|
import { TokenList } from '../../types'
|
|
@@ -520,12 +524,14 @@ const parseMorphoResults = (
|
|
|
520
524
|
)
|
|
521
525
|
|
|
522
526
|
if (debtPrice) {
|
|
523
|
-
if (!prices[oracleIdCollateral])
|
|
527
|
+
if (!prices[oracleIdCollateral]) {
|
|
524
528
|
prices[oracleIdCollateral] = priceDebtToCollateral * debtPrice
|
|
529
|
+
}
|
|
525
530
|
} else {
|
|
526
531
|
if (collateralPrice) {
|
|
527
|
-
if (!prices[oracleId])
|
|
532
|
+
if (!prices[oracleId]) {
|
|
528
533
|
prices[oracleId] = collateralPrice / priceDebtToCollateral
|
|
534
|
+
}
|
|
529
535
|
}
|
|
530
536
|
}
|
|
531
537
|
})
|
package/src/utils/constants.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { Chain } from '@1delta/chain-registry'
|
|
|
4
4
|
const CELO_MULTICALL_ADDRESS = '0x633987602DE5C4F337e3DbF265303A1080324204'
|
|
5
5
|
const BNB_MULTICALL_ADDRESS = '0x963Df249eD09c358A4819E39d9Cd5736c3087184'
|
|
6
6
|
const MANTLE_MULTICALL_ADDRESS = '0x2A51f2F647E1883F88C992244dEd171238693107'
|
|
7
|
-
const ARBITRUM_ONE_MULTICALL_ADDRESS =
|
|
7
|
+
const ARBITRUM_ONE_MULTICALL_ADDRESS =
|
|
8
|
+
'0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB'
|
|
8
9
|
const LINEA_MULTICALL_ADDRESS = '0xac1cE734566f390A94b00eb9bf561c2625BF44ea'
|
|
9
10
|
const AVALANCHE_MULTICALL_ADDRESS = '0x0139141Cd4Ee88dF3Cdb65881D411bAE271Ef0C2'
|
|
10
11
|
const BASE_MULTICALL_ADDRESS = '0x091e99cb1C49331a94dD62755D168E941AbD0693'
|
|
@@ -27,74 +28,55 @@ const CYBER_MULTICALL_ADDRESS = '0x906d6eB9CF8f64e100e44f8f491b833a8d40B530'
|
|
|
27
28
|
const METAL_MULTICALL_ADDRESS = '0x5d6b0f5335ec95cD2aB7E52f2A0750dd86502435'
|
|
28
29
|
const ZERO_MULTICALL_ADDRESS = '0x9CA4dcb2505fbf536F6c54AA0a77C79f4fBC35C0'
|
|
29
30
|
const BOB_MULTICALL_ADDRESS = '0x5d6b0f5335ec95cD2aB7E52f2A0750dd86502435'
|
|
30
|
-
const WORLDCHAIN_MULTICALL_ADDRESS =
|
|
31
|
+
const WORLDCHAIN_MULTICALL_ADDRESS =
|
|
32
|
+
'0x0a22c04215c97E3F532F4eF30e0aD9458792dAB9'
|
|
31
33
|
const LISK_MULTICALL_ADDRESS = '0xE3dbcD53f4Ce1b06Ab200f4912BD35672e68f1FA'
|
|
32
34
|
const REDSTONE_MULTICALL_ADDRESS = '0xd57B52452a0FDfE3ff8e0A40Bd10D00D0bfe0723'
|
|
33
35
|
const MANTA_MULTICALL_ADDRESS = '0x52dFC0D9960F11A9Ca9FF616e791B91188446a60'
|
|
34
36
|
const ZORA_MULTICALL_ADDRESS = '0xA51c76bEE6746cB487a7e9312E43e2b8f4A37C15'
|
|
35
37
|
const CORE_MULTICALL_ADDRESS = '0xFe9F82D820757787895Da00B1dBD35c3B8b04894'
|
|
38
|
+
const MORPH_MULTICALL_ADDRESS = '0xAcD82113982479B25E7c1D09858F0130921Dbbca'
|
|
39
|
+
const TELOS_MULTICALL_ADDRESS = '0x5d6b0f5335ec95cD2aB7E52f2A0750dd86502435'
|
|
36
40
|
|
|
37
41
|
/**
|
|
38
42
|
* Uniswap Interface Multicall
|
|
39
43
|
*/
|
|
40
44
|
export const MULTICALL_ADDRESS: { [c: string]: string } = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
45
|
+
[Chain.OP_MAINNET]: '0x1F98415757620B543A52E61c46B32eB19261F984',
|
|
46
|
+
[Chain.POLYGON_MAINNET]: '0x1F98415757620B543A52E61c46B32eB19261F984',
|
|
47
|
+
[Chain.ETHEREUM_MAINNET]: '0x1F98415757620B543A52E61c46B32eB19261F984',
|
|
48
|
+
[Chain.ARBITRUM_ONE]: ARBITRUM_ONE_MULTICALL_ADDRESS,
|
|
49
|
+
[Chain.BASE]: BASE_MULTICALL_ADDRESS,
|
|
50
|
+
[Chain.CELO_MAINNET]: CELO_MULTICALL_ADDRESS,
|
|
51
|
+
[Chain.BNB_SMART_CHAIN_MAINNET]: BNB_MULTICALL_ADDRESS,
|
|
52
|
+
[Chain.MANTLE]: MANTLE_MULTICALL_ADDRESS,
|
|
53
|
+
[Chain.BLAST]: BLAST_MULTICALL_ADDRESS,
|
|
54
|
+
[Chain.LINEA]: LINEA_MULTICALL_ADDRESS,
|
|
55
|
+
[Chain.AVALANCHE_C_CHAIN]: AVALANCHE_MULTICALL_ADDRESS,
|
|
56
|
+
[Chain.TAIKO_ALETHIA]: TAIKO_MULTICALL_ADDRESS,
|
|
57
|
+
[Chain.HEMI_NETWORK]: HEMI_MULTICALL_ADDRESS,
|
|
58
|
+
[Chain.GNOSIS]: GNOSIS_MULTICALL_ADDRESS,
|
|
59
|
+
[Chain.CORE_BLOCKCHAIN_MAINNET]: CORE_MULTICALL_ADDRESS,
|
|
60
|
+
[Chain.METIS_ANDROMEDA_MAINNET]: METIS_MULTICALL_ADDRESS,
|
|
61
|
+
[Chain.MODE]: MODE_MULTICALL_ADDRESS,
|
|
62
|
+
[Chain.INK]: INK_MULTICALL_ADDRESS,
|
|
63
|
+
[Chain.IOTA_EVM]: IOTA_MULTICALL_ADDRESS,
|
|
64
|
+
[Chain.CORN]: CORN_MULTICALL_ADDRESS,
|
|
65
|
+
[Chain.SONIC_MAINNET]: SONIC_MULTICALL_ADDRESS,
|
|
66
|
+
[Chain.FANTOM_OPERA]: FANTOM_MULTICALL_ADDRESS,
|
|
67
|
+
[Chain.SCROLL]: SCROLL_MULTICALL_ADDRESS,
|
|
68
|
+
[Chain.SHAPE]: SHAPE_MULTICALL_ADDRESS,
|
|
69
|
+
[Chain.CYBER_MAINNET]: CYBER_MULTICALL_ADDRESS,
|
|
70
|
+
[Chain.ZORA]: ZORA_MULTICALL_ADDRESS,
|
|
71
|
+
[Chain.MANTA_PACIFIC_MAINNET]: MANTA_MULTICALL_ADDRESS,
|
|
72
|
+
[Chain.REDSTONE]: REDSTONE_MULTICALL_ADDRESS,
|
|
73
|
+
[Chain.KAVA]: KAVA_MULTICALL_ADDRESS,
|
|
74
|
+
[Chain.METAL_L2]: METAL_MULTICALL_ADDRESS,
|
|
75
|
+
[Chain.LISK]: LISK_MULTICALL_ADDRESS,
|
|
76
|
+
[Chain.BOB]: BOB_MULTICALL_ADDRESS,
|
|
77
|
+
[Chain.ZERO_NETWORK]: ZERO_MULTICALL_ADDRESS,
|
|
78
|
+
[Chain.SAGA]: SAGA_MULTICALL_ADDRESS,
|
|
79
|
+
[Chain.MORPH]: MORPH_MULTICALL_ADDRESS,
|
|
80
|
+
[Chain.TELOS_EVM_MAINNET]: TELOS_MULTICALL_ADDRESS,
|
|
81
|
+
[Chain.WORLD_CHAIN]: WORLDCHAIN_MULTICALL_ADDRESS,
|
|
76
82
|
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* 1Delta Composer Addresses
|
|
80
|
-
*/
|
|
81
|
-
export const COMPOSERS = {
|
|
82
|
-
[Chain.ARBITRUM_ONE]: "0x05f3f58716a88A52493Be45aA0871c55b3748f18",
|
|
83
|
-
[Chain.OP_MAINNET]: "0xCDef0A216fcEF809258aA4f341dB1A5aB296ea72",
|
|
84
|
-
[Chain.POLYGON_MAINNET]: "0xFd245e732b40b6BF2038e42b476bD06580585326",
|
|
85
|
-
[Chain.BASE]: "0xB7ea94340e65CC68d1274aE483dfBE593fD6f21e",
|
|
86
|
-
[Chain.SONIC_MAINNET]: "0x8E24CfC19c6C00c524353CB8816f5f1c2F33c201",
|
|
87
|
-
[Chain.HEMI_NETWORK]: "0x79f4061BF049c5c6CAC6bfe2415c2460815F4ac7",
|
|
88
|
-
[Chain.TAIKO_ALETHIA]: "0x594cE4B82A81930cC637f1A59afdFb0D70054232",
|
|
89
|
-
[Chain.METIS_ANDROMEDA_MAINNET]: "0xCe434378adacC51d54312c872113D687Ac19B516",
|
|
90
|
-
[Chain.GNOSIS]: "0xcb6eb8df68153cebf60e1872273ef52075a5c297",
|
|
91
|
-
[Chain.AVALANCHE_C_CHAIN]: '0x8E24CfC19c6C00c524353CB8816f5f1c2F33c201',
|
|
92
|
-
[Chain.MODE]: '0x8E24CfC19c6C00c524353CB8816f5f1c2F33c201',
|
|
93
|
-
[Chain.SCROLL]: '0x8E24CfC19c6C00c524353CB8816f5f1c2F33c201',
|
|
94
|
-
[Chain.CORE_BLOCKCHAIN_MAINNET]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
95
|
-
[Chain.FANTOM_OPERA]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
96
|
-
[Chain.BNB_SMART_CHAIN_MAINNET]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
97
|
-
[Chain.MANTLE]: "0x5c019a146758287c614fe654caec1ba1caf05f4e",
|
|
98
|
-
[Chain.LINEA]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
99
|
-
[Chain.BLAST]: "0x816EBC5cb8A5651C902Cb06659907A93E574Db0B",
|
|
100
|
-
}
|
package/src/utils/index.ts
CHANGED
|
@@ -5,8 +5,6 @@ import {
|
|
|
5
5
|
AAVE_V32_LENDERS,
|
|
6
6
|
} from '@1delta/lender-registry'
|
|
7
7
|
import { uniq } from 'lodash'
|
|
8
|
-
import { COMPOSERS } from './constants'
|
|
9
|
-
import { zeroAddress } from 'viem'
|
|
10
8
|
import {
|
|
11
9
|
aavePools,
|
|
12
10
|
aaveReserves,
|
|
@@ -113,10 +111,6 @@ export const getAavesForChain = () => {
|
|
|
113
111
|
return lenders
|
|
114
112
|
}
|
|
115
113
|
|
|
116
|
-
export const getComposerAddress = (chainId: string): string => {
|
|
117
|
-
return COMPOSERS[chainId as keyof typeof COMPOSERS] ?? zeroAddress
|
|
118
|
-
}
|
|
119
|
-
|
|
120
114
|
export const getLenderAssets = (
|
|
121
115
|
chainId: string | number | undefined,
|
|
122
116
|
lendingProtocol = Lender.AAVE_V3,
|
package/src/yields/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ const ethZero = 'ETH0::ETH0'
|
|
|
32
32
|
const usdThree = 'Web 3 Dollar::USD3'
|
|
33
33
|
const jitoSol = 'Jito Staked SOL::JitoSOL'
|
|
34
34
|
const thBill = 'Theo Short Duration US Treasury Fund::THBILL'
|
|
35
|
+
const ssuperusd = 'SuperReturn sSuperUSD::SSUPERUSD'
|
|
35
36
|
const FeedData = {
|
|
36
37
|
WSTETH: 'https://eth-api.lido.fi/v1/protocol/steth/apr/sma',
|
|
37
38
|
STMATIC: 'https://polygon.lido.fi/api/stats',
|
|
@@ -67,6 +68,8 @@ const FeedData = {
|
|
|
67
68
|
JITOSOL: 'https://www.jito.network/api/getJitoPoolStats/',
|
|
68
69
|
THBILL: 'https://thbill-api.theo.xyz/snapshots',
|
|
69
70
|
YEARN_KATANA: 'https://katana-apr-service.vercel.app/api/vaults',
|
|
71
|
+
SSUPERUSD:
|
|
72
|
+
'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',
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
const LenderAPIs = {
|
|
@@ -182,6 +185,18 @@ export const fetchGeneralYields = async () => {
|
|
|
182
185
|
}
|
|
183
186
|
})
|
|
184
187
|
|
|
188
|
+
const ssuperusdPromise = safeFetch('SSUPERUSD', async () => {
|
|
189
|
+
try {
|
|
190
|
+
const res = await fetch(FeedData.SSUPERUSD, {
|
|
191
|
+
method: 'GET',
|
|
192
|
+
headers: { Accept: 'application/json', 'User-Agent': '1delta/yields' },
|
|
193
|
+
}).then((r) => r.json())
|
|
194
|
+
return apyToAprPercent(res?.[1]?.result.data.json ?? 0)
|
|
195
|
+
} catch (e) {
|
|
196
|
+
return 0
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
|
|
185
200
|
const rsethPromise = safeFetch('RSETH', async () => {
|
|
186
201
|
const res = await fetch(FeedData.RSETH).then((r) => r.json())
|
|
187
202
|
return apyToAprPercent(res.totalAPY)
|
|
@@ -491,6 +506,7 @@ export const fetchGeneralYields = async () => {
|
|
|
491
506
|
jitoSolData,
|
|
492
507
|
thBillData,
|
|
493
508
|
yearnKatanaData,
|
|
509
|
+
ssuperusdData,
|
|
494
510
|
] = await Promise.all([
|
|
495
511
|
wstethPromise,
|
|
496
512
|
ezethPromise,
|
|
@@ -525,6 +541,7 @@ export const fetchGeneralYields = async () => {
|
|
|
525
541
|
jitoSolPromise,
|
|
526
542
|
thbillPromise,
|
|
527
543
|
yearnKatanaPromise,
|
|
544
|
+
ssuperusdPromise,
|
|
528
545
|
])
|
|
529
546
|
|
|
530
547
|
const data: YieldDataWithTimestamp = {
|
|
@@ -560,6 +577,7 @@ export const fetchGeneralYields = async () => {
|
|
|
560
577
|
[pufEth]: pufEthData,
|
|
561
578
|
[jitoSol]: jitoSolData,
|
|
562
579
|
[thBill]: thBillData,
|
|
580
|
+
[ssuperusd]: ssuperusdData,
|
|
563
581
|
...rtokensData,
|
|
564
582
|
...hypeData,
|
|
565
583
|
...angleData,
|
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
import { describe, it } from 'vitest'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
attachPricesToFlashLiquidity,
|
|
4
|
+
fetchFlashLiquidityForChain,
|
|
5
|
+
fetchLenderMetaFromDirAndInitialize,
|
|
6
|
+
fetchMainPrices,
|
|
7
|
+
} from '../src'
|
|
8
|
+
import { getEvmClient, multicallRetry } from '@1delta/providers'
|
|
9
|
+
import { Chain } from '@1delta/chain-registry'
|
|
10
|
+
import { getDeltaTokenList } from './utils'
|
|
5
11
|
|
|
12
|
+
describe(
|
|
13
|
+
'find flash liquidity',
|
|
14
|
+
() => {
|
|
15
|
+
it('flash liquidity for chain', async () => {
|
|
16
|
+
await fetchLenderMetaFromDirAndInitialize()
|
|
6
17
|
|
|
18
|
+
const chain = Chain.ETHEREUM_MAINNET
|
|
19
|
+
const list = await getDeltaTokenList(chain)
|
|
20
|
+
const liquidity = await fetchFlashLiquidityForChain(chain, multicallRetry, list)
|
|
7
21
|
|
|
8
|
-
|
|
9
|
-
it('flash liquidity for chain', async () => {
|
|
22
|
+
console.log('liquidity', liquidity['0x8292bb45bf1ee4d140127049757c2e0ff06317ed'])
|
|
10
23
|
|
|
11
|
-
|
|
24
|
+
// const prices = await fetchMainPrices([chain])
|
|
12
25
|
|
|
13
|
-
|
|
26
|
+
// console.log("prices", prices)
|
|
14
27
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// const prices = await fetchMainPrices([chain])
|
|
18
|
-
|
|
19
|
-
// console.log("prices", prices)
|
|
20
|
-
|
|
21
|
-
// const dataWithPrices = attachPricesToFlashLiquidity(chain, liquidity, prices)
|
|
22
|
-
|
|
23
|
-
// console.log(dataWithPrices)
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
}, { timeout: 10000 })
|
|
28
|
+
// const dataWithPrices = attachPricesToFlashLiquidity(chain, liquidity, prices)
|
|
27
29
|
|
|
30
|
+
// console.log(dataWithPrices)
|
|
31
|
+
})
|
|
32
|
+
},
|
|
33
|
+
{ timeout: 10000 },
|
|
34
|
+
)
|
|
28
35
|
|
|
29
36
|
function prettyPrint(obj: any) {
|
|
30
37
|
for (const key in obj) {
|
|
@@ -37,4 +44,4 @@ function prettyPrint(obj: any) {
|
|
|
37
44
|
console.log(`${keyStr} ${value}`)
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
|
-
}
|
|
47
|
+
}
|
package/test/lenderData.test.ts
CHANGED
|
@@ -20,16 +20,19 @@ describe(
|
|
|
20
20
|
it.only('should return lender data', async () => {
|
|
21
21
|
await fetchLenderMetaFromDirAndInitialize()
|
|
22
22
|
|
|
23
|
-
const chainId = Chain.
|
|
24
|
-
|
|
25
|
-
const ps = [
|
|
23
|
+
const chainId = Chain.ETHEREUM_MAINNET
|
|
24
|
+
const list = await getDeltaTokenList(chainId)
|
|
25
|
+
const ps = [
|
|
26
|
+
fetchMainPrices([chainId], undefined, { [chainId]: { list } }),
|
|
27
|
+
fetchGeneralYields(),
|
|
28
|
+
]
|
|
26
29
|
|
|
27
30
|
const [prices, yields] = await Promise.all(ps)
|
|
28
31
|
|
|
29
32
|
// console.log("yields", yields)
|
|
30
33
|
// console.log("prices", prices)
|
|
31
34
|
|
|
32
|
-
const lenders = getLendersForChain(chainId) as any
|
|
35
|
+
const lenders = [Lender.AAVE_V3_HORIZON] // getLendersForChain(chainId) as any
|
|
33
36
|
console.log('lenders', lenders)
|
|
34
37
|
const lendingData = await getLenderPublicData(
|
|
35
38
|
chainId,
|
package/test/mainPrices.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it } from 'vitest'
|
|
2
2
|
import { fetchLenderMetaFromDirAndInitialize, fetchMainPrices } from '../src'
|
|
3
3
|
import { Chain } from '@1delta/chain-registry'
|
|
4
|
-
import { prettyPrint } from './utils'
|
|
4
|
+
import { getDeltaTokenList, prettyPrint } from './utils'
|
|
5
5
|
|
|
6
6
|
describe(
|
|
7
7
|
'find prices',
|
|
@@ -9,17 +9,10 @@ describe(
|
|
|
9
9
|
it('should return prices for valid tokens', async () => {
|
|
10
10
|
|
|
11
11
|
await fetchLenderMetaFromDirAndInitialize()
|
|
12
|
+
const list = await getDeltaTokenList(Chain.HYPEREVM)
|
|
12
13
|
const mainPrices = await fetchMainPrices([
|
|
13
|
-
Chain.MANTLE,
|
|
14
|
-
Chain.BNB_SMART_CHAIN_MAINNET,
|
|
15
|
-
Chain.OP_MAINNET,
|
|
16
|
-
Chain.POLYGON_MAINNET,
|
|
17
|
-
Chain.HEMI_NETWORK,
|
|
18
|
-
Chain.ARBITRUM_ONE,
|
|
19
14
|
Chain.HYPEREVM,
|
|
20
|
-
|
|
21
|
-
Chain.HEMI_NETWORK,
|
|
22
|
-
])
|
|
15
|
+
],undefined, {[Chain.HYPEREVM]: {list}})
|
|
23
16
|
// console.log(mainPrices['Hemi::HEMI'])
|
|
24
17
|
prettyPrint(mainPrices)
|
|
25
18
|
})
|