@gearbox-protocol/sdk 7.3.0 → 7.4.0-next.1
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/cjs/dev/AccountsCounterPlugin.js +6 -0
- package/dist/cjs/sdk/sdk-legacy/core/creditAccount.js +4 -5
- package/dist/cjs/sdk/sdk-legacy/core/creditManager.js +4 -0
- package/dist/cjs/sdk/sdk-legacy/core/pool.js +4 -11
- package/dist/cjs/sdk/sdk-legacy/gearboxRewards/extraAPY.js +5 -4
- package/dist/esm/dev/AccountsCounterPlugin.js +6 -0
- package/dist/esm/sdk/sdk-legacy/core/creditAccount.js +4 -5
- package/dist/esm/sdk/sdk-legacy/core/creditManager.js +4 -0
- package/dist/esm/sdk/sdk-legacy/core/pool.js +4 -11
- package/dist/esm/sdk/sdk-legacy/gearboxRewards/extraAPY.js +5 -4
- package/dist/types/dev/AccountsCounterPlugin.d.ts +3 -1
- package/dist/types/sdk/sdk-legacy/core/creditAccount.d.ts +3 -2
- package/dist/types/sdk/sdk-legacy/core/creditManager.d.ts +3 -0
- package/dist/types/sdk/sdk-legacy/core/pool.d.ts +3 -4
- package/dist/types/sdk/sdk-legacy/payload/creditAccount.d.ts +3 -0
- package/dist/types/sdk/sdk-legacy/payload/creditManager.d.ts +3 -0
- package/dist/types/sdk/sdk-legacy/payload/pool.d.ts +3 -0
- package/package.json +1 -1
|
@@ -32,6 +32,12 @@ class AccountsCounterPlugin extends import_sdk.SDKConstruct {
|
|
|
32
32
|
async syncState() {
|
|
33
33
|
await this.#load();
|
|
34
34
|
}
|
|
35
|
+
get accounts() {
|
|
36
|
+
return this.#accounts;
|
|
37
|
+
}
|
|
38
|
+
forCreditManager(addr) {
|
|
39
|
+
return this.#accounts.mustGet(addr);
|
|
40
|
+
}
|
|
35
41
|
async #load() {
|
|
36
42
|
const [compressor] = this.sdk.addressProvider.mustGetLatest(
|
|
37
43
|
import_sdk.AP_CREDIT_ACCOUNT_COMPRESSOR,
|
|
@@ -28,6 +28,8 @@ var import_price = require("../utils/price.js");
|
|
|
28
28
|
const MAX_UINT16 = 65535;
|
|
29
29
|
class CreditAccountData_Legacy {
|
|
30
30
|
isSuccessful;
|
|
31
|
+
chainId;
|
|
32
|
+
network;
|
|
31
33
|
creditAccount;
|
|
32
34
|
borrower;
|
|
33
35
|
creditManager;
|
|
@@ -38,7 +40,6 @@ class CreditAccountData_Legacy {
|
|
|
38
40
|
version;
|
|
39
41
|
enabledTokensMask;
|
|
40
42
|
healthFactor;
|
|
41
|
-
isDeleting;
|
|
42
43
|
baseBorrowRateWithoutFee;
|
|
43
44
|
borrowedAmount;
|
|
44
45
|
accruedInterest;
|
|
@@ -56,6 +57,8 @@ class CreditAccountData_Legacy {
|
|
|
56
57
|
quotedTokens = {};
|
|
57
58
|
constructor(payload) {
|
|
58
59
|
this.isSuccessful = payload.isSuccessful;
|
|
60
|
+
this.chainId = payload.chainId;
|
|
61
|
+
this.network = payload.network;
|
|
59
62
|
this.creditAccount = payload.addr.toLowerCase();
|
|
60
63
|
this.borrower = payload.borrower.toLowerCase();
|
|
61
64
|
this.creditManager = payload.creditManager.toLowerCase();
|
|
@@ -68,7 +71,6 @@ class CreditAccountData_Legacy {
|
|
|
68
71
|
(payload.healthFactor || 0n) * import_constants.PERCENTAGE_FACTOR / import_constants.WAD
|
|
69
72
|
);
|
|
70
73
|
this.enabledTokensMask = payload.enabledTokensMask;
|
|
71
|
-
this.isDeleting = false;
|
|
72
74
|
this.borrowedAmount = payload.debt;
|
|
73
75
|
this.accruedInterest = payload.accruedInterest || 0n;
|
|
74
76
|
this.accruedFees = payload.accruedFees || 0n;
|
|
@@ -107,9 +109,6 @@ class CreditAccountData_Legacy {
|
|
|
107
109
|
this.tokens[token] = balance;
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
|
-
setDeleteInProgress(d) {
|
|
111
|
-
this.isDeleting = d;
|
|
112
|
-
}
|
|
113
112
|
static sortBalances(balances, prices, tokens) {
|
|
114
113
|
return Object.entries(balances).sort(
|
|
115
114
|
([addr1, amount1], [addr2, amount2]) => {
|
|
@@ -26,6 +26,8 @@ var import_constants = require("../../constants/index.js");
|
|
|
26
26
|
var import_utils = require("../../utils/index.js");
|
|
27
27
|
class CreditManagerData_Legacy {
|
|
28
28
|
address;
|
|
29
|
+
chainId;
|
|
30
|
+
network;
|
|
29
31
|
underlyingToken;
|
|
30
32
|
pool;
|
|
31
33
|
creditFacade;
|
|
@@ -67,6 +69,8 @@ class CreditManagerData_Legacy {
|
|
|
67
69
|
quotas;
|
|
68
70
|
constructor(payload) {
|
|
69
71
|
this.address = payload.addr.toLowerCase();
|
|
72
|
+
this.chainId = payload.chainId;
|
|
73
|
+
this.network = payload.network;
|
|
70
74
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
71
75
|
this.name = payload.name;
|
|
72
76
|
this.pool = payload.pool.toLowerCase();
|
|
@@ -30,7 +30,8 @@ var import_utils = require("../../utils/index.js");
|
|
|
30
30
|
var import_formatter = require("../utils/formatter.js");
|
|
31
31
|
class PoolData_Legacy {
|
|
32
32
|
address;
|
|
33
|
-
|
|
33
|
+
chainId;
|
|
34
|
+
network;
|
|
34
35
|
underlyingToken;
|
|
35
36
|
dieselToken;
|
|
36
37
|
stakedDieselToken;
|
|
@@ -62,7 +63,8 @@ class PoolData_Legacy {
|
|
|
62
63
|
lastBaseInterestUpdate;
|
|
63
64
|
constructor(payload, extra) {
|
|
64
65
|
this.address = payload.addr.toLowerCase();
|
|
65
|
-
this.
|
|
66
|
+
this.chainId = payload.chainId;
|
|
67
|
+
this.network = payload.network;
|
|
66
68
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
67
69
|
this.dieselToken = payload.dieselToken.toLowerCase();
|
|
68
70
|
this.stakedDieselToken = (extra.stakedDieselToken || []).map(
|
|
@@ -151,13 +153,6 @@ class PoolData_Legacy {
|
|
|
151
153
|
});
|
|
152
154
|
return model.read.calcBorrowRate([expectedLiquidity, availableLiquidity]);
|
|
153
155
|
}
|
|
154
|
-
static getPoolType(name) {
|
|
155
|
-
const [identity = ""] = name.split(" ") || [];
|
|
156
|
-
const lc = identity.toLowerCase();
|
|
157
|
-
if (lc === "farm") return "farm";
|
|
158
|
-
if (lc === "trade") return "trade";
|
|
159
|
-
return "universal";
|
|
160
|
-
}
|
|
161
156
|
static calculateUtilization(expected, available) {
|
|
162
157
|
if (expected === 0n) return 0;
|
|
163
158
|
const borrowed = expected - available;
|
|
@@ -169,7 +164,6 @@ class ChartsPoolData {
|
|
|
169
164
|
address;
|
|
170
165
|
underlyingToken;
|
|
171
166
|
dieselToken;
|
|
172
|
-
type;
|
|
173
167
|
version;
|
|
174
168
|
name;
|
|
175
169
|
addLiqCount;
|
|
@@ -222,7 +216,6 @@ class ChartsPoolData {
|
|
|
222
216
|
this.address = (payload.addr || "").toLowerCase();
|
|
223
217
|
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
224
218
|
this.dieselToken = (payload.dieselToken || "").toLowerCase();
|
|
225
|
-
this.type = PoolData_Legacy.getPoolType(payload.name || "");
|
|
226
219
|
this.version = payload.version || 1;
|
|
227
220
|
this.name = payload.name || "";
|
|
228
221
|
this.earned7D = payload.earned7D || 0;
|
|
@@ -86,7 +86,7 @@ class GearboxRewardsExtraApy {
|
|
|
86
86
|
pointsInfo2
|
|
87
87
|
);
|
|
88
88
|
if (points !== null) {
|
|
89
|
-
acc2.push({ balance: points, token:
|
|
89
|
+
acc2.push({ balance: points, token: tokenAddress });
|
|
90
90
|
}
|
|
91
91
|
return acc2;
|
|
92
92
|
},
|
|
@@ -98,14 +98,15 @@ class GearboxRewardsExtraApy {
|
|
|
98
98
|
return r;
|
|
99
99
|
}
|
|
100
100
|
static getPoolTokenPoints(tokenBalanceInPool, pool, tokensList, pointsInfo) {
|
|
101
|
-
if (!tokenBalanceInPool
|
|
101
|
+
if (!tokenBalanceInPool && pointsInfo.estimation === "relative")
|
|
102
|
+
return null;
|
|
102
103
|
if (pool.expectedLiquidity <= 0) return 0n;
|
|
103
|
-
const { decimals = 18 } = tokensList[
|
|
104
|
+
const { decimals = 18 } = tokensList[pointsInfo.token] || {};
|
|
104
105
|
const targetFactor = 10n ** BigInt(decimals);
|
|
105
106
|
const { decimals: underlyingDecimals = 18 } = tokensList[pool.underlyingToken] || {};
|
|
106
107
|
const underlyingFactor = 10n ** BigInt(underlyingDecimals);
|
|
107
108
|
const defaultPoints = pointsInfo.amount * targetFactor / import_constants.PERCENTAGE_FACTOR;
|
|
108
|
-
const points = pointsInfo.estimation === "absolute" ? defaultPoints : tokenBalanceInPool
|
|
109
|
+
const points = pointsInfo.estimation === "absolute" ? defaultPoints : (tokenBalanceInPool?.balance || 0n) * defaultPoints / (pool.expectedLiquidity * targetFactor / underlyingFactor);
|
|
109
110
|
return import_math.BigIntMath.min(points, defaultPoints);
|
|
110
111
|
}
|
|
111
112
|
static getPoolPointsTip(poolRewards, pool, token) {
|
|
@@ -17,6 +17,12 @@ class AccountsCounterPlugin extends SDKConstruct {
|
|
|
17
17
|
async syncState() {
|
|
18
18
|
await this.#load();
|
|
19
19
|
}
|
|
20
|
+
get accounts() {
|
|
21
|
+
return this.#accounts;
|
|
22
|
+
}
|
|
23
|
+
forCreditManager(addr) {
|
|
24
|
+
return this.#accounts.mustGet(addr);
|
|
25
|
+
}
|
|
20
26
|
async #load() {
|
|
21
27
|
const [compressor] = this.sdk.addressProvider.mustGetLatest(
|
|
22
28
|
AP_CREDIT_ACCOUNT_COMPRESSOR,
|
|
@@ -14,6 +14,8 @@ import { PriceUtils } from "../utils/price.js";
|
|
|
14
14
|
const MAX_UINT16 = 65535;
|
|
15
15
|
class CreditAccountData_Legacy {
|
|
16
16
|
isSuccessful;
|
|
17
|
+
chainId;
|
|
18
|
+
network;
|
|
17
19
|
creditAccount;
|
|
18
20
|
borrower;
|
|
19
21
|
creditManager;
|
|
@@ -24,7 +26,6 @@ class CreditAccountData_Legacy {
|
|
|
24
26
|
version;
|
|
25
27
|
enabledTokensMask;
|
|
26
28
|
healthFactor;
|
|
27
|
-
isDeleting;
|
|
28
29
|
baseBorrowRateWithoutFee;
|
|
29
30
|
borrowedAmount;
|
|
30
31
|
accruedInterest;
|
|
@@ -42,6 +43,8 @@ class CreditAccountData_Legacy {
|
|
|
42
43
|
quotedTokens = {};
|
|
43
44
|
constructor(payload) {
|
|
44
45
|
this.isSuccessful = payload.isSuccessful;
|
|
46
|
+
this.chainId = payload.chainId;
|
|
47
|
+
this.network = payload.network;
|
|
45
48
|
this.creditAccount = payload.addr.toLowerCase();
|
|
46
49
|
this.borrower = payload.borrower.toLowerCase();
|
|
47
50
|
this.creditManager = payload.creditManager.toLowerCase();
|
|
@@ -54,7 +57,6 @@ class CreditAccountData_Legacy {
|
|
|
54
57
|
(payload.healthFactor || 0n) * PERCENTAGE_FACTOR / WAD
|
|
55
58
|
);
|
|
56
59
|
this.enabledTokensMask = payload.enabledTokensMask;
|
|
57
|
-
this.isDeleting = false;
|
|
58
60
|
this.borrowedAmount = payload.debt;
|
|
59
61
|
this.accruedInterest = payload.accruedInterest || 0n;
|
|
60
62
|
this.accruedFees = payload.accruedFees || 0n;
|
|
@@ -93,9 +95,6 @@ class CreditAccountData_Legacy {
|
|
|
93
95
|
this.tokens[token] = balance;
|
|
94
96
|
});
|
|
95
97
|
}
|
|
96
|
-
setDeleteInProgress(d) {
|
|
97
|
-
this.isDeleting = d;
|
|
98
|
-
}
|
|
99
98
|
static sortBalances(balances, prices, tokens) {
|
|
100
99
|
return Object.entries(balances).sort(
|
|
101
100
|
([addr1, amount1], [addr2, amount2]) => {
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
import { toBigInt } from "../../utils/index.js";
|
|
7
7
|
class CreditManagerData_Legacy {
|
|
8
8
|
address;
|
|
9
|
+
chainId;
|
|
10
|
+
network;
|
|
9
11
|
underlyingToken;
|
|
10
12
|
pool;
|
|
11
13
|
creditFacade;
|
|
@@ -47,6 +49,8 @@ class CreditManagerData_Legacy {
|
|
|
47
49
|
quotas;
|
|
48
50
|
constructor(payload) {
|
|
49
51
|
this.address = payload.addr.toLowerCase();
|
|
52
|
+
this.chainId = payload.chainId;
|
|
53
|
+
this.network = payload.network;
|
|
50
54
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
51
55
|
this.name = payload.name;
|
|
52
56
|
this.pool = payload.pool.toLowerCase();
|
|
@@ -8,7 +8,8 @@ import { toBigInt } from "../../utils/index.js";
|
|
|
8
8
|
import { rayToNumber } from "../utils/formatter.js";
|
|
9
9
|
class PoolData_Legacy {
|
|
10
10
|
address;
|
|
11
|
-
|
|
11
|
+
chainId;
|
|
12
|
+
network;
|
|
12
13
|
underlyingToken;
|
|
13
14
|
dieselToken;
|
|
14
15
|
stakedDieselToken;
|
|
@@ -40,7 +41,8 @@ class PoolData_Legacy {
|
|
|
40
41
|
lastBaseInterestUpdate;
|
|
41
42
|
constructor(payload, extra) {
|
|
42
43
|
this.address = payload.addr.toLowerCase();
|
|
43
|
-
this.
|
|
44
|
+
this.chainId = payload.chainId;
|
|
45
|
+
this.network = payload.network;
|
|
44
46
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
45
47
|
this.dieselToken = payload.dieselToken.toLowerCase();
|
|
46
48
|
this.stakedDieselToken = (extra.stakedDieselToken || []).map(
|
|
@@ -129,13 +131,6 @@ class PoolData_Legacy {
|
|
|
129
131
|
});
|
|
130
132
|
return model.read.calcBorrowRate([expectedLiquidity, availableLiquidity]);
|
|
131
133
|
}
|
|
132
|
-
static getPoolType(name) {
|
|
133
|
-
const [identity = ""] = name.split(" ") || [];
|
|
134
|
-
const lc = identity.toLowerCase();
|
|
135
|
-
if (lc === "farm") return "farm";
|
|
136
|
-
if (lc === "trade") return "trade";
|
|
137
|
-
return "universal";
|
|
138
|
-
}
|
|
139
134
|
static calculateUtilization(expected, available) {
|
|
140
135
|
if (expected === 0n) return 0;
|
|
141
136
|
const borrowed = expected - available;
|
|
@@ -147,7 +142,6 @@ class ChartsPoolData {
|
|
|
147
142
|
address;
|
|
148
143
|
underlyingToken;
|
|
149
144
|
dieselToken;
|
|
150
|
-
type;
|
|
151
145
|
version;
|
|
152
146
|
name;
|
|
153
147
|
addLiqCount;
|
|
@@ -200,7 +194,6 @@ class ChartsPoolData {
|
|
|
200
194
|
this.address = (payload.addr || "").toLowerCase();
|
|
201
195
|
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
202
196
|
this.dieselToken = (payload.dieselToken || "").toLowerCase();
|
|
203
|
-
this.type = PoolData_Legacy.getPoolType(payload.name || "");
|
|
204
197
|
this.version = payload.version || 1;
|
|
205
198
|
this.name = payload.name || "";
|
|
206
199
|
this.earned7D = payload.earned7D || 0;
|
|
@@ -53,7 +53,7 @@ class GearboxRewardsExtraApy {
|
|
|
53
53
|
pointsInfo2
|
|
54
54
|
);
|
|
55
55
|
if (points !== null) {
|
|
56
|
-
acc2.push({ balance: points, token:
|
|
56
|
+
acc2.push({ balance: points, token: tokenAddress });
|
|
57
57
|
}
|
|
58
58
|
return acc2;
|
|
59
59
|
},
|
|
@@ -65,14 +65,15 @@ class GearboxRewardsExtraApy {
|
|
|
65
65
|
return r;
|
|
66
66
|
}
|
|
67
67
|
static getPoolTokenPoints(tokenBalanceInPool, pool, tokensList, pointsInfo) {
|
|
68
|
-
if (!tokenBalanceInPool
|
|
68
|
+
if (!tokenBalanceInPool && pointsInfo.estimation === "relative")
|
|
69
|
+
return null;
|
|
69
70
|
if (pool.expectedLiquidity <= 0) return 0n;
|
|
70
|
-
const { decimals = 18 } = tokensList[
|
|
71
|
+
const { decimals = 18 } = tokensList[pointsInfo.token] || {};
|
|
71
72
|
const targetFactor = 10n ** BigInt(decimals);
|
|
72
73
|
const { decimals: underlyingDecimals = 18 } = tokensList[pool.underlyingToken] || {};
|
|
73
74
|
const underlyingFactor = 10n ** BigInt(underlyingDecimals);
|
|
74
75
|
const defaultPoints = pointsInfo.amount * targetFactor / PERCENTAGE_FACTOR;
|
|
75
|
-
const points = pointsInfo.estimation === "absolute" ? defaultPoints : tokenBalanceInPool
|
|
76
|
+
const points = pointsInfo.estimation === "absolute" ? defaultPoints : (tokenBalanceInPool?.balance || 0n) * defaultPoints / (pool.expectedLiquidity * targetFactor / underlyingFactor);
|
|
76
77
|
return BigIntMath.min(points, defaultPoints);
|
|
77
78
|
}
|
|
78
79
|
static getPoolPointsTip(poolRewards, pool, token) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { IGearboxSDKPlugin, IPluginState } from "../sdk/index.js";
|
|
3
|
-
import { SDKConstruct } from "../sdk/index.js";
|
|
3
|
+
import { AddressMap, SDKConstruct } from "../sdk/index.js";
|
|
4
4
|
export interface AccountsCounterPluginState extends IPluginState {
|
|
5
5
|
/**
|
|
6
6
|
* Mapping of credit manager addresses to the number of accounts
|
|
@@ -12,6 +12,8 @@ export declare class AccountsCounterPlugin extends SDKConstruct implements IGear
|
|
|
12
12
|
readonly version = 1;
|
|
13
13
|
attach(): Promise<void>;
|
|
14
14
|
syncState(): Promise<void>;
|
|
15
|
+
get accounts(): AddressMap<bigint>;
|
|
16
|
+
forCreditManager(addr: Address): bigint;
|
|
15
17
|
get state(): AccountsCounterPluginState;
|
|
16
18
|
hydrate(state: AccountsCounterPluginState): void;
|
|
17
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
+
import type { NetworkType } from "../../chain/chains.js";
|
|
2
3
|
import type { Asset } from "../../router/index.js";
|
|
3
4
|
import type { TokensAPYList } from "../apy/index.js";
|
|
4
5
|
import type { CaTokenBalance, CreditAccountDataPayload } from "../payload/creditAccount.js";
|
|
@@ -103,6 +104,8 @@ export interface BotDataLegacy {
|
|
|
103
104
|
}
|
|
104
105
|
export declare class CreditAccountData_Legacy {
|
|
105
106
|
readonly isSuccessful: boolean;
|
|
107
|
+
readonly chainId: number;
|
|
108
|
+
readonly network: NetworkType;
|
|
106
109
|
readonly creditAccount: Address;
|
|
107
110
|
readonly borrower: Address;
|
|
108
111
|
readonly creditManager: Address;
|
|
@@ -113,7 +116,6 @@ export declare class CreditAccountData_Legacy {
|
|
|
113
116
|
readonly version: number;
|
|
114
117
|
readonly enabledTokensMask: bigint;
|
|
115
118
|
readonly healthFactor: number;
|
|
116
|
-
isDeleting: boolean;
|
|
117
119
|
readonly baseBorrowRateWithoutFee: number;
|
|
118
120
|
readonly borrowedAmount: bigint;
|
|
119
121
|
readonly accruedInterest: bigint;
|
|
@@ -130,7 +132,6 @@ export declare class CreditAccountData_Legacy {
|
|
|
130
132
|
readonly forbiddenTokens: Record<Address, true>;
|
|
131
133
|
readonly quotedTokens: Record<Address, true>;
|
|
132
134
|
constructor(payload: CreditAccountDataPayload);
|
|
133
|
-
setDeleteInProgress(d: boolean): void;
|
|
134
135
|
static sortBalances(balances: Record<Address, bigint>, prices: Record<Address, bigint>, tokens: Record<Address, TokenData>): Array<[Address, bigint]>;
|
|
135
136
|
static sortAssets(balances: Array<Asset>, prices: Record<Address, bigint>, tokens: Record<Address, TokenData>): Asset[];
|
|
136
137
|
static tokensAbcComparator(t1?: TokenData, t2?: TokenData): 1 | 0 | -1;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
+
import type { NetworkType } from "../../chain/chains.js";
|
|
2
3
|
import type { ChartsCreditManagerPayload, CreditManagerDataPayload, QuotaInfo } from "../payload/creditManager.js";
|
|
3
4
|
export declare class CreditManagerData_Legacy {
|
|
4
5
|
readonly address: Address;
|
|
6
|
+
readonly chainId: number;
|
|
7
|
+
readonly network: NetworkType;
|
|
5
8
|
readonly underlyingToken: Address;
|
|
6
9
|
readonly pool: Address;
|
|
7
10
|
readonly creditFacade: Address;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Address, PublicClient } from "viem";
|
|
2
|
+
import type { NetworkType } from "../../chain/chains.js";
|
|
2
3
|
import type { ChartsPoolDataPayload, LinearModel, PoolDataExtraPayload, PoolDataPayload, UserPoolPayload } from "../payload/pool.js";
|
|
3
|
-
export type PoolType = "universal" | "trade" | "farm";
|
|
4
4
|
export declare class PoolData_Legacy {
|
|
5
5
|
readonly address: Address;
|
|
6
|
-
readonly
|
|
6
|
+
readonly chainId: number;
|
|
7
|
+
readonly network: NetworkType;
|
|
7
8
|
readonly underlyingToken: Address;
|
|
8
9
|
readonly dieselToken: Address;
|
|
9
10
|
readonly stakedDieselToken: Array<Address>;
|
|
@@ -45,7 +46,6 @@ export declare class PoolData_Legacy {
|
|
|
45
46
|
readonly lastBaseInterestUpdate: bigint;
|
|
46
47
|
constructor(payload: PoolDataPayload, extra: PoolDataExtraPayload);
|
|
47
48
|
calculateBorrowRate({ provider, expectedLiquidity, availableLiquidity, }: CalculateBorrowRateProps): Promise<bigint>;
|
|
48
|
-
static getPoolType(name: string): PoolType;
|
|
49
49
|
static calculateUtilization(expected: bigint, available: bigint): number;
|
|
50
50
|
}
|
|
51
51
|
interface CalculateBorrowRateProps {
|
|
@@ -57,7 +57,6 @@ export declare class ChartsPoolData {
|
|
|
57
57
|
readonly address: Address;
|
|
58
58
|
readonly underlyingToken: Address;
|
|
59
59
|
readonly dieselToken: Address;
|
|
60
|
-
readonly type: PoolType;
|
|
61
60
|
readonly version: number;
|
|
62
61
|
readonly name: string;
|
|
63
62
|
readonly addLiqCount: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
+
import type { NetworkType } from "../../chain/index.js";
|
|
2
3
|
export interface CaTokenBalance {
|
|
3
4
|
success: boolean;
|
|
4
5
|
token: Address;
|
|
@@ -41,4 +42,6 @@ export interface CreditAccountDataPayload {
|
|
|
41
42
|
}[];
|
|
42
43
|
cfVersion: bigint;
|
|
43
44
|
expirationDate: number;
|
|
45
|
+
chainId: number;
|
|
46
|
+
network: NetworkType;
|
|
44
47
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
+
import type { NetworkType } from "../../chain/chains.js";
|
|
2
3
|
import type { BigNumberish } from "../utils/formatter.js";
|
|
3
4
|
import type { PoolDataPayload } from "./pool.js";
|
|
4
5
|
export interface CreditManagerDebtParamsSDK {
|
|
@@ -54,6 +55,8 @@ export interface CreditManagerDataPayload {
|
|
|
54
55
|
liquidationDiscountExpired: number;
|
|
55
56
|
quotas: PoolDataPayload["quotas"];
|
|
56
57
|
isBorrowingForbidden: boolean;
|
|
58
|
+
chainId: number;
|
|
59
|
+
network: NetworkType;
|
|
57
60
|
}
|
|
58
61
|
export interface ChartsCreditManagerPayload {
|
|
59
62
|
addr: Address;
|
|
@@ -2,6 +2,7 @@ import type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype"
|
|
|
2
2
|
import type { Address } from "viem";
|
|
3
3
|
import type { iPeripheryCompressorAbi } from "../../../abi/compressors.js";
|
|
4
4
|
import type { Unarray } from "../../base/types.js";
|
|
5
|
+
import type { NetworkType } from "../../chain/chains.js";
|
|
5
6
|
export type ZapperData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iPeripheryCompressorAbi, "getZappers">["outputs"]>>;
|
|
6
7
|
export interface ZapperDataFull extends ZapperData {
|
|
7
8
|
pool: Address;
|
|
@@ -49,6 +50,8 @@ export interface PoolDataPayload {
|
|
|
49
50
|
isActive: boolean;
|
|
50
51
|
}[];
|
|
51
52
|
zappers: readonly ZapperDataFull[];
|
|
53
|
+
chainId: number;
|
|
54
|
+
network: NetworkType;
|
|
52
55
|
}
|
|
53
56
|
export interface PoolDataExtraPayload {
|
|
54
57
|
stakedDieselToken: Array<Address>;
|