@gearbox-protocol/sdk 3.0.0-next.182 → 3.0.0-next.183
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.
|
@@ -31,6 +31,7 @@ export declare class CreditManagerData {
|
|
|
31
31
|
readonly liquidationDiscountExpired: number;
|
|
32
32
|
readonly collateralTokens: Array<string>;
|
|
33
33
|
readonly supportedTokens: Record<string, true>;
|
|
34
|
+
readonly usableTokens: Record<string, true>;
|
|
34
35
|
readonly adapters: Record<string, string>;
|
|
35
36
|
readonly contractsByAdapter: Record<string, string>;
|
|
36
37
|
readonly liquidationThresholds: Record<string, bigint>;
|
|
@@ -32,6 +32,7 @@ class CreditManagerData {
|
|
|
32
32
|
liquidationDiscountExpired;
|
|
33
33
|
collateralTokens = [];
|
|
34
34
|
supportedTokens = {};
|
|
35
|
+
usableTokens = {};
|
|
35
36
|
adapters;
|
|
36
37
|
contractsByAdapter;
|
|
37
38
|
liquidationThresholds;
|
|
@@ -66,11 +67,6 @@ class CreditManagerData {
|
|
|
66
67
|
this.liquidationDiscount = Number(payload.liquidationDiscount);
|
|
67
68
|
this.feeLiquidationExpired = Number(payload.feeLiquidationExpired);
|
|
68
69
|
this.liquidationDiscountExpired = Number(payload.liquidationDiscountExpired);
|
|
69
|
-
payload.collateralTokens.forEach(t => {
|
|
70
|
-
const tLc = t.toLowerCase();
|
|
71
|
-
this.collateralTokens.push(tLc);
|
|
72
|
-
this.supportedTokens[tLc] = true;
|
|
73
|
-
});
|
|
74
70
|
this.adapters = Object.fromEntries(payload.adapters.map(a => [
|
|
75
71
|
a.targetContract.toLowerCase(),
|
|
76
72
|
a.adapter.toLowerCase(),
|
|
@@ -107,6 +103,16 @@ class CreditManagerData {
|
|
|
107
103
|
version: Number(payload?.lirm?.version),
|
|
108
104
|
isBorrowingMoreU2Forbidden: payload?.lirm?.isBorrowingMoreU2Forbidden,
|
|
109
105
|
};
|
|
106
|
+
payload.collateralTokens.forEach(t => {
|
|
107
|
+
const tLc = t.toLowerCase();
|
|
108
|
+
const zeroLt = this.liquidationThresholds[tLc] === 0n;
|
|
109
|
+
const quotaNotActive = this.quotas[tLc]?.isActive === false;
|
|
110
|
+
const allowed = !zeroLt && !quotaNotActive;
|
|
111
|
+
if (allowed)
|
|
112
|
+
this.usableTokens[tLc] = true;
|
|
113
|
+
this.collateralTokens.push(tLc);
|
|
114
|
+
this.supportedTokens[tLc] = true;
|
|
115
|
+
});
|
|
110
116
|
txParser_1.TxParser.addCreditManager(this.address, this.version);
|
|
111
117
|
if (this.creditFacade !== "" && this.creditFacade !== sdk_gov_1.ADDRESS_0X0) {
|
|
112
118
|
txParser_1.TxParser.addCreditFacade(this.creditFacade, sdk_gov_1.tokenSymbolByAddress[this.underlyingToken], this.version);
|
|
@@ -18,17 +18,15 @@ const EXTRA_LM_MINING = {
|
|
|
18
18
|
const REWARD_PERIOD = 14 * 24 * 60 * 60;
|
|
19
19
|
// const REWARDS_FIRST_START = 1711641600;
|
|
20
20
|
// const REWARDS_FIRST_END = 1712844000;
|
|
21
|
-
const REWARDS_SECOND_END = 1714150800;
|
|
22
|
-
const REWARDS_THIRD_END =
|
|
21
|
+
// const REWARDS_SECOND_END = 1714150800;
|
|
22
|
+
const REWARDS_THIRD_END = 1715374800;
|
|
23
|
+
const REWARDS_FOURTH_END = REWARDS_THIRD_END + REWARD_PERIOD;
|
|
23
24
|
// const REWARD_FIRST_PART = toBN("15000", decimals.GHO);
|
|
24
|
-
const REWARD_SECOND_PART =
|
|
25
|
+
// const REWARD_SECOND_PART = toBN("15000", decimals.GHO);
|
|
25
26
|
const REWARD_THIRD_PART = (0, formatter_1.toBN)("15000", sdk_gov_1.decimals.GHO);
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const finished = timestamp >= REWARDS_SECOND_END
|
|
30
|
-
? REWARDS_THIRD_END
|
|
31
|
-
: REWARDS_SECOND_END;
|
|
27
|
+
const REWARD_FOURTH_PART = (0, formatter_1.toBN)("7500", sdk_gov_1.decimals.GHO);
|
|
28
|
+
const reward = timestamp >= REWARDS_THIRD_END ? REWARD_FOURTH_PART : REWARD_THIRD_PART;
|
|
29
|
+
const finished = timestamp >= REWARDS_THIRD_END ? REWARDS_FOURTH_END : REWARDS_THIRD_END;
|
|
32
30
|
return {
|
|
33
31
|
balance: 0n,
|
|
34
32
|
duration: BigInt(REWARD_PERIOD),
|
|
@@ -237,6 +235,7 @@ class GearboxRewardsApi {
|
|
|
237
235
|
}
|
|
238
236
|
}
|
|
239
237
|
exports.GearboxRewardsApi = GearboxRewardsApi;
|
|
238
|
+
// https://api.merkl.xyz/v3/campaignsForMainParameter?chainId=1&mainParameter=0xE2037090f896A858E3168B978668F22026AC52e7
|
|
240
239
|
class MerkleXYZApi {
|
|
241
240
|
static domain = "https://api.merkl.xyz/v3";
|
|
242
241
|
static getRewardsUrl = (options) => endpoint_1.ChartsApi.getRelativeUrl([this.domain, "userRewards"].join("/"), options);
|