@gearbox-protocol/sdk 3.0.0-vfour.113 → 3.0.0-vfour.115
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/sdk/index.cjs +392 -47
- package/dist/cjs/sdk/index.d.ts +317 -97
- package/dist/esm/sdk/index.d.mts +317 -97
- package/dist/esm/sdk/index.mjs +392 -50
- package/package.json +1 -1
package/dist/cjs/sdk/index.cjs
CHANGED
|
@@ -7061,6 +7061,267 @@ var zeroPriceFeedAbi = [
|
|
|
7061
7061
|
stateMutability: "view"
|
|
7062
7062
|
}
|
|
7063
7063
|
];
|
|
7064
|
+
var pendleTWAPPTPriceFeedAbi = [
|
|
7065
|
+
{
|
|
7066
|
+
type: "constructor",
|
|
7067
|
+
inputs: [
|
|
7068
|
+
{
|
|
7069
|
+
name: "_market",
|
|
7070
|
+
type: "address",
|
|
7071
|
+
internalType: "address"
|
|
7072
|
+
},
|
|
7073
|
+
{
|
|
7074
|
+
name: "_priceFeed",
|
|
7075
|
+
type: "address",
|
|
7076
|
+
internalType: "address"
|
|
7077
|
+
},
|
|
7078
|
+
{
|
|
7079
|
+
name: "_stalenessPeriod",
|
|
7080
|
+
type: "uint32",
|
|
7081
|
+
internalType: "uint32"
|
|
7082
|
+
},
|
|
7083
|
+
{
|
|
7084
|
+
name: "_twapWindow",
|
|
7085
|
+
type: "uint32",
|
|
7086
|
+
internalType: "uint32"
|
|
7087
|
+
}
|
|
7088
|
+
],
|
|
7089
|
+
stateMutability: "nonpayable"
|
|
7090
|
+
},
|
|
7091
|
+
{
|
|
7092
|
+
type: "function",
|
|
7093
|
+
name: "decimals",
|
|
7094
|
+
inputs: [],
|
|
7095
|
+
outputs: [
|
|
7096
|
+
{
|
|
7097
|
+
name: "",
|
|
7098
|
+
type: "uint8",
|
|
7099
|
+
internalType: "uint8"
|
|
7100
|
+
}
|
|
7101
|
+
],
|
|
7102
|
+
stateMutability: "view"
|
|
7103
|
+
},
|
|
7104
|
+
{
|
|
7105
|
+
type: "function",
|
|
7106
|
+
name: "description",
|
|
7107
|
+
inputs: [],
|
|
7108
|
+
outputs: [
|
|
7109
|
+
{
|
|
7110
|
+
name: "",
|
|
7111
|
+
type: "string",
|
|
7112
|
+
internalType: "string"
|
|
7113
|
+
}
|
|
7114
|
+
],
|
|
7115
|
+
stateMutability: "view"
|
|
7116
|
+
},
|
|
7117
|
+
{
|
|
7118
|
+
type: "function",
|
|
7119
|
+
name: "expiry",
|
|
7120
|
+
inputs: [],
|
|
7121
|
+
outputs: [
|
|
7122
|
+
{
|
|
7123
|
+
name: "",
|
|
7124
|
+
type: "uint256",
|
|
7125
|
+
internalType: "uint256"
|
|
7126
|
+
}
|
|
7127
|
+
],
|
|
7128
|
+
stateMutability: "view"
|
|
7129
|
+
},
|
|
7130
|
+
{
|
|
7131
|
+
type: "function",
|
|
7132
|
+
name: "latestRoundData",
|
|
7133
|
+
inputs: [],
|
|
7134
|
+
outputs: [
|
|
7135
|
+
{
|
|
7136
|
+
name: "",
|
|
7137
|
+
type: "uint80",
|
|
7138
|
+
internalType: "uint80"
|
|
7139
|
+
},
|
|
7140
|
+
{
|
|
7141
|
+
name: "",
|
|
7142
|
+
type: "int256",
|
|
7143
|
+
internalType: "int256"
|
|
7144
|
+
},
|
|
7145
|
+
{
|
|
7146
|
+
name: "",
|
|
7147
|
+
type: "uint256",
|
|
7148
|
+
internalType: "uint256"
|
|
7149
|
+
},
|
|
7150
|
+
{
|
|
7151
|
+
name: "",
|
|
7152
|
+
type: "uint256",
|
|
7153
|
+
internalType: "uint256"
|
|
7154
|
+
},
|
|
7155
|
+
{
|
|
7156
|
+
name: "",
|
|
7157
|
+
type: "uint80",
|
|
7158
|
+
internalType: "uint80"
|
|
7159
|
+
}
|
|
7160
|
+
],
|
|
7161
|
+
stateMutability: "view"
|
|
7162
|
+
},
|
|
7163
|
+
{
|
|
7164
|
+
type: "function",
|
|
7165
|
+
name: "market",
|
|
7166
|
+
inputs: [],
|
|
7167
|
+
outputs: [
|
|
7168
|
+
{
|
|
7169
|
+
name: "",
|
|
7170
|
+
type: "address",
|
|
7171
|
+
internalType: "address"
|
|
7172
|
+
}
|
|
7173
|
+
],
|
|
7174
|
+
stateMutability: "view"
|
|
7175
|
+
},
|
|
7176
|
+
{
|
|
7177
|
+
type: "function",
|
|
7178
|
+
name: "priceFeed",
|
|
7179
|
+
inputs: [],
|
|
7180
|
+
outputs: [
|
|
7181
|
+
{
|
|
7182
|
+
name: "",
|
|
7183
|
+
type: "address",
|
|
7184
|
+
internalType: "address"
|
|
7185
|
+
}
|
|
7186
|
+
],
|
|
7187
|
+
stateMutability: "view"
|
|
7188
|
+
},
|
|
7189
|
+
{
|
|
7190
|
+
type: "function",
|
|
7191
|
+
name: "priceFeedType",
|
|
7192
|
+
inputs: [],
|
|
7193
|
+
outputs: [
|
|
7194
|
+
{
|
|
7195
|
+
name: "",
|
|
7196
|
+
type: "uint8",
|
|
7197
|
+
internalType: "enum PriceFeedType"
|
|
7198
|
+
}
|
|
7199
|
+
],
|
|
7200
|
+
stateMutability: "view"
|
|
7201
|
+
},
|
|
7202
|
+
{
|
|
7203
|
+
type: "function",
|
|
7204
|
+
name: "skipCheck",
|
|
7205
|
+
inputs: [],
|
|
7206
|
+
outputs: [
|
|
7207
|
+
{
|
|
7208
|
+
name: "",
|
|
7209
|
+
type: "bool",
|
|
7210
|
+
internalType: "bool"
|
|
7211
|
+
}
|
|
7212
|
+
],
|
|
7213
|
+
stateMutability: "view"
|
|
7214
|
+
},
|
|
7215
|
+
{
|
|
7216
|
+
type: "function",
|
|
7217
|
+
name: "skipPriceCheck",
|
|
7218
|
+
inputs: [],
|
|
7219
|
+
outputs: [
|
|
7220
|
+
{
|
|
7221
|
+
name: "",
|
|
7222
|
+
type: "bool",
|
|
7223
|
+
internalType: "bool"
|
|
7224
|
+
}
|
|
7225
|
+
],
|
|
7226
|
+
stateMutability: "view"
|
|
7227
|
+
},
|
|
7228
|
+
{
|
|
7229
|
+
type: "function",
|
|
7230
|
+
name: "stalenessPeriod",
|
|
7231
|
+
inputs: [],
|
|
7232
|
+
outputs: [
|
|
7233
|
+
{
|
|
7234
|
+
name: "",
|
|
7235
|
+
type: "uint32",
|
|
7236
|
+
internalType: "uint32"
|
|
7237
|
+
}
|
|
7238
|
+
],
|
|
7239
|
+
stateMutability: "view"
|
|
7240
|
+
},
|
|
7241
|
+
{
|
|
7242
|
+
type: "function",
|
|
7243
|
+
name: "sy",
|
|
7244
|
+
inputs: [],
|
|
7245
|
+
outputs: [
|
|
7246
|
+
{
|
|
7247
|
+
name: "",
|
|
7248
|
+
type: "address",
|
|
7249
|
+
internalType: "address"
|
|
7250
|
+
}
|
|
7251
|
+
],
|
|
7252
|
+
stateMutability: "view"
|
|
7253
|
+
},
|
|
7254
|
+
{
|
|
7255
|
+
type: "function",
|
|
7256
|
+
name: "twapWindow",
|
|
7257
|
+
inputs: [],
|
|
7258
|
+
outputs: [
|
|
7259
|
+
{
|
|
7260
|
+
name: "",
|
|
7261
|
+
type: "uint32",
|
|
7262
|
+
internalType: "uint32"
|
|
7263
|
+
}
|
|
7264
|
+
],
|
|
7265
|
+
stateMutability: "view"
|
|
7266
|
+
},
|
|
7267
|
+
{
|
|
7268
|
+
type: "function",
|
|
7269
|
+
name: "version",
|
|
7270
|
+
inputs: [],
|
|
7271
|
+
outputs: [
|
|
7272
|
+
{
|
|
7273
|
+
name: "",
|
|
7274
|
+
type: "uint256",
|
|
7275
|
+
internalType: "uint256"
|
|
7276
|
+
}
|
|
7277
|
+
],
|
|
7278
|
+
stateMutability: "view"
|
|
7279
|
+
},
|
|
7280
|
+
{
|
|
7281
|
+
type: "function",
|
|
7282
|
+
name: "yt",
|
|
7283
|
+
inputs: [],
|
|
7284
|
+
outputs: [
|
|
7285
|
+
{
|
|
7286
|
+
name: "",
|
|
7287
|
+
type: "address",
|
|
7288
|
+
internalType: "address"
|
|
7289
|
+
}
|
|
7290
|
+
],
|
|
7291
|
+
stateMutability: "view"
|
|
7292
|
+
},
|
|
7293
|
+
{
|
|
7294
|
+
type: "error",
|
|
7295
|
+
name: "AddressIsNotContractException",
|
|
7296
|
+
inputs: [
|
|
7297
|
+
{
|
|
7298
|
+
name: "",
|
|
7299
|
+
type: "address",
|
|
7300
|
+
internalType: "address"
|
|
7301
|
+
}
|
|
7302
|
+
]
|
|
7303
|
+
},
|
|
7304
|
+
{
|
|
7305
|
+
type: "error",
|
|
7306
|
+
name: "IncorrectParameterException",
|
|
7307
|
+
inputs: []
|
|
7308
|
+
},
|
|
7309
|
+
{
|
|
7310
|
+
type: "error",
|
|
7311
|
+
name: "IncorrectPriceException",
|
|
7312
|
+
inputs: []
|
|
7313
|
+
},
|
|
7314
|
+
{
|
|
7315
|
+
type: "error",
|
|
7316
|
+
name: "IncorrectPriceFeedException",
|
|
7317
|
+
inputs: []
|
|
7318
|
+
},
|
|
7319
|
+
{
|
|
7320
|
+
type: "error",
|
|
7321
|
+
name: "StalePriceException",
|
|
7322
|
+
inputs: []
|
|
7323
|
+
}
|
|
7324
|
+
];
|
|
7064
7325
|
|
|
7065
7326
|
// src/sdk/abi/errors.ts
|
|
7066
7327
|
var iRouterV3ErrorsAbi = [
|
|
@@ -24358,6 +24619,12 @@ var TIMELOCK = {
|
|
|
24358
24619
|
Optimism: "0x148DD932eCe1155c11006F5650c6Ff428f8D374A",
|
|
24359
24620
|
Base: NOT_DEPLOYED
|
|
24360
24621
|
};
|
|
24622
|
+
var GEARBOX_RISK_CURATORS = {
|
|
24623
|
+
Mainnet: [TIMELOCK.Mainnet],
|
|
24624
|
+
Arbitrum: [TIMELOCK.Arbitrum],
|
|
24625
|
+
Optimism: [TIMELOCK.Optimism],
|
|
24626
|
+
Base: [TIMELOCK.Base]
|
|
24627
|
+
};
|
|
24361
24628
|
|
|
24362
24629
|
// src/sdk/constants/address-provider.ts
|
|
24363
24630
|
var NO_VERSION = 0;
|
|
@@ -24594,12 +24861,12 @@ var json_parse = (s) => {
|
|
|
24594
24861
|
function createRawTx(to, parameters, description) {
|
|
24595
24862
|
const { args } = parameters;
|
|
24596
24863
|
const fname = parameters.functionName;
|
|
24597
|
-
const { abi:
|
|
24864
|
+
const { abi: abi30, functionName } = (() => {
|
|
24598
24865
|
if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
|
|
24599
24866
|
return parameters;
|
|
24600
24867
|
return viem.prepareEncodeFunctionData(parameters);
|
|
24601
24868
|
})();
|
|
24602
|
-
const abiItem =
|
|
24869
|
+
const abiItem = abi30[0];
|
|
24603
24870
|
const signature = functionName;
|
|
24604
24871
|
const data = "inputs" in abiItem && abiItem.inputs ? viem.encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
|
|
24605
24872
|
const functionEncodedData = viem.concatHex([signature, data ?? "0x"]);
|
|
@@ -25371,7 +25638,9 @@ function createAdapter(sdk, args) {
|
|
|
25371
25638
|
case "AD_STAKING_REWARDS":
|
|
25372
25639
|
return new StakingRewardsAdapterContract(sdk, args);
|
|
25373
25640
|
default:
|
|
25374
|
-
throw new Error(
|
|
25641
|
+
throw new Error(
|
|
25642
|
+
`adapter for ${adapterType} at ${args.baseParams.addr} is not implemented`
|
|
25643
|
+
);
|
|
25375
25644
|
}
|
|
25376
25645
|
}
|
|
25377
25646
|
|
|
@@ -26603,12 +26872,18 @@ var BalancerWeightedPriceFeedContract = class extends AbstractLPPriceFeedContrac
|
|
|
26603
26872
|
});
|
|
26604
26873
|
}
|
|
26605
26874
|
};
|
|
26606
|
-
|
|
26607
|
-
// src/sdk/market/pricefeeds/BoundedPriceFeed.ts
|
|
26608
26875
|
var BoundedPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
26609
|
-
upperBound
|
|
26876
|
+
upperBound;
|
|
26610
26877
|
constructor(sdk, args) {
|
|
26611
26878
|
super(sdk, { ...args, name: "BoundedPriceFeed", abi: boundedPriceFeedAbi });
|
|
26879
|
+
const decoder = viem.decodeAbiParameters(
|
|
26880
|
+
[
|
|
26881
|
+
{ type: "int256" }
|
|
26882
|
+
// upperBound
|
|
26883
|
+
],
|
|
26884
|
+
args.baseParams.serializedParams
|
|
26885
|
+
);
|
|
26886
|
+
this.upperBound = decoder[0];
|
|
26612
26887
|
}
|
|
26613
26888
|
stateHuman(raw = true) {
|
|
26614
26889
|
return {
|
|
@@ -26743,6 +27018,18 @@ var MellowLRTPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
26743
27018
|
}
|
|
26744
27019
|
};
|
|
26745
27020
|
|
|
27021
|
+
// src/sdk/market/pricefeeds/PendleTWAPPTPriceFeed.ts
|
|
27022
|
+
var abi28 = pendleTWAPPTPriceFeedAbi;
|
|
27023
|
+
var PendleTWAPPTPriceFeed = class extends AbstractPriceFeedContract {
|
|
27024
|
+
constructor(sdk, args) {
|
|
27025
|
+
super(sdk, {
|
|
27026
|
+
...args,
|
|
27027
|
+
name: "PendleTWAPPTPriceFeed",
|
|
27028
|
+
abi: abi28
|
|
27029
|
+
});
|
|
27030
|
+
}
|
|
27031
|
+
};
|
|
27032
|
+
|
|
26746
27033
|
// src/sdk/utils/internal/Hooks.ts
|
|
26747
27034
|
var Hooks = class {
|
|
26748
27035
|
#reg = {};
|
|
@@ -27095,6 +27382,68 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
27095
27382
|
*/
|
|
27096
27383
|
async generatePriceFeedsUpdateTxs(priceFeeds, logContext = {}) {
|
|
27097
27384
|
const updateables = priceFeeds ? priceFeeds.flatMap((pf) => pf.updatableDependencies()) : this.#feeds.values();
|
|
27385
|
+
return this.#generatePriceFeedsUpdateTxs(updateables, logContext);
|
|
27386
|
+
}
|
|
27387
|
+
mustGet(address) {
|
|
27388
|
+
return this.#feeds.mustGet(address);
|
|
27389
|
+
}
|
|
27390
|
+
getOrCreate(data) {
|
|
27391
|
+
const existing = this.#feeds.get(data.baseParams.addr);
|
|
27392
|
+
if (existing?.loaded) {
|
|
27393
|
+
return existing;
|
|
27394
|
+
}
|
|
27395
|
+
const feed = this.#create(data);
|
|
27396
|
+
this.#feeds.upsert(data.baseParams.addr, feed);
|
|
27397
|
+
return feed;
|
|
27398
|
+
}
|
|
27399
|
+
/**
|
|
27400
|
+
* Set redstone historical timestamp
|
|
27401
|
+
* @param timestampMs in milliseconds, or true to use timestamp from attach block
|
|
27402
|
+
*/
|
|
27403
|
+
setRedstoneHistoricalTimestamp(timestampMs) {
|
|
27404
|
+
const ts = timestampMs === true ? Number(this.sdk.timestamp) * 1e3 : timestampMs;
|
|
27405
|
+
this.#redstoneUpdater.setHistoricalTimestamp(ts);
|
|
27406
|
+
}
|
|
27407
|
+
/**
|
|
27408
|
+
* Loads PARTIAL information about all updatable price feeds from MarketCompressor
|
|
27409
|
+
* This can later be used to load price feed updates
|
|
27410
|
+
*/
|
|
27411
|
+
async preloadUpdatablePriceFeeds(curators, pools) {
|
|
27412
|
+
const feedsData = await this.#loadUpdatablePriceFeeds(curators, pools);
|
|
27413
|
+
for (const data of feedsData) {
|
|
27414
|
+
const feed = this.#create({ baseParams: data });
|
|
27415
|
+
this.#feeds.upsert(feed.address, feed);
|
|
27416
|
+
}
|
|
27417
|
+
}
|
|
27418
|
+
/**
|
|
27419
|
+
* Generates price update transaction via multicall3 without any market data knowledge
|
|
27420
|
+
* @param curators
|
|
27421
|
+
* @param pools
|
|
27422
|
+
* @returns
|
|
27423
|
+
*/
|
|
27424
|
+
async getUpdatePriceFeedsTx(curators, pools) {
|
|
27425
|
+
const feedsData = await this.#loadUpdatablePriceFeeds(curators, pools);
|
|
27426
|
+
const feeds = feedsData.map((data) => this.#create({ baseParams: data }));
|
|
27427
|
+
const updates = await this.#generatePriceFeedsUpdateTxs(feeds);
|
|
27428
|
+
return createRawTx(
|
|
27429
|
+
viem.getChainContractAddress({
|
|
27430
|
+
chain: this.sdk.provider.chain,
|
|
27431
|
+
contract: "multicall3"
|
|
27432
|
+
}),
|
|
27433
|
+
{
|
|
27434
|
+
abi: viem.multicall3Abi,
|
|
27435
|
+
functionName: "aggregate3",
|
|
27436
|
+
args: [
|
|
27437
|
+
updates.txs.map((tx) => ({
|
|
27438
|
+
target: tx.to,
|
|
27439
|
+
allowFailure: false,
|
|
27440
|
+
callData: tx.callData
|
|
27441
|
+
}))
|
|
27442
|
+
]
|
|
27443
|
+
}
|
|
27444
|
+
);
|
|
27445
|
+
}
|
|
27446
|
+
async #generatePriceFeedsUpdateTxs(updateables, logContext = {}) {
|
|
27098
27447
|
const txs = [];
|
|
27099
27448
|
const redstonePFs = [];
|
|
27100
27449
|
for (const pf of updateables) {
|
|
@@ -27125,36 +27474,12 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
27125
27474
|
}
|
|
27126
27475
|
return result;
|
|
27127
27476
|
}
|
|
27128
|
-
|
|
27129
|
-
return this.#feeds.mustGet(address);
|
|
27130
|
-
}
|
|
27131
|
-
getOrCreate(data) {
|
|
27132
|
-
const existing = this.#feeds.get(data.baseParams.addr);
|
|
27133
|
-
if (existing?.loaded) {
|
|
27134
|
-
return existing;
|
|
27135
|
-
}
|
|
27136
|
-
const feed = this.#create(data);
|
|
27137
|
-
this.#feeds.upsert(data.baseParams.addr, feed);
|
|
27138
|
-
return feed;
|
|
27139
|
-
}
|
|
27140
|
-
/**
|
|
27141
|
-
* Set redstone historical timestamp
|
|
27142
|
-
* @param timestampMs in milliseconds, or true to use timestamp from attach block
|
|
27143
|
-
*/
|
|
27144
|
-
setRedstoneHistoricalTimestamp(timestampMs) {
|
|
27145
|
-
const ts = timestampMs === true ? Number(this.sdk.timestamp) * 1e3 : timestampMs;
|
|
27146
|
-
this.#redstoneUpdater.setHistoricalTimestamp(ts);
|
|
27147
|
-
}
|
|
27148
|
-
/**
|
|
27149
|
-
* Loads PARTIAL information about all updatable price feeds from MarketCompressor
|
|
27150
|
-
* This can later be used to load price feed updates
|
|
27151
|
-
*/
|
|
27152
|
-
async loadUpdatablePriceFeeds(curators, pools) {
|
|
27477
|
+
async #loadUpdatablePriceFeeds(curators, pools) {
|
|
27153
27478
|
const marketCompressorAddress = this.sdk.addressProvider.getAddress(
|
|
27154
27479
|
AP_MARKET_COMPRESSOR,
|
|
27155
27480
|
310
|
|
27156
27481
|
);
|
|
27157
|
-
const
|
|
27482
|
+
const result = await this.provider.publicClient.readContract({
|
|
27158
27483
|
address: marketCompressorAddress,
|
|
27159
27484
|
abi: iMarketCompressorAbi,
|
|
27160
27485
|
functionName: "getUpdatablePriceFeeds",
|
|
@@ -27169,11 +27494,8 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
27169
27494
|
// @ts-ignore
|
|
27170
27495
|
gas: 500000000n
|
|
27171
27496
|
});
|
|
27172
|
-
|
|
27173
|
-
|
|
27174
|
-
this.#feeds.upsert(feed.address, feed);
|
|
27175
|
-
}
|
|
27176
|
-
this.logger?.debug(`loaded ${feedsData.length} updatable price feeds`);
|
|
27497
|
+
this.logger?.debug(`loaded ${result.length} updatable price feeds`);
|
|
27498
|
+
return result;
|
|
27177
27499
|
}
|
|
27178
27500
|
#create(data) {
|
|
27179
27501
|
const contractType = bytes32ToString(
|
|
@@ -27208,6 +27530,8 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
27208
27530
|
return new ZeroPriceFeedContract(this.sdk, data);
|
|
27209
27531
|
case "PF_MELLOW_LRT_ORACLE":
|
|
27210
27532
|
return new MellowLRTPriceFeedContract(this.sdk, data);
|
|
27533
|
+
case "PF_PENDLE_PT_TWAP_ORACLE":
|
|
27534
|
+
return new PendleTWAPPTPriceFeed(this.sdk, data);
|
|
27211
27535
|
default:
|
|
27212
27536
|
throw new Error(`Price feed type ${contractType} not supported, `);
|
|
27213
27537
|
}
|
|
@@ -27686,6 +28010,20 @@ async function detectNetwork(client) {
|
|
|
27686
28010
|
}
|
|
27687
28011
|
throw new Error("Unsupported network");
|
|
27688
28012
|
}
|
|
28013
|
+
async function sendRawTx(client, params) {
|
|
28014
|
+
const { account, tx } = params;
|
|
28015
|
+
return utils.getAction(
|
|
28016
|
+
client,
|
|
28017
|
+
actions.sendTransaction,
|
|
28018
|
+
"sendTransaction"
|
|
28019
|
+
)({
|
|
28020
|
+
// @ts-expect-error
|
|
28021
|
+
account,
|
|
28022
|
+
data: tx.callData,
|
|
28023
|
+
to: tx.to,
|
|
28024
|
+
value: BigInt(tx.value)
|
|
28025
|
+
});
|
|
28026
|
+
}
|
|
27689
28027
|
async function simulateMulticall(client, parameters) {
|
|
27690
28028
|
const {
|
|
27691
28029
|
account,
|
|
@@ -27715,9 +28053,9 @@ async function simulateMulticall(client, parameters) {
|
|
|
27715
28053
|
let currentChunk = 0;
|
|
27716
28054
|
let currentChunkSize = 0;
|
|
27717
28055
|
for (const contract of contracts) {
|
|
27718
|
-
const { abi:
|
|
28056
|
+
const { abi: abi30, address, args, functionName } = contract;
|
|
27719
28057
|
try {
|
|
27720
|
-
const callData = viem.encodeFunctionData({ abi:
|
|
28058
|
+
const callData = viem.encodeFunctionData({ abi: abi30, args, functionName });
|
|
27721
28059
|
currentChunkSize += (callData.length - 2) / 2;
|
|
27722
28060
|
if (
|
|
27723
28061
|
// Check if batching is enabled.
|
|
@@ -27739,7 +28077,7 @@ async function simulateMulticall(client, parameters) {
|
|
|
27739
28077
|
];
|
|
27740
28078
|
} catch (err) {
|
|
27741
28079
|
const error = viem.getContractError(err, {
|
|
27742
|
-
abi:
|
|
28080
|
+
abi: abi30,
|
|
27743
28081
|
address,
|
|
27744
28082
|
args,
|
|
27745
28083
|
docsPath: "/docs/contract/multicall",
|
|
@@ -27796,12 +28134,12 @@ async function simulateMulticall(client, parameters) {
|
|
|
27796
28134
|
for (let j = 0; j < aggregate3Result.length; j++) {
|
|
27797
28135
|
const { returnData, success } = aggregate3Result[j];
|
|
27798
28136
|
const { callData } = chunkedCalls[i][j];
|
|
27799
|
-
const { abi:
|
|
28137
|
+
const { abi: abi30, address, functionName, args } = contracts[results.length];
|
|
27800
28138
|
try {
|
|
27801
28139
|
if (callData === "0x") throw new viem.AbiDecodingZeroDataError();
|
|
27802
28140
|
if (!success) throw new viem.RawContractError({ data: returnData });
|
|
27803
28141
|
const result2 = viem.decodeFunctionResult({
|
|
27804
|
-
abi:
|
|
28142
|
+
abi: abi30,
|
|
27805
28143
|
args,
|
|
27806
28144
|
data: returnData,
|
|
27807
28145
|
functionName
|
|
@@ -27809,7 +28147,7 @@ async function simulateMulticall(client, parameters) {
|
|
|
27809
28147
|
results.push(allowFailure ? { result: result2, status: "success" } : result2);
|
|
27810
28148
|
} catch (err) {
|
|
27811
28149
|
const error = viem.getContractError(err, {
|
|
27812
|
-
abi:
|
|
28150
|
+
abi: abi30,
|
|
27813
28151
|
address,
|
|
27814
28152
|
args,
|
|
27815
28153
|
docsPath: "/docs/contract/multicall",
|
|
@@ -27826,11 +28164,11 @@ async function simulateMulticall(client, parameters) {
|
|
|
27826
28164
|
}
|
|
27827
28165
|
|
|
27828
28166
|
// src/sdk/market/MarketConfiguratorContract.ts
|
|
27829
|
-
var
|
|
28167
|
+
var abi29 = iMarketConfiguratorV310Abi;
|
|
27830
28168
|
var MarketConfiguratorContract = class extends BaseContract {
|
|
27831
28169
|
constructor(sdk, address) {
|
|
27832
28170
|
super(sdk, {
|
|
27833
|
-
abi:
|
|
28171
|
+
abi: abi29,
|
|
27834
28172
|
addr: address,
|
|
27835
28173
|
contractType: AP_MARKET_CONFIGURATOR,
|
|
27836
28174
|
version: 0
|
|
@@ -27873,6 +28211,10 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
27873
28211
|
}
|
|
27874
28212
|
}
|
|
27875
28213
|
async loadMarkets(curators, ignoreUpdateablePrices) {
|
|
28214
|
+
if (!curators.length) {
|
|
28215
|
+
this.#logger?.warn("no curators provided, skipping loadMarkets");
|
|
28216
|
+
return;
|
|
28217
|
+
}
|
|
27876
28218
|
this.#curators = curators;
|
|
27877
28219
|
await this.#loadMarkets(curators, [], ignoreUpdateablePrices);
|
|
27878
28220
|
}
|
|
@@ -27895,7 +28237,7 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
27895
28237
|
);
|
|
27896
28238
|
let txs = [];
|
|
27897
28239
|
if (!ignoreUpdateablePrices) {
|
|
27898
|
-
await this.sdk.priceFeeds.
|
|
28240
|
+
await this.sdk.priceFeeds.preloadUpdatablePriceFeeds(curators, pools);
|
|
27899
28241
|
const updates = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
|
|
27900
28242
|
txs = updates.txs;
|
|
27901
28243
|
}
|
|
@@ -29587,7 +29929,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
29587
29929
|
);
|
|
29588
29930
|
this.#marketRegister = new MarketRegister(this);
|
|
29589
29931
|
await this.#marketRegister.loadMarkets(
|
|
29590
|
-
riskCurators ?? [
|
|
29932
|
+
riskCurators ?? GEARBOX_RISK_CURATORS[this.#provider.networkType],
|
|
29591
29933
|
ignoreUpdateablePrices
|
|
29592
29934
|
);
|
|
29593
29935
|
try {
|
|
@@ -29828,6 +30170,7 @@ exports.CurveV1AdapterStableNGContract = CurveV1AdapterStableNGContract;
|
|
|
29828
30170
|
exports.DaiUsdsAdapterContract = DaiUsdsAdapterContract;
|
|
29829
30171
|
exports.ERC4626AdapterContract = ERC4626AdapterContract;
|
|
29830
30172
|
exports.Erc4626PriceFeedContract = Erc4626PriceFeedContract;
|
|
30173
|
+
exports.GEARBOX_RISK_CURATORS = GEARBOX_RISK_CURATORS;
|
|
29831
30174
|
exports.GaugeContract = GaugeContract;
|
|
29832
30175
|
exports.GaugeStakingService = GaugeStakingService;
|
|
29833
30176
|
exports.GearStakingContract = GearStakingContract;
|
|
@@ -29847,6 +30190,7 @@ exports.PERCENTAGE_FACTOR = PERCENTAGE_FACTOR;
|
|
|
29847
30190
|
exports.PRICE_DECIMALS = PRICE_DECIMALS;
|
|
29848
30191
|
exports.PRICE_DECIMALS_POW = PRICE_DECIMALS_POW;
|
|
29849
30192
|
exports.PendleRouterAdapterContract = PendleRouterAdapterContract;
|
|
30193
|
+
exports.PendleTWAPPTPriceFeed = PendleTWAPPTPriceFeed;
|
|
29850
30194
|
exports.PoolContract = PoolContract;
|
|
29851
30195
|
exports.PoolFactory = PoolFactory;
|
|
29852
30196
|
exports.PoolQuotaKeeperContract = PoolQuotaKeeperContract;
|
|
@@ -29901,6 +30245,7 @@ exports.json_stringify = json_stringify;
|
|
|
29901
30245
|
exports.numberWithCommas = numberWithCommas;
|
|
29902
30246
|
exports.percentFmt = percentFmt;
|
|
29903
30247
|
exports.rawTxToMulticallPriceUpdate = rawTxToMulticallPriceUpdate;
|
|
30248
|
+
exports.sendRawTx = sendRawTx;
|
|
29904
30249
|
exports.simulateMulticall = simulateMulticall;
|
|
29905
30250
|
exports.toHumanFormat = toHumanFormat;
|
|
29906
30251
|
exports.tokenToTicker = tokenToTicker;
|