@gearbox-protocol/sdk 3.0.0-vfour.2 → 3.0.0-vfour.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +84 -96
- package/dist/cjs/index.d.ts +42 -29
- package/dist/esm/index.d.mts +42 -29
- package/dist/esm/index.mjs +85 -97
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -12289,19 +12289,18 @@ var SDKConstruct = class {
|
|
|
12289
12289
|
};
|
|
12290
12290
|
|
|
12291
12291
|
// src/base/BaseContract.ts
|
|
12292
|
-
var BaseContract = class
|
|
12292
|
+
var BaseContract = class extends SDKConstruct {
|
|
12293
12293
|
contract;
|
|
12294
12294
|
abi;
|
|
12295
12295
|
logger;
|
|
12296
|
-
static register = {};
|
|
12297
|
-
version;
|
|
12298
12296
|
contractType;
|
|
12297
|
+
version;
|
|
12299
12298
|
#name;
|
|
12300
12299
|
#address;
|
|
12301
12300
|
constructor(sdk, args) {
|
|
12302
12301
|
super(sdk);
|
|
12303
12302
|
this.abi = args.abi;
|
|
12304
|
-
this.#address = args.
|
|
12303
|
+
this.#address = args.addr;
|
|
12305
12304
|
this.contract = viem.getContract({
|
|
12306
12305
|
address: this.address,
|
|
12307
12306
|
abi: this.abi,
|
|
@@ -12309,11 +12308,14 @@ var BaseContract = class _BaseContract extends SDKConstruct {
|
|
|
12309
12308
|
public: sdk.provider.publicClient
|
|
12310
12309
|
}
|
|
12311
12310
|
});
|
|
12312
|
-
this
|
|
12313
|
-
this.
|
|
12314
|
-
this.contractType
|
|
12315
|
-
|
|
12316
|
-
|
|
12311
|
+
this.version = Number(args.version || 0);
|
|
12312
|
+
this.contractType = args.contractType ?? "";
|
|
12313
|
+
if (viem.isHex(this.contractType)) {
|
|
12314
|
+
this.contractType = bytes32ToString(this.contractType);
|
|
12315
|
+
}
|
|
12316
|
+
this.name = this.#name = args.name || this.contractType || this.#address;
|
|
12317
|
+
this.logger = childLogger(this.name, sdk.logger);
|
|
12318
|
+
sdk.contracts.upsert(this.address, this);
|
|
12317
12319
|
}
|
|
12318
12320
|
get address() {
|
|
12319
12321
|
return this.#address;
|
|
@@ -12345,16 +12347,17 @@ var BaseContract = class _BaseContract extends SDKConstruct {
|
|
|
12345
12347
|
contractType: this.contractType
|
|
12346
12348
|
};
|
|
12347
12349
|
}
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
contract.parseLog(log);
|
|
12353
|
-
}
|
|
12354
|
-
});
|
|
12355
|
-
}
|
|
12350
|
+
/**
|
|
12351
|
+
* Updates contract's internal state from event
|
|
12352
|
+
* @param _log
|
|
12353
|
+
*/
|
|
12356
12354
|
parseLog(_log) {
|
|
12357
12355
|
}
|
|
12356
|
+
/**
|
|
12357
|
+
* Converts contract calldata to some human-friendly string
|
|
12358
|
+
* @param calldata
|
|
12359
|
+
* @returns
|
|
12360
|
+
*/
|
|
12358
12361
|
parseFunctionData(calldata) {
|
|
12359
12362
|
const decoded = viem.decodeFunctionData({
|
|
12360
12363
|
abi: this.abi,
|
|
@@ -12386,17 +12389,6 @@ var BaseContract = class _BaseContract extends SDKConstruct {
|
|
|
12386
12389
|
parseFunctionParams(_params) {
|
|
12387
12390
|
return void 0;
|
|
12388
12391
|
}
|
|
12389
|
-
static parseMultiCall(calls) {
|
|
12390
|
-
return calls.map((call) => _BaseContract.parse(call.target, call.callData));
|
|
12391
|
-
}
|
|
12392
|
-
static parse(address, calldata) {
|
|
12393
|
-
const contract = _BaseContract.register[address.toLowerCase()];
|
|
12394
|
-
if (contract) {
|
|
12395
|
-
return contract.parseFunctionData(calldata);
|
|
12396
|
-
} else {
|
|
12397
|
-
throw new Error(`Contract not found: ${address}`);
|
|
12398
|
-
}
|
|
12399
|
-
}
|
|
12400
12392
|
async getVersion() {
|
|
12401
12393
|
this.version = Number(
|
|
12402
12394
|
await this.sdk.provider.publicClient.readContract({
|
|
@@ -12476,7 +12468,7 @@ var AddressProviderContractV3_1 = class extends BaseContract {
|
|
|
12476
12468
|
latest = {};
|
|
12477
12469
|
constructor(sdk, address) {
|
|
12478
12470
|
super(sdk, {
|
|
12479
|
-
address,
|
|
12471
|
+
addr: address,
|
|
12480
12472
|
name: "AddressProviderV3",
|
|
12481
12473
|
abi: iAddressProviderV3_1Abi
|
|
12482
12474
|
});
|
|
@@ -12571,7 +12563,7 @@ var AddressProviderContractV3_1 = class extends BaseContract {
|
|
|
12571
12563
|
var BotListContract = class extends BaseContract {
|
|
12572
12564
|
approvedCreditManagers = /* @__PURE__ */ new Set();
|
|
12573
12565
|
constructor(sdk, address) {
|
|
12574
|
-
super(sdk, { address, name: "BotListV3", abi: botListV3Abi });
|
|
12566
|
+
super(sdk, { addr: address, name: "BotListV3", abi: botListV3Abi });
|
|
12575
12567
|
}
|
|
12576
12568
|
parseFunctionParams(params) {
|
|
12577
12569
|
switch (params.functionName) {
|
|
@@ -12635,7 +12627,7 @@ var BotListContract = class extends BaseContract {
|
|
|
12635
12627
|
// src/core/GearStakingV3Contract.ts
|
|
12636
12628
|
var GearStakingContract = class extends BaseContract {
|
|
12637
12629
|
constructor(sdk, address) {
|
|
12638
|
-
super(sdk, { address, name: "GearStakingV3", abi: gearStakingV3Abi });
|
|
12630
|
+
super(sdk, { addr: address, name: "GearStakingV3", abi: gearStakingV3Abi });
|
|
12639
12631
|
}
|
|
12640
12632
|
parseFunctionParams(params) {
|
|
12641
12633
|
switch (params.functionName) {
|
|
@@ -12660,9 +12652,7 @@ var CreditConfiguratorContract = class extends BaseContract {
|
|
|
12660
12652
|
emergencyLiquidators = [];
|
|
12661
12653
|
constructor(sdk, { creditConfigurator, creditManager }, emergencyLiquidators2) {
|
|
12662
12654
|
super(sdk, {
|
|
12663
|
-
|
|
12664
|
-
contractType: creditConfigurator.baseParams.contractType,
|
|
12665
|
-
version: Number(creditConfigurator.baseParams.version),
|
|
12655
|
+
...creditConfigurator.baseParams,
|
|
12666
12656
|
name: `CreditConfigurator(${creditManager.name})`,
|
|
12667
12657
|
abi: creditConfiguratorV3Abi
|
|
12668
12658
|
});
|
|
@@ -12728,9 +12718,7 @@ var CreditFacadeContract = class extends BaseContract {
|
|
|
12728
12718
|
state;
|
|
12729
12719
|
constructor(sdk, { creditFacade, creditManager }) {
|
|
12730
12720
|
super(sdk, {
|
|
12731
|
-
|
|
12732
|
-
version: Number(creditFacade.baseParams.version),
|
|
12733
|
-
contractType: creditFacade.baseParams.contractType,
|
|
12721
|
+
...creditFacade.baseParams,
|
|
12734
12722
|
name: `CreditFacadeV3(${creditManager.name})`,
|
|
12735
12723
|
abi: creditFacadeV3Abi
|
|
12736
12724
|
});
|
|
@@ -12768,7 +12756,7 @@ var CreditFacadeContract = class extends BaseContract {
|
|
|
12768
12756
|
const [onBehalfOf, calls, referralCode] = params.args;
|
|
12769
12757
|
return [
|
|
12770
12758
|
this.addressLabels.get(onBehalfOf),
|
|
12771
|
-
|
|
12759
|
+
this.sdk.parseMultiCall([...calls]).join(","),
|
|
12772
12760
|
`${referralCode}`
|
|
12773
12761
|
];
|
|
12774
12762
|
}
|
|
@@ -12776,7 +12764,7 @@ var CreditFacadeContract = class extends BaseContract {
|
|
|
12776
12764
|
const [creditAccount, calls] = params.args;
|
|
12777
12765
|
return [
|
|
12778
12766
|
this.addressLabels.get(creditAccount),
|
|
12779
|
-
|
|
12767
|
+
this.sdk.parseMultiCall([...calls]).join(",")
|
|
12780
12768
|
];
|
|
12781
12769
|
}
|
|
12782
12770
|
case "liquidateCreditAccount": {
|
|
@@ -12784,7 +12772,7 @@ var CreditFacadeContract = class extends BaseContract {
|
|
|
12784
12772
|
return [
|
|
12785
12773
|
this.addressLabels.get(creditAccount),
|
|
12786
12774
|
this.addressLabels.get(to),
|
|
12787
|
-
|
|
12775
|
+
this.sdk.parseMultiCall([...calls]).join(",")
|
|
12788
12776
|
];
|
|
12789
12777
|
}
|
|
12790
12778
|
case "setBotPermissions": {
|
|
@@ -12806,9 +12794,7 @@ var CreditManagerContract = class extends BaseContract {
|
|
|
12806
12794
|
state;
|
|
12807
12795
|
constructor(sdk, { creditManager, creditFacade }, pool) {
|
|
12808
12796
|
super(sdk, {
|
|
12809
|
-
|
|
12810
|
-
version: Number(creditManager.baseParams.version),
|
|
12811
|
-
contractType: creditManager.baseParams.contractType,
|
|
12797
|
+
...creditManager.baseParams,
|
|
12812
12798
|
name: `CreditManagerV3(${creditManager.name})`,
|
|
12813
12799
|
abi: creditManagerV3Abi
|
|
12814
12800
|
});
|
|
@@ -12825,13 +12811,11 @@ var CreditManagerContract = class extends BaseContract {
|
|
|
12825
12811
|
collateralTokens: Object.fromEntries(
|
|
12826
12812
|
collateralTokens.map((t, i) => [t, liquidationThresholds[i]])
|
|
12827
12813
|
),
|
|
12828
|
-
feeInterest:
|
|
12829
|
-
feeLiquidation:
|
|
12830
|
-
liquidationDiscount:
|
|
12831
|
-
feeLiquidationExpired:
|
|
12832
|
-
liquidationDiscountExpired:
|
|
12833
|
-
creditManager.liquidationDiscountExpired
|
|
12834
|
-
),
|
|
12814
|
+
feeInterest: creditManager.feeInterest,
|
|
12815
|
+
feeLiquidation: creditManager.feeLiquidation,
|
|
12816
|
+
liquidationDiscount: creditManager.liquidationDiscount,
|
|
12817
|
+
feeLiquidationExpired: creditManager.feeLiquidationExpired,
|
|
12818
|
+
liquidationDiscountExpired: creditManager.liquidationDiscountExpired,
|
|
12835
12819
|
quotedTokensMask: 0n,
|
|
12836
12820
|
contractsToAdapters: {},
|
|
12837
12821
|
// cmd.adapters.reduce(
|
|
@@ -12903,9 +12887,7 @@ var GaugeContract = class extends BaseContract {
|
|
|
12903
12887
|
state;
|
|
12904
12888
|
constructor(sdk, pool, gauge) {
|
|
12905
12889
|
super(sdk, {
|
|
12906
|
-
|
|
12907
|
-
contractType: gauge.baseParams.contractType,
|
|
12908
|
-
version: Number(gauge.baseParams.version),
|
|
12890
|
+
...gauge.baseParams,
|
|
12909
12891
|
name: `Gauge(${pool.name})`,
|
|
12910
12892
|
abi: gaugeV3Abi
|
|
12911
12893
|
});
|
|
@@ -12951,9 +12933,7 @@ var LinearModelContract = class extends BaseContract {
|
|
|
12951
12933
|
state;
|
|
12952
12934
|
constructor(sdk, { interestRateModel }) {
|
|
12953
12935
|
super(sdk, {
|
|
12954
|
-
|
|
12955
|
-
contractType: interestRateModel.baseParams.contractType,
|
|
12956
|
-
version: Number(interestRateModel.baseParams.version),
|
|
12936
|
+
...interestRateModel.baseParams,
|
|
12957
12937
|
name: "LinearInterestRateModel",
|
|
12958
12938
|
abi: linearInterestRateModelV3Abi
|
|
12959
12939
|
});
|
|
@@ -12996,9 +12976,7 @@ var PoolContract = class extends BaseContract {
|
|
|
12996
12976
|
hasOperation = false;
|
|
12997
12977
|
constructor(sdk, data) {
|
|
12998
12978
|
super(sdk, {
|
|
12999
|
-
|
|
13000
|
-
address: data.baseParams.addr,
|
|
13001
|
-
contractType: data.baseParams.contractType,
|
|
12979
|
+
...data.baseParams,
|
|
13002
12980
|
name: `PoolV3(${data.name})`,
|
|
13003
12981
|
abi
|
|
13004
12982
|
});
|
|
@@ -13019,7 +12997,6 @@ var PoolContract = class extends BaseContract {
|
|
|
13019
12997
|
withdrawFee: Number(data.withdrawFee)
|
|
13020
12998
|
};
|
|
13021
12999
|
}
|
|
13022
|
-
// LOGS
|
|
13023
13000
|
parseLog(log) {
|
|
13024
13001
|
const parsedLog = viem.parseEventLogs({
|
|
13025
13002
|
abi: this.abi,
|
|
@@ -13056,9 +13033,7 @@ var PoolQuotaKeeperContract = class extends BaseContract {
|
|
|
13056
13033
|
state;
|
|
13057
13034
|
constructor(sdk, pool, pqk) {
|
|
13058
13035
|
super(sdk, {
|
|
13059
|
-
|
|
13060
|
-
contractType: pqk.baseParams.contractType,
|
|
13061
|
-
version: Number(pqk.baseParams.version),
|
|
13036
|
+
...pqk.baseParams,
|
|
13062
13037
|
name: `PoolQuotaKeeper(${pool.name})`,
|
|
13063
13038
|
abi: poolQuotaKeeperV3Abi
|
|
13064
13039
|
});
|
|
@@ -13142,28 +13117,26 @@ var AbstractPriceFeedContract = class extends BaseContract {
|
|
|
13142
13117
|
* True if the contract deployed at this address implements IUpdatablePriceFeed interface
|
|
13143
13118
|
*/
|
|
13144
13119
|
updatable;
|
|
13145
|
-
priceFeedType;
|
|
13146
13120
|
decimals;
|
|
13147
13121
|
underlyingPriceFeeds;
|
|
13148
13122
|
hasLowerBoundCap = false;
|
|
13149
13123
|
constructor(sdk, args) {
|
|
13150
|
-
const priceFeedType = bytes32ToString(
|
|
13151
|
-
args.baseParams.contractType
|
|
13152
|
-
);
|
|
13153
13124
|
super(sdk, {
|
|
13154
13125
|
abi: args.abi,
|
|
13155
|
-
|
|
13126
|
+
addr: args.baseParams.addr,
|
|
13156
13127
|
name: args.name,
|
|
13157
|
-
contractType:
|
|
13158
|
-
version:
|
|
13128
|
+
contractType: args.baseParams.contractType,
|
|
13129
|
+
version: args.baseParams.version
|
|
13159
13130
|
});
|
|
13160
|
-
this.priceFeedType = priceFeedType;
|
|
13161
13131
|
this.decimals = args.decimals;
|
|
13162
13132
|
this.updatable = args.updatable;
|
|
13163
13133
|
this.underlyingPriceFeeds = args.underlyingFeeds.map(
|
|
13164
13134
|
(address, i) => new PriceFeedRef(this.sdk, address, args.underlyingStalenessPeriods[i])
|
|
13165
13135
|
);
|
|
13166
13136
|
}
|
|
13137
|
+
get priceFeedType() {
|
|
13138
|
+
return this.contractType;
|
|
13139
|
+
}
|
|
13167
13140
|
async currentLowerBound() {
|
|
13168
13141
|
return await this.sdk.provider.publicClient.readContract({
|
|
13169
13142
|
abi: ilpPriceFeedAbi,
|
|
@@ -13230,7 +13203,6 @@ var AbstractLPPriceFeedContract = class _AbstractLPPriceFeedContract extends Abs
|
|
|
13230
13203
|
|
|
13231
13204
|
// src/market/pricefeeds/BalancerStablePriceFeed.ts
|
|
13232
13205
|
var BalancerStablePriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
13233
|
-
priceFeedType = "PF_BALANCER_STABLE_LP_ORACLE";
|
|
13234
13206
|
constructor(sdk, args) {
|
|
13235
13207
|
super(sdk, {
|
|
13236
13208
|
...args,
|
|
@@ -13257,7 +13229,6 @@ var BalancerStablePriceFeedContract = class extends AbstractLPPriceFeedContract
|
|
|
13257
13229
|
|
|
13258
13230
|
// src/market/pricefeeds/BalancerWeightedPriceFeed.ts
|
|
13259
13231
|
var BalancerWeightedPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
13260
|
-
priceFeedType = "PF_BALANCER_WEIGHTED_LP_ORACLE";
|
|
13261
13232
|
constructor(sdk, args) {
|
|
13262
13233
|
super(sdk, {
|
|
13263
13234
|
...args,
|
|
@@ -13285,7 +13256,6 @@ var BalancerWeightedPriceFeedContract = class extends AbstractLPPriceFeedContrac
|
|
|
13285
13256
|
|
|
13286
13257
|
// src/market/pricefeeds/BoundedPriceFeed.ts
|
|
13287
13258
|
var BoundedPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
13288
|
-
priceFeedType = "PF_BOUNDED_ORACLE";
|
|
13289
13259
|
upperBound = 0n;
|
|
13290
13260
|
constructor(sdk, args) {
|
|
13291
13261
|
super(sdk, { ...args, name: "BoundedPriceFeed", abi: boundedPriceFeedAbi });
|
|
@@ -13293,9 +13263,9 @@ var BoundedPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
13293
13263
|
get state() {
|
|
13294
13264
|
return {
|
|
13295
13265
|
...this.contractData,
|
|
13266
|
+
contractType: "PF_BOUNDED_ORACLE",
|
|
13296
13267
|
pricefeeds: [this.underlyingPriceFeeds[0].state],
|
|
13297
13268
|
upperBound: this.upperBound,
|
|
13298
|
-
contractType: this.priceFeedType,
|
|
13299
13269
|
skipCheck: true
|
|
13300
13270
|
};
|
|
13301
13271
|
}
|
|
@@ -13303,7 +13273,6 @@ var BoundedPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
13303
13273
|
|
|
13304
13274
|
// src/market/pricefeeds/ChainlinkPriceFeed.ts
|
|
13305
13275
|
var ChainlinkPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
13306
|
-
priceFeedType = "PF_CHAINLINK_ORACLE";
|
|
13307
13276
|
constructor(sdk, args) {
|
|
13308
13277
|
super(sdk, {
|
|
13309
13278
|
...args,
|
|
@@ -13323,7 +13292,6 @@ var ChainlinkPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
13323
13292
|
|
|
13324
13293
|
// src/market/pricefeeds/CompositePriceFeed.ts
|
|
13325
13294
|
var CompositePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
13326
|
-
priceFeedType = "PF_COMPOSITE_ORACLE";
|
|
13327
13295
|
constructor(sdk, args) {
|
|
13328
13296
|
super(sdk, {
|
|
13329
13297
|
...args,
|
|
@@ -13353,7 +13321,6 @@ var CompositePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
13353
13321
|
|
|
13354
13322
|
// src/market/pricefeeds/CurveCryptoPriceFeed.ts
|
|
13355
13323
|
var CurveCryptoPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
13356
|
-
priceFeedType = "PF_CURVE_CRYPTO_LP_ORACLE";
|
|
13357
13324
|
constructor(sdk, args) {
|
|
13358
13325
|
super(sdk, {
|
|
13359
13326
|
...args,
|
|
@@ -13388,9 +13355,6 @@ var CurveStablePriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
13388
13355
|
});
|
|
13389
13356
|
}
|
|
13390
13357
|
get state() {
|
|
13391
|
-
if (this.priceFeedType !== "PF_CURVE_STABLE_LP_ORACLE") {
|
|
13392
|
-
throw new Error("Invalid feed type");
|
|
13393
|
-
}
|
|
13394
13358
|
return {
|
|
13395
13359
|
...this.contractData,
|
|
13396
13360
|
contractType: this.priceFeedType,
|
|
@@ -13409,7 +13373,6 @@ var CurveStablePriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
13409
13373
|
|
|
13410
13374
|
// src/market/pricefeeds/CurveUSDPriceFeed.ts
|
|
13411
13375
|
var CurveUSDPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
13412
|
-
priceFeedType = "PF_CURVE_USD_ORACLE";
|
|
13413
13376
|
constructor(sdk, args) {
|
|
13414
13377
|
super(sdk, {
|
|
13415
13378
|
...args,
|
|
@@ -13434,7 +13397,6 @@ var CurveUSDPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
13434
13397
|
}
|
|
13435
13398
|
};
|
|
13436
13399
|
var Erc4626PriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
13437
|
-
priceFeedType = "PF_ERC4626_ORACLE";
|
|
13438
13400
|
constructor(sdk, args) {
|
|
13439
13401
|
super(sdk, {
|
|
13440
13402
|
...args,
|
|
@@ -13468,7 +13430,6 @@ var Erc4626PriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
13468
13430
|
|
|
13469
13431
|
// src/market/pricefeeds/MellowLRTPriceFeed.ts
|
|
13470
13432
|
var MellowLRTPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
13471
|
-
priceFeedType = "PF_MELLOW_LRT_ORACLE";
|
|
13472
13433
|
constructor(sdk, args) {
|
|
13473
13434
|
super(sdk, {
|
|
13474
13435
|
...args,
|
|
@@ -13494,7 +13455,6 @@ var MellowLRTPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
13494
13455
|
}
|
|
13495
13456
|
};
|
|
13496
13457
|
var RedstonePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
13497
|
-
priceFeedType = "PF_REDSTONE_ORACLE";
|
|
13498
13458
|
decimals = 8;
|
|
13499
13459
|
dataServiceId;
|
|
13500
13460
|
dataId;
|
|
@@ -13549,7 +13509,7 @@ var RedstonePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
13549
13509
|
get state() {
|
|
13550
13510
|
return {
|
|
13551
13511
|
...this.contractData,
|
|
13552
|
-
contractType:
|
|
13512
|
+
contractType: "PF_REDSTONE_ORACLE",
|
|
13553
13513
|
dataId: this.dataId,
|
|
13554
13514
|
signers: this.signers,
|
|
13555
13515
|
signersThreshold: this.signersThreshold,
|
|
@@ -13692,7 +13652,6 @@ function getCalldataWithTimestamp(dataFeedId, packages, unsignedMetadata) {
|
|
|
13692
13652
|
|
|
13693
13653
|
// src/market/pricefeeds/WstETHPriceFeed.ts
|
|
13694
13654
|
var WstETHPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
13695
|
-
priceFeedType = "PF_WSTETH_ORACLE";
|
|
13696
13655
|
constructor(sdk, args) {
|
|
13697
13656
|
super(sdk, {
|
|
13698
13657
|
...args,
|
|
@@ -13719,7 +13678,6 @@ var WstETHPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
13719
13678
|
|
|
13720
13679
|
// src/market/pricefeeds/YearnPriceFeed.ts
|
|
13721
13680
|
var YearnPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
13722
|
-
priceFeedType = "PF_YEARN_ORACLE";
|
|
13723
13681
|
constructor(sdk, args) {
|
|
13724
13682
|
super(sdk, {
|
|
13725
13683
|
...args,
|
|
@@ -13746,7 +13704,6 @@ var YearnPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
13746
13704
|
|
|
13747
13705
|
// src/market/pricefeeds/ZeroPriceFeed.ts
|
|
13748
13706
|
var ZeroPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
13749
|
-
priceFeedType = "PF_ZERO_ORACLE";
|
|
13750
13707
|
constructor(sdk, args) {
|
|
13751
13708
|
super(sdk, {
|
|
13752
13709
|
...args,
|
|
@@ -13758,7 +13715,7 @@ var ZeroPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
13758
13715
|
get state() {
|
|
13759
13716
|
return {
|
|
13760
13717
|
...this.contractData,
|
|
13761
|
-
contractType:
|
|
13718
|
+
contractType: "PF_ZERO_ORACLE",
|
|
13762
13719
|
skipCheck: true,
|
|
13763
13720
|
stalenessPeriod: 0,
|
|
13764
13721
|
pricefeeds: []
|
|
@@ -13779,7 +13736,6 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
13779
13736
|
}
|
|
13780
13737
|
/**
|
|
13781
13738
|
* Returns RawTxs to update price feeds
|
|
13782
|
-
* This method is static because price feeds may belong to different markets with different PriceFeedFactory instances
|
|
13783
13739
|
* @param priceFeeds top-level price feeds, actual updatable price feeds will be derived. If not provided will use all price feeds that are attached
|
|
13784
13740
|
* @returns
|
|
13785
13741
|
*/
|
|
@@ -13868,9 +13824,7 @@ var PriceOracleContract = class extends BaseContract {
|
|
|
13868
13824
|
#priceFeedTree;
|
|
13869
13825
|
constructor(sdk, data) {
|
|
13870
13826
|
super(sdk, {
|
|
13871
|
-
|
|
13872
|
-
contractType: data.baseParams.contractType,
|
|
13873
|
-
version: Number(data.baseParams.version),
|
|
13827
|
+
...data.baseParams,
|
|
13874
13828
|
name: "PriceOracleV3",
|
|
13875
13829
|
abi: priceOracleV3Abi
|
|
13876
13830
|
});
|
|
@@ -14279,7 +14233,7 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
14279
14233
|
#connectors;
|
|
14280
14234
|
constructor(sdk, address) {
|
|
14281
14235
|
super(sdk, {
|
|
14282
|
-
address,
|
|
14236
|
+
addr: address,
|
|
14283
14237
|
name: "RouterV3",
|
|
14284
14238
|
abi: routerV3Abi
|
|
14285
14239
|
});
|
|
@@ -14571,7 +14525,14 @@ var GearboxSDK = class _GearboxSDK extends eventemitter3.EventEmitter {
|
|
|
14571
14525
|
* TODO: use whatever interface is necessary for InterestRateModels
|
|
14572
14526
|
*/
|
|
14573
14527
|
interestRateModels = new AddressMap();
|
|
14528
|
+
/**
|
|
14529
|
+
* All price feeds known to sdk, without oracle-related data (stalenessPeriod, main/reserve, etc.)
|
|
14530
|
+
*/
|
|
14574
14531
|
priceFeeds;
|
|
14532
|
+
/**
|
|
14533
|
+
* All contracts known to sdk
|
|
14534
|
+
*/
|
|
14535
|
+
contracts = new AddressMap();
|
|
14575
14536
|
static async attach(options) {
|
|
14576
14537
|
const { rpcURL, timeout, logger } = options;
|
|
14577
14538
|
let { networkType, addressProvider, chainId } = options;
|
|
@@ -14640,6 +14601,33 @@ var GearboxSDK = class _GearboxSDK extends eventemitter3.EventEmitter {
|
|
|
14640
14601
|
this.logger?.info(`attach time: ${Date.now() - time} ms`);
|
|
14641
14602
|
return this;
|
|
14642
14603
|
}
|
|
14604
|
+
parseLogs(logs) {
|
|
14605
|
+
logs.forEach((log) => {
|
|
14606
|
+
const contract = this.contracts.get(log.address);
|
|
14607
|
+
contract?.parseLog(log);
|
|
14608
|
+
});
|
|
14609
|
+
}
|
|
14610
|
+
/**
|
|
14611
|
+
* Converts contract call into some human-friendly string
|
|
14612
|
+
* @param address
|
|
14613
|
+
* @param calldata
|
|
14614
|
+
* @returns
|
|
14615
|
+
*/
|
|
14616
|
+
parseFunctionData(address, calldata) {
|
|
14617
|
+
const contract = this.contracts.mustGet(address);
|
|
14618
|
+
return contract.parseFunctionData(calldata);
|
|
14619
|
+
}
|
|
14620
|
+
/**
|
|
14621
|
+
* Converts multicalls into some human-friendly strings
|
|
14622
|
+
* @param address
|
|
14623
|
+
* @param calldata
|
|
14624
|
+
* @returns
|
|
14625
|
+
*/
|
|
14626
|
+
parseMultiCall(calls) {
|
|
14627
|
+
return calls.map(
|
|
14628
|
+
(call) => this.parseFunctionData(call.target, call.callData)
|
|
14629
|
+
);
|
|
14630
|
+
}
|
|
14643
14631
|
async updateBlock() {
|
|
14644
14632
|
const block = await this.provider.publicClient.getBlock({
|
|
14645
14633
|
blockTag: "latest"
|
|
@@ -14675,7 +14663,7 @@ var GearboxSDK = class _GearboxSDK extends eventemitter3.EventEmitter {
|
|
|
14675
14663
|
fromBlock: BigInt(this.currentBlock),
|
|
14676
14664
|
toBlock: BigInt(toBlock)
|
|
14677
14665
|
});
|
|
14678
|
-
|
|
14666
|
+
this.parseLogs(events);
|
|
14679
14667
|
for (const pf of this.marketRegister.getPoolFactories()) {
|
|
14680
14668
|
if (pf.poolContract.hasOperation) ;
|
|
14681
14669
|
}
|