@gearbox-protocol/deploy-tools 1.6.0-next.16 → 1.6.0-next.17

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.
Files changed (2) hide show
  1. package/dist/index.js +1898 -413
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -368810,7 +368810,8 @@ var require_PoolQuotaKeeperV3Visitor = __commonJS({
368810
368810
  discoveryBlock: evt.blockNumber,
368811
368811
  version: types_1.VERSION_UNKNOWN,
368812
368812
  immutableState: {
368813
- pool: immutableState.pool
368813
+ pool: immutableState.pool,
368814
+ underlying: immutableState.underlying
368814
368815
  }
368815
368816
  });
368816
368817
  }
@@ -368898,7 +368899,8 @@ var require_PoolV3Visitor = __commonJS({
368898
368899
  discoveryBlock: log.blockNumber,
368899
368900
  version: types_1.VERSION_UNKNOWN,
368900
368901
  immutableState: {
368901
- pool: address
368902
+ pool: address,
368903
+ underlying: immutableState.underlying
368902
368904
  }
368903
368905
  });
368904
368906
  break;
@@ -370596,6 +370598,7 @@ var require_AbstractParser = __commonJS({
370596
370598
  };
370597
370599
  Object.defineProperty(exports2, "__esModule", { value: true });
370598
370600
  var ethers_1 = require_lib254();
370601
+ var container_1 = require_container();
370599
370602
  var log_1 = __importDefault2(require_log());
370600
370603
  var helpers_1 = require_helpers6();
370601
370604
  var _parseConstructor, parseConstructor_fn;
@@ -370663,6 +370666,39 @@ var require_AbstractParser = __commonJS({
370663
370666
  }
370664
370667
  throw new Error(`cannot parse constructor arguments ${encodedArgs} of address ${address}: all constructors failed`);
370665
370668
  }
370669
+ /**
370670
+ * Parser for amount in underlying token of some contract, thrown if underlying cannot be obtained from immutable state
370671
+ * @param parameter
370672
+ * @param parameters
370673
+ * @param address
370674
+ * @returns
370675
+ */
370676
+ parseUnderlyingAmount(parameter, parameters, address) {
370677
+ return (0, helpers_1.parseTokenAmount)(this.getUnderlying(address, this.contractType))(parameter, parameters, address);
370678
+ }
370679
+ /**
370680
+ * Helper to get underlying token from immutable state of contract in address tree
370681
+ * @param address
370682
+ * @param contractType
370683
+ * @returns
370684
+ */
370685
+ getUnderlying(address, contractType) {
370686
+ var _a;
370687
+ const entry = container_1.container.addressTree.getContract(address);
370688
+ if (!entry) {
370689
+ throw new Error(`cannot find ${address} in address tree`);
370690
+ }
370691
+ if (entry.contract !== contractType) {
370692
+ throw new Error(`was looking for ${contractType} at ${address}, but address tree contains ${entry.contract}`);
370693
+ }
370694
+ if (!("immutableState" in entry)) {
370695
+ throw new Error(`tree entry for ${contractType} at ${address}, has no immutable state`);
370696
+ }
370697
+ if (!((_a = entry.immutableState) == null ? void 0 : _a.underlying)) {
370698
+ throw new Error(`cannot find underlying in immutable state of ${contractType} at ${address}`);
370699
+ }
370700
+ return entry.immutableState.underlying;
370701
+ }
370666
370702
  get iFace() {
370667
370703
  if (!this._iFace) {
370668
370704
  throw new Error(`interface is not set for ${this.contractType} parser`);
@@ -371711,7 +371747,6 @@ var require_CreditConfiguratorV3Parser = __commonJS({
371711
371747
  };
371712
371748
  Object.defineProperty(exports2, "__esModule", { value: true });
371713
371749
  var sdk_1 = require_lib255();
371714
- var container_1 = require_container();
371715
371750
  var AbstractParser_1 = __importDefault2(require_AbstractParser());
371716
371751
  var helpers_1 = require_helpers6();
371717
371752
  var constructorAbi = {
@@ -371779,12 +371814,11 @@ var require_CreditConfiguratorV3Parser = __commonJS({
371779
371814
  stateMutability: "nonpayable",
371780
371815
  type: "constructor"
371781
371816
  };
371782
- var _parseCreditManagerOpts, parseCreditManagerOpts_fn, _getCreditManagerAddress, getCreditManagerAddress_fn;
371817
+ var _parseCreditManagerOpts, parseCreditManagerOpts_fn;
371783
371818
  var CreditConfiguratorV3Parser = class extends AbstractParser_1.default {
371784
371819
  constructor(contractType) {
371785
371820
  super(contractType, constructorAbi);
371786
371821
  __privateAdd(this, _parseCreditManagerOpts);
371787
- __privateAdd(this, _getCreditManagerAddress);
371788
371822
  this._iFace = (0, helpers_1.augmentInterface)(sdk_1.ICreditConfiguratorV3__factory.createInterface(), "function setController(address newController) external");
371789
371823
  this.parameterParsers = {
371790
371824
  constructor: [
@@ -371805,13 +371839,12 @@ var require_CreditConfiguratorV3Parser = __commonJS({
371805
371839
  }
371806
371840
  parseConstructor(address, encodedArgs) {
371807
371841
  const resp = super.parseConstructor(address, encodedArgs);
371808
- const cmAddr = resp.parameters[0].raw.value;
371809
- const cm = __privateMethod(this, _getCreditManagerAddress, getCreditManagerAddress_fn).call(this, cmAddr);
371842
+ const creditManager = resp.parameters[0].raw.value;
371810
371843
  return {
371811
371844
  ...resp,
371812
371845
  immutableState: {
371813
- creditManager: cmAddr,
371814
- underlying: cm.immutableState.underlying
371846
+ creditManager,
371847
+ underlying: this.getUnderlying(creditManager, "CREDIT_MANAGER_V3")
371815
371848
  }
371816
371849
  };
371817
371850
  }
@@ -371820,8 +371853,7 @@ var require_CreditConfiguratorV3Parser = __commonJS({
371820
371853
  parseCreditManagerOpts_fn = function(parameter, parameters) {
371821
371854
  const { maxDebt, minDebt, collateralTokens, ...rest } = parameter.value;
371822
371855
  const cmAddr = parameters[0].value;
371823
- const cm = __privateMethod(this, _getCreditManagerAddress, getCreditManagerAddress_fn).call(this, cmAddr);
371824
- const underlying = cm.immutableState.underlying.toLowerCase();
371856
+ const underlying = this.getUnderlying(cmAddr, "CREDIT_MANAGER_V3").toLowerCase();
371825
371857
  const symbol = sdk_1.tokenSymbolByAddress[underlying];
371826
371858
  return {
371827
371859
  raw: parameter,
@@ -371846,21 +371878,6 @@ var require_CreditConfiguratorV3Parser = __commonJS({
371846
371878
  }
371847
371879
  };
371848
371880
  };
371849
- _getCreditManagerAddress = new WeakSet();
371850
- getCreditManagerAddress_fn = function(cmAddr) {
371851
- var _a;
371852
- const entry = container_1.container.addressTree.getContract(cmAddr);
371853
- if (!entry) {
371854
- throw new Error(`constructor of credit configurator v3 cannot find credit manager ${cmAddr} in address tree`);
371855
- }
371856
- if (entry.contract !== "CREDIT_MANAGER_V3") {
371857
- throw new Error(`constructor of credit configurator v3 wants credit manager with address ${cmAddr}, but address tree has ${entry.contract}`);
371858
- }
371859
- if (!((_a = entry.immutableState) == null ? void 0 : _a.underlying)) {
371860
- throw new Error(`constructor of credit configurator v3 wants credit manager with address ${cmAddr}, but in address tree it has no immutable state`);
371861
- }
371862
- return entry;
371863
- };
371864
371881
  exports2.default = CreditConfiguratorV3Parser;
371865
371882
  }
371866
371883
  });
@@ -371894,14 +371911,11 @@ var require_CreditFacadeV3Parser = __commonJS({
371894
371911
  };
371895
371912
  Object.defineProperty(exports2, "__esModule", { value: true });
371896
371913
  var sdk_1 = require_lib255();
371897
- var container_1 = require_container();
371898
371914
  var AbstractParser_1 = __importDefault2(require_AbstractParser());
371899
371915
  var helpers_1 = require_helpers6();
371900
- var _getCreditManagerAddress, getCreditManagerAddress_fn;
371901
371916
  var CreditFacadeV3Parser = class extends AbstractParser_1.default {
371902
371917
  constructor(contractType) {
371903
371918
  super(contractType, "constructor(address creditManager, address degenNFT, bool expirable)");
371904
- __privateAdd(this, _getCreditManagerAddress);
371905
371919
  this._iFace = (0, helpers_1.augmentInterface)(sdk_1.ICreditFacadeV3__factory.createInterface(), "function setController(address newController) external");
371906
371920
  this.parameterParsers = {
371907
371921
  constructor: [(0, helpers_1.parseAddress)(), (0, helpers_1.parseAddress)(), void 0],
@@ -371910,33 +371924,16 @@ var require_CreditFacadeV3Parser = __commonJS({
371910
371924
  }
371911
371925
  parseConstructor(address, encodedArgs) {
371912
371926
  const resp = super.parseConstructor(address, encodedArgs);
371913
- const cmAddr = resp.parameters[0].raw.value;
371914
- const cm = __privateMethod(this, _getCreditManagerAddress, getCreditManagerAddress_fn).call(this, cmAddr);
371927
+ const creditManager = resp.parameters[0].raw.value;
371915
371928
  return {
371916
371929
  ...resp,
371917
371930
  immutableState: {
371918
- creditManager: cmAddr,
371919
- underlying: cm.immutableState.underlying
371931
+ creditManager,
371932
+ underlying: this.getUnderlying(creditManager, "CREDIT_MANAGER_V3")
371920
371933
  }
371921
371934
  };
371922
371935
  }
371923
371936
  };
371924
- _getCreditManagerAddress = new WeakSet();
371925
- getCreditManagerAddress_fn = function(cmAddr) {
371926
- var _a;
371927
- const entry = container_1.container.addressTree.getContract(cmAddr);
371928
- if (!entry) {
371929
- throw new Error(`constructor of credit facade v3 cannot find credit manager ${cmAddr} in address tree`);
371930
- }
371931
- if (entry.contract !== "CREDIT_MANAGER_V3") {
371932
- throw new Error(`constructor of credit facade v3 wants credit manager with address ${cmAddr}, but address tree has ${entry.contract}`);
371933
- }
371934
- const cm = entry;
371935
- if (!((_a = cm.immutableState) == null ? void 0 : _a.underlying)) {
371936
- throw new Error(`constructor of credit facade v3 wants credit manager with address ${cmAddr}, but in address tree it has no immutable state`);
371937
- }
371938
- return cm;
371939
- };
371940
371937
  exports2.default = CreditFacadeV3Parser;
371941
371938
  }
371942
371939
  });
@@ -371969,7 +371966,6 @@ var require_CreditManagerV1Parser = __commonJS({
371969
371966
  return mod && mod.__esModule ? mod : { "default": mod };
371970
371967
  };
371971
371968
  Object.defineProperty(exports2, "__esModule", { value: true });
371972
- var container_1 = require_container();
371973
371969
  var ICreditManager__factory_1 = require_ICreditManager_factory();
371974
371970
  var AbstractParser_1 = __importDefault2(require_AbstractParser());
371975
371971
  var CreditManagerV1Parser = class extends AbstractParser_1.default {
@@ -371979,22 +371975,12 @@ var require_CreditManagerV1Parser = __commonJS({
371979
371975
  }
371980
371976
  parseConstructor(address, encodedArgs) {
371981
371977
  const resp = super.parseConstructor(address, encodedArgs);
371982
- const poolAddr = resp.parameters[4].raw.value;
371983
- const entry = container_1.container.addressTree.getContract(poolAddr);
371984
- if (!entry) {
371985
- throw new Error(`consturctor of credit manager v1 at ${address} cannot find pool ${poolAddr} in address tree`);
371986
- }
371987
- if (entry.contract !== "POOL_V1") {
371988
- throw new Error(`consturctor of credit manager v1 at ${address} wants pool with address ${poolAddr}, but address tree has ${entry.contract}`);
371989
- }
371990
- if (!entry.immutableState.underlying) {
371991
- throw new Error(`consturctor of credit manager v1 at ${address} wants pool with address ${poolAddr}, but in address tree it has no immutable state`);
371992
- }
371978
+ const pool = resp.parameters[4].raw.value;
371993
371979
  return {
371994
371980
  ...resp,
371995
371981
  immutableState: {
371996
- underlying: entry.immutableState.underlying,
371997
- pool: poolAddr
371982
+ pool,
371983
+ underlying: this.getUnderlying(pool, "POOL_V1")
371998
371984
  }
371999
371985
  };
372000
371986
  }
@@ -372012,7 +371998,6 @@ var require_CreditManagerV2Parser = __commonJS({
372012
371998
  };
372013
371999
  Object.defineProperty(exports2, "__esModule", { value: true });
372014
372000
  var sdk_1 = require_lib255();
372015
- var container_1 = require_container();
372016
372001
  var AbstractParser_1 = __importDefault2(require_AbstractParser());
372017
372002
  var CreditManagerV2Parser = class extends AbstractParser_1.default {
372018
372003
  constructor(contractType) {
@@ -372020,24 +372005,13 @@ var require_CreditManagerV2Parser = __commonJS({
372020
372005
  this._iFace = sdk_1.ICreditManagerV2__factory.createInterface();
372021
372006
  }
372022
372007
  parseConstructor(address, encodedArgs) {
372023
- var _a;
372024
372008
  const resp = super.parseConstructor(address, encodedArgs);
372025
- const poolAddr = resp.parameters[0].raw.value;
372026
- const entry = container_1.container.addressTree.getContract(poolAddr);
372027
- if (!entry) {
372028
- throw new Error(`consturctor of credit manager v2 at ${address} cannot find pool ${poolAddr} in address tree`);
372029
- }
372030
- if (entry.contract !== "POOL_V1") {
372031
- throw new Error(`consturctor of credit manager v2 at ${address} wants pool with address ${poolAddr}, but address tree has ${entry.contract}`);
372032
- }
372033
- if (!((_a = entry.immutableState) == null ? void 0 : _a.underlying)) {
372034
- throw new Error(`consturctor of credit manager v2 at ${address} wants pool with address ${poolAddr}, but in address tree it has no immutable state`);
372035
- }
372009
+ const pool = resp.parameters[0].raw.value;
372036
372010
  return {
372037
372011
  ...resp,
372038
372012
  immutableState: {
372039
- pool: poolAddr,
372040
- underlying: entry.immutableState.underlying
372013
+ pool,
372014
+ underlying: this.getUnderlying(pool, "POOL_V1")
372041
372015
  }
372042
372016
  };
372043
372017
  }
@@ -372055,7 +372029,6 @@ var require_CreditManagerV3Parser = __commonJS({
372055
372029
  };
372056
372030
  Object.defineProperty(exports2, "__esModule", { value: true });
372057
372031
  var sdk_1 = require_lib255();
372058
- var container_1 = require_container();
372059
372032
  var AbstractParser_1 = __importDefault2(require_AbstractParser());
372060
372033
  var helpers_1 = require_helpers6();
372061
372034
  var CreditManagerV3Parser = class extends AbstractParser_1.default {
@@ -372067,25 +372040,14 @@ var require_CreditManagerV3Parser = __commonJS({
372067
372040
  };
372068
372041
  }
372069
372042
  parseConstructor(address, encodedArgs) {
372070
- var _a;
372071
372043
  const resp = super.parseConstructor(address, encodedArgs);
372072
- const poolAddr = resp.parameters[1].raw.value;
372073
- const pool = container_1.container.addressTree.getContract(poolAddr);
372074
- if (!pool) {
372075
- throw new Error(`consturctor of credit manager v3 at ${address} cannot find pool ${poolAddr} in address tree`);
372076
- }
372077
- if (pool.contract !== "POOL_V3") {
372078
- throw new Error(`consturctor of credit manager v3 at ${address} wants pool with address ${poolAddr}, but address tree has ${pool.contract}`);
372079
- }
372080
- if (!((_a = pool.immutableState) == null ? void 0 : _a.underlying)) {
372081
- throw new Error(`consturctor of credit manager v3 at ${address} wants pool with address ${poolAddr}, but in address tree it has no immutable state`);
372082
- }
372044
+ const pool = resp.parameters[1].raw.value;
372083
372045
  return {
372084
372046
  ...resp,
372085
372047
  name: `Credit Manager V3: ${resp.parameters[2].raw.value}`,
372086
372048
  immutableState: {
372087
- pool: poolAddr,
372088
- underlying: pool.immutableState.underlying
372049
+ pool,
372050
+ underlying: this.getUnderlying(pool, "POOL_V3")
372089
372051
  }
372090
372052
  };
372091
372053
  }
@@ -373040,10 +373002,12 @@ var require_GaugeV3Parser = __commonJS({
373040
373002
  }
373041
373003
  parseConstructor(address, encodedArgs) {
373042
373004
  const resp = super.parseConstructor(address, encodedArgs);
373005
+ const pool = resp.parameters[0].raw.value;
373043
373006
  return {
373044
373007
  ...resp,
373045
373008
  immutableState: {
373046
- pool: resp.parameters[0].raw.value
373009
+ pool,
373010
+ underlying: this.getUnderlying(pool, "POOL_V3")
373047
373011
  }
373048
373012
  };
373049
373013
  }
@@ -373229,7 +373193,7 @@ var require_PoolQuotaKeeperV3Parser = __commonJS({
373229
373193
  "addCreditManager(address)": [(0, helpers_1.parseAddress)()],
373230
373194
  "setTokenLimit(address,uint96)": [
373231
373195
  (0, helpers_1.parseToken)(),
373232
- (0, helpers_1.parseTokenArgumentAmount)(0, "limit")
373196
+ this.parseUnderlyingAmount
373233
373197
  ],
373234
373198
  "setTokenQuotaIncreaseFee(address,uint16)": [
373235
373199
  (0, helpers_1.parseToken)(),
@@ -373239,10 +373203,12 @@ var require_PoolQuotaKeeperV3Parser = __commonJS({
373239
373203
  }
373240
373204
  parseConstructor(address, encodedArgs) {
373241
373205
  const resp = super.parseConstructor(address, encodedArgs);
373206
+ const pool = resp.parameters[0].raw.value;
373242
373207
  return {
373243
373208
  ...resp,
373244
373209
  immutableState: {
373245
- pool: resp.parameters[0].raw.value
373210
+ pool,
373211
+ underlying: this.getUnderlying(pool, "POOL_V3")
373246
373212
  }
373247
373213
  };
373248
373214
  }
@@ -373293,14 +373259,11 @@ var require_PoolV3Parser = __commonJS({
373293
373259
  };
373294
373260
  Object.defineProperty(exports2, "__esModule", { value: true });
373295
373261
  var sdk_1 = require_lib255();
373296
- var container_1 = require_container();
373297
373262
  var AbstractParser_1 = __importDefault2(require_AbstractParser());
373298
373263
  var helpers_1 = require_helpers6();
373299
- var _parseUnderlyingAmount, parseUnderlyingAmount_fn;
373300
373264
  var PoolV3Parser = class extends AbstractParser_1.default {
373301
373265
  constructor(contractType) {
373302
373266
  super(contractType, "constructor(address addressProvider, address underlyingToken, address interestRateModel, uint256 totalDebtLimit, string memory name, string memory symbol)");
373303
- __privateAdd(this, _parseUnderlyingAmount);
373304
373267
  this._iFace = sdk_1.IPoolV3__factory.createInterface();
373305
373268
  this.parameterParsers = {
373306
373269
  constructor: [
@@ -373314,7 +373277,7 @@ var require_PoolV3Parser = __commonJS({
373314
373277
  "setPoolQuotaKeeper(address)": [(0, helpers_1.parseAddress)()],
373315
373278
  "setCreditManagerDebtLimit(address,uint256)": [
373316
373279
  (0, helpers_1.parseAddress)(),
373317
- __privateMethod(this, _parseUnderlyingAmount, parseUnderlyingAmount_fn)
373280
+ this.parseUnderlyingAmount
373318
373281
  ]
373319
373282
  };
373320
373283
  }
@@ -373330,18 +373293,6 @@ var require_PoolV3Parser = __commonJS({
373330
373293
  };
373331
373294
  }
373332
373295
  };
373333
- _parseUnderlyingAmount = new WeakSet();
373334
- parseUnderlyingAmount_fn = function(parameter, parameters, address) {
373335
- const self2 = container_1.container.addressTree.getContract(address);
373336
- if (!self2) {
373337
- throw new Error(`PoolV3 ${address} cannot find self in address tree`);
373338
- }
373339
- if (self2.contract !== "POOL_V3") {
373340
- throw new Error(`PoolV3 ${address} in address tree has different contract type ${self2.contract}`);
373341
- }
373342
- const underlying = self2.immutableState.underlying;
373343
- return (0, helpers_1.parseTokenAmount)(underlying)(parameter, parameters, address);
373344
- };
373345
373296
  exports2.default = PoolV3Parser;
373346
373297
  }
373347
373298
  });
@@ -373599,332 +373550,1855 @@ var require_factory5 = __commonJS({
373599
373550
  } catch (e) {
373600
373551
  throw new Error(`cannot get parser for ${address}: ${e}`);
373601
373552
  }
373602
- }
373603
- exports2.parserFor = parserFor;
373604
- var CONTRACT_NAME_TO_TYPE = new Map([
373605
- ["AddressProviderV3", "ADDRESS_PROVIDER_V3"],
373606
- ["BotListV3", "BOT_LIST"],
373607
- ["ControllerTimelockV3", "CONTROLLER_TIMELOCK_V3"],
373608
- ["CreditManagerV3", "CREDIT_MANAGER_V3"],
373609
- ["CreditFacadeV3", "CREDIT_FACADE_V3"],
373610
- ["CreditConfiguratorV3", "CREDIT_CONFIGURATOR_V3"],
373611
- ["CurveCryptoLPPriceFeed", "PRICE_FEED_CURVE_CRYPTO_ORACLE"],
373612
- ["DataCompressorV2_10", "DATA_COMPRESSOR_V210"],
373613
- ["DataCompressorV3_00", "DATA_COMPRESSOR_V3"],
373614
- ["FarmingPool", "ONE_INCH_FARMING_POOL"],
373615
- ["GaugeV3", "GAUGE_V3"],
373616
- ["GearStakingV3", "GEAR_STAKING"],
373617
- ["LinearInterestRateModelV3", "INTEREST_RATE_MODEL_V3"],
373618
- ["PoolQuotaKeeperV3", "POOL_QUOTA_KEEPER_V3"],
373619
- ["PoolV3", "POOL_V3"],
373620
- ["PriceOracleV3", "PRICE_ORACLE_V3"],
373621
- ["ZapperRegister", "ZAPPER_REGISTER"],
373622
- ...Object.keys(ZapperParser_1.ZAPPER_CONSTRUCTORS).map((z) => [z, "ZAPPER"]),
373623
- ...Object.entries(adapters_1.ADAPTER_NAMES),
373624
- ...Object.entries(feeds_1.FEED_NAMES)
373625
- ]);
373626
- function parserForContractName(name4) {
373627
- const contractType = CONTRACT_NAME_TO_TYPE.get(name4);
373628
- if (!contractType) {
373629
- throw new Error(`cannot find parser for contract named '${name4}'`);
373553
+ }
373554
+ exports2.parserFor = parserFor;
373555
+ var CONTRACT_NAME_TO_TYPE = new Map([
373556
+ ["AddressProviderV3", "ADDRESS_PROVIDER_V3"],
373557
+ ["BotListV3", "BOT_LIST"],
373558
+ ["ControllerTimelockV3", "CONTROLLER_TIMELOCK_V3"],
373559
+ ["CreditManagerV3", "CREDIT_MANAGER_V3"],
373560
+ ["CreditFacadeV3", "CREDIT_FACADE_V3"],
373561
+ ["CreditConfiguratorV3", "CREDIT_CONFIGURATOR_V3"],
373562
+ ["CurveCryptoLPPriceFeed", "PRICE_FEED_CURVE_CRYPTO_ORACLE"],
373563
+ ["DataCompressorV2_10", "DATA_COMPRESSOR_V210"],
373564
+ ["DataCompressorV3_00", "DATA_COMPRESSOR_V3"],
373565
+ ["FarmingPool", "ONE_INCH_FARMING_POOL"],
373566
+ ["GaugeV3", "GAUGE_V3"],
373567
+ ["GearStakingV3", "GEAR_STAKING"],
373568
+ ["LinearInterestRateModelV3", "INTEREST_RATE_MODEL_V3"],
373569
+ ["PoolQuotaKeeperV3", "POOL_QUOTA_KEEPER_V3"],
373570
+ ["PoolV3", "POOL_V3"],
373571
+ ["PriceOracleV3", "PRICE_ORACLE_V3"],
373572
+ ["ZapperRegister", "ZAPPER_REGISTER"],
373573
+ ...Object.keys(ZapperParser_1.ZAPPER_CONSTRUCTORS).map((z) => [z, "ZAPPER"]),
373574
+ ...Object.entries(adapters_1.ADAPTER_NAMES),
373575
+ ...Object.entries(feeds_1.FEED_NAMES)
373576
+ ]);
373577
+ function parserForContractName(name4) {
373578
+ const contractType = CONTRACT_NAME_TO_TYPE.get(name4);
373579
+ if (!contractType) {
373580
+ throw new Error(`cannot find parser for contract named '${name4}'`);
373581
+ }
373582
+ return parserForContractType(contractType, void 0, name4);
373583
+ }
373584
+ exports2.parserForContractName = parserForContractName;
373585
+ function parserForContractType(contract, version5, contractName) {
373586
+ let parser = (0, adapters_1.adapterParser)(contract, version5, contractName) ?? (0, feeds_1.priceFeedParser)(contract, version5, contractName);
373587
+ if (parser) {
373588
+ return parser;
373589
+ }
373590
+ switch (contract) {
373591
+ case "TIMELOCK":
373592
+ return new TimelockParser_1.default(contract);
373593
+ case "CREATE2_FACTORY":
373594
+ return new Create2FactoryParser_1.default(contract);
373595
+ case "ADDRESS_PROVIDER_V1":
373596
+ return new AddressProviderV1Parser_1.default(contract);
373597
+ case "ADDRESS_PROVIDER_V3":
373598
+ return new AddressProviderV3Parser_1.default(contract);
373599
+ case "CONTRACTS_REGISTER":
373600
+ return new ContractsRegisterParser_1.default(contract);
373601
+ case "BOT_LIST":
373602
+ return new BotListV3Parser_1.default(contract);
373603
+ case "GEAR_STAKING":
373604
+ return new GearStakingV3Parser_1.default(contract);
373605
+ case "POOL_V1":
373606
+ return new PoolV1Parser_1.default(contract);
373607
+ case "POOL_V3":
373608
+ return new PoolV3Parser_1.default(contract);
373609
+ case "POOL_QUOTA_KEEPER_V3":
373610
+ return new PoolQuotaKeeperV3Parser_1.default(contract);
373611
+ case "PRICE_ORACLE_V2":
373612
+ return new PriceOracleV2Parser_1.default(contract);
373613
+ case "PRICE_ORACLE_V3":
373614
+ return new PriceOracleV3Parser_1.default(contract);
373615
+ case "CREDIT_MANAGER_V1":
373616
+ return new CreditManagerV1Parser_1.default(contract);
373617
+ case "CREDIT_MANAGER_V2":
373618
+ return new CreditManagerV2Parser_1.default(contract);
373619
+ case "CREDIT_MANAGER_V3":
373620
+ return new CreditManagerV3Parser_1.default(contract);
373621
+ case "CREDIT_CONFIGURATOR_V2":
373622
+ return new CreditConfiguratorV2Parser_1.default(contract);
373623
+ case "CREDIT_CONFIGURATOR_V3":
373624
+ return new CreditConfiguratorV3Parser_1.default(contract);
373625
+ case "CREDIT_FACADE_V2":
373626
+ return new CreditFacadeV2Parser_1.default(contract);
373627
+ case "CREDIT_FACADE_V3":
373628
+ return new CreditFacadeV3Parser_1.default(contract);
373629
+ case "CREDIT_FILTER":
373630
+ return new CreditFilterParser_1.default(contract);
373631
+ case "GAUGE_V3":
373632
+ return new GaugeV3Parser_1.default(contract);
373633
+ case "DEGEN_NFT":
373634
+ return new DegenNFTParser_1.default(contract);
373635
+ case "INTEREST_RATE_MODEL_V1":
373636
+ return new InterestRateModelV1Parser_1.default(contract);
373637
+ case "INTEREST_RATE_MODEL_V3":
373638
+ return new InterestRateModelV3Parser_1.default(contract);
373639
+ case "DATA_COMPRESSOR_V2":
373640
+ return new DataCompressorV2Parser_1.default(contract);
373641
+ case "DATA_COMPRESSOR_V210":
373642
+ return new DataCompressorV210Parser_1.default(contract);
373643
+ case "DATA_COMPRESSOR_V3":
373644
+ return new DataCompressorV3Parser_1.default(contract);
373645
+ case "ZAPPER_REGISTER":
373646
+ return new ZapperRegisterParser_1.default(contract);
373647
+ case "ZAPPER":
373648
+ return new ZapperParser_1.default(contract, contractName);
373649
+ case "GOVERNOR_V3":
373650
+ return new GovernorV3Parser_1.default(contract);
373651
+ case "CONTROLLER_TIMELOCK_V3":
373652
+ return new ControllerTimelockV3Parser_1.default(contract);
373653
+ case "ONE_INCH_FARMING_POOL":
373654
+ return new OneInchFarmingPoolParser_1.default(contract);
373655
+ default: {
373656
+ const vstr = version5 ? `version ${version5}` : "";
373657
+ throw new Error(`cannot find parser for ${contract} ${vstr}`);
373658
+ }
373659
+ }
373660
+ }
373661
+ }
373662
+ });
373663
+
373664
+ // ../../packages/lib/dist/parsers/types.js
373665
+ var require_types36 = __commonJS({
373666
+ "../../packages/lib/dist/parsers/types.js"(exports2) {
373667
+ "use strict";
373668
+ Object.defineProperty(exports2, "__esModule", { value: true });
373669
+ }
373670
+ });
373671
+
373672
+ // ../../packages/lib/dist/parsers/index.js
373673
+ var require_parsers = __commonJS({
373674
+ "../../packages/lib/dist/parsers/index.js"(exports2) {
373675
+ "use strict";
373676
+ var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
373677
+ if (k2 === void 0)
373678
+ k2 = k;
373679
+ var desc = Object.getOwnPropertyDescriptor(m, k);
373680
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
373681
+ desc = { enumerable: true, get: function() {
373682
+ return m[k];
373683
+ } };
373684
+ }
373685
+ Object.defineProperty(o, k2, desc);
373686
+ } : function(o, m, k, k2) {
373687
+ if (k2 === void 0)
373688
+ k2 = k;
373689
+ o[k2] = m[k];
373690
+ });
373691
+ var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
373692
+ for (var p in m)
373693
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
373694
+ __createBinding2(exports3, m, p);
373695
+ };
373696
+ Object.defineProperty(exports2, "__esModule", { value: true });
373697
+ __exportStar2(require_factory5(), exports2);
373698
+ __exportStar2(require_types36(), exports2);
373699
+ }
373700
+ });
373701
+
373702
+ // ../../packages/lib/dist/UpdateParser.js
373703
+ var require_UpdateParser = __commonJS({
373704
+ "../../packages/lib/dist/UpdateParser.js"(exports2) {
373705
+ "use strict";
373706
+ var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
373707
+ return mod && mod.__esModule ? mod : { "default": mod };
373708
+ };
373709
+ Object.defineProperty(exports2, "__esModule", { value: true });
373710
+ exports2.UpdateParser = void 0;
373711
+ var promises_1 = require("fs/promises");
373712
+ var deploy_suite_1 = require_dist4();
373713
+ var ethers_1 = require_lib254();
373714
+ var container_1 = require_container();
373715
+ var helpers_1 = require_helpers();
373716
+ var batch_files_1 = require_batch_files();
373717
+ var log_1 = __importDefault2(require_log());
373718
+ var parsers_1 = require_parsers();
373719
+ var SafeBase_1 = require_SafeBase();
373720
+ var types_1 = require_types33();
373721
+ var _logger, _output2, _parseSafeTxHashes, parseSafeTxHashes_fn, _parseBatchAndMeta, parseBatchAndMeta_fn, _parseNormalizedBatch, parseNormalizedBatch_fn, _parseNormalizedTx, parseNormalizedTx_fn, _collectCreate2Addresses, collectCreate2Addresses_fn;
373722
+ var UpdateParser2 = class extends SafeBase_1.SafeBase {
373723
+ constructor(opts) {
373724
+ const provider = new ethers_1.ethers.providers.StaticJsonRpcProvider(opts.rpcUrl);
373725
+ super(provider, opts);
373726
+ __privateAdd(this, _parseSafeTxHashes);
373727
+ __privateAdd(this, _parseBatchAndMeta);
373728
+ __privateAdd(this, _parseNormalizedBatch);
373729
+ __privateAdd(this, _parseNormalizedTx);
373730
+ __privateAdd(this, _collectCreate2Addresses);
373731
+ __privateAdd(this, _logger, log_1.default.getSubLogger({ name: "parser" }));
373732
+ __privateAdd(this, _output2, {
373733
+ addresses: {},
373734
+ updates: []
373735
+ });
373736
+ }
373737
+ async parse(opts) {
373738
+ const { batchFile, metaFile, safeTxHashes } = opts;
373739
+ if (batchFile) {
373740
+ await __privateMethod(this, _parseBatchAndMeta, parseBatchAndMeta_fn).call(this, batchFile, metaFile);
373741
+ } else {
373742
+ await __privateMethod(this, _parseSafeTxHashes, parseSafeTxHashes_fn).call(this, safeTxHashes);
373743
+ }
373744
+ return __privateGet(this, _output2);
373745
+ }
373746
+ };
373747
+ _logger = new WeakMap();
373748
+ _output2 = new WeakMap();
373749
+ _parseSafeTxHashes = new WeakSet();
373750
+ parseSafeTxHashes_fn = async function(hashes) {
373751
+ const txPromises = hashes ? Promise.all(hashes.map((hash) => this.service.getTransaction(hash))) : this.service.getPendingTransactions(this.safeAddress).then((l) => (0, helpers_1.getTransactionsToExecute)(l));
373752
+ const txs = await txPromises;
373753
+ };
373754
+ _parseBatchAndMeta = new WeakSet();
373755
+ parseBatchAndMeta_fn = async function(batchFileOrDir, metaFile) {
373756
+ let meta;
373757
+ let batches;
373758
+ const batchStat = await (0, promises_1.stat)(batchFileOrDir);
373759
+ if (batchStat.isDirectory()) {
373760
+ __privateGet(this, _logger).trace(`'${batchFileOrDir}' is a directory`);
373761
+ const bd = await (0, batch_files_1.loadBatchDir)(batchFileOrDir);
373762
+ meta = bd.meta;
373763
+ batches = bd.batches;
373764
+ } else if (metaFile) {
373765
+ meta = await (0, promises_1.readFile)(metaFile, "utf-8").then(JSON.parse);
373766
+ const content = await (0, promises_1.readFile)(batchFileOrDir, "utf-8").then(JSON.parse);
373767
+ if (batchFileOrDir.endsWith(".execute.json")) {
373768
+ const isGovernorExecute = (0, deploy_suite_1.isExecutionBatch)(content);
373769
+ if (isGovernorExecute) {
373770
+ batches = [
373771
+ {
373772
+ format: "batch_pair",
373773
+ name: batchFileOrDir.replace(".execute.json", ""),
373774
+ execute: true,
373775
+ queue: false,
373776
+ transactions: (0, batch_files_1.normalizeGovernorExecuteBatch)(content),
373777
+ // TODO: when given single file, this can be any of three types
373778
+ type: "governor"
373779
+ }
373780
+ ];
373781
+ } else {
373782
+ batches = [
373783
+ {
373784
+ format: "batch_pair",
373785
+ name: batchFileOrDir.replace(".execute.json", ""),
373786
+ execute: true,
373787
+ queue: false,
373788
+ transactions: (0, batch_files_1.normalizeMultisigTx)(content),
373789
+ type: (0, deploy_suite_1.isTimelockBatch)(content) ? "timelock" : "direct"
373790
+ }
373791
+ ];
373792
+ }
373793
+ } else if (batchFileOrDir.endsWith(".queue.json")) {
373794
+ batches = [
373795
+ {
373796
+ format: "batch_pair",
373797
+ name: batchFileOrDir.replace(".queue.json", ""),
373798
+ queue: true,
373799
+ execute: false,
373800
+ transactions: (0, batch_files_1.normalizeMultisigTx)(content),
373801
+ type: (0, deploy_suite_1.hasGovernorBatchStart)(content) ? "governor" : "timelock"
373802
+ }
373803
+ ];
373804
+ } else {
373805
+ throw new Error(`invalid file name: ${batchFileOrDir}: neither queue nor execute`);
373806
+ }
373807
+ }
373808
+ if (!(batches == null ? void 0 : batches.length)) {
373809
+ throw new Error(`no batch files found in ${batchFileOrDir}`);
373810
+ }
373811
+ if (!meta) {
373812
+ __privateGet(this, _logger).info(`no metafile files found in ${batchFileOrDir} or metafile ${metaFile}`);
373813
+ } else {
373814
+ __privateGet(this, _logger).debug(`metafile contains ${Object.entries(meta).length} entries`);
373815
+ }
373816
+ __privateGet(this, _logger).info(`will parse ${batches.length} batch files`);
373817
+ for (let i = 0; i < batches.length; i++) {
373818
+ const parsed = await __privateMethod(this, _parseNormalizedBatch, parseNormalizedBatch_fn).call(this, batches[i], i, batches.length, meta ?? []);
373819
+ __privateGet(this, _output2).updates.push(parsed);
373820
+ }
373821
+ };
373822
+ _parseNormalizedBatch = new WeakSet();
373823
+ parseNormalizedBatch_fn = async function(batch, i, total, meta) {
373824
+ __privateGet(this, _logger).debug(`[${i + 1}/${total}] processing ${(0, batch_files_1.updateTtile)(batch)}`);
373825
+ const transactions = [];
373826
+ for (const tx of batch.transactions) {
373827
+ transactions.push(await __privateMethod(this, _parseNormalizedTx, parseNormalizedTx_fn).call(this, tx, meta));
373828
+ }
373829
+ return {
373830
+ ...batch,
373831
+ transactions
373832
+ };
373833
+ };
373834
+ _parseNormalizedTx = new WeakSet();
373835
+ parseNormalizedTx_fn = async function(tx, meta) {
373836
+ const contract = container_1.container.addressTree.getContract(tx.target);
373837
+ if (!contract) {
373838
+ throw new Error(`address ${tx.target} not found in gearbox contract tree`);
373839
+ }
373840
+ const parsed = await (0, parsers_1.parserFor)(contract).parse(tx.target, tx.data, tx.signature, meta);
373841
+ if ((0, types_1.isDeployTransaction)(parsed)) {
373842
+ const { to, contract: contract2, immutableState, name: name4 } = parsed.constructorTransaction;
373843
+ let newAddress = {
373844
+ address: to,
373845
+ contract: contract2,
373846
+ immutableState,
373847
+ name: name4,
373848
+ version: types_1.VERSION_UNKNOWN,
373849
+ isCreate2: true
373850
+ };
373851
+ const bytecode = parsed.parameters[1].raw.value;
373852
+ newAddress = await container_1.container.addressTree.addCreate2Address(newAddress, bytecode, meta);
373853
+ __privateGet(this, _output2).addresses[to.toLowerCase()] = newAddress;
373854
+ }
373855
+ const toAddr = container_1.container.addressTree.getContract(tx.target);
373856
+ if (!toAddr) {
373857
+ throw new Error(`tx target ${tx.target} not found in tree`);
373858
+ }
373859
+ __privateGet(this, _output2).addresses[tx.target.toLowerCase()] = toAddr;
373860
+ __privateMethod(this, _collectCreate2Addresses, collectCreate2Addresses_fn).call(this, parsed);
373861
+ return parsed;
373862
+ };
373863
+ _collectCreate2Addresses = new WeakSet();
373864
+ collectCreate2Addresses_fn = function(tx) {
373865
+ if ((0, types_1.isDeployTransaction)(tx)) {
373866
+ __privateMethod(this, _collectCreate2Addresses, collectCreate2Addresses_fn).call(this, tx.constructorTransaction);
373867
+ }
373868
+ for (const p of tx.parameters) {
373869
+ if (p.type === "gearbox_address") {
373870
+ const pAddr = container_1.container.addressTree.getContract(p.value);
373871
+ if (!pAddr) {
373872
+ throw new Error(`parameter ${p.name} is gearbox address, but is not found in tree`);
373873
+ }
373874
+ __privateGet(this, _output2).addresses[p.value.toLowerCase()] = pAddr;
373875
+ }
373876
+ }
373877
+ };
373878
+ exports2.UpdateParser = UpdateParser2;
373879
+ }
373880
+ });
373881
+
373882
+ // ../../packages/lib/dist/types/generated/CreditManager__factory.js
373883
+ var require_CreditManager_factory = __commonJS({
373884
+ "../../packages/lib/dist/types/generated/CreditManager__factory.js"(exports2) {
373885
+ "use strict";
373886
+ Object.defineProperty(exports2, "__esModule", { value: true });
373887
+ exports2.CreditManager__factory = void 0;
373888
+ var ethers_1 = require_lib254();
373889
+ var _abi = [
373890
+ {
373891
+ inputs: [
373892
+ {
373893
+ internalType: "address",
373894
+ name: "_pool",
373895
+ type: "address"
373896
+ }
373897
+ ],
373898
+ stateMutability: "nonpayable",
373899
+ type: "constructor"
373900
+ },
373901
+ {
373902
+ inputs: [],
373903
+ name: "AdaptersOrCreditFacadeOnlyException",
373904
+ type: "error"
373905
+ },
373906
+ {
373907
+ inputs: [],
373908
+ name: "AllowanceFailedException",
373909
+ type: "error"
373910
+ },
373911
+ {
373912
+ inputs: [],
373913
+ name: "CallerNotPausableAdminException",
373914
+ type: "error"
373915
+ },
373916
+ {
373917
+ inputs: [],
373918
+ name: "CallerNotUnPausableAdminException",
373919
+ type: "error"
373920
+ },
373921
+ {
373922
+ inputs: [],
373923
+ name: "CreditConfiguratorOnlyException",
373924
+ type: "error"
373925
+ },
373926
+ {
373927
+ inputs: [],
373928
+ name: "CreditFacadeOnlyException",
373929
+ type: "error"
373930
+ },
373931
+ {
373932
+ inputs: [],
373933
+ name: "HasNoOpenedAccountException",
373934
+ type: "error"
373935
+ },
373936
+ {
373937
+ inputs: [],
373938
+ name: "NotEnoughCollateralException",
373939
+ type: "error"
373940
+ },
373941
+ {
373942
+ inputs: [],
373943
+ name: "ReentrancyLockException",
373944
+ type: "error"
373945
+ },
373946
+ {
373947
+ inputs: [],
373948
+ name: "TargetContractNotAllowedException",
373949
+ type: "error"
373950
+ },
373951
+ {
373952
+ inputs: [],
373953
+ name: "TokenAlreadyAddedException",
373954
+ type: "error"
373955
+ },
373956
+ {
373957
+ inputs: [],
373958
+ name: "TokenNotAllowedException",
373959
+ type: "error"
373960
+ },
373961
+ {
373962
+ inputs: [],
373963
+ name: "TooManyEnabledTokensException",
373964
+ type: "error"
373965
+ },
373966
+ {
373967
+ inputs: [],
373968
+ name: "TooManyTokensException",
373969
+ type: "error"
373970
+ },
373971
+ {
373972
+ inputs: [],
373973
+ name: "ZeroAddressException",
373974
+ type: "error"
373975
+ },
373976
+ {
373977
+ inputs: [],
373978
+ name: "ZeroAddressOrUserAlreadyHasAccountException",
373979
+ type: "error"
373980
+ },
373981
+ {
373982
+ anonymous: false,
373983
+ inputs: [
373984
+ {
373985
+ indexed: true,
373986
+ internalType: "address",
373987
+ name: "borrower",
373988
+ type: "address"
373989
+ },
373990
+ {
373991
+ indexed: true,
373992
+ internalType: "address",
373993
+ name: "target",
373994
+ type: "address"
373995
+ }
373996
+ ],
373997
+ name: "ExecuteOrder",
373998
+ type: "event"
373999
+ },
374000
+ {
374001
+ anonymous: false,
374002
+ inputs: [
374003
+ {
374004
+ indexed: true,
374005
+ internalType: "address",
374006
+ name: "newConfigurator",
374007
+ type: "address"
374008
+ }
374009
+ ],
374010
+ name: "NewConfigurator",
374011
+ type: "event"
374012
+ },
374013
+ {
374014
+ anonymous: false,
374015
+ inputs: [
374016
+ {
374017
+ indexed: false,
374018
+ internalType: "address",
374019
+ name: "account",
374020
+ type: "address"
374021
+ }
374022
+ ],
374023
+ name: "Paused",
374024
+ type: "event"
374025
+ },
374026
+ {
374027
+ anonymous: false,
374028
+ inputs: [
374029
+ {
374030
+ indexed: false,
374031
+ internalType: "address",
374032
+ name: "account",
374033
+ type: "address"
374034
+ }
374035
+ ],
374036
+ name: "Unpaused",
374037
+ type: "event"
374038
+ },
374039
+ {
374040
+ inputs: [],
374041
+ name: "_accountFactory",
374042
+ outputs: [
374043
+ {
374044
+ internalType: "contract IAccountFactory",
374045
+ name: "",
374046
+ type: "address"
374047
+ }
374048
+ ],
374049
+ stateMutability: "view",
374050
+ type: "function"
374051
+ },
374052
+ {
374053
+ inputs: [],
374054
+ name: "_acl",
374055
+ outputs: [
374056
+ {
374057
+ internalType: "contract IACL",
374058
+ name: "",
374059
+ type: "address"
374060
+ }
374061
+ ],
374062
+ stateMutability: "view",
374063
+ type: "function"
374064
+ },
374065
+ {
374066
+ inputs: [
374067
+ {
374068
+ internalType: "address",
374069
+ name: "",
374070
+ type: "address"
374071
+ }
374072
+ ],
374073
+ name: "adapterToContract",
374074
+ outputs: [
374075
+ {
374076
+ internalType: "address",
374077
+ name: "",
374078
+ type: "address"
374079
+ }
374080
+ ],
374081
+ stateMutability: "view",
374082
+ type: "function"
374083
+ },
374084
+ {
374085
+ inputs: [
374086
+ {
374087
+ internalType: "address",
374088
+ name: "payer",
374089
+ type: "address"
374090
+ },
374091
+ {
374092
+ internalType: "address",
374093
+ name: "creditAccount",
374094
+ type: "address"
374095
+ },
374096
+ {
374097
+ internalType: "address",
374098
+ name: "token",
374099
+ type: "address"
374100
+ },
374101
+ {
374102
+ internalType: "uint256",
374103
+ name: "amount",
374104
+ type: "uint256"
374105
+ }
374106
+ ],
374107
+ name: "addCollateral",
374108
+ outputs: [],
374109
+ stateMutability: "nonpayable",
374110
+ type: "function"
374111
+ },
374112
+ {
374113
+ inputs: [
374114
+ {
374115
+ internalType: "address",
374116
+ name: "liquidator",
374117
+ type: "address"
374118
+ }
374119
+ ],
374120
+ name: "addEmergencyLiquidator",
374121
+ outputs: [],
374122
+ stateMutability: "nonpayable",
374123
+ type: "function"
374124
+ },
374125
+ {
374126
+ inputs: [
374127
+ {
374128
+ internalType: "address",
374129
+ name: "token",
374130
+ type: "address"
374131
+ }
374132
+ ],
374133
+ name: "addToken",
374134
+ outputs: [],
374135
+ stateMutability: "nonpayable",
374136
+ type: "function"
374137
+ },
374138
+ {
374139
+ inputs: [
374140
+ {
374141
+ internalType: "address",
374142
+ name: "borrower",
374143
+ type: "address"
374144
+ },
374145
+ {
374146
+ internalType: "address",
374147
+ name: "targetContract",
374148
+ type: "address"
374149
+ },
374150
+ {
374151
+ internalType: "address",
374152
+ name: "token",
374153
+ type: "address"
374154
+ },
374155
+ {
374156
+ internalType: "uint256",
374157
+ name: "amount",
374158
+ type: "uint256"
374159
+ }
374160
+ ],
374161
+ name: "approveCreditAccount",
374162
+ outputs: [],
374163
+ stateMutability: "nonpayable",
374164
+ type: "function"
374165
+ },
374166
+ {
374167
+ inputs: [
374168
+ {
374169
+ internalType: "uint256",
374170
+ name: "totalValue",
374171
+ type: "uint256"
374172
+ },
374173
+ {
374174
+ internalType: "enum ClosureAction",
374175
+ name: "closureActionType",
374176
+ type: "uint8"
374177
+ },
374178
+ {
374179
+ internalType: "uint256",
374180
+ name: "borrowedAmount",
374181
+ type: "uint256"
374182
+ },
374183
+ {
374184
+ internalType: "uint256",
374185
+ name: "borrowedAmountWithInterest",
374186
+ type: "uint256"
374187
+ }
374188
+ ],
374189
+ name: "calcClosePayments",
374190
+ outputs: [
374191
+ {
374192
+ internalType: "uint256",
374193
+ name: "amountToPool",
374194
+ type: "uint256"
374195
+ },
374196
+ {
374197
+ internalType: "uint256",
374198
+ name: "remainingFunds",
374199
+ type: "uint256"
374200
+ },
374201
+ {
374202
+ internalType: "uint256",
374203
+ name: "profit",
374204
+ type: "uint256"
374205
+ },
374206
+ {
374207
+ internalType: "uint256",
374208
+ name: "loss",
374209
+ type: "uint256"
374210
+ }
374211
+ ],
374212
+ stateMutability: "view",
374213
+ type: "function"
374214
+ },
374215
+ {
374216
+ inputs: [
374217
+ {
374218
+ internalType: "address",
374219
+ name: "creditAccount",
374220
+ type: "address"
374221
+ }
374222
+ ],
374223
+ name: "calcCreditAccountAccruedInterest",
374224
+ outputs: [
374225
+ {
374226
+ internalType: "uint256",
374227
+ name: "borrowedAmount",
374228
+ type: "uint256"
374229
+ },
374230
+ {
374231
+ internalType: "uint256",
374232
+ name: "borrowedAmountWithInterest",
374233
+ type: "uint256"
374234
+ },
374235
+ {
374236
+ internalType: "uint256",
374237
+ name: "borrowedAmountWithInterestAndFees",
374238
+ type: "uint256"
374239
+ }
374240
+ ],
374241
+ stateMutability: "view",
374242
+ type: "function"
374243
+ },
374244
+ {
374245
+ inputs: [
374246
+ {
374247
+ internalType: "address",
374248
+ name: "",
374249
+ type: "address"
374250
+ }
374251
+ ],
374252
+ name: "canLiquidateWhilePaused",
374253
+ outputs: [
374254
+ {
374255
+ internalType: "bool",
374256
+ name: "",
374257
+ type: "bool"
374258
+ }
374259
+ ],
374260
+ stateMutability: "view",
374261
+ type: "function"
374262
+ },
374263
+ {
374264
+ inputs: [
374265
+ {
374266
+ internalType: "address",
374267
+ name: "adapter",
374268
+ type: "address"
374269
+ },
374270
+ {
374271
+ internalType: "address",
374272
+ name: "targetContract",
374273
+ type: "address"
374274
+ }
374275
+ ],
374276
+ name: "changeContractAllowance",
374277
+ outputs: [],
374278
+ stateMutability: "nonpayable",
374279
+ type: "function"
374280
+ },
374281
+ {
374282
+ inputs: [
374283
+ {
374284
+ internalType: "address",
374285
+ name: "creditAccount",
374286
+ type: "address"
374287
+ },
374288
+ {
374289
+ internalType: "address",
374290
+ name: "token",
374291
+ type: "address"
374292
+ }
374293
+ ],
374294
+ name: "checkAndEnableToken",
374295
+ outputs: [],
374296
+ stateMutability: "nonpayable",
374297
+ type: "function"
374298
+ },
374299
+ {
374300
+ inputs: [
374301
+ {
374302
+ internalType: "address",
374303
+ name: "creditAccount",
374304
+ type: "address"
374305
+ }
374306
+ ],
374307
+ name: "checkAndOptimizeEnabledTokens",
374308
+ outputs: [],
374309
+ stateMutability: "nonpayable",
374310
+ type: "function"
374311
+ },
374312
+ {
374313
+ inputs: [
374314
+ {
374315
+ internalType: "address",
374316
+ name: "borrower",
374317
+ type: "address"
374318
+ },
374319
+ {
374320
+ internalType: "enum ClosureAction",
374321
+ name: "closureActionType",
374322
+ type: "uint8"
374323
+ },
374324
+ {
374325
+ internalType: "uint256",
374326
+ name: "totalValue",
374327
+ type: "uint256"
374328
+ },
374329
+ {
374330
+ internalType: "address",
374331
+ name: "payer",
374332
+ type: "address"
374333
+ },
374334
+ {
374335
+ internalType: "address",
374336
+ name: "to",
374337
+ type: "address"
374338
+ },
374339
+ {
374340
+ internalType: "uint256",
374341
+ name: "skipTokenMask",
374342
+ type: "uint256"
374343
+ },
374344
+ {
374345
+ internalType: "bool",
374346
+ name: "convertWETH",
374347
+ type: "bool"
374348
+ }
374349
+ ],
374350
+ name: "closeCreditAccount",
374351
+ outputs: [
374352
+ {
374353
+ internalType: "uint256",
374354
+ name: "remainingFunds",
374355
+ type: "uint256"
374356
+ }
374357
+ ],
374358
+ stateMutability: "nonpayable",
374359
+ type: "function"
374360
+ },
374361
+ {
374362
+ inputs: [
374363
+ {
374364
+ internalType: "uint256",
374365
+ name: "id",
374366
+ type: "uint256"
374367
+ }
374368
+ ],
374369
+ name: "collateralTokens",
374370
+ outputs: [
374371
+ {
374372
+ internalType: "address",
374373
+ name: "token",
374374
+ type: "address"
374375
+ },
374376
+ {
374377
+ internalType: "uint16",
374378
+ name: "liquidationThreshold",
374379
+ type: "uint16"
374380
+ }
374381
+ ],
374382
+ stateMutability: "view",
374383
+ type: "function"
374384
+ },
374385
+ {
374386
+ inputs: [
374387
+ {
374388
+ internalType: "uint256",
374389
+ name: "tokenMask",
374390
+ type: "uint256"
374391
+ }
374392
+ ],
374393
+ name: "collateralTokensByMask",
374394
+ outputs: [
374395
+ {
374396
+ internalType: "address",
374397
+ name: "token",
374398
+ type: "address"
374399
+ },
374400
+ {
374401
+ internalType: "uint16",
374402
+ name: "liquidationThreshold",
374403
+ type: "uint16"
374404
+ }
374405
+ ],
374406
+ stateMutability: "view",
374407
+ type: "function"
374408
+ },
374409
+ {
374410
+ inputs: [],
374411
+ name: "collateralTokensCount",
374412
+ outputs: [
374413
+ {
374414
+ internalType: "uint256",
374415
+ name: "",
374416
+ type: "uint256"
374417
+ }
374418
+ ],
374419
+ stateMutability: "view",
374420
+ type: "function"
374421
+ },
374422
+ {
374423
+ inputs: [
374424
+ {
374425
+ internalType: "address",
374426
+ name: "",
374427
+ type: "address"
374428
+ }
374429
+ ],
374430
+ name: "contractToAdapter",
374431
+ outputs: [
374432
+ {
374433
+ internalType: "address",
374434
+ name: "",
374435
+ type: "address"
374436
+ }
374437
+ ],
374438
+ stateMutability: "view",
374439
+ type: "function"
374440
+ },
374441
+ {
374442
+ inputs: [
374443
+ {
374444
+ internalType: "address",
374445
+ name: "",
374446
+ type: "address"
374447
+ }
374448
+ ],
374449
+ name: "creditAccounts",
374450
+ outputs: [
374451
+ {
374452
+ internalType: "address",
374453
+ name: "",
374454
+ type: "address"
374455
+ }
374456
+ ],
374457
+ stateMutability: "view",
374458
+ type: "function"
374459
+ },
374460
+ {
374461
+ inputs: [],
374462
+ name: "creditConfigurator",
374463
+ outputs: [
374464
+ {
374465
+ internalType: "address",
374466
+ name: "",
374467
+ type: "address"
374468
+ }
374469
+ ],
374470
+ stateMutability: "view",
374471
+ type: "function"
374472
+ },
374473
+ {
374474
+ inputs: [],
374475
+ name: "creditFacade",
374476
+ outputs: [
374477
+ {
374478
+ internalType: "address",
374479
+ name: "",
374480
+ type: "address"
374481
+ }
374482
+ ],
374483
+ stateMutability: "view",
374484
+ type: "function"
374485
+ },
374486
+ {
374487
+ inputs: [
374488
+ {
374489
+ internalType: "address",
374490
+ name: "",
374491
+ type: "address"
374492
+ }
374493
+ ],
374494
+ name: "cumulativeDropAtFastCheckRAY",
374495
+ outputs: [
374496
+ {
374497
+ internalType: "uint256",
374498
+ name: "",
374499
+ type: "uint256"
374500
+ }
374501
+ ],
374502
+ stateMutability: "view",
374503
+ type: "function"
374504
+ },
374505
+ {
374506
+ inputs: [
374507
+ {
374508
+ internalType: "address",
374509
+ name: "creditAccount",
374510
+ type: "address"
374511
+ },
374512
+ {
374513
+ internalType: "address",
374514
+ name: "token",
374515
+ type: "address"
374516
+ }
374517
+ ],
374518
+ name: "disableToken",
374519
+ outputs: [],
374520
+ stateMutability: "nonpayable",
374521
+ type: "function"
374522
+ },
374523
+ {
374524
+ inputs: [
374525
+ {
374526
+ internalType: "address",
374527
+ name: "",
374528
+ type: "address"
374529
+ }
374530
+ ],
374531
+ name: "enabledTokensMap",
374532
+ outputs: [
374533
+ {
374534
+ internalType: "uint256",
374535
+ name: "",
374536
+ type: "uint256"
374537
+ }
374538
+ ],
374539
+ stateMutability: "view",
374540
+ type: "function"
374541
+ },
374542
+ {
374543
+ inputs: [
374544
+ {
374545
+ internalType: "address",
374546
+ name: "borrower",
374547
+ type: "address"
374548
+ },
374549
+ {
374550
+ internalType: "address",
374551
+ name: "targetContract",
374552
+ type: "address"
374553
+ },
374554
+ {
374555
+ internalType: "bytes",
374556
+ name: "data",
374557
+ type: "bytes"
374558
+ }
374559
+ ],
374560
+ name: "executeOrder",
374561
+ outputs: [
374562
+ {
374563
+ internalType: "bytes",
374564
+ name: "",
374565
+ type: "bytes"
374566
+ }
374567
+ ],
374568
+ stateMutability: "nonpayable",
374569
+ type: "function"
374570
+ },
374571
+ {
374572
+ inputs: [
374573
+ {
374574
+ internalType: "address",
374575
+ name: "creditAccount",
374576
+ type: "address"
374577
+ },
374578
+ {
374579
+ internalType: "address",
374580
+ name: "tokenIn",
374581
+ type: "address"
374582
+ },
374583
+ {
374584
+ internalType: "address",
374585
+ name: "tokenOut",
374586
+ type: "address"
374587
+ },
374588
+ {
374589
+ internalType: "uint256",
374590
+ name: "balanceInBefore",
374591
+ type: "uint256"
374592
+ },
374593
+ {
374594
+ internalType: "uint256",
374595
+ name: "balanceOutBefore",
374596
+ type: "uint256"
374597
+ }
374598
+ ],
374599
+ name: "fastCollateralCheck",
374600
+ outputs: [],
374601
+ stateMutability: "nonpayable",
374602
+ type: "function"
374603
+ },
374604
+ {
374605
+ inputs: [],
374606
+ name: "fees",
374607
+ outputs: [
374608
+ {
374609
+ internalType: "uint16",
374610
+ name: "feeInterest",
374611
+ type: "uint16"
374612
+ },
374613
+ {
374614
+ internalType: "uint16",
374615
+ name: "feeLiquidation",
374616
+ type: "uint16"
374617
+ },
374618
+ {
374619
+ internalType: "uint16",
374620
+ name: "liquidationDiscount",
374621
+ type: "uint16"
374622
+ },
374623
+ {
374624
+ internalType: "uint16",
374625
+ name: "feeLiquidationExpired",
374626
+ type: "uint16"
374627
+ },
374628
+ {
374629
+ internalType: "uint16",
374630
+ name: "liquidationDiscountExpired",
374631
+ type: "uint16"
374632
+ }
374633
+ ],
374634
+ stateMutability: "view",
374635
+ type: "function"
374636
+ },
374637
+ {
374638
+ inputs: [],
374639
+ name: "forbiddenTokenMask",
374640
+ outputs: [
374641
+ {
374642
+ internalType: "uint256",
374643
+ name: "",
374644
+ type: "uint256"
374645
+ }
374646
+ ],
374647
+ stateMutability: "view",
374648
+ type: "function"
374649
+ },
374650
+ {
374651
+ inputs: [
374652
+ {
374653
+ internalType: "address",
374654
+ name: "creditAccount",
374655
+ type: "address"
374656
+ }
374657
+ ],
374658
+ name: "fullCollateralCheck",
374659
+ outputs: [],
374660
+ stateMutability: "nonpayable",
374661
+ type: "function"
374662
+ },
374663
+ {
374664
+ inputs: [
374665
+ {
374666
+ internalType: "address",
374667
+ name: "borrower",
374668
+ type: "address"
374669
+ }
374670
+ ],
374671
+ name: "getCreditAccountOrRevert",
374672
+ outputs: [
374673
+ {
374674
+ internalType: "address",
374675
+ name: "result",
374676
+ type: "address"
374677
+ }
374678
+ ],
374679
+ stateMutability: "view",
374680
+ type: "function"
374681
+ },
374682
+ {
374683
+ inputs: [
374684
+ {
374685
+ internalType: "address",
374686
+ name: "token",
374687
+ type: "address"
374688
+ }
374689
+ ],
374690
+ name: "liquidationThresholds",
374691
+ outputs: [
374692
+ {
374693
+ internalType: "uint16",
374694
+ name: "lt",
374695
+ type: "uint16"
374696
+ }
374697
+ ],
374698
+ stateMutability: "view",
374699
+ type: "function"
374700
+ },
374701
+ {
374702
+ inputs: [
374703
+ {
374704
+ internalType: "address",
374705
+ name: "creditAccount",
374706
+ type: "address"
374707
+ },
374708
+ {
374709
+ internalType: "uint256",
374710
+ name: "amount",
374711
+ type: "uint256"
374712
+ },
374713
+ {
374714
+ internalType: "bool",
374715
+ name: "increase",
374716
+ type: "bool"
374717
+ }
374718
+ ],
374719
+ name: "manageDebt",
374720
+ outputs: [
374721
+ {
374722
+ internalType: "uint256",
374723
+ name: "newBorrowedAmount",
374724
+ type: "uint256"
374725
+ }
374726
+ ],
374727
+ stateMutability: "nonpayable",
374728
+ type: "function"
374729
+ },
374730
+ {
374731
+ inputs: [],
374732
+ name: "maxAllowedEnabledTokenLength",
374733
+ outputs: [
374734
+ {
374735
+ internalType: "uint8",
374736
+ name: "",
374737
+ type: "uint8"
374738
+ }
374739
+ ],
374740
+ stateMutability: "view",
374741
+ type: "function"
374742
+ },
374743
+ {
374744
+ inputs: [
374745
+ {
374746
+ internalType: "uint256",
374747
+ name: "borrowedAmount",
374748
+ type: "uint256"
374749
+ },
374750
+ {
374751
+ internalType: "address",
374752
+ name: "onBehalfOf",
374753
+ type: "address"
374754
+ }
374755
+ ],
374756
+ name: "openCreditAccount",
374757
+ outputs: [
374758
+ {
374759
+ internalType: "address",
374760
+ name: "",
374761
+ type: "address"
374762
+ }
374763
+ ],
374764
+ stateMutability: "nonpayable",
374765
+ type: "function"
374766
+ },
374767
+ {
374768
+ inputs: [],
374769
+ name: "pause",
374770
+ outputs: [],
374771
+ stateMutability: "nonpayable",
374772
+ type: "function"
374773
+ },
374774
+ {
374775
+ inputs: [],
374776
+ name: "paused",
374777
+ outputs: [
374778
+ {
374779
+ internalType: "bool",
374780
+ name: "",
374781
+ type: "bool"
374782
+ }
374783
+ ],
374784
+ stateMutability: "view",
374785
+ type: "function"
374786
+ },
374787
+ {
374788
+ inputs: [],
374789
+ name: "pool",
374790
+ outputs: [
374791
+ {
374792
+ internalType: "address",
374793
+ name: "",
374794
+ type: "address"
374795
+ }
374796
+ ],
374797
+ stateMutability: "view",
374798
+ type: "function"
374799
+ },
374800
+ {
374801
+ inputs: [],
374802
+ name: "poolService",
374803
+ outputs: [
374804
+ {
374805
+ internalType: "address",
374806
+ name: "",
374807
+ type: "address"
374808
+ }
374809
+ ],
374810
+ stateMutability: "view",
374811
+ type: "function"
374812
+ },
374813
+ {
374814
+ inputs: [],
374815
+ name: "priceOracle",
374816
+ outputs: [
374817
+ {
374818
+ internalType: "contract IPriceOracleV2",
374819
+ name: "",
374820
+ type: "address"
374821
+ }
374822
+ ],
374823
+ stateMutability: "view",
374824
+ type: "function"
374825
+ },
374826
+ {
374827
+ inputs: [
374828
+ {
374829
+ internalType: "address",
374830
+ name: "liquidator",
374831
+ type: "address"
374832
+ }
374833
+ ],
374834
+ name: "removeEmergencyLiquidator",
374835
+ outputs: [],
374836
+ stateMutability: "nonpayable",
374837
+ type: "function"
374838
+ },
374839
+ {
374840
+ inputs: [
374841
+ {
374842
+ internalType: "address",
374843
+ name: "_creditConfigurator",
374844
+ type: "address"
374845
+ }
374846
+ ],
374847
+ name: "setConfigurator",
374848
+ outputs: [],
374849
+ stateMutability: "nonpayable",
374850
+ type: "function"
374851
+ },
374852
+ {
374853
+ inputs: [
374854
+ {
374855
+ internalType: "uint256",
374856
+ name: "_forbidMask",
374857
+ type: "uint256"
374858
+ }
374859
+ ],
374860
+ name: "setForbidMask",
374861
+ outputs: [],
374862
+ stateMutability: "nonpayable",
374863
+ type: "function"
374864
+ },
374865
+ {
374866
+ inputs: [
374867
+ {
374868
+ internalType: "address",
374869
+ name: "token",
374870
+ type: "address"
374871
+ },
374872
+ {
374873
+ internalType: "uint16",
374874
+ name: "liquidationThreshold",
374875
+ type: "uint16"
374876
+ }
374877
+ ],
374878
+ name: "setLiquidationThreshold",
374879
+ outputs: [],
374880
+ stateMutability: "nonpayable",
374881
+ type: "function"
374882
+ },
374883
+ {
374884
+ inputs: [
374885
+ {
374886
+ internalType: "uint8",
374887
+ name: "newMaxEnabledTokens",
374888
+ type: "uint8"
374889
+ }
374890
+ ],
374891
+ name: "setMaxEnabledTokens",
374892
+ outputs: [],
374893
+ stateMutability: "nonpayable",
374894
+ type: "function"
374895
+ },
374896
+ {
374897
+ inputs: [
374898
+ {
374899
+ internalType: "uint16",
374900
+ name: "_feeInterest",
374901
+ type: "uint16"
374902
+ },
374903
+ {
374904
+ internalType: "uint16",
374905
+ name: "_feeLiquidation",
374906
+ type: "uint16"
374907
+ },
374908
+ {
374909
+ internalType: "uint16",
374910
+ name: "_liquidationDiscount",
374911
+ type: "uint16"
374912
+ },
374913
+ {
374914
+ internalType: "uint16",
374915
+ name: "_feeLiquidationExpired",
374916
+ type: "uint16"
374917
+ },
374918
+ {
374919
+ internalType: "uint16",
374920
+ name: "_liquidationDiscountExpired",
374921
+ type: "uint16"
374922
+ }
374923
+ ],
374924
+ name: "setParams",
374925
+ outputs: [],
374926
+ stateMutability: "nonpayable",
374927
+ type: "function"
374928
+ },
374929
+ {
374930
+ inputs: [
374931
+ {
374932
+ internalType: "address",
374933
+ name: "token",
374934
+ type: "address"
374935
+ }
374936
+ ],
374937
+ name: "tokenMasksMap",
374938
+ outputs: [
374939
+ {
374940
+ internalType: "uint256",
374941
+ name: "mask",
374942
+ type: "uint256"
374943
+ }
374944
+ ],
374945
+ stateMutability: "view",
374946
+ type: "function"
374947
+ },
374948
+ {
374949
+ inputs: [
374950
+ {
374951
+ internalType: "address",
374952
+ name: "from",
374953
+ type: "address"
374954
+ },
374955
+ {
374956
+ internalType: "address",
374957
+ name: "to",
374958
+ type: "address"
374959
+ }
374960
+ ],
374961
+ name: "transferAccountOwnership",
374962
+ outputs: [],
374963
+ stateMutability: "nonpayable",
374964
+ type: "function"
374965
+ },
374966
+ {
374967
+ inputs: [],
374968
+ name: "underlying",
374969
+ outputs: [
374970
+ {
374971
+ internalType: "address",
374972
+ name: "",
374973
+ type: "address"
374974
+ }
374975
+ ],
374976
+ stateMutability: "view",
374977
+ type: "function"
374978
+ },
374979
+ {
374980
+ inputs: [],
374981
+ name: "universalAdapter",
374982
+ outputs: [
374983
+ {
374984
+ internalType: "address",
374985
+ name: "",
374986
+ type: "address"
374987
+ }
374988
+ ],
374989
+ stateMutability: "view",
374990
+ type: "function"
374991
+ },
374992
+ {
374993
+ inputs: [],
374994
+ name: "unpause",
374995
+ outputs: [],
374996
+ stateMutability: "nonpayable",
374997
+ type: "function"
374998
+ },
374999
+ {
375000
+ inputs: [
375001
+ {
375002
+ internalType: "address",
375003
+ name: "_creditFacade",
375004
+ type: "address"
375005
+ }
375006
+ ],
375007
+ name: "upgradeCreditFacade",
375008
+ outputs: [],
375009
+ stateMutability: "nonpayable",
375010
+ type: "function"
375011
+ },
375012
+ {
375013
+ inputs: [
375014
+ {
375015
+ internalType: "address",
375016
+ name: "_priceOracle",
375017
+ type: "address"
375018
+ }
375019
+ ],
375020
+ name: "upgradePriceOracle",
375021
+ outputs: [],
375022
+ stateMutability: "nonpayable",
375023
+ type: "function"
375024
+ },
375025
+ {
375026
+ inputs: [],
375027
+ name: "version",
375028
+ outputs: [
375029
+ {
375030
+ internalType: "uint256",
375031
+ name: "",
375032
+ type: "uint256"
375033
+ }
375034
+ ],
375035
+ stateMutability: "view",
375036
+ type: "function"
375037
+ },
375038
+ {
375039
+ inputs: [],
375040
+ name: "wethAddress",
375041
+ outputs: [
375042
+ {
375043
+ internalType: "address",
375044
+ name: "",
375045
+ type: "address"
375046
+ }
375047
+ ],
375048
+ stateMutability: "view",
375049
+ type: "function"
375050
+ },
375051
+ {
375052
+ inputs: [],
375053
+ name: "wethGateway",
375054
+ outputs: [
375055
+ {
375056
+ internalType: "address",
375057
+ name: "",
375058
+ type: "address"
375059
+ }
375060
+ ],
375061
+ stateMutability: "view",
375062
+ type: "function"
375063
+ }
375064
+ ];
375065
+ var _bytecode = "";
375066
+ var isSuperArgs = (xs) => xs.length > 1;
375067
+ var CreditManager__factory = class extends ethers_1.ContractFactory {
375068
+ constructor(...args) {
375069
+ if (isSuperArgs(args)) {
375070
+ super(...args);
375071
+ } else {
375072
+ super(_abi, _bytecode, args[0]);
375073
+ }
373630
375074
  }
373631
- return parserForContractType(contractType, void 0, name4);
373632
- }
373633
- exports2.parserForContractName = parserForContractName;
373634
- function parserForContractType(contract, version5, contractName) {
373635
- let parser = (0, adapters_1.adapterParser)(contract, version5, contractName) ?? (0, feeds_1.priceFeedParser)(contract, version5, contractName);
373636
- if (parser) {
373637
- return parser;
375075
+ deploy(_pool, overrides) {
375076
+ return super.deploy(_pool, overrides || {});
373638
375077
  }
373639
- switch (contract) {
373640
- case "TIMELOCK":
373641
- return new TimelockParser_1.default(contract);
373642
- case "CREATE2_FACTORY":
373643
- return new Create2FactoryParser_1.default(contract);
373644
- case "ADDRESS_PROVIDER_V1":
373645
- return new AddressProviderV1Parser_1.default(contract);
373646
- case "ADDRESS_PROVIDER_V3":
373647
- return new AddressProviderV3Parser_1.default(contract);
373648
- case "CONTRACTS_REGISTER":
373649
- return new ContractsRegisterParser_1.default(contract);
373650
- case "BOT_LIST":
373651
- return new BotListV3Parser_1.default(contract);
373652
- case "GEAR_STAKING":
373653
- return new GearStakingV3Parser_1.default(contract);
373654
- case "POOL_V1":
373655
- return new PoolV1Parser_1.default(contract);
373656
- case "POOL_V3":
373657
- return new PoolV3Parser_1.default(contract);
373658
- case "POOL_QUOTA_KEEPER_V3":
373659
- return new PoolQuotaKeeperV3Parser_1.default(contract);
373660
- case "PRICE_ORACLE_V2":
373661
- return new PriceOracleV2Parser_1.default(contract);
373662
- case "PRICE_ORACLE_V3":
373663
- return new PriceOracleV3Parser_1.default(contract);
373664
- case "CREDIT_MANAGER_V1":
373665
- return new CreditManagerV1Parser_1.default(contract);
373666
- case "CREDIT_MANAGER_V2":
373667
- return new CreditManagerV2Parser_1.default(contract);
373668
- case "CREDIT_MANAGER_V3":
373669
- return new CreditManagerV3Parser_1.default(contract);
373670
- case "CREDIT_CONFIGURATOR_V2":
373671
- return new CreditConfiguratorV2Parser_1.default(contract);
373672
- case "CREDIT_CONFIGURATOR_V3":
373673
- return new CreditConfiguratorV3Parser_1.default(contract);
373674
- case "CREDIT_FACADE_V2":
373675
- return new CreditFacadeV2Parser_1.default(contract);
373676
- case "CREDIT_FACADE_V3":
373677
- return new CreditFacadeV3Parser_1.default(contract);
373678
- case "CREDIT_FILTER":
373679
- return new CreditFilterParser_1.default(contract);
373680
- case "GAUGE_V3":
373681
- return new GaugeV3Parser_1.default(contract);
373682
- case "DEGEN_NFT":
373683
- return new DegenNFTParser_1.default(contract);
373684
- case "INTEREST_RATE_MODEL_V1":
373685
- return new InterestRateModelV1Parser_1.default(contract);
373686
- case "INTEREST_RATE_MODEL_V3":
373687
- return new InterestRateModelV3Parser_1.default(contract);
373688
- case "DATA_COMPRESSOR_V2":
373689
- return new DataCompressorV2Parser_1.default(contract);
373690
- case "DATA_COMPRESSOR_V210":
373691
- return new DataCompressorV210Parser_1.default(contract);
373692
- case "DATA_COMPRESSOR_V3":
373693
- return new DataCompressorV3Parser_1.default(contract);
373694
- case "ZAPPER_REGISTER":
373695
- return new ZapperRegisterParser_1.default(contract);
373696
- case "ZAPPER":
373697
- return new ZapperParser_1.default(contract, contractName);
373698
- case "GOVERNOR_V3":
373699
- return new GovernorV3Parser_1.default(contract);
373700
- case "CONTROLLER_TIMELOCK_V3":
373701
- return new ControllerTimelockV3Parser_1.default(contract);
373702
- case "ONE_INCH_FARMING_POOL":
373703
- return new OneInchFarmingPoolParser_1.default(contract);
373704
- default: {
373705
- const vstr = version5 ? `version ${version5}` : "";
373706
- throw new Error(`cannot find parser for ${contract} ${vstr}`);
373707
- }
375078
+ getDeployTransaction(_pool, overrides) {
375079
+ return super.getDeployTransaction(_pool, overrides || {});
373708
375080
  }
373709
- }
375081
+ attach(address) {
375082
+ return super.attach(address);
375083
+ }
375084
+ connect(signer) {
375085
+ return super.connect(signer);
375086
+ }
375087
+ static bytecode = _bytecode;
375088
+ static abi = _abi;
375089
+ static createInterface() {
375090
+ return new ethers_1.utils.Interface(_abi);
375091
+ }
375092
+ static connect(address, signerOrProvider) {
375093
+ return new ethers_1.Contract(address, _abi, signerOrProvider);
375094
+ }
375095
+ };
375096
+ exports2.CreditManager__factory = CreditManager__factory;
373710
375097
  }
373711
375098
  });
373712
375099
 
373713
- // ../../packages/lib/dist/parsers/types.js
373714
- var require_types36 = __commonJS({
373715
- "../../packages/lib/dist/parsers/types.js"(exports2) {
375100
+ // ../../packages/lib/dist/types/generated/IACL__factory.js
375101
+ var require_IACL_factory = __commonJS({
375102
+ "../../packages/lib/dist/types/generated/IACL__factory.js"(exports2) {
373716
375103
  "use strict";
373717
375104
  Object.defineProperty(exports2, "__esModule", { value: true });
373718
- }
373719
- });
373720
-
373721
- // ../../packages/lib/dist/parsers/index.js
373722
- var require_parsers = __commonJS({
373723
- "../../packages/lib/dist/parsers/index.js"(exports2) {
373724
- "use strict";
373725
- var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
373726
- if (k2 === void 0)
373727
- k2 = k;
373728
- var desc = Object.getOwnPropertyDescriptor(m, k);
373729
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
373730
- desc = { enumerable: true, get: function() {
373731
- return m[k];
373732
- } };
375105
+ exports2.IACL__factory = void 0;
375106
+ var ethers_1 = require_lib254();
375107
+ var _abi = [
375108
+ {
375109
+ inputs: [
375110
+ {
375111
+ internalType: "address",
375112
+ name: "addr",
375113
+ type: "address"
375114
+ }
375115
+ ],
375116
+ name: "AddressNotPausableAdminException",
375117
+ type: "error"
375118
+ },
375119
+ {
375120
+ inputs: [
375121
+ {
375122
+ internalType: "address",
375123
+ name: "addr",
375124
+ type: "address"
375125
+ }
375126
+ ],
375127
+ name: "AddressNotUnpausableAdminException",
375128
+ type: "error"
375129
+ },
375130
+ {
375131
+ anonymous: false,
375132
+ inputs: [
375133
+ {
375134
+ indexed: true,
375135
+ internalType: "address",
375136
+ name: "newAdmin",
375137
+ type: "address"
375138
+ }
375139
+ ],
375140
+ name: "PausableAdminAdded",
375141
+ type: "event"
375142
+ },
375143
+ {
375144
+ anonymous: false,
375145
+ inputs: [
375146
+ {
375147
+ indexed: true,
375148
+ internalType: "address",
375149
+ name: "admin",
375150
+ type: "address"
375151
+ }
375152
+ ],
375153
+ name: "PausableAdminRemoved",
375154
+ type: "event"
375155
+ },
375156
+ {
375157
+ anonymous: false,
375158
+ inputs: [
375159
+ {
375160
+ indexed: true,
375161
+ internalType: "address",
375162
+ name: "newAdmin",
375163
+ type: "address"
375164
+ }
375165
+ ],
375166
+ name: "UnpausableAdminAdded",
375167
+ type: "event"
375168
+ },
375169
+ {
375170
+ anonymous: false,
375171
+ inputs: [
375172
+ {
375173
+ indexed: true,
375174
+ internalType: "address",
375175
+ name: "admin",
375176
+ type: "address"
375177
+ }
375178
+ ],
375179
+ name: "UnpausableAdminRemoved",
375180
+ type: "event"
375181
+ },
375182
+ {
375183
+ inputs: [
375184
+ {
375185
+ internalType: "address",
375186
+ name: "account",
375187
+ type: "address"
375188
+ }
375189
+ ],
375190
+ name: "isConfigurator",
375191
+ outputs: [
375192
+ {
375193
+ internalType: "bool",
375194
+ name: "",
375195
+ type: "bool"
375196
+ }
375197
+ ],
375198
+ stateMutability: "view",
375199
+ type: "function"
375200
+ },
375201
+ {
375202
+ inputs: [
375203
+ {
375204
+ internalType: "address",
375205
+ name: "addr",
375206
+ type: "address"
375207
+ }
375208
+ ],
375209
+ name: "isPausableAdmin",
375210
+ outputs: [
375211
+ {
375212
+ internalType: "bool",
375213
+ name: "",
375214
+ type: "bool"
375215
+ }
375216
+ ],
375217
+ stateMutability: "view",
375218
+ type: "function"
375219
+ },
375220
+ {
375221
+ inputs: [
375222
+ {
375223
+ internalType: "address",
375224
+ name: "addr",
375225
+ type: "address"
375226
+ }
375227
+ ],
375228
+ name: "isUnpausableAdmin",
375229
+ outputs: [
375230
+ {
375231
+ internalType: "bool",
375232
+ name: "",
375233
+ type: "bool"
375234
+ }
375235
+ ],
375236
+ stateMutability: "view",
375237
+ type: "function"
375238
+ },
375239
+ {
375240
+ inputs: [],
375241
+ name: "owner",
375242
+ outputs: [
375243
+ {
375244
+ internalType: "address",
375245
+ name: "",
375246
+ type: "address"
375247
+ }
375248
+ ],
375249
+ stateMutability: "view",
375250
+ type: "function"
375251
+ },
375252
+ {
375253
+ inputs: [],
375254
+ name: "version",
375255
+ outputs: [
375256
+ {
375257
+ internalType: "uint256",
375258
+ name: "",
375259
+ type: "uint256"
375260
+ }
375261
+ ],
375262
+ stateMutability: "view",
375263
+ type: "function"
375264
+ }
375265
+ ];
375266
+ var IACL__factory = class {
375267
+ static abi = _abi;
375268
+ static createInterface() {
375269
+ return new ethers_1.utils.Interface(_abi);
375270
+ }
375271
+ static connect(address, signerOrProvider) {
375272
+ return new ethers_1.Contract(address, _abi, signerOrProvider);
373733
375273
  }
373734
- Object.defineProperty(o, k2, desc);
373735
- } : function(o, m, k, k2) {
373736
- if (k2 === void 0)
373737
- k2 = k;
373738
- o[k2] = m[k];
373739
- });
373740
- var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
373741
- for (var p in m)
373742
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
373743
- __createBinding2(exports3, m, p);
373744
375274
  };
373745
- Object.defineProperty(exports2, "__esModule", { value: true });
373746
- __exportStar2(require_factory5(), exports2);
373747
- __exportStar2(require_types36(), exports2);
375275
+ exports2.IACL__factory = IACL__factory;
373748
375276
  }
373749
375277
  });
373750
375278
 
373751
- // ../../packages/lib/dist/UpdateParser.js
373752
- var require_UpdateParser = __commonJS({
373753
- "../../packages/lib/dist/UpdateParser.js"(exports2) {
375279
+ // ../../packages/lib/dist/ZeroLT.js
375280
+ var require_ZeroLT = __commonJS({
375281
+ "../../packages/lib/dist/ZeroLT.js"(exports2) {
373754
375282
  "use strict";
373755
375283
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
373756
375284
  return mod && mod.__esModule ? mod : { "default": mod };
373757
375285
  };
373758
375286
  Object.defineProperty(exports2, "__esModule", { value: true });
373759
- exports2.UpdateParser = void 0;
373760
- var promises_1 = require("fs/promises");
373761
- var deploy_suite_1 = require_dist4();
375287
+ exports2.ZeroLT = void 0;
375288
+ var sdk_1 = require_lib255();
373762
375289
  var ethers_1 = require_lib254();
373763
- var container_1 = require_container();
373764
- var helpers_1 = require_helpers();
373765
- var batch_files_1 = require_batch_files();
375290
+ var constants_1 = require_constants7();
373766
375291
  var log_1 = __importDefault2(require_log());
373767
- var parsers_1 = require_parsers();
373768
- var SafeBase_1 = require_SafeBase();
373769
- var types_1 = require_types33();
373770
- var _logger, _output2, _parseSafeTxHashes, parseSafeTxHashes_fn, _parseBatchAndMeta, parseBatchAndMeta_fn, _parseNormalizedBatch, parseNormalizedBatch_fn, _parseNormalizedTx, parseNormalizedTx_fn, _collectCreate2Addresses, collectCreate2Addresses_fn;
373771
- var UpdateParser2 = class extends SafeBase_1.SafeBase {
375292
+ var CreditManager__factory_1 = require_CreditManager_factory();
375293
+ var IACL__factory_1 = require_IACL_factory();
375294
+ var utils_1 = require_utils33();
375295
+ var _logger, _acl, _dc210, _dc300, _configrator, _provider, _setOnV2, setOnV2_fn, _setOnV3, setOnV3_fn;
375296
+ var ZeroLT2 = class {
373772
375297
  constructor(opts) {
373773
- const provider = new ethers_1.ethers.providers.StaticJsonRpcProvider(opts.rpcUrl);
373774
- super(provider, opts);
373775
- __privateAdd(this, _parseSafeTxHashes);
373776
- __privateAdd(this, _parseBatchAndMeta);
373777
- __privateAdd(this, _parseNormalizedBatch);
373778
- __privateAdd(this, _parseNormalizedTx);
373779
- __privateAdd(this, _collectCreate2Addresses);
373780
- __privateAdd(this, _logger, log_1.default.getSubLogger({ name: "parser" }));
373781
- __privateAdd(this, _output2, {
373782
- addresses: {},
373783
- updates: []
373784
- });
373785
- }
373786
- async parse(opts) {
373787
- const { batchFile, metaFile, safeTxHashes } = opts;
373788
- if (batchFile) {
373789
- await __privateMethod(this, _parseBatchAndMeta, parseBatchAndMeta_fn).call(this, batchFile, metaFile);
373790
- } else {
373791
- await __privateMethod(this, _parseSafeTxHashes, parseSafeTxHashes_fn).call(this, safeTxHashes);
373792
- }
373793
- return __privateGet(this, _output2);
375298
+ __privateAdd(this, _setOnV2);
375299
+ __privateAdd(this, _setOnV3);
375300
+ __privateAdd(this, _logger, log_1.default.getSubLogger());
375301
+ __privateAdd(this, _acl, void 0);
375302
+ __privateAdd(this, _dc210, void 0);
375303
+ __privateAdd(this, _dc300, void 0);
375304
+ __privateAdd(this, _configrator, void 0);
375305
+ __privateAdd(this, _provider, void 0);
375306
+ __privateSet(this, _provider, new ethers_1.ethers.providers.StaticJsonRpcProvider(opts.rpcUrl));
373794
375307
  }
373795
- };
373796
- _logger = new WeakMap();
373797
- _output2 = new WeakMap();
373798
- _parseSafeTxHashes = new WeakSet();
373799
- parseSafeTxHashes_fn = async function(hashes) {
373800
- const txPromises = hashes ? Promise.all(hashes.map((hash) => this.service.getTransaction(hash))) : this.service.getPendingTransactions(this.safeAddress).then((l) => (0, helpers_1.getTransactionsToExecute)(l));
373801
- const txs = await txPromises;
373802
- };
373803
- _parseBatchAndMeta = new WeakSet();
373804
- parseBatchAndMeta_fn = async function(batchFileOrDir, metaFile) {
373805
- let meta;
373806
- let batches;
373807
- const batchStat = await (0, promises_1.stat)(batchFileOrDir);
373808
- if (batchStat.isDirectory()) {
373809
- __privateGet(this, _logger).trace(`'${batchFileOrDir}' is a directory`);
373810
- const bd = await (0, batch_files_1.loadBatchDir)(batchFileOrDir);
373811
- meta = bd.meta;
373812
- batches = bd.batches;
373813
- } else if (metaFile) {
373814
- meta = await (0, promises_1.readFile)(metaFile, "utf-8").then(JSON.parse);
373815
- const content = await (0, promises_1.readFile)(batchFileOrDir, "utf-8").then(JSON.parse);
373816
- if (batchFileOrDir.endsWith(".execute.json")) {
373817
- const isGovernorExecute = (0, deploy_suite_1.isExecutionBatch)(content);
373818
- if (isGovernorExecute) {
373819
- batches = [
373820
- {
373821
- format: "batch_pair",
373822
- name: batchFileOrDir.replace(".execute.json", ""),
373823
- execute: true,
373824
- queue: false,
373825
- transactions: (0, batch_files_1.normalizeGovernorExecuteBatch)(content),
373826
- // TODO: when given single file, this can be any of three types
373827
- type: "governor"
373828
- }
373829
- ];
373830
- } else {
373831
- batches = [
373832
- {
373833
- format: "batch_pair",
373834
- name: batchFileOrDir.replace(".execute.json", ""),
373835
- execute: true,
373836
- queue: false,
373837
- transactions: (0, batch_files_1.normalizeMultisigTx)(content),
373838
- type: (0, deploy_suite_1.isTimelockBatch)(content) ? "timelock" : "direct"
373839
- }
373840
- ];
373841
- }
373842
- } else if (batchFileOrDir.endsWith(".queue.json")) {
373843
- batches = [
373844
- {
373845
- format: "batch_pair",
373846
- name: batchFileOrDir.replace(".queue.json", ""),
373847
- queue: true,
373848
- execute: false,
373849
- transactions: (0, batch_files_1.normalizeMultisigTx)(content),
373850
- type: (0, deploy_suite_1.hasGovernorBatchStart)(content) ? "governor" : "timelock"
373851
- }
373852
- ];
373853
- } else {
373854
- throw new Error(`invalid file name: ${batchFileOrDir}: neither queue nor execute`);
375308
+ async setLtZero() {
375309
+ var _a, _b;
375310
+ __privateGet(this, _logger).info("running zero lt script");
375311
+ const addressProvider = sdk_1.IAddressProviderV3__factory.connect(constants_1.ADDRESS_PROVIDER_V3_ADDRESS, __privateGet(this, _provider));
375312
+ (_a = __privateGet(this, _logger)) == null ? void 0 : _a.debug(`addressProvider: ${addressProvider.address}`);
375313
+ const [dc210Addr, dc300Addr, aclAddr] = await Promise.all([
375314
+ await addressProvider.getAddressOrRevert(ethers_1.ethers.utils.formatBytes32String("DATA_COMPRESSOR"), 210),
375315
+ await addressProvider.getAddressOrRevert(ethers_1.ethers.utils.formatBytes32String("DATA_COMPRESSOR"), 300),
375316
+ await addressProvider.getAddressOrRevert(ethers_1.ethers.utils.formatBytes32String("ACL"), 0)
375317
+ ]);
375318
+ __privateSet(this, _dc210, sdk_1.IDataCompressorV2_10__factory.connect(dc210Addr, __privateGet(this, _provider)));
375319
+ __privateSet(this, _dc300, sdk_1.IDataCompressorV3_00__factory.connect(dc300Addr, __privateGet(this, _provider)));
375320
+ __privateSet(this, _acl, IACL__factory_1.IACL__factory.connect(aclAddr, __privateGet(this, _provider)));
375321
+ __privateSet(this, _configrator, await __privateGet(this, _acl).owner());
375322
+ (_b = __privateGet(this, _logger)) == null ? void 0 : _b.debug("configurator: ", __privateGet(this, _configrator));
375323
+ const [cmV2s, cmV3s] = await Promise.all([
375324
+ __privateGet(this, _dc210).getCreditManagersV2List(),
375325
+ __privateGet(this, _dc300).getCreditManagersV3List()
375326
+ ]);
375327
+ __privateGet(this, _logger).debug(`managers: ${cmV2s.length} v2, ${cmV3s.length} v3`);
375328
+ for (const i of cmV2s) {
375329
+ await __privateMethod(this, _setOnV2, setOnV2_fn).call(this, new sdk_1.CreditManagerData(i));
373855
375330
  }
373856
- }
373857
- if (!(batches == null ? void 0 : batches.length)) {
373858
- throw new Error(`no batch files found in ${batchFileOrDir}`);
373859
- }
373860
- if (!meta) {
373861
- __privateGet(this, _logger).info(`no metafile files found in ${batchFileOrDir} or metafile ${metaFile}`);
373862
- } else {
373863
- __privateGet(this, _logger).debug(`metafile contains ${Object.entries(meta).length} entries`);
373864
- }
373865
- __privateGet(this, _logger).info(`will parse ${batches.length} batch files`);
373866
- for (let i = 0; i < batches.length; i++) {
373867
- const parsed = await __privateMethod(this, _parseNormalizedBatch, parseNormalizedBatch_fn).call(this, batches[i], i, batches.length, meta ?? []);
373868
- __privateGet(this, _output2).updates.push(parsed);
373869
- }
373870
- };
373871
- _parseNormalizedBatch = new WeakSet();
373872
- parseNormalizedBatch_fn = async function(batch, i, total, meta) {
373873
- __privateGet(this, _logger).debug(`[${i + 1}/${total}] processing ${(0, batch_files_1.updateTtile)(batch)}`);
373874
- const transactions = [];
373875
- for (const tx of batch.transactions) {
373876
- transactions.push(await __privateMethod(this, _parseNormalizedTx, parseNormalizedTx_fn).call(this, tx, meta));
373877
- }
373878
- return {
373879
- ...batch,
373880
- transactions
373881
- };
373882
- };
373883
- _parseNormalizedTx = new WeakSet();
373884
- parseNormalizedTx_fn = async function(tx, meta) {
373885
- const contract = container_1.container.addressTree.getContract(tx.target);
373886
- if (!contract) {
373887
- throw new Error(`address ${tx.target} not found in gearbox contract tree`);
373888
- }
373889
- const parsed = await (0, parsers_1.parserFor)(contract).parse(tx.target, tx.data, tx.signature, meta);
373890
- if ((0, types_1.isDeployTransaction)(parsed)) {
373891
- const { to, contract: contract2, immutableState, name: name4 } = parsed.constructorTransaction;
373892
- let newAddress = {
373893
- address: to,
373894
- contract: contract2,
373895
- immutableState,
373896
- name: name4,
373897
- version: types_1.VERSION_UNKNOWN,
373898
- isCreate2: true
373899
- };
373900
- const bytecode = parsed.parameters[1].raw.value;
373901
- newAddress = await container_1.container.addressTree.addCreate2Address(newAddress, bytecode, meta);
373902
- __privateGet(this, _output2).addresses[to.toLowerCase()] = newAddress;
373903
- }
373904
- const toAddr = container_1.container.addressTree.getContract(tx.target);
373905
- if (!toAddr) {
373906
- throw new Error(`tx target ${tx.target} not found in tree`);
373907
- }
373908
- __privateGet(this, _output2).addresses[tx.target.toLowerCase()] = toAddr;
373909
- __privateMethod(this, _collectCreate2Addresses, collectCreate2Addresses_fn).call(this, parsed);
373910
- return parsed;
373911
- };
373912
- _collectCreate2Addresses = new WeakSet();
373913
- collectCreate2Addresses_fn = function(tx) {
373914
- if ((0, types_1.isDeployTransaction)(tx)) {
373915
- __privateMethod(this, _collectCreate2Addresses, collectCreate2Addresses_fn).call(this, tx.constructorTransaction);
373916
- }
373917
- for (const p of tx.parameters) {
373918
- if (p.type === "gearbox_address") {
373919
- const pAddr = container_1.container.addressTree.getContract(p.value);
373920
- if (!pAddr) {
373921
- throw new Error(`parameter ${p.name} is gearbox address, but is not found in tree`);
373922
- }
373923
- __privateGet(this, _output2).addresses[p.value.toLowerCase()] = pAddr;
375331
+ for (const i of cmV3s) {
375332
+ await __privateMethod(this, _setOnV3, setOnV3_fn).call(this, new sdk_1.CreditManagerData(i));
373924
375333
  }
375334
+ __privateGet(this, _logger).info("zero lt finished");
373925
375335
  }
373926
375336
  };
373927
- exports2.UpdateParser = UpdateParser2;
375337
+ _logger = new WeakMap();
375338
+ _acl = new WeakMap();
375339
+ _dc210 = new WeakMap();
375340
+ _dc300 = new WeakMap();
375341
+ _configrator = new WeakMap();
375342
+ _provider = new WeakMap();
375343
+ _setOnV2 = new WeakSet();
375344
+ setOnV2_fn = async function(cm) {
375345
+ const logger = __privateGet(this, _logger).getSubLogger({ name: cm.name });
375346
+ const root = await (0, utils_1.impersonate)(__privateGet(this, _provider), __privateGet(this, _configrator));
375347
+ logger.debug(`zeroeing, collateralTokens: ${cm.collateralTokens.length}`);
375348
+ const cc = sdk_1.ICreditConfiguratorV2__factory.connect(cm.creditConfigurator, root);
375349
+ const newFeeLiquidation = cm.liquidationDiscount - 1;
375350
+ logger.trace("setFees part 1");
375351
+ await cc.setFees(cm.feeInterest, newFeeLiquidation, sdk_1.PERCENTAGE_FACTOR - BigInt(cm.liquidationDiscount), cm.feeLiquidationExpired, cm.liquidationDiscountExpired);
375352
+ logger.trace("setFees part 2");
375353
+ await cc.setFees(cm.feeInterest, cm.feeLiquidation, sdk_1.PERCENTAGE_FACTOR - BigInt(cm.liquidationDiscount), cm.feeLiquidationExpired, cm.liquidationDiscountExpired);
375354
+ logger.trace("setFees done");
375355
+ const ccRoot = await (0, utils_1.impersonate)(__privateGet(this, _provider), cm.creditConfigurator);
375356
+ logger.trace(`impresonating creditConfigurator ${cm.creditConfigurator}`);
375357
+ const creditManager = CreditManager__factory_1.CreditManager__factory.connect(cm.address, ccRoot);
375358
+ logger.trace("setting liquidation threshold");
375359
+ await creditManager.setLiquidationThreshold(cm.underlyingToken, 1);
375360
+ logger.trace(`setting configurator: ${cc.address}`);
375361
+ await creditManager.setConfigurator(cc.address);
375362
+ logger.debug("done");
375363
+ await (0, utils_1.stopImpersonate)(__privateGet(this, _provider), cm.creditConfigurator);
375364
+ await (0, utils_1.stopImpersonate)(__privateGet(this, _provider), __privateGet(this, _configrator));
375365
+ logger.trace("zero lt self-checking");
375366
+ const cm2 = await __privateGet(this, _dc210).getCreditManagerData(cm.address);
375367
+ if (cm2.liquidationThresholds.some((lt) => lt.toNumber() > 1)) {
375368
+ throw new Error("LT is not 1");
375369
+ }
375370
+ logger.info("zero lt OK for CM " + cm.address);
375371
+ };
375372
+ _setOnV3 = new WeakSet();
375373
+ setOnV3_fn = async function(cm) {
375374
+ const logger = __privateGet(this, _logger).getSubLogger({ name: cm.name });
375375
+ const root = await (0, utils_1.impersonate)(__privateGet(this, _provider), __privateGet(this, _configrator));
375376
+ logger.debug(`zeroeing, collateralTokens: ${cm.collateralTokens.length}`);
375377
+ const cc = sdk_1.ICreditConfiguratorV3__factory.connect(cm.creditConfigurator, root);
375378
+ const newFeeLiquidation = cm.liquidationDiscount - 1;
375379
+ logger.trace("setFees part 1");
375380
+ await cc.setFees(cm.feeInterest, newFeeLiquidation, sdk_1.PERCENTAGE_FACTOR - BigInt(cm.liquidationDiscount), cm.feeLiquidationExpired, cm.liquidationDiscountExpired);
375381
+ logger.trace("setFees part 2");
375382
+ await cc.setFees(cm.feeInterest, cm.feeLiquidation, sdk_1.PERCENTAGE_FACTOR - BigInt(cm.liquidationDiscount), cm.feeLiquidationExpired, cm.liquidationDiscountExpired);
375383
+ logger.trace("setFees done");
375384
+ const ccRoot = await (0, utils_1.impersonate)(__privateGet(this, _provider), cm.creditConfigurator);
375385
+ logger.trace(`impresonating creditConfigurator ${cm.creditConfigurator}`);
375386
+ const creditManager = sdk_1.ICreditManagerV3__factory.connect(cm.address, ccRoot);
375387
+ logger.trace("setting liquidation threshold");
375388
+ await creditManager.setCollateralTokenData(cm.underlyingToken, 1, 1, ethers_1.ethers.BigNumber.from(2).pow(40).sub(1), 0);
375389
+ logger.trace(`setting configurator ${cc.address}`);
375390
+ await creditManager.setCreditConfigurator(cc.address);
375391
+ logger.debug("done");
375392
+ await (0, utils_1.stopImpersonate)(__privateGet(this, _provider), cm.creditConfigurator);
375393
+ await (0, utils_1.stopImpersonate)(__privateGet(this, _provider), __privateGet(this, _configrator));
375394
+ logger.trace("zero lt self-checking");
375395
+ const cm2 = await __privateGet(this, _dc300).getCreditManagerData(cm.address);
375396
+ if (cm2.liquidationThresholds.some((lt) => lt.toNumber() > 1)) {
375397
+ throw new Error("LT is not 1");
375398
+ }
375399
+ logger.info("zero lt OK for CM " + cm.address);
375400
+ };
375401
+ exports2.ZeroLT = ZeroLT2;
373928
375402
  }
373929
375403
  });
373930
375404
 
@@ -373963,6 +375437,7 @@ var require_dist11 = __commonJS({
373963
375437
  __exportStar2(require_tree(), exports2);
373964
375438
  __exportStar2(require_types33(), exports2);
373965
375439
  __exportStar2(require_UpdateParser(), exports2);
375440
+ __exportStar2(require_ZeroLT(), exports2);
373966
375441
  }
373967
375442
  });
373968
375443
 
@@ -414760,7 +416235,7 @@ var require_package3 = __commonJS({
414760
416235
  module2.exports = {
414761
416236
  name: "@gearbox-protocol/deploy-tools",
414762
416237
  description: "Gearbox deploy tools",
414763
- version: "1.6.0-next.15",
416238
+ version: "1.6.0-next.16",
414764
416239
  homepage: "https://gearbox.fi",
414765
416240
  keywords: [
414766
416241
  "gearbox"
@@ -416034,6 +417509,15 @@ function verifyEtherscan() {
416034
417509
  });
416035
417510
  }
416036
417511
 
417512
+ // src/commands/zero-lt.ts
417513
+ var import_lib7 = __toESM(require_dist11());
417514
+ function zeroLT() {
417515
+ return new Command().name("zero-lt").description("sets LTs to zero on credit managers").action(async (opts) => {
417516
+ const zlt = new import_lib7.ZeroLT(opts);
417517
+ await zlt.setLtZero();
417518
+ });
417519
+ }
417520
+
416037
417521
  // src/index.ts
416038
417522
  var program2 = new Command();
416039
417523
  program2.name("deploy-tools").description("gearbox deploy tools").version(require_package3().version);
@@ -416041,6 +417525,7 @@ program2.addCommand(copyMultisig());
416041
417525
  program2.addCommand(addressTree());
416042
417526
  program2.addCommand(verifyEtherscan());
416043
417527
  program2.addCommand(parse2());
417528
+ program2.addCommand(zeroLT());
416044
417529
  program2.commands.forEach((cmd) => {
416045
417530
  cmd.addOption(
416046
417531
  new Option("--rpc-url <url>", "rpc provider url").default("https://rpc.ankr.com/eth").env("RPC_URL")