@gearbox-protocol/sdk 3.0.0-next.37 → 3.0.0-next.39
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/contracts/index.sol +3 -1
- package/lib/core/creditManager.d.ts +1 -3
- package/lib/core/creditManager.js +2 -10
- package/lib/core/gauge.d.ts +11 -1
- package/lib/core/gauge.js +24 -1
- package/lib/core/pool.d.ts +3 -0
- package/lib/core/pool.js +11 -0
- package/lib/core/transactions.d.ts +23 -3
- package/lib/core/transactions.js +73 -100
- package/lib/payload/gauge.d.ts +8 -1
- package/lib/types/IGearStakingV3.sol/IGearStakingV3.d.ts +385 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3.js +2 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3Events.d.ts +117 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3Events.js +2 -0
- package/lib/types/IGearStakingV3.sol/index.d.ts +2 -0
- package/lib/types/IGearStakingV3.sol/index.js +2 -0
- package/lib/types/factories/IGearStakingV3.sol/IGearStakingV3Events__factory.d.ts +113 -0
- package/lib/types/factories/IGearStakingV3.sol/IGearStakingV3Events__factory.js +152 -0
- package/lib/types/factories/IGearStakingV3.sol/IGearStakingV3__factory.d.ts +457 -0
- package/lib/types/factories/IGearStakingV3.sol/IGearStakingV3__factory.js +600 -0
- package/lib/types/factories/IGearStakingV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IGearStakingV3.sol/index.js +10 -0
- package/lib/types/factories/index.d.ts +1 -0
- package/lib/types/factories/index.js +3 -2
- package/lib/types/index.d.ts +6 -0
- package/lib/types/index.js +5 -1
- package/package.json +4 -4
package/contracts/index.sol
CHANGED
|
@@ -15,6 +15,8 @@ import {ICreditConfiguratorV2} from "@gearbox-protocol/core-v2/contracts/interfa
|
|
|
15
15
|
import {IWERC20Zapper} from "@gearbox-protocol/integrations-v3/contracts/interfaces/zappers/IWERC20Zapper.sol";
|
|
16
16
|
import {IWETHZapper} from "@gearbox-protocol/integrations-v3/contracts/interfaces/zappers/IWETHZapper.sol";
|
|
17
17
|
|
|
18
|
+
import {IGearStakingV3} from "@gearbox-protocol/core-v3/contracts/interfaces/IGearStakingV3.sol";
|
|
19
|
+
|
|
18
20
|
// Adapters
|
|
19
21
|
import {ILidoV1Adapter} from "@gearbox-protocol/integrations-v3/contracts/interfaces/lido/ILidoV1Adapter.sol";
|
|
20
22
|
import {IBaseRewardPool} from "@gearbox-protocol/integrations-v3/contracts/integrations/convex/IBaseRewardPool.sol";
|
|
@@ -48,4 +50,4 @@ import {ICurveV1_4AssetsAdapter} from
|
|
|
48
50
|
import {IRouter} from
|
|
49
51
|
"@gearbox-protocol/router-v3/contracts/interfaces/IRouter.sol";
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MultiCall } from "../pathfinder/core";
|
|
2
2
|
import { ChartsCreditManagerPayload, CreditManagerDataPayload, QuotaInfo } from "../payload/creditManager";
|
|
3
3
|
import { LinearModel } from "../payload/pool";
|
|
4
|
-
|
|
4
|
+
import { PoolType } from "./pool";
|
|
5
5
|
export declare class CreditManagerData {
|
|
6
6
|
readonly address: string;
|
|
7
7
|
readonly type: PoolType;
|
|
@@ -35,7 +35,6 @@ export declare class CreditManagerData {
|
|
|
35
35
|
readonly interestModel: LinearModel;
|
|
36
36
|
constructor(payload: CreditManagerDataPayload);
|
|
37
37
|
get id(): string;
|
|
38
|
-
static getCMType(name: string): PoolType;
|
|
39
38
|
isQuoted(token: string): boolean;
|
|
40
39
|
encodeAddCollateralV2(tokenAddress: string, amount: bigint): MultiCall;
|
|
41
40
|
encodeAddCollateralV3(tokenAddress: string, amount: bigint): MultiCall;
|
|
@@ -93,4 +92,3 @@ export declare class ChartsCreditManagerData {
|
|
|
93
92
|
readonly liquidationThresholds: Record<string, bigint>;
|
|
94
93
|
constructor(payload: ChartsCreditManagerPayload);
|
|
95
94
|
}
|
|
96
|
-
export {};
|
|
@@ -4,6 +4,7 @@ exports.ChartsCreditManagerData = exports.CreditManagerData = void 0;
|
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
5
|
const txParser_1 = require("../parsers/txParser");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
|
+
const pool_1 = require("./pool");
|
|
7
8
|
class CreditManagerData {
|
|
8
9
|
address;
|
|
9
10
|
type;
|
|
@@ -38,7 +39,7 @@ class CreditManagerData {
|
|
|
38
39
|
constructor(payload) {
|
|
39
40
|
this.address = payload.addr.toLowerCase();
|
|
40
41
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
41
|
-
this.type =
|
|
42
|
+
this.type = pool_1.PoolData.getPoolType(payload.name || "");
|
|
42
43
|
this.name = payload.name;
|
|
43
44
|
this.pool = payload.pool.toLowerCase();
|
|
44
45
|
this.creditFacade = payload.creditFacade.toLowerCase();
|
|
@@ -112,15 +113,6 @@ class CreditManagerData {
|
|
|
112
113
|
get id() {
|
|
113
114
|
return this.address;
|
|
114
115
|
}
|
|
115
|
-
static getCMType(name) {
|
|
116
|
-
const [identity = ""] = name.split(" ") || [];
|
|
117
|
-
const lc = identity.toLowerCase();
|
|
118
|
-
if (lc === "farm")
|
|
119
|
-
return "farm";
|
|
120
|
-
if (lc === "trade")
|
|
121
|
-
return "trade";
|
|
122
|
-
return "universal";
|
|
123
|
-
}
|
|
124
116
|
isQuoted(token) {
|
|
125
117
|
return !!this.quotas[token];
|
|
126
118
|
}
|
package/lib/core/gauge.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GaugeDataPayload, GaugeQuotaParams } from "../payload/gauge";
|
|
1
|
+
import { GaugeDataPayload, GaugeQuotaParams, GaugeStakingDataPayload } from "../payload/gauge";
|
|
2
|
+
import { BigintifyProps } from "../utils/types";
|
|
2
3
|
export declare class GaugeData {
|
|
3
4
|
readonly address: string;
|
|
4
5
|
readonly pool: string;
|
|
@@ -9,3 +10,12 @@ export declare class GaugeData {
|
|
|
9
10
|
readonly quotaParams: Record<string, GaugeQuotaParams>;
|
|
10
11
|
constructor(payload: GaugeDataPayload);
|
|
11
12
|
}
|
|
13
|
+
export declare class GaugeStakingData {
|
|
14
|
+
readonly availableBalance: bigint;
|
|
15
|
+
readonly totalBalance: bigint;
|
|
16
|
+
readonly epoch: number;
|
|
17
|
+
readonly withdrawableNow: bigint;
|
|
18
|
+
readonly withdrawableInEpochsTotal: bigint;
|
|
19
|
+
readonly withdrawableInEpochs: BigintifyProps<GaugeStakingDataPayload["withdrawableAmounts"]["withdrawableInEpochs"]>;
|
|
20
|
+
constructor(payload: GaugeStakingDataPayload);
|
|
21
|
+
}
|
package/lib/core/gauge.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GaugeData = void 0;
|
|
3
|
+
exports.GaugeStakingData = exports.GaugeData = void 0;
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
5
|
class GaugeData {
|
|
6
6
|
address;
|
|
@@ -37,3 +37,26 @@ class GaugeData {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
exports.GaugeData = GaugeData;
|
|
40
|
+
class GaugeStakingData {
|
|
41
|
+
availableBalance;
|
|
42
|
+
totalBalance;
|
|
43
|
+
epoch;
|
|
44
|
+
withdrawableNow;
|
|
45
|
+
withdrawableInEpochsTotal;
|
|
46
|
+
withdrawableInEpochs;
|
|
47
|
+
constructor(payload) {
|
|
48
|
+
this.availableBalance = (0, sdk_gov_1.toBigInt)(payload.availableBalance);
|
|
49
|
+
this.totalBalance = (0, sdk_gov_1.toBigInt)(payload.totalBalance);
|
|
50
|
+
this.epoch = payload.epoch;
|
|
51
|
+
this.withdrawableNow = (0, sdk_gov_1.toBigInt)(payload.withdrawableAmounts.withdrawableNow);
|
|
52
|
+
const { total, list } = payload.withdrawableAmounts.withdrawableInEpochs.reduce(({ total, list }, a) => {
|
|
53
|
+
const bn = (0, sdk_gov_1.toBigInt)(a);
|
|
54
|
+
list.push(bn);
|
|
55
|
+
return { total: total + bn, list };
|
|
56
|
+
}, { total: 0n, list: [] });
|
|
57
|
+
this.withdrawableInEpochsTotal = total;
|
|
58
|
+
this.withdrawableInEpochs =
|
|
59
|
+
list;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.GaugeStakingData = GaugeStakingData;
|
package/lib/core/pool.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { providers, Signer } from "ethers";
|
|
|
2
2
|
import { CreditManagerDebtParams, QuotaInfo } from "../payload/creditManager";
|
|
3
3
|
import { ChartsPoolDataPayload, LinearModel, PoolDataPayload, PoolZapper, UserPoolPayload } from "../payload/pool";
|
|
4
4
|
import { IPoolService, IPoolV3 } from "../types";
|
|
5
|
+
export type PoolType = "universal" | "trade" | "farm";
|
|
5
6
|
export declare class PoolData {
|
|
6
7
|
readonly address: string;
|
|
8
|
+
readonly type: PoolType;
|
|
7
9
|
readonly underlyingToken: string;
|
|
8
10
|
readonly dieselToken: string;
|
|
9
11
|
readonly isPaused: boolean;
|
|
@@ -35,6 +37,7 @@ export declare class PoolData {
|
|
|
35
37
|
getPoolContractV1(signer: Signer): IPoolService;
|
|
36
38
|
getPoolContractV3(signer: Signer): IPoolV3;
|
|
37
39
|
calculateBorrowRate({ provider, expectedLiquidity, availableLiquidity, }: CalculateBorrowRateProps): Promise<import("ethers").BigNumber>;
|
|
40
|
+
static getPoolType(name: string): PoolType;
|
|
38
41
|
}
|
|
39
42
|
interface CalculateBorrowRateProps {
|
|
40
43
|
provider: providers.Provider;
|
package/lib/core/pool.js
CHANGED
|
@@ -6,6 +6,7 @@ const types_1 = require("../types");
|
|
|
6
6
|
const formatter_1 = require("../utils/formatter");
|
|
7
7
|
class PoolData {
|
|
8
8
|
address;
|
|
9
|
+
type;
|
|
9
10
|
underlyingToken;
|
|
10
11
|
dieselToken;
|
|
11
12
|
isPaused;
|
|
@@ -36,6 +37,7 @@ class PoolData {
|
|
|
36
37
|
lastBaseInterestUpdate;
|
|
37
38
|
constructor(payload) {
|
|
38
39
|
this.address = payload.addr.toLowerCase();
|
|
40
|
+
this.type = PoolData.getPoolType(payload.name || "");
|
|
39
41
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
40
42
|
this.dieselToken = payload.dieselToken.toLowerCase();
|
|
41
43
|
this.isPaused = payload.isPaused;
|
|
@@ -120,6 +122,15 @@ class PoolData {
|
|
|
120
122
|
const model = types_1.IInterestRateModel__factory.connect(this.interestModel.interestModel, provider);
|
|
121
123
|
return model.calcBorrowRate(expectedLiquidity, availableLiquidity);
|
|
122
124
|
}
|
|
125
|
+
static getPoolType(name) {
|
|
126
|
+
const [identity = ""] = name.split(" ") || [];
|
|
127
|
+
const lc = identity.toLowerCase();
|
|
128
|
+
if (lc === "farm")
|
|
129
|
+
return "farm";
|
|
130
|
+
if (lc === "trade")
|
|
131
|
+
return "trade";
|
|
132
|
+
return "universal";
|
|
133
|
+
}
|
|
123
134
|
}
|
|
124
135
|
exports.PoolData = PoolData;
|
|
125
136
|
class ChartsPoolData {
|
|
@@ -2,7 +2,7 @@ import { SupportedContract } from "@gearbox-protocol/sdk-gov";
|
|
|
2
2
|
import { Asset } from "./assets";
|
|
3
3
|
import { EVMTx, EVMTxProps } from "./eventOrTx";
|
|
4
4
|
export interface TxSerialized {
|
|
5
|
-
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens" | "TxUpdateQuota";
|
|
5
|
+
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens" | "TxUpdateQuota" | "TxGaugeStake" | "TxGaugeUnstake" | "TxGaugeClaim";
|
|
6
6
|
content: string;
|
|
7
7
|
}
|
|
8
8
|
export declare class TxSerializer {
|
|
@@ -134,9 +134,7 @@ export declare class TxClaimReward extends EVMTx {
|
|
|
134
134
|
toString(): string;
|
|
135
135
|
serialize(): TxSerialized;
|
|
136
136
|
}
|
|
137
|
-
type TxClaimNFTProps = EVMTxProps;
|
|
138
137
|
export declare class TxClaimNFT extends EVMTx {
|
|
139
|
-
constructor(opts: TxClaimNFTProps);
|
|
140
138
|
toString(): string;
|
|
141
139
|
serialize(): TxSerialized;
|
|
142
140
|
}
|
|
@@ -204,4 +202,26 @@ export declare class TxUpdateQuota extends EVMTx {
|
|
|
204
202
|
toString(): string;
|
|
205
203
|
serialize(): TxSerialized;
|
|
206
204
|
}
|
|
205
|
+
interface TxGaugeStakeProps extends EVMTxProps {
|
|
206
|
+
amount: bigint;
|
|
207
|
+
}
|
|
208
|
+
export declare class TxGaugeStake extends EVMTx {
|
|
209
|
+
readonly amount: bigint;
|
|
210
|
+
constructor(opts: TxGaugeStakeProps);
|
|
211
|
+
toString(): string;
|
|
212
|
+
serialize(): TxSerialized;
|
|
213
|
+
}
|
|
214
|
+
interface TxGaugeUnstakeProps extends EVMTxProps {
|
|
215
|
+
amount: bigint;
|
|
216
|
+
}
|
|
217
|
+
export declare class TxGaugeUnstake extends EVMTx {
|
|
218
|
+
readonly amount: bigint;
|
|
219
|
+
constructor(opts: TxGaugeUnstakeProps);
|
|
220
|
+
toString(): string;
|
|
221
|
+
serialize(): TxSerialized;
|
|
222
|
+
}
|
|
223
|
+
export declare class TxGaugeClaim extends EVMTx {
|
|
224
|
+
toString(): string;
|
|
225
|
+
serialize(): TxSerialized;
|
|
226
|
+
}
|
|
207
227
|
export {};
|
package/lib/core/transactions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TxUpdateQuota = exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimGearRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
3
|
+
exports.TxGaugeClaim = exports.TxGaugeUnstake = exports.TxGaugeStake = exports.TxUpdateQuota = exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimGearRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
5
|
const contractsRegister_1 = require("../contracts/contractsRegister");
|
|
6
6
|
const math_1 = require("../utils/math");
|
|
@@ -45,6 +45,12 @@ class TxSerializer {
|
|
|
45
45
|
return new TxEnableTokens(params);
|
|
46
46
|
case "TxUpdateQuota":
|
|
47
47
|
return new TxUpdateQuota(params);
|
|
48
|
+
case "TxGaugeStake":
|
|
49
|
+
return new TxGaugeStake(params);
|
|
50
|
+
case "TxGaugeUnstake":
|
|
51
|
+
return new TxGaugeUnstake(params);
|
|
52
|
+
case "TxGaugeClaim":
|
|
53
|
+
return new TxGaugeClaim(params);
|
|
48
54
|
default:
|
|
49
55
|
throw new Error(`Unknown transaction for parsing: ${e.type}`);
|
|
50
56
|
}
|
|
@@ -57,12 +63,7 @@ class TxAddLiquidity extends eventOrTx_1.EVMTx {
|
|
|
57
63
|
underlyingToken;
|
|
58
64
|
pool;
|
|
59
65
|
constructor(opts) {
|
|
60
|
-
super(
|
|
61
|
-
block: opts.block,
|
|
62
|
-
txHash: opts.txHash,
|
|
63
|
-
txStatus: opts.txStatus,
|
|
64
|
-
timestamp: opts.timestamp,
|
|
65
|
-
});
|
|
66
|
+
super(opts);
|
|
66
67
|
this.amount = opts.amount;
|
|
67
68
|
this.underlyingToken = opts.underlyingToken;
|
|
68
69
|
this.pool = opts.pool;
|
|
@@ -84,12 +85,7 @@ class TxRemoveLiquidity extends eventOrTx_1.EVMTx {
|
|
|
84
85
|
dieselToken;
|
|
85
86
|
pool;
|
|
86
87
|
constructor(opts) {
|
|
87
|
-
super(
|
|
88
|
-
block: opts.block,
|
|
89
|
-
txHash: opts.txHash,
|
|
90
|
-
txStatus: opts.txStatus,
|
|
91
|
-
timestamp: opts.timestamp,
|
|
92
|
-
});
|
|
88
|
+
super(opts);
|
|
93
89
|
this.amount = opts.amount;
|
|
94
90
|
this.dieselToken = opts.dieselToken;
|
|
95
91
|
this.pool = opts.pool;
|
|
@@ -115,12 +111,7 @@ class TXSwap extends eventOrTx_1.EVMTx {
|
|
|
115
111
|
tokenTo;
|
|
116
112
|
creditManager;
|
|
117
113
|
constructor(opts) {
|
|
118
|
-
super(
|
|
119
|
-
block: opts.block,
|
|
120
|
-
txHash: opts.txHash,
|
|
121
|
-
txStatus: opts.txStatus,
|
|
122
|
-
timestamp: opts.timestamp,
|
|
123
|
-
});
|
|
114
|
+
super(opts);
|
|
124
115
|
this.protocol = opts.protocol;
|
|
125
116
|
this.operation = opts.operation;
|
|
126
117
|
this.amountFrom = opts.amountFrom;
|
|
@@ -151,12 +142,7 @@ class TxAddCollateral extends eventOrTx_1.EVMTx {
|
|
|
151
142
|
addedToken;
|
|
152
143
|
creditManager;
|
|
153
144
|
constructor(opts) {
|
|
154
|
-
super(
|
|
155
|
-
block: opts.block,
|
|
156
|
-
txHash: opts.txHash,
|
|
157
|
-
txStatus: opts.txStatus,
|
|
158
|
-
timestamp: opts.timestamp,
|
|
159
|
-
});
|
|
145
|
+
super(opts);
|
|
160
146
|
this.amount = opts.amount;
|
|
161
147
|
this.addedToken = opts.addedToken;
|
|
162
148
|
this.creditManager = opts.creditManager;
|
|
@@ -178,12 +164,7 @@ class TxIncreaseBorrowAmount extends eventOrTx_1.EVMTx {
|
|
|
178
164
|
underlyingToken;
|
|
179
165
|
creditManager;
|
|
180
166
|
constructor(opts) {
|
|
181
|
-
super(
|
|
182
|
-
block: opts.block,
|
|
183
|
-
txHash: opts.txHash,
|
|
184
|
-
txStatus: opts.txStatus,
|
|
185
|
-
timestamp: opts.timestamp,
|
|
186
|
-
});
|
|
167
|
+
super(opts);
|
|
187
168
|
this.amount = opts.amount;
|
|
188
169
|
this.underlyingToken = opts.underlyingToken;
|
|
189
170
|
this.creditManager = opts.creditManager;
|
|
@@ -205,12 +186,7 @@ class TxDecreaseBorrowAmount extends eventOrTx_1.EVMTx {
|
|
|
205
186
|
underlyingToken;
|
|
206
187
|
creditManager;
|
|
207
188
|
constructor(opts) {
|
|
208
|
-
super(
|
|
209
|
-
block: opts.block,
|
|
210
|
-
txHash: opts.txHash,
|
|
211
|
-
txStatus: opts.txStatus,
|
|
212
|
-
timestamp: opts.timestamp,
|
|
213
|
-
});
|
|
189
|
+
super(opts);
|
|
214
190
|
this.amount = opts.amount;
|
|
215
191
|
this.underlyingToken = opts.underlyingToken;
|
|
216
192
|
this.creditManager = opts.creditManager;
|
|
@@ -233,12 +209,7 @@ class TxOpenAccount extends eventOrTx_1.EVMTx {
|
|
|
233
209
|
leverage;
|
|
234
210
|
creditManager;
|
|
235
211
|
constructor(opts) {
|
|
236
|
-
super(
|
|
237
|
-
block: opts.block,
|
|
238
|
-
txHash: opts.txHash,
|
|
239
|
-
txStatus: opts.txStatus,
|
|
240
|
-
timestamp: opts.timestamp,
|
|
241
|
-
});
|
|
212
|
+
super(opts);
|
|
242
213
|
this.amount = opts.amount;
|
|
243
214
|
this.underlyingToken = opts.underlyingToken;
|
|
244
215
|
this.leverage = opts.leverage;
|
|
@@ -265,12 +236,7 @@ class TxOpenMultitokenAccount extends eventOrTx_1.EVMTx {
|
|
|
265
236
|
underlyingToken;
|
|
266
237
|
assets;
|
|
267
238
|
constructor(opts) {
|
|
268
|
-
super(
|
|
269
|
-
block: opts.block,
|
|
270
|
-
txHash: opts.txHash,
|
|
271
|
-
txStatus: opts.txStatus,
|
|
272
|
-
timestamp: opts.timestamp,
|
|
273
|
-
});
|
|
239
|
+
super(opts);
|
|
274
240
|
this.borrowedAmount = opts.borrowedAmount;
|
|
275
241
|
this.underlyingToken = opts.underlyingToken;
|
|
276
242
|
this.creditManager = opts.creditManager;
|
|
@@ -297,12 +263,7 @@ exports.TxOpenMultitokenAccount = TxOpenMultitokenAccount;
|
|
|
297
263
|
class TxClaimReward extends eventOrTx_1.EVMTx {
|
|
298
264
|
contracts;
|
|
299
265
|
constructor(opts) {
|
|
300
|
-
super(
|
|
301
|
-
block: opts.block,
|
|
302
|
-
txHash: opts.txHash,
|
|
303
|
-
txStatus: opts.txStatus,
|
|
304
|
-
timestamp: opts.timestamp,
|
|
305
|
-
});
|
|
266
|
+
super(opts);
|
|
306
267
|
this.contracts = opts.contracts;
|
|
307
268
|
}
|
|
308
269
|
toString() {
|
|
@@ -321,14 +282,6 @@ class TxClaimReward extends eventOrTx_1.EVMTx {
|
|
|
321
282
|
}
|
|
322
283
|
exports.TxClaimReward = TxClaimReward;
|
|
323
284
|
class TxClaimNFT extends eventOrTx_1.EVMTx {
|
|
324
|
-
constructor(opts) {
|
|
325
|
-
super({
|
|
326
|
-
block: opts.block,
|
|
327
|
-
txHash: opts.txHash,
|
|
328
|
-
txStatus: opts.txStatus,
|
|
329
|
-
timestamp: opts.timestamp,
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
285
|
toString() {
|
|
333
286
|
return `NFT claimed`;
|
|
334
287
|
}
|
|
@@ -344,12 +297,7 @@ class TxClaimGearRewards extends eventOrTx_1.EVMTx {
|
|
|
344
297
|
token;
|
|
345
298
|
amount;
|
|
346
299
|
constructor(opts) {
|
|
347
|
-
super(
|
|
348
|
-
block: opts.block,
|
|
349
|
-
txHash: opts.txHash,
|
|
350
|
-
txStatus: opts.txStatus,
|
|
351
|
-
timestamp: opts.timestamp,
|
|
352
|
-
});
|
|
300
|
+
super(opts);
|
|
353
301
|
this.amount = opts.amount;
|
|
354
302
|
this.token = opts.token;
|
|
355
303
|
}
|
|
@@ -368,12 +316,7 @@ exports.TxClaimGearRewards = TxClaimGearRewards;
|
|
|
368
316
|
class TxRepayAccount extends eventOrTx_1.EVMTx {
|
|
369
317
|
creditManager;
|
|
370
318
|
constructor(opts) {
|
|
371
|
-
super(
|
|
372
|
-
block: opts.block,
|
|
373
|
-
txHash: opts.txHash,
|
|
374
|
-
txStatus: opts.txStatus,
|
|
375
|
-
timestamp: opts.timestamp,
|
|
376
|
-
});
|
|
319
|
+
super(opts);
|
|
377
320
|
this.creditManager = opts.creditManager;
|
|
378
321
|
}
|
|
379
322
|
toString() {
|
|
@@ -390,12 +333,7 @@ exports.TxRepayAccount = TxRepayAccount;
|
|
|
390
333
|
class TxCloseAccount extends eventOrTx_1.EVMTx {
|
|
391
334
|
creditManager;
|
|
392
335
|
constructor(opts) {
|
|
393
|
-
super(
|
|
394
|
-
block: opts.block,
|
|
395
|
-
txHash: opts.txHash,
|
|
396
|
-
txStatus: opts.txStatus,
|
|
397
|
-
timestamp: opts.timestamp,
|
|
398
|
-
});
|
|
336
|
+
super(opts);
|
|
399
337
|
this.creditManager = opts.creditManager;
|
|
400
338
|
}
|
|
401
339
|
toString() {
|
|
@@ -412,12 +350,7 @@ exports.TxCloseAccount = TxCloseAccount;
|
|
|
412
350
|
class TxApprove extends eventOrTx_1.EVMTx {
|
|
413
351
|
token;
|
|
414
352
|
constructor(opts) {
|
|
415
|
-
super(
|
|
416
|
-
block: opts.block,
|
|
417
|
-
txHash: opts.txHash,
|
|
418
|
-
txStatus: opts.txStatus,
|
|
419
|
-
timestamp: opts.timestamp,
|
|
420
|
-
});
|
|
353
|
+
super(opts);
|
|
421
354
|
this.token = opts.token;
|
|
422
355
|
}
|
|
423
356
|
toString() {
|
|
@@ -437,12 +370,7 @@ class TxEnableTokens extends eventOrTx_1.EVMTx {
|
|
|
437
370
|
disabledTokens;
|
|
438
371
|
creditManager;
|
|
439
372
|
constructor(opts) {
|
|
440
|
-
super(
|
|
441
|
-
block: opts.block,
|
|
442
|
-
txHash: opts.txHash,
|
|
443
|
-
txStatus: opts.txStatus,
|
|
444
|
-
timestamp: opts.timestamp,
|
|
445
|
-
});
|
|
373
|
+
super(opts);
|
|
446
374
|
this.enabledTokens = opts.enabledTokens;
|
|
447
375
|
this.disabledTokens = opts.disabledTokens;
|
|
448
376
|
this.creditManager = opts.creditManager;
|
|
@@ -477,12 +405,7 @@ class TxUpdateQuota extends eventOrTx_1.EVMTx {
|
|
|
477
405
|
underlyingToken;
|
|
478
406
|
creditManager;
|
|
479
407
|
constructor(opts) {
|
|
480
|
-
super(
|
|
481
|
-
block: opts.block,
|
|
482
|
-
txHash: opts.txHash,
|
|
483
|
-
txStatus: opts.txStatus,
|
|
484
|
-
timestamp: opts.timestamp,
|
|
485
|
-
});
|
|
408
|
+
super(opts);
|
|
486
409
|
this.updatedQuotas = opts.updatedQuotas;
|
|
487
410
|
this.creditManager = opts.creditManager;
|
|
488
411
|
this.underlyingToken = opts.underlyingToken;
|
|
@@ -499,9 +422,59 @@ class TxUpdateQuota extends eventOrTx_1.EVMTx {
|
|
|
499
422
|
}
|
|
500
423
|
serialize() {
|
|
501
424
|
return {
|
|
502
|
-
type: "
|
|
425
|
+
type: "TxUpdateQuota",
|
|
503
426
|
content: JSON.stringify(this),
|
|
504
427
|
};
|
|
505
428
|
}
|
|
506
429
|
}
|
|
507
430
|
exports.TxUpdateQuota = TxUpdateQuota;
|
|
431
|
+
class TxGaugeStake extends eventOrTx_1.EVMTx {
|
|
432
|
+
amount;
|
|
433
|
+
constructor(opts) {
|
|
434
|
+
super(opts);
|
|
435
|
+
this.amount = opts.amount;
|
|
436
|
+
}
|
|
437
|
+
toString() {
|
|
438
|
+
const tokenDecimals = sdk_gov_1.decimals.GEAR;
|
|
439
|
+
const amountString = (0, sdk_gov_1.formatBN)(math_1.BigIntMath.abs(this.amount), tokenDecimals);
|
|
440
|
+
return `Gauge: staked ${amountString} GEAR`;
|
|
441
|
+
}
|
|
442
|
+
serialize() {
|
|
443
|
+
return {
|
|
444
|
+
type: "TxGaugeStake",
|
|
445
|
+
content: JSON.stringify(this),
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
exports.TxGaugeStake = TxGaugeStake;
|
|
450
|
+
class TxGaugeUnstake extends eventOrTx_1.EVMTx {
|
|
451
|
+
amount;
|
|
452
|
+
constructor(opts) {
|
|
453
|
+
super(opts);
|
|
454
|
+
this.amount = opts.amount;
|
|
455
|
+
}
|
|
456
|
+
toString() {
|
|
457
|
+
const tokenDecimals = sdk_gov_1.decimals.GEAR;
|
|
458
|
+
const amountString = (0, sdk_gov_1.formatBN)(math_1.BigIntMath.abs(this.amount), tokenDecimals);
|
|
459
|
+
return `Gauge: unstaked ${amountString} GEAR`;
|
|
460
|
+
}
|
|
461
|
+
serialize() {
|
|
462
|
+
return {
|
|
463
|
+
type: "TxGaugeUnstake",
|
|
464
|
+
content: JSON.stringify(this),
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
exports.TxGaugeUnstake = TxGaugeUnstake;
|
|
469
|
+
class TxGaugeClaim extends eventOrTx_1.EVMTx {
|
|
470
|
+
toString() {
|
|
471
|
+
return `Gauge: withdrawals claimed`;
|
|
472
|
+
}
|
|
473
|
+
serialize() {
|
|
474
|
+
return {
|
|
475
|
+
type: "TxGaugeClaim",
|
|
476
|
+
content: JSON.stringify(this),
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
exports.TxGaugeClaim = TxGaugeClaim;
|
package/lib/payload/gauge.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import { ExcludeArrayProps } from "@gearbox-protocol/sdk-gov";
|
|
1
|
+
import { AwaitedRes, ExcludeArrayProps } from "@gearbox-protocol/sdk-gov";
|
|
2
|
+
import { IGearStakingV3 } from "../types";
|
|
2
3
|
import { GaugeInfoStructOutput, GaugeQuotaParamsStructOutput } from "../types/IDataCompressorV3_00";
|
|
3
4
|
import { BigintifyProps } from "../utils/types";
|
|
4
5
|
export type GaugeQuotaParams = BigintifyProps<ExcludeArrayProps<GaugeQuotaParamsStructOutput>>;
|
|
5
6
|
export type GaugeDataPayload = ExcludeArrayProps<GaugeInfoStructOutput>;
|
|
7
|
+
export interface GaugeStakingDataPayload {
|
|
8
|
+
availableBalance: AwaitedRes<IGearStakingV3["availableBalance"]>;
|
|
9
|
+
totalBalance: AwaitedRes<IGearStakingV3["balanceOf"]>;
|
|
10
|
+
epoch: AwaitedRes<IGearStakingV3["getCurrentEpoch"]>;
|
|
11
|
+
withdrawableAmounts: AwaitedRes<IGearStakingV3["getWithdrawableAmounts"]>;
|
|
12
|
+
}
|