@gearbox-protocol/sdk 8.1.5 → 8.2.0-next.1
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/GearboxSDK.js +20 -8
- package/dist/cjs/sdk/abi/oracles.js +141 -0
- package/dist/cjs/sdk/market/pricefeeds/AbstractPriceFeed.js +2 -1
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +17 -23
- package/dist/cjs/sdk/market/pricefeeds/PythPriceFeed.js +9 -1
- package/dist/cjs/sdk/market/pricefeeds/RedstonePriceFeed.js +9 -7
- package/dist/cjs/sdk/market/pricefeeds/index.js +2 -0
- package/dist/cjs/sdk/market/pricefeeds/isUpdatablePriceFeed.js +30 -0
- package/dist/cjs/sdk/market/pricefeeds/updates/PriceUpdateTx.js +52 -0
- package/dist/cjs/sdk/market/pricefeeds/{RedstoneCache.js → updates/PriceUpdatesCache.js} +12 -12
- package/dist/cjs/sdk/market/pricefeeds/updates/PythUpdater.js +189 -0
- package/dist/cjs/sdk/market/pricefeeds/{RedstoneUpdater.js → updates/RedstoneUpdater.js} +21 -45
- package/dist/cjs/sdk/market/pricefeeds/updates/index.js +31 -0
- package/dist/cjs/sdk/market/pricefeeds/updates/types.js +16 -0
- package/dist/cjs/sdk/utils/retry.js +4 -2
- package/dist/cjs/sdk/utils/viem/cast.js +5 -2
- package/dist/cjs/sdk/utils/viem/simulateMulticall.js +3 -1
- package/dist/cjs/sdk/utils/viem/simulateWithPriceUpdates.js +2 -2
- package/dist/esm/sdk/GearboxSDK.js +20 -8
- package/dist/esm/sdk/abi/oracles.js +140 -0
- package/dist/esm/sdk/market/pricefeeds/AbstractPriceFeed.js +2 -1
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +18 -24
- package/dist/esm/sdk/market/pricefeeds/PythPriceFeed.js +9 -1
- package/dist/esm/sdk/market/pricefeeds/RedstonePriceFeed.js +8 -5
- package/dist/esm/sdk/market/pricefeeds/index.js +1 -0
- package/dist/esm/sdk/market/pricefeeds/isUpdatablePriceFeed.js +6 -0
- package/dist/esm/sdk/market/pricefeeds/updates/PriceUpdateTx.js +28 -0
- package/dist/esm/sdk/market/pricefeeds/{RedstoneCache.js → updates/PriceUpdatesCache.js} +8 -8
- package/dist/esm/sdk/market/pricefeeds/updates/PythUpdater.js +169 -0
- package/dist/esm/sdk/market/pricefeeds/{RedstoneUpdater.js → updates/RedstoneUpdater.js} +21 -44
- package/dist/esm/sdk/market/pricefeeds/updates/index.js +6 -0
- package/dist/esm/sdk/market/pricefeeds/updates/types.js +0 -0
- package/dist/esm/sdk/utils/retry.js +4 -2
- package/dist/esm/sdk/utils/viem/cast.js +5 -2
- package/dist/esm/sdk/utils/viem/simulateMulticall.js +3 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +2 -2
- package/dist/types/sdk/GearboxSDK.d.ts +5 -1
- package/dist/types/sdk/abi/oracles.d.ts +212 -0
- package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +2 -2
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +4 -4
- package/dist/types/sdk/market/pricefeeds/PythPriceFeed.d.ts +218 -4
- package/dist/types/sdk/market/pricefeeds/RedstonePriceFeed.d.ts +4 -4
- package/dist/types/sdk/market/pricefeeds/index.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/isUpdatablePriceFeed.d.ts +2 -0
- package/dist/types/sdk/market/pricefeeds/types.d.ts +5 -2
- package/dist/types/sdk/market/pricefeeds/updates/PriceUpdateTx.d.ts +10 -0
- package/dist/types/sdk/market/pricefeeds/updates/PriceUpdatesCache.d.ts +17 -0
- package/dist/types/sdk/market/pricefeeds/updates/PythUpdater.d.ts +40 -0
- package/dist/types/sdk/market/pricefeeds/{RedstoneUpdater.d.ts → updates/RedstoneUpdater.d.ts} +11 -18
- package/dist/types/sdk/market/pricefeeds/updates/RedstoneUpdater.test.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/updates/index.d.ts +3 -0
- package/dist/types/sdk/market/pricefeeds/updates/types.d.ts +21 -0
- package/dist/types/sdk/utils/retry.d.ts +1 -0
- package/dist/types/sdk/utils/viem/cast.d.ts +1 -1
- package/dist/types/sdk/utils/viem/simulateMulticall.d.ts +1 -1
- package/dist/types/sdk/utils/viem/simulateWithPriceUpdates.d.ts +1 -1
- package/package.json +4 -1
- package/dist/types/sdk/market/pricefeeds/RedstoneCache.d.ts +0 -25
|
@@ -6157,3 +6157,215 @@ export declare const pendleTWAPPTPriceFeedAbi: readonly [{
|
|
|
6157
6157
|
readonly name: "StalePriceException";
|
|
6158
6158
|
readonly inputs: readonly [];
|
|
6159
6159
|
}];
|
|
6160
|
+
export declare const pythPriceFeedAbi: readonly [{
|
|
6161
|
+
readonly type: "constructor";
|
|
6162
|
+
readonly inputs: readonly [{
|
|
6163
|
+
readonly name: "_token";
|
|
6164
|
+
readonly type: "address";
|
|
6165
|
+
readonly internalType: "address";
|
|
6166
|
+
}, {
|
|
6167
|
+
readonly name: "_priceFeedId";
|
|
6168
|
+
readonly type: "bytes32";
|
|
6169
|
+
readonly internalType: "bytes32";
|
|
6170
|
+
}, {
|
|
6171
|
+
readonly name: "_pyth";
|
|
6172
|
+
readonly type: "address";
|
|
6173
|
+
readonly internalType: "address";
|
|
6174
|
+
}, {
|
|
6175
|
+
readonly name: "_maxConfToPriceRatio";
|
|
6176
|
+
readonly type: "uint256";
|
|
6177
|
+
readonly internalType: "uint256";
|
|
6178
|
+
}, {
|
|
6179
|
+
readonly name: "descriptionTicker";
|
|
6180
|
+
readonly type: "string";
|
|
6181
|
+
readonly internalType: "string";
|
|
6182
|
+
}];
|
|
6183
|
+
readonly stateMutability: "nonpayable";
|
|
6184
|
+
}, {
|
|
6185
|
+
readonly type: "receive";
|
|
6186
|
+
readonly stateMutability: "payable";
|
|
6187
|
+
}, {
|
|
6188
|
+
readonly type: "function";
|
|
6189
|
+
readonly name: "contractType";
|
|
6190
|
+
readonly inputs: readonly [];
|
|
6191
|
+
readonly outputs: readonly [{
|
|
6192
|
+
readonly name: "";
|
|
6193
|
+
readonly type: "bytes32";
|
|
6194
|
+
readonly internalType: "bytes32";
|
|
6195
|
+
}];
|
|
6196
|
+
readonly stateMutability: "view";
|
|
6197
|
+
}, {
|
|
6198
|
+
readonly type: "function";
|
|
6199
|
+
readonly name: "decimals";
|
|
6200
|
+
readonly inputs: readonly [];
|
|
6201
|
+
readonly outputs: readonly [{
|
|
6202
|
+
readonly name: "";
|
|
6203
|
+
readonly type: "uint8";
|
|
6204
|
+
readonly internalType: "uint8";
|
|
6205
|
+
}];
|
|
6206
|
+
readonly stateMutability: "view";
|
|
6207
|
+
}, {
|
|
6208
|
+
readonly type: "function";
|
|
6209
|
+
readonly name: "description";
|
|
6210
|
+
readonly inputs: readonly [];
|
|
6211
|
+
readonly outputs: readonly [{
|
|
6212
|
+
readonly name: "";
|
|
6213
|
+
readonly type: "string";
|
|
6214
|
+
readonly internalType: "string";
|
|
6215
|
+
}];
|
|
6216
|
+
readonly stateMutability: "view";
|
|
6217
|
+
}, {
|
|
6218
|
+
readonly type: "function";
|
|
6219
|
+
readonly name: "latestRoundData";
|
|
6220
|
+
readonly inputs: readonly [];
|
|
6221
|
+
readonly outputs: readonly [{
|
|
6222
|
+
readonly name: "";
|
|
6223
|
+
readonly type: "uint80";
|
|
6224
|
+
readonly internalType: "uint80";
|
|
6225
|
+
}, {
|
|
6226
|
+
readonly name: "";
|
|
6227
|
+
readonly type: "int256";
|
|
6228
|
+
readonly internalType: "int256";
|
|
6229
|
+
}, {
|
|
6230
|
+
readonly name: "";
|
|
6231
|
+
readonly type: "uint256";
|
|
6232
|
+
readonly internalType: "uint256";
|
|
6233
|
+
}, {
|
|
6234
|
+
readonly name: "";
|
|
6235
|
+
readonly type: "uint256";
|
|
6236
|
+
readonly internalType: "uint256";
|
|
6237
|
+
}, {
|
|
6238
|
+
readonly name: "";
|
|
6239
|
+
readonly type: "uint80";
|
|
6240
|
+
readonly internalType: "uint80";
|
|
6241
|
+
}];
|
|
6242
|
+
readonly stateMutability: "view";
|
|
6243
|
+
}, {
|
|
6244
|
+
readonly type: "function";
|
|
6245
|
+
readonly name: "maxConfToPriceRatio";
|
|
6246
|
+
readonly inputs: readonly [];
|
|
6247
|
+
readonly outputs: readonly [{
|
|
6248
|
+
readonly name: "";
|
|
6249
|
+
readonly type: "uint256";
|
|
6250
|
+
readonly internalType: "uint256";
|
|
6251
|
+
}];
|
|
6252
|
+
readonly stateMutability: "view";
|
|
6253
|
+
}, {
|
|
6254
|
+
readonly type: "function";
|
|
6255
|
+
readonly name: "priceFeedId";
|
|
6256
|
+
readonly inputs: readonly [];
|
|
6257
|
+
readonly outputs: readonly [{
|
|
6258
|
+
readonly name: "";
|
|
6259
|
+
readonly type: "bytes32";
|
|
6260
|
+
readonly internalType: "bytes32";
|
|
6261
|
+
}];
|
|
6262
|
+
readonly stateMutability: "view";
|
|
6263
|
+
}, {
|
|
6264
|
+
readonly type: "function";
|
|
6265
|
+
readonly name: "pyth";
|
|
6266
|
+
readonly inputs: readonly [];
|
|
6267
|
+
readonly outputs: readonly [{
|
|
6268
|
+
readonly name: "";
|
|
6269
|
+
readonly type: "address";
|
|
6270
|
+
readonly internalType: "address";
|
|
6271
|
+
}];
|
|
6272
|
+
readonly stateMutability: "view";
|
|
6273
|
+
}, {
|
|
6274
|
+
readonly type: "function";
|
|
6275
|
+
readonly name: "serialize";
|
|
6276
|
+
readonly inputs: readonly [];
|
|
6277
|
+
readonly outputs: readonly [{
|
|
6278
|
+
readonly name: "";
|
|
6279
|
+
readonly type: "bytes";
|
|
6280
|
+
readonly internalType: "bytes";
|
|
6281
|
+
}];
|
|
6282
|
+
readonly stateMutability: "view";
|
|
6283
|
+
}, {
|
|
6284
|
+
readonly type: "function";
|
|
6285
|
+
readonly name: "skipPriceCheck";
|
|
6286
|
+
readonly inputs: readonly [];
|
|
6287
|
+
readonly outputs: readonly [{
|
|
6288
|
+
readonly name: "";
|
|
6289
|
+
readonly type: "bool";
|
|
6290
|
+
readonly internalType: "bool";
|
|
6291
|
+
}];
|
|
6292
|
+
readonly stateMutability: "view";
|
|
6293
|
+
}, {
|
|
6294
|
+
readonly type: "function";
|
|
6295
|
+
readonly name: "token";
|
|
6296
|
+
readonly inputs: readonly [];
|
|
6297
|
+
readonly outputs: readonly [{
|
|
6298
|
+
readonly name: "";
|
|
6299
|
+
readonly type: "address";
|
|
6300
|
+
readonly internalType: "address";
|
|
6301
|
+
}];
|
|
6302
|
+
readonly stateMutability: "view";
|
|
6303
|
+
}, {
|
|
6304
|
+
readonly type: "function";
|
|
6305
|
+
readonly name: "updatable";
|
|
6306
|
+
readonly inputs: readonly [];
|
|
6307
|
+
readonly outputs: readonly [{
|
|
6308
|
+
readonly name: "";
|
|
6309
|
+
readonly type: "bool";
|
|
6310
|
+
readonly internalType: "bool";
|
|
6311
|
+
}];
|
|
6312
|
+
readonly stateMutability: "view";
|
|
6313
|
+
}, {
|
|
6314
|
+
readonly type: "function";
|
|
6315
|
+
readonly name: "updatePrice";
|
|
6316
|
+
readonly inputs: readonly [{
|
|
6317
|
+
readonly name: "data";
|
|
6318
|
+
readonly type: "bytes";
|
|
6319
|
+
readonly internalType: "bytes";
|
|
6320
|
+
}];
|
|
6321
|
+
readonly outputs: readonly [];
|
|
6322
|
+
readonly stateMutability: "nonpayable";
|
|
6323
|
+
}, {
|
|
6324
|
+
readonly type: "function";
|
|
6325
|
+
readonly name: "version";
|
|
6326
|
+
readonly inputs: readonly [];
|
|
6327
|
+
readonly outputs: readonly [{
|
|
6328
|
+
readonly name: "";
|
|
6329
|
+
readonly type: "uint256";
|
|
6330
|
+
readonly internalType: "uint256";
|
|
6331
|
+
}];
|
|
6332
|
+
readonly stateMutability: "view";
|
|
6333
|
+
}, {
|
|
6334
|
+
readonly type: "event";
|
|
6335
|
+
readonly name: "UpdatePrice";
|
|
6336
|
+
readonly inputs: readonly [{
|
|
6337
|
+
readonly name: "price";
|
|
6338
|
+
readonly type: "uint256";
|
|
6339
|
+
readonly indexed: false;
|
|
6340
|
+
readonly internalType: "uint256";
|
|
6341
|
+
}];
|
|
6342
|
+
readonly anonymous: false;
|
|
6343
|
+
}, {
|
|
6344
|
+
readonly type: "error";
|
|
6345
|
+
readonly name: "ConfToPriceRatioTooHighException";
|
|
6346
|
+
readonly inputs: readonly [];
|
|
6347
|
+
}, {
|
|
6348
|
+
readonly type: "error";
|
|
6349
|
+
readonly name: "IncorrectExpectedPublishTimestampException";
|
|
6350
|
+
readonly inputs: readonly [];
|
|
6351
|
+
}, {
|
|
6352
|
+
readonly type: "error";
|
|
6353
|
+
readonly name: "IncorrectParameterException";
|
|
6354
|
+
readonly inputs: readonly [];
|
|
6355
|
+
}, {
|
|
6356
|
+
readonly type: "error";
|
|
6357
|
+
readonly name: "IncorrectPriceDecimalsException";
|
|
6358
|
+
readonly inputs: readonly [];
|
|
6359
|
+
}, {
|
|
6360
|
+
readonly type: "error";
|
|
6361
|
+
readonly name: "IncorrectPriceException";
|
|
6362
|
+
readonly inputs: readonly [];
|
|
6363
|
+
}, {
|
|
6364
|
+
readonly type: "error";
|
|
6365
|
+
readonly name: "PriceTimestampTooFarAheadException";
|
|
6366
|
+
readonly inputs: readonly [];
|
|
6367
|
+
}, {
|
|
6368
|
+
readonly type: "error";
|
|
6369
|
+
readonly name: "PriceTimestampTooFarBehindException";
|
|
6370
|
+
readonly inputs: readonly [];
|
|
6371
|
+
}];
|
|
@@ -4,7 +4,7 @@ import { BaseContract } from "../../base/index.js";
|
|
|
4
4
|
import type { GearboxSDK } from "../../GearboxSDK.js";
|
|
5
5
|
import type { PriceFeedStateHuman } from "../../types/index.js";
|
|
6
6
|
import { PriceFeedRef } from "./PriceFeedRef.js";
|
|
7
|
-
import type { IPriceFeedContract, PriceFeedContractType } from "./types.js";
|
|
7
|
+
import type { IPriceFeedContract, IUpdatablePriceFeedContract, PriceFeedContractType } from "./types.js";
|
|
8
8
|
export type PartialPriceFeedTreeNode = RequiredBy<Partial<PriceFeedTreeNode>, "baseParams">;
|
|
9
9
|
export type PriceFeedConstructorArgs<abi extends Abi | readonly unknown[]> = PartialPriceFeedTreeNode & {
|
|
10
10
|
abi: abi;
|
|
@@ -30,5 +30,5 @@ export declare abstract class AbstractPriceFeedContract<const abi extends Abi |
|
|
|
30
30
|
answer(overrides?: {
|
|
31
31
|
blockNumber?: bigint;
|
|
32
32
|
}): Promise<bigint>;
|
|
33
|
-
updatableDependencies():
|
|
33
|
+
updatableDependencies(): IUpdatablePriceFeedContract[];
|
|
34
34
|
}
|
|
@@ -5,9 +5,8 @@ import type { GearboxSDK } from "../../GearboxSDK.js";
|
|
|
5
5
|
import type { ILogger } from "../../types/index.js";
|
|
6
6
|
import type { IHooks } from "../../utils/internal/index.js";
|
|
7
7
|
import { type PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
8
|
-
import type { RedstoneOptions, RedstoneUpdateTask } from "./RedstoneUpdater.js";
|
|
9
|
-
import { RedstoneUpdater } from "./RedstoneUpdater.js";
|
|
10
8
|
import type { IPriceFeedContract, UpdatePriceFeedsResult } from "./types.js";
|
|
9
|
+
import type { IPriceUpdater, IPriceUpdateTask, PythOptions, RedstoneOptions } from "./updates/index.js";
|
|
11
10
|
export type PriceFeedRegisterHooks = {
|
|
12
11
|
/**
|
|
13
12
|
* Emitted when transactions to update price feeds have been generated, but before they're used anywhere
|
|
@@ -16,10 +15,11 @@ export type PriceFeedRegisterHooks = {
|
|
|
16
15
|
};
|
|
17
16
|
export interface PriceFeedRegisterOptions {
|
|
18
17
|
redstone?: RedstoneOptions;
|
|
18
|
+
pyth?: PythOptions;
|
|
19
19
|
}
|
|
20
20
|
export interface LatestUpdate {
|
|
21
21
|
timestamp: number;
|
|
22
|
-
|
|
22
|
+
updates: IPriceUpdateTask[];
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* PriceFeedRegister acts as a chain-level cache to avoid creating multiple contract instances.
|
|
@@ -29,7 +29,7 @@ export interface LatestUpdate {
|
|
|
29
29
|
export declare class PriceFeedRegister extends SDKConstruct implements IHooks<PriceFeedRegisterHooks> {
|
|
30
30
|
#private;
|
|
31
31
|
readonly logger?: ILogger;
|
|
32
|
-
readonly
|
|
32
|
+
readonly updaters: IPriceUpdater[];
|
|
33
33
|
constructor(sdk: GearboxSDK, opts?: PriceFeedRegisterOptions);
|
|
34
34
|
addHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: PriceFeedRegisterHooks[K]) => void | Promise<void>) => void;
|
|
35
35
|
removeHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: PriceFeedRegisterHooks[K]) => void | Promise<void>) => void;
|
|
@@ -1,14 +1,228 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
2
|
import type { GearboxSDK } from "../../GearboxSDK.js";
|
|
3
|
+
import type { RawTx } from "../../types/index.js";
|
|
3
4
|
import type { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
4
5
|
import { AbstractPriceFeedContract } from "./AbstractPriceFeed.js";
|
|
5
|
-
|
|
6
|
+
import type { IUpdatablePriceFeedContract } from "./types.js";
|
|
7
|
+
declare const abi: readonly [{
|
|
8
|
+
readonly type: "constructor";
|
|
9
|
+
readonly inputs: readonly [{
|
|
10
|
+
readonly name: "_token";
|
|
11
|
+
readonly type: "address";
|
|
12
|
+
readonly internalType: "address";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "_priceFeedId";
|
|
15
|
+
readonly type: "bytes32";
|
|
16
|
+
readonly internalType: "bytes32";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "_pyth";
|
|
19
|
+
readonly type: "address";
|
|
20
|
+
readonly internalType: "address";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "_maxConfToPriceRatio";
|
|
23
|
+
readonly type: "uint256";
|
|
24
|
+
readonly internalType: "uint256";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "descriptionTicker";
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
readonly internalType: "string";
|
|
29
|
+
}];
|
|
30
|
+
readonly stateMutability: "nonpayable";
|
|
31
|
+
}, {
|
|
32
|
+
readonly type: "receive";
|
|
33
|
+
readonly stateMutability: "payable";
|
|
34
|
+
}, {
|
|
35
|
+
readonly type: "function";
|
|
36
|
+
readonly name: "contractType";
|
|
37
|
+
readonly inputs: readonly [];
|
|
38
|
+
readonly outputs: readonly [{
|
|
39
|
+
readonly name: "";
|
|
40
|
+
readonly type: "bytes32";
|
|
41
|
+
readonly internalType: "bytes32";
|
|
42
|
+
}];
|
|
43
|
+
readonly stateMutability: "view";
|
|
44
|
+
}, {
|
|
45
|
+
readonly type: "function";
|
|
46
|
+
readonly name: "decimals";
|
|
47
|
+
readonly inputs: readonly [];
|
|
48
|
+
readonly outputs: readonly [{
|
|
49
|
+
readonly name: "";
|
|
50
|
+
readonly type: "uint8";
|
|
51
|
+
readonly internalType: "uint8";
|
|
52
|
+
}];
|
|
53
|
+
readonly stateMutability: "view";
|
|
54
|
+
}, {
|
|
55
|
+
readonly type: "function";
|
|
56
|
+
readonly name: "description";
|
|
57
|
+
readonly inputs: readonly [];
|
|
58
|
+
readonly outputs: readonly [{
|
|
59
|
+
readonly name: "";
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
readonly internalType: "string";
|
|
62
|
+
}];
|
|
63
|
+
readonly stateMutability: "view";
|
|
64
|
+
}, {
|
|
65
|
+
readonly type: "function";
|
|
66
|
+
readonly name: "latestRoundData";
|
|
67
|
+
readonly inputs: readonly [];
|
|
68
|
+
readonly outputs: readonly [{
|
|
69
|
+
readonly name: "";
|
|
70
|
+
readonly type: "uint80";
|
|
71
|
+
readonly internalType: "uint80";
|
|
72
|
+
}, {
|
|
73
|
+
readonly name: "";
|
|
74
|
+
readonly type: "int256";
|
|
75
|
+
readonly internalType: "int256";
|
|
76
|
+
}, {
|
|
77
|
+
readonly name: "";
|
|
78
|
+
readonly type: "uint256";
|
|
79
|
+
readonly internalType: "uint256";
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "";
|
|
82
|
+
readonly type: "uint256";
|
|
83
|
+
readonly internalType: "uint256";
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "";
|
|
86
|
+
readonly type: "uint80";
|
|
87
|
+
readonly internalType: "uint80";
|
|
88
|
+
}];
|
|
89
|
+
readonly stateMutability: "view";
|
|
90
|
+
}, {
|
|
91
|
+
readonly type: "function";
|
|
92
|
+
readonly name: "maxConfToPriceRatio";
|
|
93
|
+
readonly inputs: readonly [];
|
|
94
|
+
readonly outputs: readonly [{
|
|
95
|
+
readonly name: "";
|
|
96
|
+
readonly type: "uint256";
|
|
97
|
+
readonly internalType: "uint256";
|
|
98
|
+
}];
|
|
99
|
+
readonly stateMutability: "view";
|
|
100
|
+
}, {
|
|
101
|
+
readonly type: "function";
|
|
102
|
+
readonly name: "priceFeedId";
|
|
103
|
+
readonly inputs: readonly [];
|
|
104
|
+
readonly outputs: readonly [{
|
|
105
|
+
readonly name: "";
|
|
106
|
+
readonly type: "bytes32";
|
|
107
|
+
readonly internalType: "bytes32";
|
|
108
|
+
}];
|
|
109
|
+
readonly stateMutability: "view";
|
|
110
|
+
}, {
|
|
111
|
+
readonly type: "function";
|
|
112
|
+
readonly name: "pyth";
|
|
113
|
+
readonly inputs: readonly [];
|
|
114
|
+
readonly outputs: readonly [{
|
|
115
|
+
readonly name: "";
|
|
116
|
+
readonly type: "address";
|
|
117
|
+
readonly internalType: "address";
|
|
118
|
+
}];
|
|
119
|
+
readonly stateMutability: "view";
|
|
120
|
+
}, {
|
|
121
|
+
readonly type: "function";
|
|
122
|
+
readonly name: "serialize";
|
|
123
|
+
readonly inputs: readonly [];
|
|
124
|
+
readonly outputs: readonly [{
|
|
125
|
+
readonly name: "";
|
|
126
|
+
readonly type: "bytes";
|
|
127
|
+
readonly internalType: "bytes";
|
|
128
|
+
}];
|
|
129
|
+
readonly stateMutability: "view";
|
|
130
|
+
}, {
|
|
131
|
+
readonly type: "function";
|
|
132
|
+
readonly name: "skipPriceCheck";
|
|
133
|
+
readonly inputs: readonly [];
|
|
134
|
+
readonly outputs: readonly [{
|
|
135
|
+
readonly name: "";
|
|
136
|
+
readonly type: "bool";
|
|
137
|
+
readonly internalType: "bool";
|
|
138
|
+
}];
|
|
139
|
+
readonly stateMutability: "view";
|
|
140
|
+
}, {
|
|
141
|
+
readonly type: "function";
|
|
142
|
+
readonly name: "token";
|
|
143
|
+
readonly inputs: readonly [];
|
|
144
|
+
readonly outputs: readonly [{
|
|
145
|
+
readonly name: "";
|
|
146
|
+
readonly type: "address";
|
|
147
|
+
readonly internalType: "address";
|
|
148
|
+
}];
|
|
149
|
+
readonly stateMutability: "view";
|
|
150
|
+
}, {
|
|
151
|
+
readonly type: "function";
|
|
152
|
+
readonly name: "updatable";
|
|
153
|
+
readonly inputs: readonly [];
|
|
154
|
+
readonly outputs: readonly [{
|
|
155
|
+
readonly name: "";
|
|
156
|
+
readonly type: "bool";
|
|
157
|
+
readonly internalType: "bool";
|
|
158
|
+
}];
|
|
159
|
+
readonly stateMutability: "view";
|
|
160
|
+
}, {
|
|
161
|
+
readonly type: "function";
|
|
162
|
+
readonly name: "updatePrice";
|
|
163
|
+
readonly inputs: readonly [{
|
|
164
|
+
readonly name: "data";
|
|
165
|
+
readonly type: "bytes";
|
|
166
|
+
readonly internalType: "bytes";
|
|
167
|
+
}];
|
|
168
|
+
readonly outputs: readonly [];
|
|
169
|
+
readonly stateMutability: "nonpayable";
|
|
170
|
+
}, {
|
|
171
|
+
readonly type: "function";
|
|
172
|
+
readonly name: "version";
|
|
173
|
+
readonly inputs: readonly [];
|
|
174
|
+
readonly outputs: readonly [{
|
|
175
|
+
readonly name: "";
|
|
176
|
+
readonly type: "uint256";
|
|
177
|
+
readonly internalType: "uint256";
|
|
178
|
+
}];
|
|
179
|
+
readonly stateMutability: "view";
|
|
180
|
+
}, {
|
|
181
|
+
readonly type: "event";
|
|
182
|
+
readonly name: "UpdatePrice";
|
|
183
|
+
readonly inputs: readonly [{
|
|
184
|
+
readonly name: "price";
|
|
185
|
+
readonly type: "uint256";
|
|
186
|
+
readonly indexed: false;
|
|
187
|
+
readonly internalType: "uint256";
|
|
188
|
+
}];
|
|
189
|
+
readonly anonymous: false;
|
|
190
|
+
}, {
|
|
191
|
+
readonly type: "error";
|
|
192
|
+
readonly name: "ConfToPriceRatioTooHighException";
|
|
193
|
+
readonly inputs: readonly [];
|
|
194
|
+
}, {
|
|
195
|
+
readonly type: "error";
|
|
196
|
+
readonly name: "IncorrectExpectedPublishTimestampException";
|
|
197
|
+
readonly inputs: readonly [];
|
|
198
|
+
}, {
|
|
199
|
+
readonly type: "error";
|
|
200
|
+
readonly name: "IncorrectParameterException";
|
|
201
|
+
readonly inputs: readonly [];
|
|
202
|
+
}, {
|
|
203
|
+
readonly type: "error";
|
|
204
|
+
readonly name: "IncorrectPriceDecimalsException";
|
|
205
|
+
readonly inputs: readonly [];
|
|
206
|
+
}, {
|
|
207
|
+
readonly type: "error";
|
|
208
|
+
readonly name: "IncorrectPriceException";
|
|
209
|
+
readonly inputs: readonly [];
|
|
210
|
+
}, {
|
|
211
|
+
readonly type: "error";
|
|
212
|
+
readonly name: "PriceTimestampTooFarAheadException";
|
|
213
|
+
readonly inputs: readonly [];
|
|
214
|
+
}, {
|
|
215
|
+
readonly type: "error";
|
|
216
|
+
readonly name: "PriceTimestampTooFarBehindException";
|
|
217
|
+
readonly inputs: readonly [];
|
|
218
|
+
}];
|
|
6
219
|
type abi = typeof abi;
|
|
7
|
-
export declare class PythPriceFeed extends AbstractPriceFeedContract<abi> {
|
|
220
|
+
export declare class PythPriceFeed extends AbstractPriceFeedContract<abi> implements IUpdatablePriceFeedContract {
|
|
8
221
|
readonly token: Address;
|
|
9
|
-
readonly priceFeedId:
|
|
222
|
+
readonly priceFeedId: Hex;
|
|
10
223
|
readonly pyth: Address;
|
|
11
224
|
readonly maxConfToPriceRatio?: bigint;
|
|
12
225
|
constructor(sdk: GearboxSDK, args: PartialPriceFeedTreeNode);
|
|
226
|
+
createPriceUpdateTx(data: `0x${string}`): RawTx;
|
|
13
227
|
}
|
|
14
228
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Address, Hex } from "viem";
|
|
2
2
|
import { redstonePriceFeedAbi } from "../../abi/index.js";
|
|
3
3
|
import type { GearboxSDK } from "../../GearboxSDK.js";
|
|
4
|
-
import type { RedstonePriceFeedStateHuman } from "../../types/index.js";
|
|
4
|
+
import type { RawTx, RedstonePriceFeedStateHuman } from "../../types/index.js";
|
|
5
5
|
import type { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
6
6
|
import { AbstractPriceFeedContract } from "./AbstractPriceFeed.js";
|
|
7
|
-
import type {
|
|
7
|
+
import type { IUpdatablePriceFeedContract } from "./types.js";
|
|
8
8
|
type abi = typeof redstonePriceFeedAbi;
|
|
9
|
-
export declare class RedstonePriceFeedContract extends AbstractPriceFeedContract<abi> {
|
|
9
|
+
export declare class RedstonePriceFeedContract extends AbstractPriceFeedContract<abi> implements IUpdatablePriceFeedContract {
|
|
10
10
|
readonly token: Address;
|
|
11
11
|
readonly dataServiceId: string;
|
|
12
12
|
readonly dataId: string;
|
|
@@ -16,6 +16,6 @@ export declare class RedstonePriceFeedContract extends AbstractPriceFeedContract
|
|
|
16
16
|
readonly lastPayloadTimestamp: number;
|
|
17
17
|
constructor(sdk: GearboxSDK, args: PartialPriceFeedTreeNode);
|
|
18
18
|
stateHuman(raw?: boolean): Omit<RedstonePriceFeedStateHuman, "stalenessPeriod">;
|
|
19
|
+
createPriceUpdateTx(data: `0x${string}`): RawTx;
|
|
19
20
|
}
|
|
20
|
-
export declare function isRedstone(pf: IPriceFeedContract): pf is RedstonePriceFeedContract;
|
|
21
21
|
export {};
|
|
@@ -8,6 +8,7 @@ export * from "./CurveStablePriceFeed.js";
|
|
|
8
8
|
export * from "./CurveUSDPriceFeed.js";
|
|
9
9
|
export * from "./Erc4626PriceFeed.js";
|
|
10
10
|
export * from "./ExternalPriceFeed.js";
|
|
11
|
+
export * from "./isUpdatablePriceFeed.js";
|
|
11
12
|
export * from "./MellowLRTPriceFeed.js";
|
|
12
13
|
export * from "./PendleTWAPPTPriceFeed.js";
|
|
13
14
|
export * from "./PriceFeedRef.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UnionOmit } from "viem";
|
|
2
2
|
import type { IBaseContract } from "../../base/index.js";
|
|
3
|
-
import type { IPriceUpdateTx, PriceFeedStateHuman } from "../../types/index.js";
|
|
3
|
+
import type { IPriceUpdateTx, PriceFeedStateHuman, RawTx } from "../../types/index.js";
|
|
4
4
|
import type { PriceFeedRef } from "./PriceFeedRef.js";
|
|
5
5
|
export type PriceFeedUsageType = "Main" | "Reserve";
|
|
6
6
|
export type PriceFeedContractTypeLegacy = "PF_BALANCER_STABLE_LP_ORACLE" | "PF_BALANCER_WEIGHTED_LP_ORACLE" | "PF_BOUNDED_ORACLE" | "PF_CHAINLINK_ORACLE" | "PF_COMPOSITE_ORACLE" | "PF_CURVE_CRYPTO_LP_ORACLE" | "PF_CURVE_STABLE_LP_ORACLE" | "PF_CURVE_USD_ORACLE" | "PF_ERC4626_ORACLE" | "PF_MELLOW_LRT_ORACLE" | "PF_PENDLE_PT_TWAP_ORACLE" | "PF_PYTH_ORACLE" | "PF_REDSTONE_ORACLE" | "PF_WSTETH_ORACLE" | "PF_YEARN_ORACLE" | "PF_ZERO_ORACLE";
|
|
@@ -27,7 +27,10 @@ export interface IPriceFeedContract extends IBaseContract {
|
|
|
27
27
|
* Returns all updatable depenedencies (uderlying price feeds) of this price feed, including price feed itself, if it's updatable
|
|
28
28
|
* @returns
|
|
29
29
|
*/
|
|
30
|
-
updatableDependencies: () =>
|
|
30
|
+
updatableDependencies: () => IUpdatablePriceFeedContract[];
|
|
31
|
+
}
|
|
32
|
+
export interface IUpdatablePriceFeedContract extends IPriceFeedContract {
|
|
33
|
+
createPriceUpdateTx: (data: `0x${string}`) => RawTx;
|
|
31
34
|
}
|
|
32
35
|
export interface ILPPriceFeedContract extends IPriceFeedContract {
|
|
33
36
|
getValue: () => Promise<bigint>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IPriceUpdateTx, RawTx } from "../../../types/index.js";
|
|
2
|
+
import type { IPriceUpdateTask } from "./types.js";
|
|
3
|
+
export declare abstract class PriceUpdateTx<T extends IPriceUpdateTask = IPriceUpdateTask> implements IPriceUpdateTx<T> {
|
|
4
|
+
readonly raw: RawTx;
|
|
5
|
+
readonly data: T;
|
|
6
|
+
abstract readonly name: string;
|
|
7
|
+
constructor(raw: RawTx, data: T);
|
|
8
|
+
get pretty(): string;
|
|
9
|
+
validateTimestamp(blockTimestamp: bigint): "valid" | "too old" | "in future";
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TimestampedCalldata } from "./types.js";
|
|
2
|
+
export interface PriceUpdatesCacheOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Assume that in historical mode we only need to fetch once and then reuse from cache forever
|
|
5
|
+
*/
|
|
6
|
+
historical: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* TTL in milliseconds
|
|
9
|
+
*/
|
|
10
|
+
ttl: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class PriceUpdatesCache {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(opts: PriceUpdatesCacheOptions);
|
|
15
|
+
get(...path: Array<number | string>): Omit<TimestampedCalldata, "cached"> | undefined;
|
|
16
|
+
set(value: Omit<TimestampedCalldata, "cached">, ...path: Array<number | string>): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SDKConstruct } from "../../../base/index.js";
|
|
2
|
+
import type { GearboxSDK } from "../../../GearboxSDK.js";
|
|
3
|
+
import type { IPriceFeedContract } from "../types.js";
|
|
4
|
+
import { PriceUpdateTx } from "./PriceUpdateTx.js";
|
|
5
|
+
import type { IPriceUpdater, IPriceUpdateTask } from "./types.js";
|
|
6
|
+
export type PythUpdateTask = IPriceUpdateTask;
|
|
7
|
+
declare class PythUpdateTx extends PriceUpdateTx<PythUpdateTask> {
|
|
8
|
+
readonly name = "pyth";
|
|
9
|
+
}
|
|
10
|
+
export interface PythOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Fixed pyth historic timestamp in seconds
|
|
13
|
+
* Set to true to enable pyth historical mode using timestamp from attach block
|
|
14
|
+
*/
|
|
15
|
+
historicTimestamp?: number | true;
|
|
16
|
+
/**
|
|
17
|
+
* Override Hermes API with this proxy. Can be used to set caching proxies, to avoid rate limiting
|
|
18
|
+
*/
|
|
19
|
+
apiProxy?: string;
|
|
20
|
+
/**
|
|
21
|
+
* TTL for pyth cache in milliseconds
|
|
22
|
+
* If 0, disables caching
|
|
23
|
+
* If not set, uses some default value
|
|
24
|
+
* Cache is always enabled in historical mode
|
|
25
|
+
*/
|
|
26
|
+
cacheTTL?: number;
|
|
27
|
+
/**
|
|
28
|
+
* When true, no error will be thrown when pyth is unable to fetch data for some feeds
|
|
29
|
+
*/
|
|
30
|
+
ignoreMissingFeeds?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Class to update multiple pyth price feeds at once
|
|
34
|
+
*/
|
|
35
|
+
export declare class PythUpdater extends SDKConstruct implements IPriceUpdater<PythUpdateTask> {
|
|
36
|
+
#private;
|
|
37
|
+
constructor(sdk: GearboxSDK, opts?: PythOptions);
|
|
38
|
+
getUpdateTxs(feeds: IPriceFeedContract[], logContext?: Record<string, any>): Promise<PythUpdateTx[]>;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
package/dist/types/sdk/market/pricefeeds/{RedstoneUpdater.d.ts → updates/RedstoneUpdater.d.ts}
RENAMED
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
dataFeedId: string;
|
|
1
|
+
import { SDKConstruct } from "../../../base/index.js";
|
|
2
|
+
import type { GearboxSDK } from "../../../GearboxSDK.js";
|
|
3
|
+
import type { IPriceFeedContract } from "../types.js";
|
|
4
|
+
import { PriceUpdateTx } from "./PriceUpdateTx.js";
|
|
5
|
+
import type { IPriceUpdater, IPriceUpdateTask } from "./types.js";
|
|
6
|
+
interface RedstoneUpdateTask extends IPriceUpdateTask {
|
|
8
7
|
dataServiceId: string;
|
|
9
|
-
priceFeed: Address;
|
|
10
|
-
timestamp: number;
|
|
11
|
-
cached: boolean;
|
|
12
8
|
}
|
|
13
|
-
|
|
14
|
-
readonly
|
|
15
|
-
readonly data: RedstoneUpdateTask;
|
|
16
|
-
constructor(raw: RawTx, data: RedstoneUpdateTask);
|
|
17
|
-
get pretty(): string;
|
|
18
|
-
validateTimestamp(blockTimestamp: bigint): "valid" | "too old" | "in future";
|
|
9
|
+
declare class RedstoneUpdateTx extends PriceUpdateTx<RedstoneUpdateTask> {
|
|
10
|
+
readonly name = "redstone";
|
|
19
11
|
}
|
|
20
12
|
export interface RedstoneOptions {
|
|
21
13
|
/**
|
|
@@ -46,8 +38,9 @@ export interface RedstoneOptions {
|
|
|
46
38
|
/**
|
|
47
39
|
* Class to update multiple redstone price feeds at once
|
|
48
40
|
*/
|
|
49
|
-
export declare class RedstoneUpdater extends SDKConstruct {
|
|
41
|
+
export declare class RedstoneUpdater extends SDKConstruct implements IPriceUpdater<RedstoneUpdateTask> {
|
|
50
42
|
#private;
|
|
51
43
|
constructor(sdk: GearboxSDK, opts?: RedstoneOptions);
|
|
52
|
-
getUpdateTxs(feeds:
|
|
44
|
+
getUpdateTxs(feeds: IPriceFeedContract[], logContext?: Record<string, any>): Promise<RedstoneUpdateTx[]>;
|
|
53
45
|
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|