@gearbox-protocol/sdk 3.0.0-next.186 → 3.0.0-next.188

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.
@@ -35,6 +35,6 @@ export declare class GaugeMath {
35
35
  private static removeVotes;
36
36
  static revertVote({ balanceAfter, initialVote, nextVoteType, voteAfter, }: UnvoteProps): bigint | undefined;
37
37
  static getBaseVote: (v: GaugeQuotaParams) => BaseVote | undefined;
38
- static getGaugeApy({ quota, voteAfter, vote }: GetGaugeApyProps): number | bigint | null;
38
+ static getGaugeApy({ quota, voteAfter, vote }: GetGaugeApyProps): bigint | null;
39
39
  }
40
40
  export {};
@@ -99,7 +99,7 @@ class GaugeMath {
99
99
  if (total === 0n)
100
100
  return quota.minRate;
101
101
  const r = (caImpact + lpImpact) / total;
102
- return Number(r);
102
+ return r;
103
103
  }
104
104
  }
105
105
  exports.GaugeMath = GaugeMath;
@@ -301,7 +301,7 @@ describe("GaugeMath getGaugeApy() test", () => {
301
301
  const r = gaugeMath_1.GaugeMath.getGaugeApy({
302
302
  quota,
303
303
  });
304
- (0, chai_1.expect)(r).to.be.eql(5000);
304
+ (0, chai_1.expect)(r).to.be.eql(5000n);
305
305
  });
306
306
  it("should calculate quota with prev vote", () => {
307
307
  const quota = {
@@ -317,7 +317,7 @@ describe("GaugeMath getGaugeApy() test", () => {
317
317
  quota,
318
318
  vote,
319
319
  });
320
- (0, chai_1.expect)(r).to.be.eql(5000);
320
+ (0, chai_1.expect)(r).to.be.eql(5000n);
321
321
  });
322
322
  it("should calculate quota with same vote increase", () => {
323
323
  const quota = {
@@ -338,7 +338,7 @@ describe("GaugeMath getGaugeApy() test", () => {
338
338
  vote,
339
339
  voteAfter,
340
340
  });
341
- (0, chai_1.expect)(r).to.be.eql(4761);
341
+ (0, chai_1.expect)(r).to.be.eql(4761n);
342
342
  });
343
343
  it("should calculate quota with different vote increase", () => {
344
344
  const quota = {
@@ -362,7 +362,7 @@ describe("GaugeMath getGaugeApy() test", () => {
362
362
  vote,
363
363
  voteAfter,
364
364
  });
365
- (0, chai_1.expect)(r).to.be.eql(6315);
365
+ (0, chai_1.expect)(r).to.be.eql(6315n);
366
366
  });
367
367
  it("should calculate quota with vote remove", () => {
368
368
  const quota = {
@@ -383,6 +383,6 @@ describe("GaugeMath getGaugeApy() test", () => {
383
383
  vote,
384
384
  voteAfter,
385
385
  });
386
- (0, chai_1.expect)(r).to.be.eql(5555);
386
+ (0, chai_1.expect)(r).to.be.eql(5555n);
387
387
  });
388
388
  });
@@ -138,6 +138,7 @@ interface TxOpenMultitokenAccountProps extends EVMTxProps {
138
138
  creditManagerName?: string;
139
139
  underlyingToken: string;
140
140
  assets: Array<string>;
141
+ withdrawDebt: boolean;
141
142
  }
142
143
  export declare class TxOpenMultitokenAccount extends EVMTx implements CMEvent {
143
144
  readonly borrowedAmount: bigint;
@@ -145,6 +146,7 @@ export declare class TxOpenMultitokenAccount extends EVMTx implements CMEvent {
145
146
  readonly creditManagerName?: string;
146
147
  readonly underlyingToken: string;
147
148
  readonly assets: Array<string>;
149
+ readonly withdrawDebt: boolean;
148
150
  constructor(opts: TxOpenMultitokenAccountProps);
149
151
  toString(): string;
150
152
  serialize(): TxSerialized;
@@ -260,6 +260,7 @@ class TxOpenMultitokenAccount extends eventOrTx_1.EVMTx {
260
260
  creditManagerName;
261
261
  underlyingToken;
262
262
  assets;
263
+ withdrawDebt;
263
264
  constructor(opts) {
264
265
  super(opts);
265
266
  this.borrowedAmount = opts.borrowedAmount;
@@ -267,16 +268,25 @@ class TxOpenMultitokenAccount extends eventOrTx_1.EVMTx {
267
268
  this.creditManager = opts.creditManager;
268
269
  this.creditManagerName = opts.creditManagerName;
269
270
  this.assets = opts.assets;
271
+ this.withdrawDebt = opts.withdrawDebt;
270
272
  }
271
273
  toString() {
272
274
  const assetSymbols = this.assets.reduce((acc, assetAddress) => {
273
275
  const [tokenSymbol] = (0, sdk_gov_1.extractTokenData)(assetAddress);
274
- if (tokenSymbol)
276
+ const skip = this.withdrawDebt && this.underlyingToken === assetAddress;
277
+ if (!skip && tokenSymbol)
275
278
  acc.push(tokenSymbol);
276
279
  return acc;
277
280
  }, []);
281
+ const name = this.creditManagerName || (0, contractsRegister_1.getContractName)(this.creditManager);
278
282
  const [symbol, underlyingDecimals] = (0, sdk_gov_1.extractTokenData)(this.underlyingToken);
279
- return `Credit Account ${this.creditManagerName || (0, contractsRegister_1.getContractName)(this.creditManager)}: opening. Borrowed amount: ${(0, sdk_gov_1.formatBN)(this.borrowedAmount, underlyingDecimals || 18)} ${symbol}; assets: ${assetSymbols.join(", ")}`;
283
+ const borrowedAmount = `${(0, sdk_gov_1.formatBN)(this.borrowedAmount, underlyingDecimals || 18)} ${symbol}`;
284
+ const assets = assetSymbols.join(", ");
285
+ const withdraw = this.withdrawDebt ? [`Withdrawn: ${borrowedAmount}`] : [];
286
+ return [
287
+ `Credit Account ${name}: opening. Borrowed amount: ${borrowedAmount}; assets: ${assets}`,
288
+ ...withdraw,
289
+ ].join("; ");
280
290
  }
281
291
  serialize() {
282
292
  return {
@@ -14,6 +14,7 @@ const apy_1 = require("./apy");
14
14
  const POOL_POINTS = {
15
15
  Mainnet: {
16
16
  [contractsRegister_1.poolByNetwork.Mainnet.WETH_V3_TRADE]: {
17
+ // !& ezeth
17
18
  // ezETH: {
18
19
  // amount: PERCENTAGE_FACTOR,
19
20
  // symbol: "ezETH",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-next.186",
3
+ "version": "3.0.0-next.188",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@gearbox-protocol/bots-v3": "^1.5.1",
34
- "@gearbox-protocol/sdk-gov": "^2.2.5",
34
+ "@gearbox-protocol/sdk-gov": "^2.2.8",
35
35
  "axios": "^1.2.6",
36
36
  "decimal.js-light": "^2.5.1",
37
37
  "deep-eql": "^4.1.0",