@gearbox-protocol/sdk 1.20.11 → 1.20.13
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/lib/core/creditManager.d.ts +23 -3
- package/lib/core/creditManager.js +58 -67
- package/lib/core/creditSession.d.ts +7 -10
- package/lib/core/creditSession.js +15 -26
- package/lib/core/pool/data.d.ts +27 -5
- package/lib/core/pool/data.js +40 -11
- package/lib/payload/creditManager.d.ts +33 -24
- package/lib/payload/creditSession.d.ts +8 -1
- package/lib/payload/pool.d.ts +32 -4
- package/package.json +1 -1
|
@@ -42,18 +42,37 @@ export declare class CreditManagerData {
|
|
|
42
42
|
protected validateOpenAccountV2(debt: BigNumber): true;
|
|
43
43
|
get id(): string;
|
|
44
44
|
}
|
|
45
|
-
export declare class ChartsCreditManagerData
|
|
46
|
-
readonly
|
|
45
|
+
export declare class ChartsCreditManagerData {
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly address: string;
|
|
48
|
+
readonly underlyingToken: string;
|
|
49
|
+
readonly pool: string;
|
|
50
|
+
readonly isWETH: boolean;
|
|
51
|
+
readonly borrowRate: number;
|
|
52
|
+
readonly borrowRateOld: number;
|
|
53
|
+
readonly borrowRateChange: number;
|
|
54
|
+
readonly minAmount: BigNumber;
|
|
55
|
+
readonly maxAmount: BigNumber;
|
|
56
|
+
readonly maxLeverageFactor: number;
|
|
57
|
+
readonly availableLiquidity: BigNumber;
|
|
58
|
+
readonly version: number;
|
|
59
|
+
readonly feeInterest: number;
|
|
60
|
+
readonly feeLiquidation: number;
|
|
61
|
+
readonly feeLiquidationExpired: number;
|
|
47
62
|
readonly openedAccountsCount: number;
|
|
48
63
|
readonly totalOpenedAccounts: number;
|
|
49
64
|
readonly totalClosedAccounts: number;
|
|
50
65
|
readonly totalRepaidAccounts: number;
|
|
51
66
|
readonly totalLiquidatedAccounts: number;
|
|
52
67
|
readonly totalBorrowed: BigNumber;
|
|
53
|
-
readonly
|
|
68
|
+
readonly totalBorrowedOld: BigNumber;
|
|
69
|
+
readonly totalBorrowedChange: number;
|
|
54
70
|
readonly totalRepaid: BigNumber;
|
|
55
71
|
readonly totalProfit: BigNumber;
|
|
72
|
+
readonly totalProfitOld: BigNumber;
|
|
73
|
+
readonly pnlChange: number;
|
|
56
74
|
readonly totalLosses: BigNumber;
|
|
75
|
+
readonly totalLossesOld: BigNumber;
|
|
57
76
|
readonly totalBorrowedInUSD: number;
|
|
58
77
|
readonly totalLossesInUSD: number;
|
|
59
78
|
readonly totalProfitInUSD: number;
|
|
@@ -63,6 +82,7 @@ export declare class ChartsCreditManagerData extends CreditManagerData {
|
|
|
63
82
|
readonly totalOpenedAccountsChange: number;
|
|
64
83
|
readonly totalClosedAccountsChange: number;
|
|
65
84
|
readonly totalLiquidatedAccountsChange: number;
|
|
85
|
+
readonly liquidationThresholds: Record<string, BigNumber>;
|
|
66
86
|
constructor(payload: ChartsCreditManagerPayload);
|
|
67
87
|
}
|
|
68
88
|
export interface CalcHealthFactorProps {
|
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __assign = (this && this.__assign) || function () {
|
|
18
3
|
__assign = Object.assign || function(t) {
|
|
19
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -154,62 +139,68 @@ var CreditManagerData = /** @class */ (function () {
|
|
|
154
139
|
return CreditManagerData;
|
|
155
140
|
}());
|
|
156
141
|
exports.CreditManagerData = CreditManagerData;
|
|
157
|
-
var ChartsCreditManagerData = /** @class */ (function (
|
|
158
|
-
__extends(ChartsCreditManagerData, _super);
|
|
142
|
+
var ChartsCreditManagerData = /** @class */ (function () {
|
|
159
143
|
function ChartsCreditManagerData(payload) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
feeInterest
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
144
|
+
this.id = (payload.addr || "").toLowerCase();
|
|
145
|
+
this.address = (payload.addr || "").toLowerCase();
|
|
146
|
+
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
147
|
+
this.pool = (payload.poolAddress || "").toLowerCase();
|
|
148
|
+
this.version = payload.version || 2;
|
|
149
|
+
this.isWETH = payload.isWeth || false;
|
|
150
|
+
this.borrowRate = ethers_1.BigNumber.from(payload.borrowRate || 0)
|
|
151
|
+
.mul(payload.feeInterest + constants_1.PERCENTAGE_FACTOR)
|
|
152
|
+
.mul(constants_1.PERCENTAGE_DECIMALS)
|
|
153
|
+
.div(constants_1.RAY)
|
|
154
|
+
.toNumber();
|
|
155
|
+
this.borrowRateOld = ethers_1.BigNumber.from(payload.borrowRateOld || 0)
|
|
156
|
+
.mul(payload.feeInterest + constants_1.PERCENTAGE_FACTOR)
|
|
157
|
+
.mul(constants_1.PERCENTAGE_DECIMALS)
|
|
158
|
+
.div(constants_1.RAY)
|
|
159
|
+
.toNumber();
|
|
160
|
+
this.borrowRateChange =
|
|
161
|
+
(payload.borrowRate10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
162
|
+
this.maxLeverageFactor = ethers_1.BigNumber.from(payload.maxLeverageFactor || 0).toNumber();
|
|
163
|
+
this.feeInterest = payload.feeInterest;
|
|
164
|
+
this.feeLiquidation = payload.feeLiquidation;
|
|
165
|
+
this.feeLiquidationExpired = payload.feeLiquidationExpired;
|
|
166
|
+
this.minAmount = ethers_1.BigNumber.from(payload.minAmount || 0);
|
|
167
|
+
this.maxAmount = ethers_1.BigNumber.from(payload.maxAmount || 0);
|
|
168
|
+
this.availableLiquidity = ethers_1.BigNumber.from(payload.availableLiquidity || 0);
|
|
169
|
+
this.availableLiquidityInUSD = payload.availableLiquidityInUSD || 0;
|
|
170
|
+
this.liquidationThresholds = Object.fromEntries(Object.entries(payload.liquidityThresholds).map(function (_a) {
|
|
171
|
+
var t = _a[0], tr = _a[1];
|
|
172
|
+
return [
|
|
173
|
+
t.toLowerCase(),
|
|
174
|
+
ethers_1.BigNumber.from(tr),
|
|
175
|
+
];
|
|
176
|
+
}));
|
|
177
|
+
this.totalBorrowed = ethers_1.BigNumber.from(payload.totalBorrowed || 0);
|
|
178
|
+
this.totalBorrowedOld = ethers_1.BigNumber.from(payload.totalBorrowedBIOld || 0);
|
|
179
|
+
this.totalBorrowedInUSD = payload.totalBorrowedInUSD || 0;
|
|
180
|
+
this.totalBorrowedChange =
|
|
181
|
+
(payload.totalBorrowedBI10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
182
|
+
this.totalLosses = ethers_1.BigNumber.from(payload.totalLosses || 0);
|
|
183
|
+
this.totalLossesOld = ethers_1.BigNumber.from(payload.totalLossesOld || 0);
|
|
184
|
+
this.totalLossesInUSD = payload.totalLossesInUSD || 0;
|
|
185
|
+
this.totalRepaid = ethers_1.BigNumber.from(payload.totalRepaid || 0);
|
|
186
|
+
this.totalRepaidInUSD = payload.totalRepaidInUSD || 0;
|
|
187
|
+
this.totalProfit = ethers_1.BigNumber.from(payload.totalProfit || 0);
|
|
188
|
+
this.totalProfitOld = ethers_1.BigNumber.from(payload.totalProfitOld || 0);
|
|
189
|
+
this.totalProfitInUSD = payload.totalProfitInUSD || 0;
|
|
190
|
+
this.pnlChange = (payload.pnl10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
191
|
+
this.openedAccountsCount = payload.openedAccountsCount || 0;
|
|
192
|
+
this.openedAccountsCountChange = payload.openedAccountsCountChange || 0;
|
|
193
|
+
this.totalOpenedAccounts = payload.totalOpenedAccounts || 0;
|
|
194
|
+
this.totalOpenedAccountsChange = payload.totalOpenedAccountsChange || 0;
|
|
195
|
+
this.totalClosedAccounts = payload.totalClosedAccounts || 0;
|
|
196
|
+
this.totalClosedAccountsChange = payload.totalClosedAccountsChange || 0;
|
|
197
|
+
this.totalRepaidAccounts = payload.totalRepaidAccounts || 0;
|
|
198
|
+
this.totalLiquidatedAccounts = payload.totalLiquidatedAccounts || 0;
|
|
199
|
+
this.totalLiquidatedAccountsChange =
|
|
208
200
|
payload.totalLiquidatedAccountsChange || 0;
|
|
209
|
-
return _this;
|
|
210
201
|
}
|
|
211
202
|
return ChartsCreditManagerData;
|
|
212
|
-
}(
|
|
203
|
+
}());
|
|
213
204
|
exports.ChartsCreditManagerData = ChartsCreditManagerData;
|
|
214
205
|
function calcHealthFactor(_a) {
|
|
215
206
|
var assets = _a.assets, prices = _a.prices, liquidationThresholds = _a.liquidationThresholds, underlyingToken = _a.underlyingToken, borrowed = _a.borrowed;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { BigNumber
|
|
1
|
+
import { BigNumber } from "ethers";
|
|
2
2
|
import { CreditSessionFilteredPayload, CreditSessionPayload } from "../payload/creditSession";
|
|
3
3
|
import { AssetWithView } from "./assets";
|
|
4
4
|
export declare type CreditSessionStatus = "active" | "closed" | "repaid" | "liquidated" | "liquidateExpired" | "liquidatePaused";
|
|
5
5
|
export declare const CREDIT_SESSION_STATUS_BY_ID: Record<number, CreditSessionStatus>;
|
|
6
6
|
export declare const CREDIT_SESSION_ID_BY_STATUS: Record<CreditSessionStatus, number>;
|
|
7
|
-
export interface CreditSessionBalance {
|
|
8
|
-
balance: BigNumber;
|
|
9
|
-
token: string;
|
|
10
|
-
}
|
|
11
7
|
export declare class CreditSession {
|
|
12
8
|
readonly id: string;
|
|
13
9
|
readonly status: CreditSessionStatus;
|
|
14
10
|
readonly borrower: string;
|
|
15
11
|
readonly creditManager: string;
|
|
16
12
|
readonly account: string;
|
|
13
|
+
readonly underlyingToken: string;
|
|
17
14
|
readonly since: number;
|
|
18
15
|
readonly sinceDate: string;
|
|
19
16
|
readonly closedAt: number;
|
|
@@ -30,18 +27,18 @@ export declare class CreditSession {
|
|
|
30
27
|
readonly apy: number;
|
|
31
28
|
readonly currentBlock: number;
|
|
32
29
|
readonly currentTimestamp: number;
|
|
33
|
-
readonly borrowAPY_RAY:
|
|
34
|
-
readonly
|
|
30
|
+
readonly borrowAPY_RAY: BigNumber;
|
|
31
|
+
readonly borrowAPY7DAverage: number;
|
|
35
32
|
readonly totalValueUSD: number;
|
|
36
|
-
readonly debt:
|
|
33
|
+
readonly debt: BigNumber;
|
|
37
34
|
readonly debtUSD: number;
|
|
38
35
|
readonly leverage: number;
|
|
39
36
|
readonly tfIndex: number;
|
|
40
37
|
readonly spotDebt: BigNumber;
|
|
41
38
|
readonly spotTotalValue: BigNumber;
|
|
42
39
|
readonly spotUserFunds: BigNumber;
|
|
43
|
-
readonly cvxUnclaimedRewards:
|
|
44
|
-
readonly balances:
|
|
40
|
+
readonly cvxUnclaimedRewards: Array<AssetWithView>;
|
|
41
|
+
readonly balances: Array<AssetWithView>;
|
|
45
42
|
constructor(payload: CreditSessionPayload);
|
|
46
43
|
}
|
|
47
44
|
export declare class CreditSessionFiltered {
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
@@ -35,6 +24,7 @@ var CreditSession = /** @class */ (function () {
|
|
|
35
24
|
this.borrower = (payload.borrower || "").toLowerCase();
|
|
36
25
|
this.creditManager = (payload.creditManager || "").toLowerCase();
|
|
37
26
|
this.account = (payload.account || "").toLowerCase();
|
|
27
|
+
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
38
28
|
this.initialAmount = ethers_1.BigNumber.from(payload.initialAmount || 0);
|
|
39
29
|
this.borrowedAmount = ethers_1.BigNumber.from(payload.borrowedAmount || 0);
|
|
40
30
|
this.totalValue = ethers_1.BigNumber.from(payload.totalValue || 0);
|
|
@@ -48,7 +38,8 @@ var CreditSession = /** @class */ (function () {
|
|
|
48
38
|
this.collateralInUSD = payload.collateralInUSD || 0;
|
|
49
39
|
this.collateralInUnderlying = payload.collateralInUnderlying || 0;
|
|
50
40
|
this.borrowAPY_RAY = ethers_1.BigNumber.from(payload.borrowAPY_RAY || 0);
|
|
51
|
-
this.
|
|
41
|
+
this.borrowAPY7DAverage =
|
|
42
|
+
(payload.borrowAPY7DAverage || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
52
43
|
this.totalValueUSD = payload.totalValueUSD || 0;
|
|
53
44
|
this.debt = ethers_1.BigNumber.from(payload.debt || 0);
|
|
54
45
|
this.debtUSD = payload.debtUSD || 0;
|
|
@@ -61,24 +52,22 @@ var CreditSession = /** @class */ (function () {
|
|
|
61
52
|
this.spotDebt = ethers_1.BigNumber.from(payload.spotDebt || 0);
|
|
62
53
|
this.spotTotalValue = ethers_1.BigNumber.from(payload.spotTotalValue || 0);
|
|
63
54
|
this.spotUserFunds = ethers_1.BigNumber.from(payload.spotUserFunds || 0);
|
|
64
|
-
this.cvxUnclaimedRewards = Object.entries(payload.cvxUnclaimedRewards || {}).
|
|
65
|
-
var _b;
|
|
55
|
+
this.cvxUnclaimedRewards = Object.entries(payload.cvxUnclaimedRewards || {}).map(function (_a) {
|
|
66
56
|
var token = _a[0], balance = _a[1];
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
return {
|
|
58
|
+
token: token.toLowerCase(),
|
|
69
59
|
balance: ethers_1.BigNumber.from(balance.bi),
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
this.balances = Object.entries(payload.balances || {}).
|
|
74
|
-
var _b;
|
|
60
|
+
balanceView: balance.f.toString(),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
this.balances = Object.entries(payload.balances || {}).map(function (_a) {
|
|
75
64
|
var token = _a[0], balance = _a[1];
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
return {
|
|
66
|
+
token: token.toLowerCase(),
|
|
78
67
|
balance: ethers_1.BigNumber.from(balance.BI),
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
}
|
|
68
|
+
balanceView: balance.F.toString(),
|
|
69
|
+
};
|
|
70
|
+
});
|
|
82
71
|
}
|
|
83
72
|
return CreditSession;
|
|
84
73
|
}());
|
package/lib/core/pool/data.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigNumber, providers, Signer } from "ethers";
|
|
2
|
-
import { ChartsPoolDataPayload, PoolDataPayload } from "../../payload/pool";
|
|
2
|
+
import { ChartsPoolDataPayload, PoolDataPayload, UserPoolPayload } from "../../payload/pool";
|
|
3
3
|
import { IPoolService } from "../../types";
|
|
4
4
|
export declare class PoolData {
|
|
5
5
|
readonly id: string;
|
|
@@ -74,13 +74,35 @@ export declare class ChartsPoolData {
|
|
|
74
74
|
readonly oldExpectedLiquidity: BigNumber;
|
|
75
75
|
readonly oldTotalBorrowed: BigNumber;
|
|
76
76
|
readonly withdrawFee: number;
|
|
77
|
-
readonly
|
|
78
|
-
readonly
|
|
79
|
-
readonly
|
|
80
|
-
readonly
|
|
77
|
+
readonly depositAPY1DAverage: number;
|
|
78
|
+
readonly depositAPY1DAverageChange: number;
|
|
79
|
+
readonly depositAPY7DAverage: number;
|
|
80
|
+
readonly depositAPY30DAverage: number;
|
|
81
81
|
readonly oldUniqueLPs: number;
|
|
82
82
|
readonly uniqueLPs: number;
|
|
83
83
|
readonly uniqueLPsChange: number;
|
|
84
84
|
constructor(payload: ChartsPoolDataPayload);
|
|
85
85
|
}
|
|
86
|
+
export declare class UserPoolData {
|
|
87
|
+
readonly id: string;
|
|
88
|
+
readonly address: string;
|
|
89
|
+
readonly dieselToken: string;
|
|
90
|
+
readonly underlyingToken: string;
|
|
91
|
+
readonly depositAPY: number;
|
|
92
|
+
readonly depositAPYRay: BigNumber;
|
|
93
|
+
readonly lmAPY: number;
|
|
94
|
+
readonly providedLiquidity: BigNumber;
|
|
95
|
+
readonly providedLiquidityInUSD: number;
|
|
96
|
+
readonly dieselBalance: BigNumber;
|
|
97
|
+
readonly dieselBalanceInUSD: number;
|
|
98
|
+
readonly lmRewards: BigNumber;
|
|
99
|
+
readonly lmRewardsInUSD: number;
|
|
100
|
+
readonly pnlInNativeToken: number;
|
|
101
|
+
readonly pnlInUSD: number;
|
|
102
|
+
readonly addedLiq: number;
|
|
103
|
+
readonly addLiqCount: number;
|
|
104
|
+
readonly removeLiqCount: number;
|
|
105
|
+
readonly removedLiq: number;
|
|
106
|
+
constructor(payload: UserPoolPayload);
|
|
107
|
+
}
|
|
86
108
|
export {};
|
package/lib/core/pool/data.js
CHANGED
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.ChartsPoolData = exports.PoolData = void 0;
|
|
39
|
+
exports.UserPoolData = exports.ChartsPoolData = exports.PoolData = void 0;
|
|
40
40
|
var ethers_1 = require("ethers");
|
|
41
41
|
var types_1 = require("../../types");
|
|
42
42
|
var formatter_1 = require("../../utils/formatter");
|
|
@@ -81,11 +81,11 @@ var PoolData = /** @class */ (function () {
|
|
|
81
81
|
exports.PoolData = PoolData;
|
|
82
82
|
var ChartsPoolData = /** @class */ (function () {
|
|
83
83
|
function ChartsPoolData(payload) {
|
|
84
|
-
this.id = payload.addr.toLowerCase();
|
|
85
|
-
this.address = payload.addr.toLowerCase();
|
|
86
|
-
this.underlyingToken = payload.underlyingToken.toLowerCase();
|
|
87
|
-
this.dieselToken = payload.dieselToken.toLowerCase();
|
|
88
|
-
this.isWETH = payload.isWETH;
|
|
84
|
+
this.id = (payload.addr || "").toLowerCase();
|
|
85
|
+
this.address = (payload.addr || "").toLowerCase();
|
|
86
|
+
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
87
|
+
this.dieselToken = (payload.dieselToken || "").toLowerCase();
|
|
88
|
+
this.isWETH = payload.isWETH || false;
|
|
89
89
|
this.earned7D = payload.earned7D || 0;
|
|
90
90
|
this.earned7DInUSD = payload.earned7DInUSD || 0;
|
|
91
91
|
this.utilization =
|
|
@@ -135,11 +135,14 @@ var ChartsPoolData = /** @class */ (function () {
|
|
|
135
135
|
this.addedLiquidity = payload.addedLiquidity || 0;
|
|
136
136
|
this.removeLiqCount = payload.removeLiqCount || 0;
|
|
137
137
|
this.removedLiquidity = payload.removedLiquidity || 0;
|
|
138
|
-
this.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
this.
|
|
138
|
+
this.depositAPY1DAverage =
|
|
139
|
+
(payload.depositAPY1DAverage || 0) / constants_1.PERCENTAGE_DECIMALS;
|
|
140
|
+
this.depositAPY1DAverageChange =
|
|
141
|
+
(payload.depositAPY1DAverage10kBasis || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
142
|
+
this.depositAPY7DAverage =
|
|
143
|
+
(payload.depositAPY7DAverage || 0) / constants_1.PERCENTAGE_DECIMALS;
|
|
144
|
+
this.depositAPY30DAverage =
|
|
145
|
+
(payload.depositAPY30DAverage || 0) / constants_1.PERCENTAGE_DECIMALS;
|
|
143
146
|
this.uniqueLPs = payload.uniqueLPs || 0;
|
|
144
147
|
this.oldUniqueLPs = payload.uniqueLPsOld || 0;
|
|
145
148
|
this.uniqueLPsChange =
|
|
@@ -148,3 +151,29 @@ var ChartsPoolData = /** @class */ (function () {
|
|
|
148
151
|
return ChartsPoolData;
|
|
149
152
|
}());
|
|
150
153
|
exports.ChartsPoolData = ChartsPoolData;
|
|
154
|
+
var UserPoolData = /** @class */ (function () {
|
|
155
|
+
function UserPoolData(payload) {
|
|
156
|
+
this.id = (payload.pool || "").toLowerCase();
|
|
157
|
+
this.address = payload.pool || "";
|
|
158
|
+
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
159
|
+
this.dieselToken = (payload.dieselToken || "").toLowerCase();
|
|
160
|
+
this.depositAPY =
|
|
161
|
+
(0, formatter_1.rayToNumber)(payload.depositAPY_RAY || 0) * constants_1.PERCENTAGE_DECIMALS;
|
|
162
|
+
this.depositAPYRay = ethers_1.BigNumber.from(payload.depositAPY_RAY || 0);
|
|
163
|
+
this.lmAPY = (payload.lmAPY || 0) / constants_1.PERCENTAGE_FACTOR;
|
|
164
|
+
this.providedLiquidity = ethers_1.BigNumber.from(payload.liqValue || 0);
|
|
165
|
+
this.providedLiquidityInUSD = payload.liqValueInUSD;
|
|
166
|
+
this.dieselBalance = ethers_1.BigNumber.from(payload.dieselBalanceBI || 0);
|
|
167
|
+
this.dieselBalanceInUSD = payload.dieselBalance;
|
|
168
|
+
this.lmRewards = ethers_1.BigNumber.from(payload.lmRewards || 0);
|
|
169
|
+
this.lmRewardsInUSD = payload.lmRewardsInUSD;
|
|
170
|
+
this.pnlInNativeToken = payload.liqPnlInNativeToken;
|
|
171
|
+
this.pnlInUSD = payload.liqPnlInUSD;
|
|
172
|
+
this.addedLiq = payload.addedLiq;
|
|
173
|
+
this.addLiqCount = payload.addLiqCount;
|
|
174
|
+
this.removeLiqCount = payload.removeLiqCount;
|
|
175
|
+
this.removedLiq = payload.removedLiq;
|
|
176
|
+
}
|
|
177
|
+
return UserPoolData;
|
|
178
|
+
}());
|
|
179
|
+
exports.UserPoolData = UserPoolData;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BigNumberish } from "ethers";
|
|
1
2
|
import { CreditManagerDataStructOutput } from "../types/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressor";
|
|
2
3
|
import { ExcludeArrayProps } from "../utils/types";
|
|
3
4
|
export interface AdapterPayload {
|
|
@@ -7,36 +8,44 @@ export interface AdapterPayload {
|
|
|
7
8
|
export declare type CreditManagerDataPayload = ExcludeArrayProps<CreditManagerDataStructOutput>;
|
|
8
9
|
export interface ChartsCreditManagerPayload {
|
|
9
10
|
addr: string;
|
|
10
|
-
|
|
11
|
-
borrowRate: string;
|
|
11
|
+
underlyingToken: string;
|
|
12
12
|
isWeth: boolean;
|
|
13
|
-
maxAmount: string;
|
|
14
|
-
maxLeverageFactor: number;
|
|
15
|
-
minAmount: string;
|
|
16
|
-
openedAccountsCount: number;
|
|
17
|
-
totalBorrowed: string;
|
|
18
|
-
totalClosedAccounts: number;
|
|
19
|
-
totalLiquidatedAccounts: number;
|
|
20
|
-
totalLosses: string;
|
|
21
|
-
totalOpenedAccounts: number;
|
|
22
|
-
totalProfit: string;
|
|
23
|
-
totalRepaid: string;
|
|
24
|
-
totalRepaidAccounts: number;
|
|
25
13
|
poolAddress: string;
|
|
26
|
-
|
|
14
|
+
maxAmount: BigNumberish;
|
|
15
|
+
minAmount: BigNumberish;
|
|
16
|
+
maxLeverageFactor: number;
|
|
17
|
+
version: number;
|
|
18
|
+
feeInterest: number;
|
|
19
|
+
feeLiquidation: number;
|
|
20
|
+
feeLiquidationExpired: number;
|
|
21
|
+
liquidationPremium: number;
|
|
22
|
+
liquidationPremiumExpired: number;
|
|
23
|
+
borrowRate: BigNumberish;
|
|
24
|
+
borrowRateOld: BigNumberish;
|
|
25
|
+
borrowRate10kBasis: number;
|
|
26
|
+
availableLiquidity: BigNumberish;
|
|
27
27
|
availableLiquidityInUSD: number;
|
|
28
|
+
totalBorrowed: BigNumberish;
|
|
28
29
|
totalBorrowedInUSD: number;
|
|
29
|
-
|
|
30
|
+
totalBorrowedBIOld: BigNumberish;
|
|
31
|
+
totalBorrowedBI10kBasis: number;
|
|
32
|
+
totalProfit: BigNumberish;
|
|
30
33
|
totalProfitInUSD: number;
|
|
34
|
+
totalProfitOld: BigNumberish;
|
|
35
|
+
pnl10kBasis: number;
|
|
36
|
+
totalRepaid: BigNumberish;
|
|
31
37
|
totalRepaidInUSD: number;
|
|
32
|
-
|
|
38
|
+
totalLosses: BigNumberish;
|
|
39
|
+
totalLossesOld: BigNumberish;
|
|
40
|
+
totalLossesInUSD: number;
|
|
41
|
+
totalOpenedAccounts: number;
|
|
33
42
|
totalOpenedAccountsChange: number;
|
|
34
|
-
|
|
43
|
+
openedAccountsCount: number;
|
|
44
|
+
openedAccountsCountChange: number;
|
|
45
|
+
totalLiquidatedAccounts: number;
|
|
35
46
|
totalLiquidatedAccountsChange: number;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
liquidationPremiumExpired: number;
|
|
41
|
-
version: number;
|
|
47
|
+
totalClosedAccounts: number;
|
|
48
|
+
totalClosedAccountsChange: number;
|
|
49
|
+
totalRepaidAccounts: number;
|
|
50
|
+
liquidityThresholds: Record<string, number>;
|
|
42
51
|
}
|
|
@@ -18,8 +18,9 @@ export interface CreditSessionPayload {
|
|
|
18
18
|
borrower: string;
|
|
19
19
|
account: string;
|
|
20
20
|
creditManager: string;
|
|
21
|
+
underlyingToken: string;
|
|
21
22
|
borrowAPY_RAY: BigNumberish;
|
|
22
|
-
|
|
23
|
+
borrowAPY7DAverage: number;
|
|
23
24
|
healthFactor: BigNumberish;
|
|
24
25
|
leverage: number;
|
|
25
26
|
tfIndex: number;
|
|
@@ -81,4 +82,10 @@ export interface CreditSessionsAggregatedStatsPayload {
|
|
|
81
82
|
openedAccountsOld: number;
|
|
82
83
|
openedAccounts10kBasis: number;
|
|
83
84
|
}
|
|
85
|
+
export interface UserCreditSessionsAggregatedStatsPayload {
|
|
86
|
+
totalValue7DInUSD: number;
|
|
87
|
+
totalValue10kBasis: number;
|
|
88
|
+
totalValueInUSD: number;
|
|
89
|
+
accounts: Array<CreditSessionPayload>;
|
|
90
|
+
}
|
|
84
91
|
export {};
|
package/lib/payload/pool.d.ts
CHANGED
|
@@ -41,10 +41,10 @@ export interface ChartsPoolDataPayload {
|
|
|
41
41
|
addedLiquidity: number;
|
|
42
42
|
removeLiqCount: number;
|
|
43
43
|
removedLiquidity: number;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
depositAPY1DAverage: number;
|
|
45
|
+
depositAPY1DAverage10kBasis: number;
|
|
46
|
+
depositAPY7DAverage: number;
|
|
47
|
+
depositAPY30DAverage: number;
|
|
48
48
|
uniqueLPsOld: number;
|
|
49
49
|
uniqueLPs: number;
|
|
50
50
|
uniqueLPs10kBasis: number;
|
|
@@ -66,3 +66,31 @@ export interface ChartsAggregatedStats {
|
|
|
66
66
|
export interface ChartsAggregatedPoolPayload extends ChartsAggregatedStats {
|
|
67
67
|
pools: Array<ChartsPoolDataPayload>;
|
|
68
68
|
}
|
|
69
|
+
export interface UserPoolPayload {
|
|
70
|
+
pool: string;
|
|
71
|
+
dieselSym: string;
|
|
72
|
+
dieselToken: string;
|
|
73
|
+
underlyingToken: string;
|
|
74
|
+
liqValue: BigNumberish;
|
|
75
|
+
liqValueInUSD: number;
|
|
76
|
+
dieselBalance: number;
|
|
77
|
+
dieselBalanceBI: BigNumberish;
|
|
78
|
+
lmRewards: BigNumberish;
|
|
79
|
+
lmRewardsInUSD: number;
|
|
80
|
+
liqPnlInNativeToken: number;
|
|
81
|
+
liqPnlInUSD: number;
|
|
82
|
+
addedLiq: number;
|
|
83
|
+
addLiqCount: number;
|
|
84
|
+
removeLiqCount: number;
|
|
85
|
+
removedLiq: number;
|
|
86
|
+
depositAPY_RAY: BigNumberish;
|
|
87
|
+
lmAPY: number;
|
|
88
|
+
}
|
|
89
|
+
export interface UserPoolAggregatedStatsPayload {
|
|
90
|
+
totalLMRewards: number;
|
|
91
|
+
totalLiqInUSD: number;
|
|
92
|
+
totalLiqt7DInUSD: number;
|
|
93
|
+
totalLiqt10kBasis: number;
|
|
94
|
+
user: string;
|
|
95
|
+
pools: Array<UserPoolPayload>;
|
|
96
|
+
}
|