@1delta/margin-fetcher 0.0.8 → 0.0.10
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/aave/AaveOracle.d.ts +10 -0
- package/dist/abis/aave/AaveOracle.d.ts.map +1 -1
- package/dist/abis/aave/AaveOracle.js +13 -0
- package/dist/abis/morpho/blue.d.ts +76 -0
- package/dist/abis/morpho/blue.d.ts.map +1 -0
- package/dist/abis/morpho/blue.js +99 -0
- package/dist/abis/morpho/lens.d.ts +16 -0
- package/dist/abis/morpho/lens.d.ts.map +1 -0
- package/dist/abis/morpho/lens.js +31 -0
- package/dist/abis/oracle/AaveOracle.d.ts +10 -0
- package/dist/abis/oracle/AaveOracle.d.ts.map +1 -1
- package/dist/abis/oracle/AaveOracle.js +13 -0
- package/dist/assets/index.d.ts +4 -4
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +7 -7
- package/dist/assets/liquidityThresholds.d.ts +29 -0
- package/dist/assets/liquidityThresholds.d.ts.map +1 -0
- package/dist/assets/liquidityThresholds.js +51 -0
- package/dist/flash-liquidity/index.d.ts +1 -0
- package/dist/flash-liquidity/index.d.ts.map +1 -1
- package/dist/flash-liquidity/index.js +1 -0
- package/dist/flash-liquidity/utils.d.ts +11 -0
- package/dist/flash-liquidity/utils.d.ts.map +1 -0
- package/dist/flash-liquidity/utils.js +17 -0
- package/dist/lending/aave-v2-type/publicCallParse.d.ts +2 -1
- package/dist/lending/aave-v2-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/aave-v2-type/publicCallParse.js +10 -7
- package/dist/lending/aave-v3-type/publicCallParse.d.ts +3 -2
- package/dist/lending/aave-v3-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/aave-v3-type/publicCallParse.js +11 -8
- package/dist/lending/aave-v3-type/types.d.ts +2 -0
- package/dist/lending/aave-v3-type/types.d.ts.map +1 -1
- package/dist/lending/addresses/compoundV3.d.ts +1 -1
- package/dist/lending/addresses/compoundV3.d.ts.map +1 -1
- package/dist/lending/addresses/compoundV3.js +8 -7
- package/dist/lending/compound-v3/publicCallParse.d.ts +2 -1
- package/dist/lending/compound-v3/publicCallParse.d.ts.map +1 -1
- package/dist/lending/compound-v3/publicCallParse.js +3 -2
- package/dist/lending/compound-v3/types.d.ts +2 -0
- package/dist/lending/compound-v3/types.d.ts.map +1 -1
- package/dist/lending/fetchLender.d.ts +2 -1
- package/dist/lending/fetchLender.d.ts.map +1 -1
- package/dist/lending/fetchLender.js +12 -8
- package/dist/lending/fetchLenderAll.d.ts +8 -0
- package/dist/lending/fetchLenderAll.d.ts.map +1 -0
- package/dist/lending/fetchLenderAll.js +12 -0
- package/dist/lending/fetchLenderExt.d.ts +8 -0
- package/dist/lending/fetchLenderExt.d.ts.map +1 -0
- package/dist/lending/fetchLenderExt.js +28 -0
- package/dist/lending/index.d.ts +1 -0
- package/dist/lending/index.d.ts.map +1 -1
- package/dist/lending/index.js +1 -0
- package/dist/lending/init/publicCallParse.d.ts +2 -1
- package/dist/lending/init/publicCallParse.d.ts.map +1 -1
- package/dist/lending/init/publicCallParse.js +3 -2
- package/dist/lending/init/types.d.ts +2 -0
- package/dist/lending/init/types.d.ts.map +1 -1
- package/dist/lending/morpho/convertPublic.d.ts +9 -0
- package/dist/lending/morpho/convertPublic.d.ts.map +1 -0
- package/dist/lending/morpho/convertPublic.js +115 -0
- package/dist/lending/morpho/fetchPublic.d.ts +3 -0
- package/dist/lending/morpho/fetchPublic.d.ts.map +1 -0
- package/dist/lending/morpho/fetchPublic.js +72 -0
- package/dist/lending/morpho/publicCallBuild.d.ts +8 -0
- package/dist/lending/morpho/publicCallBuild.d.ts.map +1 -0
- package/dist/lending/morpho/publicCallBuild.js +6 -0
- package/dist/lending/morpho/types.d.ts +106 -0
- package/dist/lending/morpho/types.d.ts.map +1 -0
- package/dist/lending/morpho/types.js +1 -0
- package/dist/lending/types/index.d.ts +18 -0
- package/dist/lending/types/index.d.ts.map +1 -0
- package/dist/lending/types/index.js +1 -0
- package/dist/lending/user-data/aave-v2-type/userCallBuild.d.ts.map +1 -1
- package/dist/lending/user-data/aave-v2-type/userCallBuild.js +4 -23
- package/dist/lending/user-data/aave-v2-type/userCallParse.d.ts.map +1 -1
- package/dist/lending/user-data/aave-v2-type/userCallParse.js +24 -11
- package/dist/lending/user-data/aave-v3-type/userCallBuild.d.ts.map +1 -1
- package/dist/lending/user-data/aave-v3-type/userCallBuild.js +1 -16
- package/dist/lending/user-data/aave-v3-type/userCallParse.d.ts.map +1 -1
- package/dist/lending/user-data/aave-v3-type/userCallParse.js +13 -6
- package/dist/lending/user-data/aave-v3-type/userCallParseYldr.d.ts.map +1 -1
- package/dist/lending/user-data/aave-v3-type/userCallParseYldr.js +12 -6
- package/dist/lending/user-data/compound-v3/addresses.d.ts.map +1 -1
- package/dist/lending/user-data/compound-v3/addresses.js +8 -7
- package/dist/lending/user-data/compound-v3/userCallParse.d.ts.map +1 -1
- package/dist/lending/user-data/compound-v3/userCallParse.js +2 -0
- package/dist/lending/user-data/morpho/decoder.d.ts +21 -0
- package/dist/lending/user-data/morpho/decoder.d.ts.map +1 -0
- package/dist/lending/user-data/morpho/decoder.js +52 -0
- package/dist/lending/user-data/morpho/morphoLib.d.ts +5 -0
- package/dist/lending/user-data/morpho/morphoLib.d.ts.map +1 -0
- package/dist/lending/user-data/morpho/morphoLib.js +21 -0
- package/dist/lending/user-data/morpho/types.d.ts +12 -0
- package/dist/lending/user-data/morpho/types.d.ts.map +1 -0
- package/dist/lending/user-data/morpho/types.js +13 -0
- package/dist/lending/user-data/morpho/userCallBuild.d.ts +6 -0
- package/dist/lending/user-data/morpho/userCallBuild.d.ts.map +1 -0
- package/dist/lending/user-data/morpho/userCallBuild.js +36 -0
- package/dist/lending/user-data/morpho/userCallParse.d.ts +11 -0
- package/dist/lending/user-data/morpho/userCallParse.d.ts.map +1 -0
- package/dist/lending/user-data/morpho/userCallParse.js +99 -0
- package/dist/lending/user-data/morpho/userCallParseNoDeploy.d.ts +11 -0
- package/dist/lending/user-data/morpho/userCallParseNoDeploy.d.ts.map +1 -0
- package/dist/lending/user-data/morpho/userCallParseNoDeploy.js +112 -0
- package/dist/lending-pairs/computeLendingPairs.d.ts +13 -0
- package/dist/lending-pairs/computeLendingPairs.d.ts.map +1 -1
- package/dist/lending-pairs/computeLendingPairs.js +129 -23
- package/dist/prices/main-prices/fetchOracleData.d.ts +1 -2
- package/dist/prices/main-prices/fetchOracleData.d.ts.map +1 -1
- package/dist/prices/main-prices/fetchOracleData.js +95 -55
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +41 -16
- package/dist/utils/parsing.d.ts.map +1 -1
- package/dist/utils/parsing.js +4 -2
- package/package.json +2 -2
- package/src/abis/aave/AaveOracle.ts +13 -0
- package/src/abis/oracle/AaveOracle.ts +13 -0
- package/src/assets/index.ts +70 -51
- package/src/assets/liquidityThresholds.ts +83 -0
- package/src/flash-liquidity/index.ts +2 -1
- package/src/flash-liquidity/utils.ts +22 -0
- package/src/lending/aave-v2-type/publicCallParse.ts +12 -7
- package/src/lending/aave-v3-type/publicCallParse.ts +13 -8
- package/src/lending/aave-v3-type/types.ts +2 -0
- package/src/lending/addresses/compoundV3.ts +29 -15
- package/src/lending/compound-v3/publicCallParse.ts +5 -2
- package/src/lending/compound-v3/types.ts +2 -0
- package/src/lending/fetchLender.ts +23 -17
- package/src/lending/index.ts +2 -1
- package/src/lending/init/publicCallParse.ts +5 -2
- package/src/lending/init/types.ts +3 -0
- package/src/lending/types/index.ts +16 -0
- package/src/lending/user-data/aave-v2-type/userCallBuild.ts +1 -25
- package/src/lending/user-data/aave-v2-type/userCallParse.ts +24 -11
- package/src/lending/user-data/aave-v3-type/userCallBuild.ts +1 -16
- package/src/lending/user-data/aave-v3-type/userCallParse.ts +15 -6
- package/src/lending/user-data/aave-v3-type/userCallParseYldr.ts +14 -6
- package/src/lending/user-data/compound-v3/addresses.ts +58 -39
- package/src/lending/user-data/compound-v3/userCallParse.ts +2 -2
- package/src/lending-pairs/computeLendingPairs.ts +421 -189
- package/src/prices/main-prices/fetchOracleData.ts +197 -107
- package/src/utils/index.ts +90 -58
- package/src/utils/parsing.ts +51 -51
- package/test/index.test.ts +15 -7
- package/test/userdata.test.ts +5 -5
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export declare const AaveOracleAbi: readonly [{
|
|
2
|
+
readonly inputs: readonly [];
|
|
3
|
+
readonly name: "BASE_CURRENCY_UNIT";
|
|
4
|
+
readonly outputs: readonly [{
|
|
5
|
+
readonly internalType: "uint256";
|
|
6
|
+
readonly name: "";
|
|
7
|
+
readonly type: "uint256";
|
|
8
|
+
}];
|
|
9
|
+
readonly stateMutability: "view";
|
|
10
|
+
readonly type: "function";
|
|
11
|
+
}, {
|
|
2
12
|
readonly inputs: readonly [{
|
|
3
13
|
readonly internalType: "address";
|
|
4
14
|
readonly name: "asset";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AaveOracle.d.ts","sourceRoot":"","sources":["../../../src/abis/aave/AaveOracle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"AaveOracle.d.ts","sourceRoot":"","sources":["../../../src/abis/aave/AaveOracle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEhB,CAAA"}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
export const AaveOracleAbi = [
|
|
2
|
+
{
|
|
3
|
+
"inputs": [],
|
|
4
|
+
"name": "BASE_CURRENCY_UNIT",
|
|
5
|
+
"outputs": [
|
|
6
|
+
{
|
|
7
|
+
"internalType": "uint256",
|
|
8
|
+
"name": "",
|
|
9
|
+
"type": "uint256"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"stateMutability": "view",
|
|
13
|
+
"type": "function"
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"inputs": [
|
|
4
17
|
{
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const MorphoBlueAbi: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "Id";
|
|
4
|
+
readonly name: "";
|
|
5
|
+
readonly type: "bytes32";
|
|
6
|
+
}, {
|
|
7
|
+
readonly internalType: "address";
|
|
8
|
+
readonly name: "";
|
|
9
|
+
readonly type: "address";
|
|
10
|
+
}];
|
|
11
|
+
readonly name: "position";
|
|
12
|
+
readonly outputs: readonly [{
|
|
13
|
+
readonly internalType: "uint256";
|
|
14
|
+
readonly name: "supplyShares";
|
|
15
|
+
readonly type: "uint256";
|
|
16
|
+
}, {
|
|
17
|
+
readonly internalType: "uint128";
|
|
18
|
+
readonly name: "borrowShares";
|
|
19
|
+
readonly type: "uint128";
|
|
20
|
+
}, {
|
|
21
|
+
readonly internalType: "uint128";
|
|
22
|
+
readonly name: "collateral";
|
|
23
|
+
readonly type: "uint128";
|
|
24
|
+
}];
|
|
25
|
+
readonly stateMutability: "view";
|
|
26
|
+
readonly type: "function";
|
|
27
|
+
}, {
|
|
28
|
+
readonly inputs: readonly [{
|
|
29
|
+
readonly internalType: "bytes32[]";
|
|
30
|
+
readonly name: "slots";
|
|
31
|
+
readonly type: "bytes32[]";
|
|
32
|
+
}];
|
|
33
|
+
readonly name: "extSloads";
|
|
34
|
+
readonly outputs: readonly [{
|
|
35
|
+
readonly internalType: "bytes32[]";
|
|
36
|
+
readonly name: "res";
|
|
37
|
+
readonly type: "bytes32[]";
|
|
38
|
+
}];
|
|
39
|
+
readonly stateMutability: "view";
|
|
40
|
+
readonly type: "function";
|
|
41
|
+
}, {
|
|
42
|
+
readonly inputs: readonly [{
|
|
43
|
+
readonly internalType: "Id";
|
|
44
|
+
readonly name: "";
|
|
45
|
+
readonly type: "bytes32";
|
|
46
|
+
}];
|
|
47
|
+
readonly name: "market";
|
|
48
|
+
readonly outputs: readonly [{
|
|
49
|
+
readonly internalType: "uint128";
|
|
50
|
+
readonly name: "totalSupplyAssets";
|
|
51
|
+
readonly type: "uint128";
|
|
52
|
+
}, {
|
|
53
|
+
readonly internalType: "uint128";
|
|
54
|
+
readonly name: "totalSupplyShares";
|
|
55
|
+
readonly type: "uint128";
|
|
56
|
+
}, {
|
|
57
|
+
readonly internalType: "uint128";
|
|
58
|
+
readonly name: "totalBorrowAssets";
|
|
59
|
+
readonly type: "uint128";
|
|
60
|
+
}, {
|
|
61
|
+
readonly internalType: "uint128";
|
|
62
|
+
readonly name: "totalBorrowShares";
|
|
63
|
+
readonly type: "uint128";
|
|
64
|
+
}, {
|
|
65
|
+
readonly internalType: "uint128";
|
|
66
|
+
readonly name: "lastUpdate";
|
|
67
|
+
readonly type: "uint128";
|
|
68
|
+
}, {
|
|
69
|
+
readonly internalType: "uint128";
|
|
70
|
+
readonly name: "fee";
|
|
71
|
+
readonly type: "uint128";
|
|
72
|
+
}];
|
|
73
|
+
readonly stateMutability: "view";
|
|
74
|
+
readonly type: "function";
|
|
75
|
+
}];
|
|
76
|
+
//# sourceMappingURL=blue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blue.d.ts","sourceRoot":"","sources":["../../../src/abis/morpho/blue.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkGhB,CAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export const MorphoBlueAbi = [
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"internalType": "Id",
|
|
6
|
+
"name": "",
|
|
7
|
+
"type": "bytes32"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"internalType": "address",
|
|
11
|
+
"name": "",
|
|
12
|
+
"type": "address"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"name": "position",
|
|
16
|
+
"outputs": [
|
|
17
|
+
{
|
|
18
|
+
"internalType": "uint256",
|
|
19
|
+
"name": "supplyShares",
|
|
20
|
+
"type": "uint256"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"internalType": "uint128",
|
|
24
|
+
"name": "borrowShares",
|
|
25
|
+
"type": "uint128"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"internalType": "uint128",
|
|
29
|
+
"name": "collateral",
|
|
30
|
+
"type": "uint128"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"stateMutability": "view",
|
|
34
|
+
"type": "function"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"inputs": [
|
|
38
|
+
{
|
|
39
|
+
"internalType": "bytes32[]",
|
|
40
|
+
"name": "slots",
|
|
41
|
+
"type": "bytes32[]"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"name": "extSloads",
|
|
45
|
+
"outputs": [
|
|
46
|
+
{
|
|
47
|
+
"internalType": "bytes32[]",
|
|
48
|
+
"name": "res",
|
|
49
|
+
"type": "bytes32[]"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"stateMutability": "view",
|
|
53
|
+
"type": "function"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"inputs": [
|
|
57
|
+
{
|
|
58
|
+
"internalType": "Id",
|
|
59
|
+
"name": "",
|
|
60
|
+
"type": "bytes32"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"name": "market",
|
|
64
|
+
"outputs": [
|
|
65
|
+
{
|
|
66
|
+
"internalType": "uint128",
|
|
67
|
+
"name": "totalSupplyAssets",
|
|
68
|
+
"type": "uint128"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"internalType": "uint128",
|
|
72
|
+
"name": "totalSupplyShares",
|
|
73
|
+
"type": "uint128"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"internalType": "uint128",
|
|
77
|
+
"name": "totalBorrowAssets",
|
|
78
|
+
"type": "uint128"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"internalType": "uint128",
|
|
82
|
+
"name": "totalBorrowShares",
|
|
83
|
+
"type": "uint128"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"internalType": "uint128",
|
|
87
|
+
"name": "lastUpdate",
|
|
88
|
+
"type": "uint128"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"internalType": "uint128",
|
|
92
|
+
"name": "fee",
|
|
93
|
+
"type": "uint128"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"stateMutability": "view",
|
|
97
|
+
"type": "function"
|
|
98
|
+
},
|
|
99
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const MorphoLensAbi: {
|
|
2
|
+
inputs: {
|
|
3
|
+
internalType: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}[];
|
|
7
|
+
name: string;
|
|
8
|
+
outputs: {
|
|
9
|
+
internalType: string;
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}[];
|
|
13
|
+
stateMutability: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}[];
|
|
16
|
+
//# sourceMappingURL=lens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lens.d.ts","sourceRoot":"","sources":["../../../src/abis/morpho/lens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;GA8BzB,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const MorphoLensAbi = [
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"internalType": "bytes32[]",
|
|
6
|
+
"name": "marketsIds",
|
|
7
|
+
"type": "bytes32[]"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"internalType": "address",
|
|
11
|
+
"name": "user",
|
|
12
|
+
"type": "address"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"internalType": "address",
|
|
16
|
+
"name": "morpho",
|
|
17
|
+
"type": "address"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"name": "getUserDataCompact",
|
|
21
|
+
"outputs": [
|
|
22
|
+
{
|
|
23
|
+
"internalType": "bytes",
|
|
24
|
+
"name": "data",
|
|
25
|
+
"type": "bytes"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"stateMutability": "view",
|
|
29
|
+
"type": "function"
|
|
30
|
+
}
|
|
31
|
+
];
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export declare const AaveOracleAbi: readonly [{
|
|
2
|
+
readonly inputs: readonly [];
|
|
3
|
+
readonly name: "BASE_CURRENCY_UNIT";
|
|
4
|
+
readonly outputs: readonly [{
|
|
5
|
+
readonly internalType: "uint256";
|
|
6
|
+
readonly name: "";
|
|
7
|
+
readonly type: "uint256";
|
|
8
|
+
}];
|
|
9
|
+
readonly stateMutability: "view";
|
|
10
|
+
readonly type: "function";
|
|
11
|
+
}, {
|
|
2
12
|
readonly inputs: readonly [{
|
|
3
13
|
readonly internalType: "address";
|
|
4
14
|
readonly name: "asset";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AaveOracle.d.ts","sourceRoot":"","sources":["../../../src/abis/oracle/AaveOracle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"AaveOracle.d.ts","sourceRoot":"","sources":["../../../src/abis/oracle/AaveOracle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEhB,CAAA"}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
export const AaveOracleAbi = [
|
|
2
|
+
{
|
|
3
|
+
"inputs": [],
|
|
4
|
+
"name": "BASE_CURRENCY_UNIT",
|
|
5
|
+
"outputs": [
|
|
6
|
+
{
|
|
7
|
+
"internalType": "uint256",
|
|
8
|
+
"name": "",
|
|
9
|
+
"type": "uint256"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"stateMutability": "view",
|
|
13
|
+
"type": "function"
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"inputs": [
|
|
4
17
|
{
|
package/dist/assets/index.d.ts
CHANGED
|
@@ -11,10 +11,10 @@ export declare function getAaveTypePoolDataProviderAddress(chainId: string, lend
|
|
|
11
11
|
export declare function getAaveTypePoolAddress(chainId: string, lender: string): string;
|
|
12
12
|
export declare function getAssetMeta(chainId: string, asset: string | undefined): any;
|
|
13
13
|
/**
|
|
14
|
-
* Convert a string (asset symbol) to a Supported asset, considering also naming conflicts
|
|
15
|
-
* @param a string
|
|
16
|
-
* @returns SupportedAsset
|
|
17
|
-
*/
|
|
14
|
+
* Convert a string (asset symbol) to a Supported asset, considering also naming conflicts
|
|
15
|
+
* @param a string
|
|
16
|
+
* @returns SupportedAsset
|
|
17
|
+
*/
|
|
18
18
|
export declare const toOracleKey: (a: string) => string;
|
|
19
19
|
export declare const toGenericPriceKey: (assetAddress: string, chainId: string) => string;
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,MAAM,EAEP,MAAM,wBAAwB,CAAC;AAGhC,gCAAgC;AAChC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAC3B,GAAG,CACnD;AAED,eAAO,MAAM,aAAa,GACxB,SAAS,MAAM,GAAG,SAAS,EAC3B,kBAAiB,MAAuB,KACvC,MAAM,EAIR,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,SAAS,MAAM,GAAG,SAAS,EAC3B,wBAA6B,KAC5B,MAAM,EAIR,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,GAAG,SAAS,EAC3B,wBAA0C,KACzC,MAAM,EAMR,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,GAAG,SAAS,EAC3B,wBAA8B,KAC7B,MAAM,EAMR,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,GAAG,SAAS,EAC3B,wBAAsC,KACrC,MAAM,EAIR,CAAC;AAEF,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,OAIf;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,MAAM,CAGR;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GACF,GAAG,CACvE;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,WAEpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,cAAc,MAAM,EAAE,SAAS,MAAM,WAEtE,CAAC"}
|
package/dist/assets/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AAVE_FORK_POOL_DATA, AAVE_STYLE_RESERVE_ASSETS, AAVE_STYLE_TOKENS, ASSET_META, COMPOUND_STYLE_RESERVE_ASSETS, COMPOUND_V2_STYLE_RESERVE_ASSETS, INIT_STYLE_RESERVE_ASSETS, Lender, SWAYLEND_RESERVE_ASSETS } from "@1delta/asset-registry";
|
|
1
|
+
import { AAVE_FORK_POOL_DATA, AAVE_STYLE_RESERVE_ASSETS, AAVE_STYLE_TOKENS, ASSET_META, COMPOUND_STYLE_RESERVE_ASSETS, COMPOUND_V2_STYLE_RESERVE_ASSETS, INIT_STYLE_RESERVE_ASSETS, Lender, SWAYLEND_RESERVE_ASSETS, } from "@1delta/asset-registry";
|
|
2
2
|
import { isAaveType, isCompoundV3, isInit, isSwaylend } from "../utils";
|
|
3
3
|
/** No specific configuration */
|
|
4
4
|
export const LENDER_MODE_NO_MODE = 0;
|
|
@@ -17,12 +17,12 @@ export const getInitAssets = (chainId, lendingProtocol = Lender.INIT) => {
|
|
|
17
17
|
};
|
|
18
18
|
export const getCompoundV3Assets = (chainId, lendingProtocol = Lender.COMPOUND_V3_USDCE) => {
|
|
19
19
|
if (isCompoundV3(lendingProtocol))
|
|
20
|
-
return COMPOUND_STYLE_RESERVE_ASSETS[lendingProtocol]?.[chainId ?? "0"] ?? [];
|
|
20
|
+
return (COMPOUND_STYLE_RESERVE_ASSETS[lendingProtocol]?.[chainId ?? "0"] ?? []);
|
|
21
21
|
return [];
|
|
22
22
|
};
|
|
23
23
|
export const getCompoundV2Assets = (chainId, lendingProtocol = Lender.VENUS) => {
|
|
24
24
|
if (isCompoundV3(lendingProtocol))
|
|
25
|
-
return COMPOUND_V2_STYLE_RESERVE_ASSETS[lendingProtocol]?.[chainId ?? "0"] ?? [];
|
|
25
|
+
return (COMPOUND_V2_STYLE_RESERVE_ASSETS[lendingProtocol]?.[chainId ?? "0"] ?? []);
|
|
26
26
|
return [];
|
|
27
27
|
};
|
|
28
28
|
export const getSwaylendAssets = (chainId, lendingProtocol = Lender.SWAYLEND_USDC) => {
|
|
@@ -42,10 +42,10 @@ export function getAssetMeta(chainId, asset) {
|
|
|
42
42
|
return ASSET_META[chainId ?? "0"]?.[asset?.toLowerCase() ?? ""];
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Convert a string (asset symbol) to a Supported asset, considering also naming conflicts
|
|
46
|
-
* @param a string
|
|
47
|
-
* @returns SupportedAsset
|
|
48
|
-
*/
|
|
45
|
+
* Convert a string (asset symbol) to a Supported asset, considering also naming conflicts
|
|
46
|
+
* @param a string
|
|
47
|
+
* @returns SupportedAsset
|
|
48
|
+
*/
|
|
49
49
|
export const toOracleKey = (a) => {
|
|
50
50
|
return a;
|
|
51
51
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface LiquidityThresholds {
|
|
2
|
+
/** Minimum total deposits in USD */
|
|
3
|
+
minDepositsUSD: number;
|
|
4
|
+
/** Minimum total debt/borrows in USD */
|
|
5
|
+
minDebtUSD: number;
|
|
6
|
+
/** Minimum total liquidity in USD */
|
|
7
|
+
minLiquidityUSD: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const DEFAULT_LIQUIDITY_THRESHOLDS: LiquidityThresholds;
|
|
10
|
+
export declare const ASSET_GROUP_LIQUIDITY_THRESHOLDS: {
|
|
11
|
+
[assetGroup: string]: LiquidityThresholds;
|
|
12
|
+
};
|
|
13
|
+
export declare const CHAIN_THRESHOLD_MULTIPLIERS: {
|
|
14
|
+
[chainId: string]: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Asset based overrides (per chain)
|
|
18
|
+
* assetKey format: "chainId-assetAddress" (lowercase)
|
|
19
|
+
*/
|
|
20
|
+
export declare const ASSET_SPECIFIC_THRESHOLDS: {
|
|
21
|
+
[assetKey: string]: LiquidityThresholds;
|
|
22
|
+
};
|
|
23
|
+
export declare function getLiquidityThresholds(chainId: string, assetAddress: string, assetGroup?: string): LiquidityThresholds;
|
|
24
|
+
export declare function meetsLiquidityThresholds(pool: {
|
|
25
|
+
totalDepositsUSD: number;
|
|
26
|
+
totalDebtUSD: number;
|
|
27
|
+
totalLiquidityUSD: number;
|
|
28
|
+
}, thresholds: LiquidityThresholds): boolean;
|
|
29
|
+
//# sourceMappingURL=liquidityThresholds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidityThresholds.d.ts","sourceRoot":"","sources":["../../src/assets/liquidityThresholds.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,4BAA4B,EAAE,mBAI1C,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE;IAAE,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,CAAA;CAMzF,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAWpE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAAA;CAEhF,CAAC;AAKF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAC,MAAM,GACjB,mBAAmB,CAkBrB;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,EACnF,UAAU,EAAE,mBAAmB,GAC9B,OAAO,CAMT"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Chain } from "@1delta/asset-registry";
|
|
2
|
+
export const DEFAULT_LIQUIDITY_THRESHOLDS = {
|
|
3
|
+
minDepositsUSD: 50_000,
|
|
4
|
+
minDebtUSD: 10_000,
|
|
5
|
+
minLiquidityUSD: 25_000,
|
|
6
|
+
};
|
|
7
|
+
export const ASSET_GROUP_LIQUIDITY_THRESHOLDS = {
|
|
8
|
+
'USDC': {
|
|
9
|
+
minDepositsUSD: 25_000,
|
|
10
|
+
minDebtUSD: 5_000,
|
|
11
|
+
minLiquidityUSD: 15_000,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export const CHAIN_THRESHOLD_MULTIPLIERS = {
|
|
15
|
+
[Chain.POLYGON_MAINNET]: 1.0,
|
|
16
|
+
[Chain.ARBITRUM_ONE]: 1.0,
|
|
17
|
+
[Chain.OP_MAINNET]: 1.0,
|
|
18
|
+
[Chain.BASE]: 1.0,
|
|
19
|
+
[Chain.MANTLE]: 0.8,
|
|
20
|
+
[Chain.LINEA]: 0.8,
|
|
21
|
+
[Chain.ZKSYNC_MAINNET]: 0.8,
|
|
22
|
+
[Chain.SCROLL]: 0.8,
|
|
23
|
+
[Chain.TAIKO_ALETHIA]: 0.6,
|
|
24
|
+
[Chain.HEMI_NETWORK]: 0.6,
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Asset based overrides (per chain)
|
|
28
|
+
* assetKey format: "chainId-assetAddress" (lowercase)
|
|
29
|
+
*/
|
|
30
|
+
export const ASSET_SPECIFIC_THRESHOLDS = {};
|
|
31
|
+
export function getLiquidityThresholds(chainId, assetAddress, assetGroup) {
|
|
32
|
+
// Check for asset overrides
|
|
33
|
+
const assetKey = `${chainId}-${assetAddress.toLowerCase()}`;
|
|
34
|
+
if (ASSET_SPECIFIC_THRESHOLDS[assetKey]) {
|
|
35
|
+
return ASSET_SPECIFIC_THRESHOLDS[assetKey];
|
|
36
|
+
}
|
|
37
|
+
let baseThresholds = assetGroup && ASSET_GROUP_LIQUIDITY_THRESHOLDS[assetGroup]
|
|
38
|
+
? ASSET_GROUP_LIQUIDITY_THRESHOLDS[assetGroup]
|
|
39
|
+
: DEFAULT_LIQUIDITY_THRESHOLDS;
|
|
40
|
+
const chainMultiplier = CHAIN_THRESHOLD_MULTIPLIERS[chainId] ?? 1.0;
|
|
41
|
+
return {
|
|
42
|
+
minDepositsUSD: Math.floor(baseThresholds.minDepositsUSD * chainMultiplier),
|
|
43
|
+
minDebtUSD: Math.floor(baseThresholds.minDebtUSD * chainMultiplier),
|
|
44
|
+
minLiquidityUSD: Math.floor(baseThresholds.minLiquidityUSD * chainMultiplier),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function meetsLiquidityThresholds(pool, thresholds) {
|
|
48
|
+
return (pool.totalDepositsUSD >= thresholds.minDepositsUSD &&
|
|
49
|
+
pool.totalDebtUSD >= thresholds.minDebtUSD &&
|
|
50
|
+
pool.totalLiquidityUSD >= thresholds.minLiquidityUSD);
|
|
51
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flash-liquidity/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flash-liquidity/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FlashLiquiditiesOnChain } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Add prices to get dollar flash liquidties
|
|
4
|
+
* Ideal for de-based flash loans
|
|
5
|
+
*/
|
|
6
|
+
export declare function attachPricesToFlashLiquidity(chainId: string, liq: FlashLiquiditiesOnChain, prices: {
|
|
7
|
+
[k: string]: number;
|
|
8
|
+
}): {
|
|
9
|
+
[asset: string]: import("./types").FlashLoanLiquidityForAsset[];
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/flash-liquidity/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,uBAAuB,EAAE,MAAM,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE;;EAc1H"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getAssetMeta, toGenericPriceKey } from "../assets";
|
|
2
|
+
/**
|
|
3
|
+
* Add prices to get dollar flash liquidties
|
|
4
|
+
* Ideal for de-based flash loans
|
|
5
|
+
*/
|
|
6
|
+
export function attachPricesToFlashLiquidity(chainId, liq, prices) {
|
|
7
|
+
let liqCopy = { ...liq };
|
|
8
|
+
Object.entries(liq).forEach(([asset, entry]) => {
|
|
9
|
+
const priceKey = getAssetMeta(chainId, asset)?.assetGroup ?? toGenericPriceKey(asset, chainId);
|
|
10
|
+
const price = prices[priceKey] ?? 0;
|
|
11
|
+
liqCopy[asset] = entry.map(e => ({
|
|
12
|
+
...e,
|
|
13
|
+
availableUSD: e.available * price
|
|
14
|
+
}));
|
|
15
|
+
});
|
|
16
|
+
return liqCopy;
|
|
17
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Lender } from "@1delta/asset-registry";
|
|
2
2
|
import { AaveV2GeneralPublicResponse } from "./types";
|
|
3
3
|
import { AdditionalYields } from "../../types";
|
|
4
|
+
import { GenericTokenList } from "../types";
|
|
4
5
|
export declare const getAaveV2ReservesDataConverter: (lender: Lender, chainId: string, prices: {
|
|
5
6
|
[asset: string]: number;
|
|
6
|
-
}, additionalYields: AdditionalYields) => [(data: any[]) => AaveV2GeneralPublicResponse | undefined, number];
|
|
7
|
+
}, additionalYields: AdditionalYields, tokenList?: GenericTokenList) => [(data: any[]) => AaveV2GeneralPublicResponse | undefined, number];
|
|
7
8
|
//# sourceMappingURL=publicCallParse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v2-type/publicCallParse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EACL,2BAA2B,EAI5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v2-type/publicCallParse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EACL,2BAA2B,EAI5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,QAAQ;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACnC,kBAAkB,gBAAgB,EAClC,YAAW,gBAAqB,KAC/B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,2BAA2B,GAAG,SAAS,EAAE,MAAM,CA6RnE,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { Lender } from "@1delta/asset-registry";
|
|
|
2
2
|
import { getAaveAssets, getAssetMeta, LENDER_MODE_NO_MODE, toGenericPriceKey, toOracleKey } from "../../assets";
|
|
3
3
|
import { BPS, convertRateToApr, formatAaveRawApyToApr, parseRawAmount } from "../../utils/parsing";
|
|
4
4
|
import { AaveV2TypeGetReserveConfigurationData, AaveV2TypeGetReserveDataIndexes, AaveV2TypeIncentivesControllerPoolInfoIndexes } from "./types";
|
|
5
|
-
export const getAaveV2ReservesDataConverter = (lender, chainId, prices, additionalYields) => {
|
|
5
|
+
export const getAaveV2ReservesDataConverter = (lender, chainId, prices, additionalYields, tokenList = {}) => {
|
|
6
6
|
switch (lender) {
|
|
7
7
|
case Lender.AURELIUS: {
|
|
8
8
|
const assetsToQuery = getAaveAssets(chainId, lender);
|
|
@@ -21,19 +21,20 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
21
21
|
const [, emission1PerSecondCollateral, ,] = data[i * 6 + 3];
|
|
22
22
|
const [, emission0PerSecondDebt, ,] = data[i * 6 + 4];
|
|
23
23
|
const [, emission1PerSecondDebt, ,] = data[i * 6 + 5];
|
|
24
|
-
const assetMeta = getAssetMeta(chainId, asset);
|
|
24
|
+
const assetMeta = tokenList[asset] ?? { ...getAssetMeta(chainId, asset), address: asset };
|
|
25
25
|
const decimals = assetMeta?.decimals ?? 18;
|
|
26
26
|
const totalStableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalStableDebt]?.toString(), decimals);
|
|
27
27
|
const totalVariableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalVariableDebt]?.toString(), decimals);
|
|
28
28
|
const liquidity = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.availableLiquidity]?.toString(), decimals);
|
|
29
29
|
const totalAToken = Number(liquidity) + Number(totalStableDebt) + Number(totalVariableDebt);
|
|
30
|
-
const oracleKey = toOracleKey(assetMeta?.
|
|
30
|
+
const oracleKey = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId);
|
|
31
31
|
const price = prices[oracleKey] ?? 1;
|
|
32
32
|
const totalDepositsUSD = totalAToken * price;
|
|
33
33
|
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
34
34
|
resultReserves[asset] = {
|
|
35
35
|
poolId: asset,
|
|
36
36
|
underlying: asset,
|
|
37
|
+
asset: assetMeta,
|
|
37
38
|
// token amounts
|
|
38
39
|
totalDeposits: totalAToken,
|
|
39
40
|
totalDebtStable: totalStableDebt,
|
|
@@ -110,19 +111,20 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
110
111
|
const borrowRewardIndex = i * 4 + 3;
|
|
111
112
|
const collateralRewards = Number(data?.[collateralRewardIndex]?.[AaveV2TypeIncentivesControllerPoolInfoIndexes.allocPoint].toString()) / totalAllocPoint * rewardsPerSecond;
|
|
112
113
|
const borrowRewards = Number(data?.[borrowRewardIndex]?.[AaveV2TypeIncentivesControllerPoolInfoIndexes.allocPoint].toString()) / totalAllocPoint * rewardsPerSecond;
|
|
113
|
-
const assetMeta = getAssetMeta(chainId, asset);
|
|
114
|
+
const assetMeta = tokenList[asset] ?? { ...getAssetMeta(chainId, asset), address: asset };
|
|
114
115
|
const decimals = assetMeta?.decimals ?? 18;
|
|
115
116
|
const totalStableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalStableDebt]?.toString(), decimals);
|
|
116
117
|
const totalVariableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalVariableDebt]?.toString(), decimals);
|
|
117
118
|
const liquidity = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.availableLiquidity]?.toString(), decimals);
|
|
118
119
|
const totalAToken = Number(liquidity) + Number(totalStableDebt) + Number(totalVariableDebt);
|
|
119
|
-
const oracleKey = toOracleKey(assetMeta?.
|
|
120
|
+
const oracleKey = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId);
|
|
120
121
|
const price = prices?.[oracleKey] ?? 1;
|
|
121
122
|
const totalDepositsUSD = totalAToken * price;
|
|
122
123
|
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
123
124
|
resultReserves[asset] = {
|
|
124
125
|
poolId: asset,
|
|
125
126
|
underlying: asset,
|
|
127
|
+
asset: assetMeta,
|
|
126
128
|
// token amounts
|
|
127
129
|
totalDeposits: totalAToken,
|
|
128
130
|
totalDebtStable: totalStableDebt,
|
|
@@ -187,19 +189,20 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
187
189
|
const asset = assetsToQuery[i];
|
|
188
190
|
const reserveData = data[i * 2];
|
|
189
191
|
const configData = data[i * 2 + 1];
|
|
190
|
-
const assetMeta = getAssetMeta(chainId, asset);
|
|
192
|
+
const assetMeta = tokenList[asset] ?? { ...getAssetMeta(chainId, asset), address: asset };
|
|
191
193
|
const decimals = assetMeta?.decimals ?? 18;
|
|
192
194
|
const totalStableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalStableDebt]?.toString(), decimals);
|
|
193
195
|
const totalVariableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalVariableDebt]?.toString(), decimals);
|
|
194
196
|
const liquidity = Number(parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.availableLiquidity]?.toString(), decimals));
|
|
195
197
|
const totalAToken = liquidity + Number(totalStableDebt) + Number(totalVariableDebt);
|
|
196
|
-
const oracleKey = toOracleKey(assetMeta?.
|
|
198
|
+
const oracleKey = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId);
|
|
197
199
|
const price = prices[oracleKey] ?? 1;
|
|
198
200
|
const totalDepositsUSD = Number(totalAToken) * price;
|
|
199
201
|
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
200
202
|
resultReserves[asset] = {
|
|
201
203
|
poolId: asset,
|
|
202
204
|
underlying: asset,
|
|
205
|
+
asset: assetMeta,
|
|
203
206
|
// token amounts
|
|
204
207
|
totalDeposits: totalAToken,
|
|
205
208
|
totalDebtStable: totalStableDebt,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AaveV3GeneralPublicResponse } from "./types";
|
|
2
2
|
import { AdditionalYields } from "../../types";
|
|
3
3
|
import { Lender } from "@1delta/asset-registry";
|
|
4
|
+
import { GenericTokenList } from "../types";
|
|
4
5
|
export declare const getAaveV3ReservesDataConverter: (lender: Lender, chainId: string, prices: {
|
|
5
6
|
[asset: string]: number;
|
|
6
|
-
}, additionalYields: AdditionalYields) => [(data: any[]) => AaveV3GeneralPublicResponse | undefined, number];
|
|
7
|
-
export declare function parseYLDRCall(chainId: string, lender: Lender, additionalYields: any, prices: any): [(data: any[]) => any | undefined, number];
|
|
7
|
+
}, additionalYields: AdditionalYields, tokenList?: GenericTokenList) => [(data: any[]) => AaveV3GeneralPublicResponse | undefined, number];
|
|
8
|
+
export declare function parseYLDRCall(chainId: string, lender: Lender, additionalYields: any, prices: any, tokenList: any): [(data: any[]) => any | undefined, number];
|
|
8
9
|
//# sourceMappingURL=publicCallParse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v3-type/publicCallParse.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAK5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v3-type/publicCallParse.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAK5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,QAAQ;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACnC,kBAAkB,gBAAgB,EAClC,YAAW,gBAAqB,KAC/B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,2BAA2B,GAAG,SAAS,EAAE,MAAM,CAwHnE,CAAA;AA0BD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,SAAS,EAAE,MAAM,CAAC,CAgF7J"}
|