@gearbox-protocol/sdk 12.3.7 → 12.3.9

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.
@@ -21,6 +21,7 @@ __export(errors_exports, {
21
21
  errorAbis: () => errorAbis,
22
22
  iExceptionsV300Abi: () => iExceptionsV300Abi,
23
23
  iExceptionsV310Abi: () => iExceptionsV310Abi,
24
+ iPartialLiquidationBotV310ErrorsAbi: () => iPartialLiquidationBotV310ErrorsAbi,
24
25
  iRedstoneErrorsAbi: () => iRedstoneErrorsAbi,
25
26
  iRedstonePriceFeedExceptionsAbi: () => iRedstonePriceFeedExceptionsAbi,
26
27
  iRouterErrorsV300Abi: () => iRouterErrorsV300Abi,
@@ -399,6 +400,12 @@ const iExceptionsV310Abi = [
399
400
  { type: "error", name: "VotingContractNotAllowedException", inputs: [] },
400
401
  { type: "error", name: "ZeroAddressException", inputs: [] }
401
402
  ];
403
+ const iPartialLiquidationBotV310ErrorsAbi = [
404
+ { type: "error", name: "LiquidatedLessThanNeededException", inputs: [] },
405
+ { type: "error", name: "LiquidatedMoreThanNeededException", inputs: [] },
406
+ { type: "error", name: "SeizedLessThanRequiredException", inputs: [] },
407
+ { type: "error", name: "UnderlyingNotLiquidatableException", inputs: [] }
408
+ ];
402
409
  const errorAbis = [
403
410
  ...iExceptionsV300Abi,
404
411
  ...iExceptionsV310Abi,
@@ -406,13 +413,15 @@ const errorAbis = [
406
413
  ...iRedstoneErrorsAbi,
407
414
  ...ilpPriceFeedExceptionsAbi,
408
415
  ...iRouterErrorsV300Abi,
409
- ...iRouterErrorsV310Abi
416
+ ...iRouterErrorsV310Abi,
417
+ ...iPartialLiquidationBotV310ErrorsAbi
410
418
  ];
411
419
  // Annotate the CommonJS export names for ESM import in node:
412
420
  0 && (module.exports = {
413
421
  errorAbis,
414
422
  iExceptionsV300Abi,
415
423
  iExceptionsV310Abi,
424
+ iPartialLiquidationBotV310ErrorsAbi,
416
425
  iRedstoneErrorsAbi,
417
426
  iRedstonePriceFeedExceptionsAbi,
418
427
  iRouterErrorsV300Abi,
@@ -142,6 +142,9 @@ class PriceOracleBaseContract extends import_base.BaseContract {
142
142
  * @param reserve use reserve price feed instead of main
143
143
  */
144
144
  convertToUSD(from, amount, reserve = false) {
145
+ if (amount === 0n) {
146
+ return 0n;
147
+ }
145
148
  const price = reserve ? this.reservePrice(from) : this.mainPrice(from);
146
149
  const scale = 10n ** BigInt(this.tokensMeta.decimals(from));
147
150
  return amount * price / scale;
@@ -153,6 +156,9 @@ class PriceOracleBaseContract extends import_base.BaseContract {
153
156
  * @param reserve use reserve price feed instead of main
154
157
  */
155
158
  convertFromUSD(to, amount, reserve = false) {
159
+ if (amount === 0n) {
160
+ return 0n;
161
+ }
156
162
  const price = reserve ? this.reservePrice(to) : this.mainPrice(to);
157
163
  const scale = 10n ** BigInt(this.tokensMeta.decimals(to));
158
164
  return amount * scale / price;
@@ -369,6 +369,12 @@ const iExceptionsV310Abi = [
369
369
  { type: "error", name: "VotingContractNotAllowedException", inputs: [] },
370
370
  { type: "error", name: "ZeroAddressException", inputs: [] }
371
371
  ];
372
+ const iPartialLiquidationBotV310ErrorsAbi = [
373
+ { type: "error", name: "LiquidatedLessThanNeededException", inputs: [] },
374
+ { type: "error", name: "LiquidatedMoreThanNeededException", inputs: [] },
375
+ { type: "error", name: "SeizedLessThanRequiredException", inputs: [] },
376
+ { type: "error", name: "UnderlyingNotLiquidatableException", inputs: [] }
377
+ ];
372
378
  const errorAbis = [
373
379
  ...iExceptionsV300Abi,
374
380
  ...iExceptionsV310Abi,
@@ -376,12 +382,14 @@ const errorAbis = [
376
382
  ...iRedstoneErrorsAbi,
377
383
  ...ilpPriceFeedExceptionsAbi,
378
384
  ...iRouterErrorsV300Abi,
379
- ...iRouterErrorsV310Abi
385
+ ...iRouterErrorsV310Abi,
386
+ ...iPartialLiquidationBotV310ErrorsAbi
380
387
  ];
381
388
  export {
382
389
  errorAbis,
383
390
  iExceptionsV300Abi,
384
391
  iExceptionsV310Abi,
392
+ iPartialLiquidationBotV310ErrorsAbi,
385
393
  iRedstoneErrorsAbi,
386
394
  iRedstonePriceFeedExceptionsAbi,
387
395
  iRouterErrorsV300Abi,
@@ -113,6 +113,9 @@ class PriceOracleBaseContract extends BaseContract {
113
113
  * @param reserve use reserve price feed instead of main
114
114
  */
115
115
  convertToUSD(from, amount, reserve = false) {
116
+ if (amount === 0n) {
117
+ return 0n;
118
+ }
116
119
  const price = reserve ? this.reservePrice(from) : this.mainPrice(from);
117
120
  const scale = 10n ** BigInt(this.tokensMeta.decimals(from));
118
121
  return amount * price / scale;
@@ -124,6 +127,9 @@ class PriceOracleBaseContract extends BaseContract {
124
127
  * @param reserve use reserve price feed instead of main
125
128
  */
126
129
  convertFromUSD(to, amount, reserve = false) {
130
+ if (amount === 0n) {
131
+ return 0n;
132
+ }
127
133
  const price = reserve ? this.reservePrice(to) : this.mainPrice(to);
128
134
  const scale = 10n ** BigInt(this.tokensMeta.decimals(to));
129
135
  return amount * scale / price;
@@ -953,6 +953,23 @@ export declare const iExceptionsV310Abi: readonly [{
953
953
  readonly name: "ZeroAddressException";
954
954
  readonly inputs: readonly [];
955
955
  }];
956
+ export declare const iPartialLiquidationBotV310ErrorsAbi: readonly [{
957
+ readonly type: "error";
958
+ readonly name: "LiquidatedLessThanNeededException";
959
+ readonly inputs: readonly [];
960
+ }, {
961
+ readonly type: "error";
962
+ readonly name: "LiquidatedMoreThanNeededException";
963
+ readonly inputs: readonly [];
964
+ }, {
965
+ readonly type: "error";
966
+ readonly name: "SeizedLessThanRequiredException";
967
+ readonly inputs: readonly [];
968
+ }, {
969
+ readonly type: "error";
970
+ readonly name: "UnderlyingNotLiquidatableException";
971
+ readonly inputs: readonly [];
972
+ }];
956
973
  export declare const errorAbis: readonly [{
957
974
  readonly type: "error";
958
975
  readonly inputs: readonly [];
@@ -1901,5 +1918,21 @@ export declare const errorAbis: readonly [{
1901
1918
  readonly type: "address";
1902
1919
  readonly internalType: "address";
1903
1920
  }];
1921
+ }, {
1922
+ readonly type: "error";
1923
+ readonly name: "LiquidatedLessThanNeededException";
1924
+ readonly inputs: readonly [];
1925
+ }, {
1926
+ readonly type: "error";
1927
+ readonly name: "LiquidatedMoreThanNeededException";
1928
+ readonly inputs: readonly [];
1929
+ }, {
1930
+ readonly type: "error";
1931
+ readonly name: "SeizedLessThanRequiredException";
1932
+ readonly inputs: readonly [];
1933
+ }, {
1934
+ readonly type: "error";
1935
+ readonly name: "UnderlyingNotLiquidatableException";
1936
+ readonly inputs: readonly [];
1904
1937
  }];
1905
1938
  export type errorAbis = typeof errorAbis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "12.3.7",
3
+ "version": "12.3.9",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",