@gearbox-protocol/sdk 8.10.1 → 8.11.0

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.
@@ -23,6 +23,7 @@ __export(oracles_exports, {
23
23
  bptWeightedPriceFeedAbi: () => bptWeightedPriceFeedAbi,
24
24
  chainlinkReadableAggregatorAbi: () => chainlinkReadableAggregatorAbi,
25
25
  compositePriceFeedAbi: () => compositePriceFeedAbi,
26
+ constantPriceFeedAbi: () => constantPriceFeedAbi,
26
27
  curveCryptoLpPriceFeedAbi: () => curveCryptoLpPriceFeedAbi,
27
28
  curveStableLpPriceFeedAbi: () => curveStableLpPriceFeedAbi,
28
29
  curveUsdPriceFeedAbi: () => curveUsdPriceFeedAbi,
@@ -4683,6 +4684,79 @@ const pythPriceFeedAbi = [
4683
4684
  { type: "error", name: "PriceTimestampTooFarAheadException", inputs: [] },
4684
4685
  { type: "error", name: "PriceTimestampTooFarBehindException", inputs: [] }
4685
4686
  ];
4687
+ const constantPriceFeedAbi = [
4688
+ {
4689
+ type: "constructor",
4690
+ inputs: [
4691
+ { name: "_price", type: "int256", internalType: "int256" },
4692
+ { name: "_descriptionTicker", type: "string", internalType: "string" }
4693
+ ],
4694
+ stateMutability: "nonpayable"
4695
+ },
4696
+ {
4697
+ type: "function",
4698
+ name: "contractType",
4699
+ inputs: [],
4700
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4701
+ stateMutability: "view"
4702
+ },
4703
+ {
4704
+ type: "function",
4705
+ name: "decimals",
4706
+ inputs: [],
4707
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
4708
+ stateMutability: "view"
4709
+ },
4710
+ {
4711
+ type: "function",
4712
+ name: "description",
4713
+ inputs: [],
4714
+ outputs: [{ name: "", type: "string", internalType: "string" }],
4715
+ stateMutability: "view"
4716
+ },
4717
+ {
4718
+ type: "function",
4719
+ name: "latestRoundData",
4720
+ inputs: [],
4721
+ outputs: [
4722
+ { name: "", type: "uint80", internalType: "uint80" },
4723
+ { name: "answer", type: "int256", internalType: "int256" },
4724
+ { name: "", type: "uint256", internalType: "uint256" },
4725
+ { name: "", type: "uint256", internalType: "uint256" },
4726
+ { name: "", type: "uint80", internalType: "uint80" }
4727
+ ],
4728
+ stateMutability: "view"
4729
+ },
4730
+ {
4731
+ type: "function",
4732
+ name: "price",
4733
+ inputs: [],
4734
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
4735
+ stateMutability: "view"
4736
+ },
4737
+ {
4738
+ type: "function",
4739
+ name: "serialize",
4740
+ inputs: [],
4741
+ outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
4742
+ stateMutability: "view"
4743
+ },
4744
+ {
4745
+ type: "function",
4746
+ name: "skipPriceCheck",
4747
+ inputs: [],
4748
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
4749
+ stateMutability: "view"
4750
+ },
4751
+ {
4752
+ type: "function",
4753
+ name: "version",
4754
+ inputs: [],
4755
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4756
+ stateMutability: "view"
4757
+ },
4758
+ { type: "error", name: "IncorrectPriceException", inputs: [] }
4759
+ ];
4686
4760
  // Annotate the CommonJS export names for ESM import in node:
4687
4761
  0 && (module.exports = {
4688
4762
  boundedPriceFeedAbi,
@@ -4690,6 +4764,7 @@ const pythPriceFeedAbi = [
4690
4764
  bptWeightedPriceFeedAbi,
4691
4765
  chainlinkReadableAggregatorAbi,
4692
4766
  compositePriceFeedAbi,
4767
+ constantPriceFeedAbi,
4693
4768
  curveCryptoLpPriceFeedAbi,
4694
4769
  curveStableLpPriceFeedAbi,
4695
4770
  curveUsdPriceFeedAbi,
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var ConstantPriceFeed_exports = {};
20
+ __export(ConstantPriceFeed_exports, {
21
+ ConstantPriceFeedContract: () => ConstantPriceFeedContract
22
+ });
23
+ module.exports = __toCommonJS(ConstantPriceFeed_exports);
24
+ var import_viem = require("viem");
25
+ var import_oracles = require("../../abi/oracles.js");
26
+ var import_AbstractPriceFeed = require("./AbstractPriceFeed.js");
27
+ class ConstantPriceFeedContract extends import_AbstractPriceFeed.AbstractPriceFeedContract {
28
+ price;
29
+ constructor(sdk, args) {
30
+ super(sdk, {
31
+ ...args,
32
+ name: "ConstantPriceFeed",
33
+ abi: import_oracles.constantPriceFeedAbi,
34
+ decimals: 8
35
+ // always 8 for USD price feeds
36
+ });
37
+ const decoder = (0, import_viem.decodeAbiParameters)(
38
+ [
39
+ { type: "int256" }
40
+ // price
41
+ ],
42
+ args.baseParams.serializedParams
43
+ );
44
+ this.price = decoder[0];
45
+ }
46
+ stateHuman(raw = true) {
47
+ return {
48
+ ...super.stateHuman(raw),
49
+ contractType: "PRICE_FEED::CONSTANT",
50
+ price: this.price
51
+ };
52
+ }
53
+ }
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ ConstantPriceFeedContract
57
+ });
@@ -31,6 +31,7 @@ var import_BalancerStablePriceFeed = require("./BalancerStablePriceFeed.js");
31
31
  var import_BalancerWeightedPriceFeed = require("./BalancerWeightedPriceFeed.js");
32
32
  var import_BoundedPriceFeed = require("./BoundedPriceFeed.js");
33
33
  var import_CompositePriceFeed = require("./CompositePriceFeed.js");
34
+ var import_ConstantPriceFeed = require("./ConstantPriceFeed.js");
34
35
  var import_CurveCryptoPriceFeed = require("./CurveCryptoPriceFeed.js");
35
36
  var import_CurveStablePriceFeed = require("./CurveStablePriceFeed.js");
36
37
  var import_CurveUSDPriceFeed = require("./CurveUSDPriceFeed.js");
@@ -187,6 +188,8 @@ class PriceFeedRegister extends import_base.SDKConstruct {
187
188
  return new import_BoundedPriceFeed.BoundedPriceFeedContract(this.sdk, data);
188
189
  case "PRICE_FEED::COMPOSITE":
189
190
  return new import_CompositePriceFeed.CompositePriceFeedContract(this.sdk, data);
191
+ case "PRICE_FEED::CONSTANT":
192
+ return new import_ConstantPriceFeed.ConstantPriceFeedContract(this.sdk, data);
190
193
  case "PRICE_FEED::CURVE_CRYPTO":
191
194
  return new import_CurveCryptoPriceFeed.CurveCryptoPriceFeedContract(this.sdk, data);
192
195
  case "PRICE_FEED::CURVE_STABLE":
@@ -4636,12 +4636,86 @@ const pythPriceFeedAbi = [
4636
4636
  { type: "error", name: "PriceTimestampTooFarAheadException", inputs: [] },
4637
4637
  { type: "error", name: "PriceTimestampTooFarBehindException", inputs: [] }
4638
4638
  ];
4639
+ const constantPriceFeedAbi = [
4640
+ {
4641
+ type: "constructor",
4642
+ inputs: [
4643
+ { name: "_price", type: "int256", internalType: "int256" },
4644
+ { name: "_descriptionTicker", type: "string", internalType: "string" }
4645
+ ],
4646
+ stateMutability: "nonpayable"
4647
+ },
4648
+ {
4649
+ type: "function",
4650
+ name: "contractType",
4651
+ inputs: [],
4652
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4653
+ stateMutability: "view"
4654
+ },
4655
+ {
4656
+ type: "function",
4657
+ name: "decimals",
4658
+ inputs: [],
4659
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
4660
+ stateMutability: "view"
4661
+ },
4662
+ {
4663
+ type: "function",
4664
+ name: "description",
4665
+ inputs: [],
4666
+ outputs: [{ name: "", type: "string", internalType: "string" }],
4667
+ stateMutability: "view"
4668
+ },
4669
+ {
4670
+ type: "function",
4671
+ name: "latestRoundData",
4672
+ inputs: [],
4673
+ outputs: [
4674
+ { name: "", type: "uint80", internalType: "uint80" },
4675
+ { name: "answer", type: "int256", internalType: "int256" },
4676
+ { name: "", type: "uint256", internalType: "uint256" },
4677
+ { name: "", type: "uint256", internalType: "uint256" },
4678
+ { name: "", type: "uint80", internalType: "uint80" }
4679
+ ],
4680
+ stateMutability: "view"
4681
+ },
4682
+ {
4683
+ type: "function",
4684
+ name: "price",
4685
+ inputs: [],
4686
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
4687
+ stateMutability: "view"
4688
+ },
4689
+ {
4690
+ type: "function",
4691
+ name: "serialize",
4692
+ inputs: [],
4693
+ outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
4694
+ stateMutability: "view"
4695
+ },
4696
+ {
4697
+ type: "function",
4698
+ name: "skipPriceCheck",
4699
+ inputs: [],
4700
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
4701
+ stateMutability: "view"
4702
+ },
4703
+ {
4704
+ type: "function",
4705
+ name: "version",
4706
+ inputs: [],
4707
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4708
+ stateMutability: "view"
4709
+ },
4710
+ { type: "error", name: "IncorrectPriceException", inputs: [] }
4711
+ ];
4639
4712
  export {
4640
4713
  boundedPriceFeedAbi,
4641
4714
  bptStablePriceFeedAbi,
4642
4715
  bptWeightedPriceFeedAbi,
4643
4716
  chainlinkReadableAggregatorAbi,
4644
4717
  compositePriceFeedAbi,
4718
+ constantPriceFeedAbi,
4645
4719
  curveCryptoLpPriceFeedAbi,
4646
4720
  curveStableLpPriceFeedAbi,
4647
4721
  curveUsdPriceFeedAbi,
@@ -0,0 +1,33 @@
1
+ import { decodeAbiParameters } from "viem";
2
+ import { constantPriceFeedAbi } from "../../abi/oracles.js";
3
+ import { AbstractPriceFeedContract } from "./AbstractPriceFeed.js";
4
+ class ConstantPriceFeedContract extends AbstractPriceFeedContract {
5
+ price;
6
+ constructor(sdk, args) {
7
+ super(sdk, {
8
+ ...args,
9
+ name: "ConstantPriceFeed",
10
+ abi: constantPriceFeedAbi,
11
+ decimals: 8
12
+ // always 8 for USD price feeds
13
+ });
14
+ const decoder = decodeAbiParameters(
15
+ [
16
+ { type: "int256" }
17
+ // price
18
+ ],
19
+ args.baseParams.serializedParams
20
+ );
21
+ this.price = decoder[0];
22
+ }
23
+ stateHuman(raw = true) {
24
+ return {
25
+ ...super.stateHuman(raw),
26
+ contractType: "PRICE_FEED::CONSTANT",
27
+ price: this.price
28
+ };
29
+ }
30
+ }
31
+ export {
32
+ ConstantPriceFeedContract
33
+ };
@@ -14,6 +14,7 @@ import { BalancerStablePriceFeedContract } from "./BalancerStablePriceFeed.js";
14
14
  import { BalancerWeightedPriceFeedContract } from "./BalancerWeightedPriceFeed.js";
15
15
  import { BoundedPriceFeedContract } from "./BoundedPriceFeed.js";
16
16
  import { CompositePriceFeedContract } from "./CompositePriceFeed.js";
17
+ import { ConstantPriceFeedContract } from "./ConstantPriceFeed.js";
17
18
  import { CurveCryptoPriceFeedContract } from "./CurveCryptoPriceFeed.js";
18
19
  import { CurveStablePriceFeedContract } from "./CurveStablePriceFeed.js";
19
20
  import { CurveUSDPriceFeedContract } from "./CurveUSDPriceFeed.js";
@@ -170,6 +171,8 @@ class PriceFeedRegister extends SDKConstruct {
170
171
  return new BoundedPriceFeedContract(this.sdk, data);
171
172
  case "PRICE_FEED::COMPOSITE":
172
173
  return new CompositePriceFeedContract(this.sdk, data);
174
+ case "PRICE_FEED::CONSTANT":
175
+ return new ConstantPriceFeedContract(this.sdk, data);
173
176
  case "PRICE_FEED::CURVE_CRYPTO":
174
177
  return new CurveCryptoPriceFeedContract(this.sdk, data);
175
178
  case "PRICE_FEED::CURVE_STABLE":
@@ -6369,3 +6369,116 @@ export declare const pythPriceFeedAbi: readonly [{
6369
6369
  readonly name: "PriceTimestampTooFarBehindException";
6370
6370
  readonly inputs: readonly [];
6371
6371
  }];
6372
+ export declare const constantPriceFeedAbi: readonly [{
6373
+ readonly type: "constructor";
6374
+ readonly inputs: readonly [{
6375
+ readonly name: "_price";
6376
+ readonly type: "int256";
6377
+ readonly internalType: "int256";
6378
+ }, {
6379
+ readonly name: "_descriptionTicker";
6380
+ readonly type: "string";
6381
+ readonly internalType: "string";
6382
+ }];
6383
+ readonly stateMutability: "nonpayable";
6384
+ }, {
6385
+ readonly type: "function";
6386
+ readonly name: "contractType";
6387
+ readonly inputs: readonly [];
6388
+ readonly outputs: readonly [{
6389
+ readonly name: "";
6390
+ readonly type: "bytes32";
6391
+ readonly internalType: "bytes32";
6392
+ }];
6393
+ readonly stateMutability: "view";
6394
+ }, {
6395
+ readonly type: "function";
6396
+ readonly name: "decimals";
6397
+ readonly inputs: readonly [];
6398
+ readonly outputs: readonly [{
6399
+ readonly name: "";
6400
+ readonly type: "uint8";
6401
+ readonly internalType: "uint8";
6402
+ }];
6403
+ readonly stateMutability: "view";
6404
+ }, {
6405
+ readonly type: "function";
6406
+ readonly name: "description";
6407
+ readonly inputs: readonly [];
6408
+ readonly outputs: readonly [{
6409
+ readonly name: "";
6410
+ readonly type: "string";
6411
+ readonly internalType: "string";
6412
+ }];
6413
+ readonly stateMutability: "view";
6414
+ }, {
6415
+ readonly type: "function";
6416
+ readonly name: "latestRoundData";
6417
+ readonly inputs: readonly [];
6418
+ readonly outputs: readonly [{
6419
+ readonly name: "";
6420
+ readonly type: "uint80";
6421
+ readonly internalType: "uint80";
6422
+ }, {
6423
+ readonly name: "answer";
6424
+ readonly type: "int256";
6425
+ readonly internalType: "int256";
6426
+ }, {
6427
+ readonly name: "";
6428
+ readonly type: "uint256";
6429
+ readonly internalType: "uint256";
6430
+ }, {
6431
+ readonly name: "";
6432
+ readonly type: "uint256";
6433
+ readonly internalType: "uint256";
6434
+ }, {
6435
+ readonly name: "";
6436
+ readonly type: "uint80";
6437
+ readonly internalType: "uint80";
6438
+ }];
6439
+ readonly stateMutability: "view";
6440
+ }, {
6441
+ readonly type: "function";
6442
+ readonly name: "price";
6443
+ readonly inputs: readonly [];
6444
+ readonly outputs: readonly [{
6445
+ readonly name: "";
6446
+ readonly type: "int256";
6447
+ readonly internalType: "int256";
6448
+ }];
6449
+ readonly stateMutability: "view";
6450
+ }, {
6451
+ readonly type: "function";
6452
+ readonly name: "serialize";
6453
+ readonly inputs: readonly [];
6454
+ readonly outputs: readonly [{
6455
+ readonly name: "";
6456
+ readonly type: "bytes";
6457
+ readonly internalType: "bytes";
6458
+ }];
6459
+ readonly stateMutability: "view";
6460
+ }, {
6461
+ readonly type: "function";
6462
+ readonly name: "skipPriceCheck";
6463
+ readonly inputs: readonly [];
6464
+ readonly outputs: readonly [{
6465
+ readonly name: "";
6466
+ readonly type: "bool";
6467
+ readonly internalType: "bool";
6468
+ }];
6469
+ readonly stateMutability: "view";
6470
+ }, {
6471
+ readonly type: "function";
6472
+ readonly name: "version";
6473
+ readonly inputs: readonly [];
6474
+ readonly outputs: readonly [{
6475
+ readonly name: "";
6476
+ readonly type: "uint256";
6477
+ readonly internalType: "uint256";
6478
+ }];
6479
+ readonly stateMutability: "view";
6480
+ }, {
6481
+ readonly type: "error";
6482
+ readonly name: "IncorrectPriceException";
6483
+ readonly inputs: readonly [];
6484
+ }];
@@ -0,0 +1,12 @@
1
+ import { constantPriceFeedAbi } from "../../abi/oracles.js";
2
+ import type { GearboxSDK } from "../../GearboxSDK.js";
3
+ import type { ConstantOracleStateHuman } from "../../types/index.js";
4
+ import type { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
5
+ import { AbstractPriceFeedContract } from "./AbstractPriceFeed.js";
6
+ type abi = typeof constantPriceFeedAbi;
7
+ export declare class ConstantPriceFeedContract extends AbstractPriceFeedContract<abi> {
8
+ readonly price: bigint;
9
+ constructor(sdk: GearboxSDK, args: PartialPriceFeedTreeNode);
10
+ stateHuman(raw?: boolean): Omit<ConstantOracleStateHuman, "stalenessPeriod">;
11
+ }
12
+ export {};
@@ -4,7 +4,7 @@ import type { IPriceUpdateTx, PriceFeedStateHuman, RawTx } from "../../types/ind
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";
7
- export type PriceFeedContractType = "PRICE_FEED::BALANCER_STABLE" | "PRICE_FEED::BALANCER_WEIGHTED" | "PRICE_FEED::BOUNDED" | "PRICE_FEED::COMPOSITE" | "PRICE_FEED::CURVE_CRYPTO" | "PRICE_FEED::CURVE_STABLE" | "PRICE_FEED::CURVE_USD" | "PRICE_FEED::ERC4626" | "PRICE_FEED::EXTERNAL" | "PRICE_FEED::MELLOW_LRT" | "PRICE_FEED::PENDLE_PT_TWAP" | "PRICE_FEED::PYTH" | "PRICE_FEED::REDSTONE" | "PRICE_FEED::WSTETH" | "PRICE_FEED::YEARN" | "PRICE_FEED::ZERO";
7
+ export type PriceFeedContractType = "PRICE_FEED::BALANCER_STABLE" | "PRICE_FEED::BALANCER_WEIGHTED" | "PRICE_FEED::BOUNDED" | "PRICE_FEED::COMPOSITE" | "PRICE_FEED::CONSTANT" | "PRICE_FEED::CURVE_CRYPTO" | "PRICE_FEED::CURVE_STABLE" | "PRICE_FEED::CURVE_USD" | "PRICE_FEED::ERC4626" | "PRICE_FEED::EXTERNAL" | "PRICE_FEED::MELLOW_LRT" | "PRICE_FEED::PENDLE_PT_TWAP" | "PRICE_FEED::PYTH" | "PRICE_FEED::REDSTONE" | "PRICE_FEED::WSTETH" | "PRICE_FEED::YEARN" | "PRICE_FEED::ZERO";
8
8
  export interface IPriceFeedContract extends IBaseContract {
9
9
  readonly hasLowerBoundCap: boolean;
10
10
  readonly priceFeedType: PriceFeedContractType;
@@ -31,6 +31,10 @@ export interface BoundedOracleStateHuman extends BasePriceFeedStateHuman {
31
31
  contractType: "PRICE_FEED::BOUNDED";
32
32
  upperBound: bigint;
33
33
  }
34
+ export interface ConstantOracleStateHuman extends BasePriceFeedStateHuman {
35
+ contractType: "PRICE_FEED::CONSTANT";
36
+ price: bigint;
37
+ }
34
38
  export interface AssetPriceFeedStateHuman extends BasePriceFeedStateHuman {
35
39
  contractType: PriceFeedContractType;
36
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "8.10.1",
3
+ "version": "8.11.0",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",