@gearbox-protocol/sdk 3.0.0-vfour.287 → 3.0.0-vfour.289

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.
@@ -61,12 +61,42 @@ class MarketConfiguratorContract extends import_base.BaseContract {
61
61
  }
62
62
  processLog(log) {
63
63
  switch (log.eventName) {
64
- // case "DeployDegenNFT":
65
- // case "SetName":
66
- // case "SetPriceFeedFromStore":
67
- // case "SetReservePriceFeedFromStore":
68
- case "ShutdownMarket":
64
+ case "AddPeripheryContract":
65
+ case "AddToken":
66
+ case "AuthorizeFactory":
67
+ case "ConfigureCreditSuite":
68
+ case "ConfigureInterestRateModel":
69
+ case "ConfigureLossPolicy":
70
+ case "ConfigurePool":
71
+ case "ConfigurePriceOracle":
72
+ case "ConfigureRateKeeper":
73
+ case "CreateCreditSuite":
69
74
  case "CreateMarket":
75
+ case "EmergencyConfigureCreditSuite":
76
+ case "EmergencyConfigureInterestRateModel":
77
+ case "EmergencyConfigureLossPolicy":
78
+ case "EmergencyConfigurePool":
79
+ case "EmergencyConfigurePriceOracle":
80
+ case "EmergencyConfigureRateKeeper":
81
+ case "EmergencyRevokeRole":
82
+ case "ExecuteHook":
83
+ case "GrantRole":
84
+ case "RemovePeripheryContract":
85
+ case "RevokeRole":
86
+ case "SetEmergencyAdmin":
87
+ case "ShutdownCreditSuite":
88
+ case "ShutdownMarket":
89
+ case "UnauthorizeFactory":
90
+ case "UpdateInterestRateModel":
91
+ case "UpdateLossPolicy":
92
+ case "UpdatePriceOracle":
93
+ case "UpdateRateKeeper":
94
+ case "UpgradeCreditFactory":
95
+ case "UpgradeInterestRateModelFactory":
96
+ case "UpgradeLossPolicyFactory":
97
+ case "UpgradePoolFactory":
98
+ case "UpgradePriceOracleFactory":
99
+ case "UpgradeRateKeeperFactory":
70
100
  this.dirty = true;
71
101
  break;
72
102
  }
@@ -296,6 +296,18 @@ class PriceOracleBaseContract extends import_base.BaseContract {
296
296
  ),
297
297
  reservePriceFeeds: Object.fromEntries(
298
298
  this.reservePriceFeeds.entries().map(([token, v]) => [this.labelAddress(token), v.stateHuman(raw)])
299
+ ),
300
+ mainPrices: Object.fromEntries(
301
+ this.mainPrices.entries().map(([token, price]) => [
302
+ this.labelAddress(token),
303
+ (0, import_utils.formatBN)(price, 8)
304
+ ])
305
+ ),
306
+ reservePrices: Object.fromEntries(
307
+ this.reservePrices.entries().map(([token, price]) => [
308
+ this.labelAddress(token),
309
+ (0, import_utils.formatBN)(price, 8)
310
+ ])
299
311
  )
300
312
  };
301
313
  }
@@ -40,12 +40,42 @@ class MarketConfiguratorContract extends BaseContract {
40
40
  }
41
41
  processLog(log) {
42
42
  switch (log.eventName) {
43
- // case "DeployDegenNFT":
44
- // case "SetName":
45
- // case "SetPriceFeedFromStore":
46
- // case "SetReservePriceFeedFromStore":
47
- case "ShutdownMarket":
43
+ case "AddPeripheryContract":
44
+ case "AddToken":
45
+ case "AuthorizeFactory":
46
+ case "ConfigureCreditSuite":
47
+ case "ConfigureInterestRateModel":
48
+ case "ConfigureLossPolicy":
49
+ case "ConfigurePool":
50
+ case "ConfigurePriceOracle":
51
+ case "ConfigureRateKeeper":
52
+ case "CreateCreditSuite":
48
53
  case "CreateMarket":
54
+ case "EmergencyConfigureCreditSuite":
55
+ case "EmergencyConfigureInterestRateModel":
56
+ case "EmergencyConfigureLossPolicy":
57
+ case "EmergencyConfigurePool":
58
+ case "EmergencyConfigurePriceOracle":
59
+ case "EmergencyConfigureRateKeeper":
60
+ case "EmergencyRevokeRole":
61
+ case "ExecuteHook":
62
+ case "GrantRole":
63
+ case "RemovePeripheryContract":
64
+ case "RevokeRole":
65
+ case "SetEmergencyAdmin":
66
+ case "ShutdownCreditSuite":
67
+ case "ShutdownMarket":
68
+ case "UnauthorizeFactory":
69
+ case "UpdateInterestRateModel":
70
+ case "UpdateLossPolicy":
71
+ case "UpdatePriceOracle":
72
+ case "UpdateRateKeeper":
73
+ case "UpgradeCreditFactory":
74
+ case "UpgradeInterestRateModelFactory":
75
+ case "UpgradeLossPolicyFactory":
76
+ case "UpgradePoolFactory":
77
+ case "UpgradePriceOracleFactory":
78
+ case "UpgradeRateKeeperFactory":
49
79
  this.dirty = true;
50
80
  break;
51
81
  }
@@ -3,7 +3,7 @@ import { iPriceFeedCompressorAbi } from "../../../abi/compressors.js";
3
3
  import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
4
4
  import { BaseContract } from "../../base/index.js";
5
5
  import { AP_PRICE_FEED_COMPRESSOR } from "../../constants/index.js";
6
- import { AddressMap } from "../../utils/index.js";
6
+ import { AddressMap, formatBN } from "../../utils/index.js";
7
7
  import { PriceFeedRef } from "../pricefeeds/index.js";
8
8
  class PriceOracleBaseContract extends BaseContract {
9
9
  /**
@@ -273,6 +273,18 @@ class PriceOracleBaseContract extends BaseContract {
273
273
  ),
274
274
  reservePriceFeeds: Object.fromEntries(
275
275
  this.reservePriceFeeds.entries().map(([token, v]) => [this.labelAddress(token), v.stateHuman(raw)])
276
+ ),
277
+ mainPrices: Object.fromEntries(
278
+ this.mainPrices.entries().map(([token, price]) => [
279
+ this.labelAddress(token),
280
+ formatBN(price, 8)
281
+ ])
282
+ ),
283
+ reservePrices: Object.fromEntries(
284
+ this.reservePrices.entries().map(([token, price]) => [
285
+ this.labelAddress(token),
286
+ formatBN(price, 8)
287
+ ])
276
288
  )
277
289
  };
278
290
  }
@@ -3,7 +3,7 @@ import type { BaseContractOptions } from "../../base/BaseContract.js";
3
3
  import type { PriceFeedMapEntry, PriceFeedTreeNode, PriceOracleData } from "../../base/index.js";
4
4
  import { BaseContract } from "../../base/index.js";
5
5
  import type { GearboxSDK } from "../../GearboxSDK.js";
6
- import type { PriceOracleV3StateHuman } from "../../types/index.js";
6
+ import type { PriceOracleStateHuman } from "../../types/index.js";
7
7
  import { AddressMap } from "../../utils/index.js";
8
8
  import type { IPriceFeedContract, UpdatePriceFeedsResult } from "../pricefeeds/index.js";
9
9
  import { PriceFeedRef } from "../pricefeeds/index.js";
@@ -414,6 +414,6 @@ export declare class PriceOracleBaseContract<abi extends Abi | readonly unknown[
414
414
  * @returns
415
415
  */
416
416
  protected findTokenForPriceFeed(priceFeed: Address): [token: Address | undefined, reserve: boolean];
417
- stateHuman(raw?: boolean): PriceOracleV3StateHuman;
417
+ stateHuman(raw?: boolean): PriceOracleStateHuman;
418
418
  protected get priceFeedTree(): readonly PriceFeedTreeNode[];
419
419
  }
@@ -151,12 +151,12 @@ export interface FindOpenStrategyPathProps {
151
151
  /**
152
152
  * Collateral assets + debt asset, nominated in ther respective tokens.
153
153
  * For example, if you open an USDC Credit Account, borrow 50_000 USDC and provide 10 WETH and 10_000 DAI as collateral
154
- * from your own funds, expectedBalances should be: [{amount: 10*10**wethDecimals}, {amount: 10000*10**daiDecimals}, {amount: 10000*10**usdcDecimals}]
154
+ * from your own funds, expectedBalances should be: [{amount: 10*10^wethDecimals}, {amount: 10000*10^daiDecimals}, {amount: 10000*10^usdcDecimals}]
155
155
  */
156
156
  expectedBalances: Array<Asset>;
157
157
  /**
158
158
  * Balances to keep on account after opening.
159
- * For example if don't want to swap WETH in the example above, leftoverBalances should be: [{amount: 10*10**wethDecimals}]
159
+ * For example if don't want to swap WETH in the example above, leftoverBalances should be: [{amount: 10*10^wethDecimals}]
160
160
  */
161
161
  leftoverBalances: Array<Asset>;
162
162
  /**
@@ -53,9 +53,11 @@ export interface RedstonePriceFeedStateHuman extends BasePriceFeedStateHuman {
53
53
  signers: Array<string>;
54
54
  signersThreshold: number;
55
55
  }
56
- export interface PriceOracleV3StateHuman extends BaseContractStateHuman {
56
+ export interface PriceOracleStateHuman extends BaseContractStateHuman {
57
57
  mainPriceFeeds: Record<string, PriceFeedStateHuman>;
58
58
  reservePriceFeeds: Record<string, PriceFeedStateHuman>;
59
+ mainPrices: Record<string, string>;
60
+ reservePrices: Record<string, string>;
59
61
  }
60
62
  export interface CreditFacadeStateHuman extends BaseContractStateHuman {
61
63
  expirable: boolean;
@@ -166,7 +168,7 @@ export interface MarketStateHuman {
166
168
  configurator: string;
167
169
  pool: PoolSuiteStateHuman;
168
170
  creditManagers: CreditSuiteStateHuman[];
169
- priceOracle: PriceOracleV3StateHuman;
171
+ priceOracle: PriceOracleStateHuman;
170
172
  pausableAdmins: string[];
171
173
  unpausableAdmins: string[];
172
174
  emergencyLiquidators: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-vfour.287",
3
+ "version": "3.0.0-vfour.289",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",