@gearbox-protocol/sdk 3.0.0-vfour.66 → 3.0.0-vfour.68

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.
@@ -21544,37 +21544,28 @@ var PriceOracleContract = class extends BaseContract {
21544
21544
  await this.sdk.marketRegister.updatePrices([this.address]);
21545
21545
  }
21546
21546
  syncStateMulticall() {
21547
- if (this.version === 310) {
21548
- return {
21549
- call: {
21550
- abi: iPriceFeedCompressorAbi,
21551
- address: this.sdk.addressProvider.getLatestVersion(
21552
- AP_PRICE_FEED_COMPRESSOR
21553
- ),
21554
- functionName: "getPriceFeeds",
21555
- args: [this.address]
21556
- },
21557
- onResult: ([entries, tree]) => {
21558
- this.#loadState(entries, tree);
21559
- }
21560
- };
21547
+ const args = [this.address];
21548
+ if (this.version === 300) {
21549
+ args.push(
21550
+ Array.from(
21551
+ /* @__PURE__ */ new Set([
21552
+ this.underlying,
21553
+ ...this.mainPriceFeeds.keys(),
21554
+ ...this.reservePriceFeeds.keys()
21555
+ ])
21556
+ )
21557
+ );
21561
21558
  }
21562
- const tokens = /* @__PURE__ */ new Set([
21563
- this.underlying,
21564
- ...this.mainPriceFeeds.keys(),
21565
- ...this.reservePriceFeeds.keys()
21566
- ]);
21567
21559
  return {
21568
21560
  call: {
21569
21561
  abi: iPriceFeedCompressorAbi,
21570
21562
  address: this.sdk.addressProvider.getLatestVersion(
21571
21563
  AP_PRICE_FEED_COMPRESSOR
21572
21564
  ),
21573
- functionName: "getPriceOracleState",
21574
- args: [this.address, [this.underlying, ...Array.from(tokens)]]
21565
+ functionName: "getPriceFeeds",
21566
+ args
21575
21567
  },
21576
- onResult: (state) => {
21577
- const { priceFeedMapping: entries, priceFeedStructure: tree } = state;
21568
+ onResult: ([entries, tree]) => {
21578
21569
  this.#loadState(entries, tree);
21579
21570
  }
21580
21571
  };
@@ -22066,14 +22057,6 @@ var MarketRegister = class extends SDKConstruct {
22066
22057
  }
22067
22058
  throw new Error(`cannot find credit manager ${creditManager}`);
22068
22059
  }
22069
- findPriceOracle(address) {
22070
- for (const market of this.markets) {
22071
- if (market.priceOracle.address.toLowerCase() === address.toLowerCase()) {
22072
- return market.priceOracle;
22073
- }
22074
- }
22075
- throw new Error(`cannot find price oracle ${address}`);
22076
- }
22077
22060
  findByCreditManager(creditManager) {
22078
22061
  const market = this.markets.find(
22079
22062
  (m) => m.creditManagers.some(
@@ -22085,6 +22068,14 @@ var MarketRegister = class extends SDKConstruct {
22085
22068
  }
22086
22069
  return market;
22087
22070
  }
22071
+ findByPriceOracle(address) {
22072
+ for (const market of this.markets) {
22073
+ if (market.priceOracle.address.toLowerCase() === address.toLowerCase()) {
22074
+ return market;
22075
+ }
22076
+ }
22077
+ throw new Error(`cannot find price oracle ${address}`);
22078
+ }
22088
22079
  get markets() {
22089
22080
  return this.#markets.values();
22090
22081
  }
@@ -22828,317 +22828,9 @@ declare class PriceOracleContract extends BaseContract<abi$c> {
22828
22828
  }];
22829
22829
  address: `0x${string}`;
22830
22830
  functionName: string;
22831
- args: `0x${string}`[];
22831
+ args: any[];
22832
22832
  };
22833
22833
  onResult: ([entries, tree]: [PriceFeedMapEntry[], PriceFeedTreeNode[]]) => void;
22834
- } | {
22835
- call: {
22836
- abi: readonly [{
22837
- readonly type: "function";
22838
- readonly inputs: readonly [];
22839
- readonly name: "contractType";
22840
- readonly outputs: readonly [{
22841
- readonly name: "";
22842
- readonly internalType: "bytes32";
22843
- readonly type: "bytes32";
22844
- }];
22845
- readonly stateMutability: "view";
22846
- }, {
22847
- readonly type: "function";
22848
- readonly inputs: readonly [{
22849
- readonly name: "priceOracle";
22850
- readonly internalType: "address";
22851
- readonly type: "address";
22852
- }, {
22853
- readonly name: "tokens";
22854
- readonly internalType: "address[]";
22855
- readonly type: "address[]";
22856
- }];
22857
- readonly name: "getPriceFeeds";
22858
- readonly outputs: readonly [{
22859
- readonly name: "priceFeedMap";
22860
- readonly internalType: "struct PriceFeedMapEntry[]";
22861
- readonly type: "tuple[]";
22862
- readonly components: readonly [{
22863
- readonly name: "token";
22864
- readonly internalType: "address";
22865
- readonly type: "address";
22866
- }, {
22867
- readonly name: "reserve";
22868
- readonly internalType: "bool";
22869
- readonly type: "bool";
22870
- }, {
22871
- readonly name: "priceFeed";
22872
- readonly internalType: "address";
22873
- readonly type: "address";
22874
- }, {
22875
- readonly name: "stalenessPeriod";
22876
- readonly internalType: "uint32";
22877
- readonly type: "uint32";
22878
- }];
22879
- }, {
22880
- readonly name: "priceFeedTree";
22881
- readonly internalType: "struct PriceFeedTreeNode[]";
22882
- readonly type: "tuple[]";
22883
- readonly components: readonly [{
22884
- readonly name: "baseParams";
22885
- readonly internalType: "struct BaseParams";
22886
- readonly type: "tuple";
22887
- readonly components: readonly [{
22888
- readonly name: "addr";
22889
- readonly internalType: "address";
22890
- readonly type: "address";
22891
- }, {
22892
- readonly name: "version";
22893
- readonly internalType: "uint256";
22894
- readonly type: "uint256";
22895
- }, {
22896
- readonly name: "contractType";
22897
- readonly internalType: "bytes32";
22898
- readonly type: "bytes32";
22899
- }, {
22900
- readonly name: "serializedParams";
22901
- readonly internalType: "bytes";
22902
- readonly type: "bytes";
22903
- }];
22904
- }, {
22905
- readonly name: "decimals";
22906
- readonly internalType: "uint8";
22907
- readonly type: "uint8";
22908
- }, {
22909
- readonly name: "skipCheck";
22910
- readonly internalType: "bool";
22911
- readonly type: "bool";
22912
- }, {
22913
- readonly name: "updatable";
22914
- readonly internalType: "bool";
22915
- readonly type: "bool";
22916
- }, {
22917
- readonly name: "underlyingFeeds";
22918
- readonly internalType: "address[]";
22919
- readonly type: "address[]";
22920
- }, {
22921
- readonly name: "underlyingStalenessPeriods";
22922
- readonly internalType: "uint32[]";
22923
- readonly type: "uint32[]";
22924
- }, {
22925
- readonly name: "answer";
22926
- readonly internalType: "struct PriceFeedAnswer";
22927
- readonly type: "tuple";
22928
- readonly components: readonly [{
22929
- readonly name: "price";
22930
- readonly internalType: "int256";
22931
- readonly type: "int256";
22932
- }, {
22933
- readonly name: "updatedAt";
22934
- readonly internalType: "uint256";
22935
- readonly type: "uint256";
22936
- }, {
22937
- readonly name: "success";
22938
- readonly internalType: "bool";
22939
- readonly type: "bool";
22940
- }];
22941
- }];
22942
- }];
22943
- readonly stateMutability: "view";
22944
- }, {
22945
- readonly type: "function";
22946
- readonly inputs: readonly [{
22947
- readonly name: "priceOracle";
22948
- readonly internalType: "address";
22949
- readonly type: "address";
22950
- }];
22951
- readonly name: "getPriceFeeds";
22952
- readonly outputs: readonly [{
22953
- readonly name: "priceFeedMap";
22954
- readonly internalType: "struct PriceFeedMapEntry[]";
22955
- readonly type: "tuple[]";
22956
- readonly components: readonly [{
22957
- readonly name: "token";
22958
- readonly internalType: "address";
22959
- readonly type: "address";
22960
- }, {
22961
- readonly name: "reserve";
22962
- readonly internalType: "bool";
22963
- readonly type: "bool";
22964
- }, {
22965
- readonly name: "priceFeed";
22966
- readonly internalType: "address";
22967
- readonly type: "address";
22968
- }, {
22969
- readonly name: "stalenessPeriod";
22970
- readonly internalType: "uint32";
22971
- readonly type: "uint32";
22972
- }];
22973
- }, {
22974
- readonly name: "priceFeedTree";
22975
- readonly internalType: "struct PriceFeedTreeNode[]";
22976
- readonly type: "tuple[]";
22977
- readonly components: readonly [{
22978
- readonly name: "baseParams";
22979
- readonly internalType: "struct BaseParams";
22980
- readonly type: "tuple";
22981
- readonly components: readonly [{
22982
- readonly name: "addr";
22983
- readonly internalType: "address";
22984
- readonly type: "address";
22985
- }, {
22986
- readonly name: "version";
22987
- readonly internalType: "uint256";
22988
- readonly type: "uint256";
22989
- }, {
22990
- readonly name: "contractType";
22991
- readonly internalType: "bytes32";
22992
- readonly type: "bytes32";
22993
- }, {
22994
- readonly name: "serializedParams";
22995
- readonly internalType: "bytes";
22996
- readonly type: "bytes";
22997
- }];
22998
- }, {
22999
- readonly name: "decimals";
23000
- readonly internalType: "uint8";
23001
- readonly type: "uint8";
23002
- }, {
23003
- readonly name: "skipCheck";
23004
- readonly internalType: "bool";
23005
- readonly type: "bool";
23006
- }, {
23007
- readonly name: "updatable";
23008
- readonly internalType: "bool";
23009
- readonly type: "bool";
23010
- }, {
23011
- readonly name: "underlyingFeeds";
23012
- readonly internalType: "address[]";
23013
- readonly type: "address[]";
23014
- }, {
23015
- readonly name: "underlyingStalenessPeriods";
23016
- readonly internalType: "uint32[]";
23017
- readonly type: "uint32[]";
23018
- }, {
23019
- readonly name: "answer";
23020
- readonly internalType: "struct PriceFeedAnswer";
23021
- readonly type: "tuple";
23022
- readonly components: readonly [{
23023
- readonly name: "price";
23024
- readonly internalType: "int256";
23025
- readonly type: "int256";
23026
- }, {
23027
- readonly name: "updatedAt";
23028
- readonly internalType: "uint256";
23029
- readonly type: "uint256";
23030
- }, {
23031
- readonly name: "success";
23032
- readonly internalType: "bool";
23033
- readonly type: "bool";
23034
- }];
23035
- }];
23036
- }];
23037
- readonly stateMutability: "view";
23038
- }, {
23039
- readonly type: "function";
23040
- readonly inputs: readonly [{
23041
- readonly name: "priceFeeds";
23042
- readonly internalType: "address[]";
23043
- readonly type: "address[]";
23044
- }];
23045
- readonly name: "loadPriceFeedTree";
23046
- readonly outputs: readonly [{
23047
- readonly name: "priceFeedTree";
23048
- readonly internalType: "struct PriceFeedTreeNode[]";
23049
- readonly type: "tuple[]";
23050
- readonly components: readonly [{
23051
- readonly name: "baseParams";
23052
- readonly internalType: "struct BaseParams";
23053
- readonly type: "tuple";
23054
- readonly components: readonly [{
23055
- readonly name: "addr";
23056
- readonly internalType: "address";
23057
- readonly type: "address";
23058
- }, {
23059
- readonly name: "version";
23060
- readonly internalType: "uint256";
23061
- readonly type: "uint256";
23062
- }, {
23063
- readonly name: "contractType";
23064
- readonly internalType: "bytes32";
23065
- readonly type: "bytes32";
23066
- }, {
23067
- readonly name: "serializedParams";
23068
- readonly internalType: "bytes";
23069
- readonly type: "bytes";
23070
- }];
23071
- }, {
23072
- readonly name: "decimals";
23073
- readonly internalType: "uint8";
23074
- readonly type: "uint8";
23075
- }, {
23076
- readonly name: "skipCheck";
23077
- readonly internalType: "bool";
23078
- readonly type: "bool";
23079
- }, {
23080
- readonly name: "updatable";
23081
- readonly internalType: "bool";
23082
- readonly type: "bool";
23083
- }, {
23084
- readonly name: "underlyingFeeds";
23085
- readonly internalType: "address[]";
23086
- readonly type: "address[]";
23087
- }, {
23088
- readonly name: "underlyingStalenessPeriods";
23089
- readonly internalType: "uint32[]";
23090
- readonly type: "uint32[]";
23091
- }, {
23092
- readonly name: "answer";
23093
- readonly internalType: "struct PriceFeedAnswer";
23094
- readonly type: "tuple";
23095
- readonly components: readonly [{
23096
- readonly name: "price";
23097
- readonly internalType: "int256";
23098
- readonly type: "int256";
23099
- }, {
23100
- readonly name: "updatedAt";
23101
- readonly internalType: "uint256";
23102
- readonly type: "uint256";
23103
- }, {
23104
- readonly name: "success";
23105
- readonly internalType: "bool";
23106
- readonly type: "bool";
23107
- }];
23108
- }];
23109
- }];
23110
- readonly stateMutability: "view";
23111
- }, {
23112
- readonly type: "function";
23113
- readonly inputs: readonly [];
23114
- readonly name: "version";
23115
- readonly outputs: readonly [{
23116
- readonly name: "";
23117
- readonly internalType: "uint256";
23118
- readonly type: "uint256";
23119
- }];
23120
- readonly stateMutability: "view";
23121
- }, {
23122
- readonly type: "event";
23123
- readonly anonymous: false;
23124
- readonly inputs: readonly [{
23125
- readonly name: "contractType";
23126
- readonly internalType: "bytes32";
23127
- readonly type: "bytes32";
23128
- readonly indexed: true;
23129
- }, {
23130
- readonly name: "serializer";
23131
- readonly internalType: "address";
23132
- readonly type: "address";
23133
- readonly indexed: true;
23134
- }];
23135
- readonly name: "SetSerializer";
23136
- }];
23137
- address: `0x${string}`;
23138
- functionName: string;
23139
- args: (`0x${string}` | `0x${string}`[])[];
23140
- };
23141
- onResult: (state: PriceOracleData) => void;
23142
22834
  };
23143
22835
  stateHuman(raw?: boolean): PriceOracleV3StateHuman;
23144
22836
  }
@@ -24849,8 +24541,8 @@ declare class MarketRegister extends SDKConstruct {
24849
24541
  get pools(): PoolFactory[];
24850
24542
  get creditManagers(): CreditFactory[];
24851
24543
  findCreditManager(creditManager: Address): CreditFactory;
24852
- findPriceOracle(address: Address): PriceOracleContract;
24853
24544
  findByCreditManager(creditManager: Address): MarketFactory;
24545
+ findByPriceOracle(address: Address): MarketFactory;
24854
24546
  get markets(): MarketFactory[];
24855
24547
  tvl(): Promise<TVL>;
24856
24548
  get curators(): Address[];
@@ -22828,317 +22828,9 @@ declare class PriceOracleContract extends BaseContract<abi$c> {
22828
22828
  }];
22829
22829
  address: `0x${string}`;
22830
22830
  functionName: string;
22831
- args: `0x${string}`[];
22831
+ args: any[];
22832
22832
  };
22833
22833
  onResult: ([entries, tree]: [PriceFeedMapEntry[], PriceFeedTreeNode[]]) => void;
22834
- } | {
22835
- call: {
22836
- abi: readonly [{
22837
- readonly type: "function";
22838
- readonly inputs: readonly [];
22839
- readonly name: "contractType";
22840
- readonly outputs: readonly [{
22841
- readonly name: "";
22842
- readonly internalType: "bytes32";
22843
- readonly type: "bytes32";
22844
- }];
22845
- readonly stateMutability: "view";
22846
- }, {
22847
- readonly type: "function";
22848
- readonly inputs: readonly [{
22849
- readonly name: "priceOracle";
22850
- readonly internalType: "address";
22851
- readonly type: "address";
22852
- }, {
22853
- readonly name: "tokens";
22854
- readonly internalType: "address[]";
22855
- readonly type: "address[]";
22856
- }];
22857
- readonly name: "getPriceFeeds";
22858
- readonly outputs: readonly [{
22859
- readonly name: "priceFeedMap";
22860
- readonly internalType: "struct PriceFeedMapEntry[]";
22861
- readonly type: "tuple[]";
22862
- readonly components: readonly [{
22863
- readonly name: "token";
22864
- readonly internalType: "address";
22865
- readonly type: "address";
22866
- }, {
22867
- readonly name: "reserve";
22868
- readonly internalType: "bool";
22869
- readonly type: "bool";
22870
- }, {
22871
- readonly name: "priceFeed";
22872
- readonly internalType: "address";
22873
- readonly type: "address";
22874
- }, {
22875
- readonly name: "stalenessPeriod";
22876
- readonly internalType: "uint32";
22877
- readonly type: "uint32";
22878
- }];
22879
- }, {
22880
- readonly name: "priceFeedTree";
22881
- readonly internalType: "struct PriceFeedTreeNode[]";
22882
- readonly type: "tuple[]";
22883
- readonly components: readonly [{
22884
- readonly name: "baseParams";
22885
- readonly internalType: "struct BaseParams";
22886
- readonly type: "tuple";
22887
- readonly components: readonly [{
22888
- readonly name: "addr";
22889
- readonly internalType: "address";
22890
- readonly type: "address";
22891
- }, {
22892
- readonly name: "version";
22893
- readonly internalType: "uint256";
22894
- readonly type: "uint256";
22895
- }, {
22896
- readonly name: "contractType";
22897
- readonly internalType: "bytes32";
22898
- readonly type: "bytes32";
22899
- }, {
22900
- readonly name: "serializedParams";
22901
- readonly internalType: "bytes";
22902
- readonly type: "bytes";
22903
- }];
22904
- }, {
22905
- readonly name: "decimals";
22906
- readonly internalType: "uint8";
22907
- readonly type: "uint8";
22908
- }, {
22909
- readonly name: "skipCheck";
22910
- readonly internalType: "bool";
22911
- readonly type: "bool";
22912
- }, {
22913
- readonly name: "updatable";
22914
- readonly internalType: "bool";
22915
- readonly type: "bool";
22916
- }, {
22917
- readonly name: "underlyingFeeds";
22918
- readonly internalType: "address[]";
22919
- readonly type: "address[]";
22920
- }, {
22921
- readonly name: "underlyingStalenessPeriods";
22922
- readonly internalType: "uint32[]";
22923
- readonly type: "uint32[]";
22924
- }, {
22925
- readonly name: "answer";
22926
- readonly internalType: "struct PriceFeedAnswer";
22927
- readonly type: "tuple";
22928
- readonly components: readonly [{
22929
- readonly name: "price";
22930
- readonly internalType: "int256";
22931
- readonly type: "int256";
22932
- }, {
22933
- readonly name: "updatedAt";
22934
- readonly internalType: "uint256";
22935
- readonly type: "uint256";
22936
- }, {
22937
- readonly name: "success";
22938
- readonly internalType: "bool";
22939
- readonly type: "bool";
22940
- }];
22941
- }];
22942
- }];
22943
- readonly stateMutability: "view";
22944
- }, {
22945
- readonly type: "function";
22946
- readonly inputs: readonly [{
22947
- readonly name: "priceOracle";
22948
- readonly internalType: "address";
22949
- readonly type: "address";
22950
- }];
22951
- readonly name: "getPriceFeeds";
22952
- readonly outputs: readonly [{
22953
- readonly name: "priceFeedMap";
22954
- readonly internalType: "struct PriceFeedMapEntry[]";
22955
- readonly type: "tuple[]";
22956
- readonly components: readonly [{
22957
- readonly name: "token";
22958
- readonly internalType: "address";
22959
- readonly type: "address";
22960
- }, {
22961
- readonly name: "reserve";
22962
- readonly internalType: "bool";
22963
- readonly type: "bool";
22964
- }, {
22965
- readonly name: "priceFeed";
22966
- readonly internalType: "address";
22967
- readonly type: "address";
22968
- }, {
22969
- readonly name: "stalenessPeriod";
22970
- readonly internalType: "uint32";
22971
- readonly type: "uint32";
22972
- }];
22973
- }, {
22974
- readonly name: "priceFeedTree";
22975
- readonly internalType: "struct PriceFeedTreeNode[]";
22976
- readonly type: "tuple[]";
22977
- readonly components: readonly [{
22978
- readonly name: "baseParams";
22979
- readonly internalType: "struct BaseParams";
22980
- readonly type: "tuple";
22981
- readonly components: readonly [{
22982
- readonly name: "addr";
22983
- readonly internalType: "address";
22984
- readonly type: "address";
22985
- }, {
22986
- readonly name: "version";
22987
- readonly internalType: "uint256";
22988
- readonly type: "uint256";
22989
- }, {
22990
- readonly name: "contractType";
22991
- readonly internalType: "bytes32";
22992
- readonly type: "bytes32";
22993
- }, {
22994
- readonly name: "serializedParams";
22995
- readonly internalType: "bytes";
22996
- readonly type: "bytes";
22997
- }];
22998
- }, {
22999
- readonly name: "decimals";
23000
- readonly internalType: "uint8";
23001
- readonly type: "uint8";
23002
- }, {
23003
- readonly name: "skipCheck";
23004
- readonly internalType: "bool";
23005
- readonly type: "bool";
23006
- }, {
23007
- readonly name: "updatable";
23008
- readonly internalType: "bool";
23009
- readonly type: "bool";
23010
- }, {
23011
- readonly name: "underlyingFeeds";
23012
- readonly internalType: "address[]";
23013
- readonly type: "address[]";
23014
- }, {
23015
- readonly name: "underlyingStalenessPeriods";
23016
- readonly internalType: "uint32[]";
23017
- readonly type: "uint32[]";
23018
- }, {
23019
- readonly name: "answer";
23020
- readonly internalType: "struct PriceFeedAnswer";
23021
- readonly type: "tuple";
23022
- readonly components: readonly [{
23023
- readonly name: "price";
23024
- readonly internalType: "int256";
23025
- readonly type: "int256";
23026
- }, {
23027
- readonly name: "updatedAt";
23028
- readonly internalType: "uint256";
23029
- readonly type: "uint256";
23030
- }, {
23031
- readonly name: "success";
23032
- readonly internalType: "bool";
23033
- readonly type: "bool";
23034
- }];
23035
- }];
23036
- }];
23037
- readonly stateMutability: "view";
23038
- }, {
23039
- readonly type: "function";
23040
- readonly inputs: readonly [{
23041
- readonly name: "priceFeeds";
23042
- readonly internalType: "address[]";
23043
- readonly type: "address[]";
23044
- }];
23045
- readonly name: "loadPriceFeedTree";
23046
- readonly outputs: readonly [{
23047
- readonly name: "priceFeedTree";
23048
- readonly internalType: "struct PriceFeedTreeNode[]";
23049
- readonly type: "tuple[]";
23050
- readonly components: readonly [{
23051
- readonly name: "baseParams";
23052
- readonly internalType: "struct BaseParams";
23053
- readonly type: "tuple";
23054
- readonly components: readonly [{
23055
- readonly name: "addr";
23056
- readonly internalType: "address";
23057
- readonly type: "address";
23058
- }, {
23059
- readonly name: "version";
23060
- readonly internalType: "uint256";
23061
- readonly type: "uint256";
23062
- }, {
23063
- readonly name: "contractType";
23064
- readonly internalType: "bytes32";
23065
- readonly type: "bytes32";
23066
- }, {
23067
- readonly name: "serializedParams";
23068
- readonly internalType: "bytes";
23069
- readonly type: "bytes";
23070
- }];
23071
- }, {
23072
- readonly name: "decimals";
23073
- readonly internalType: "uint8";
23074
- readonly type: "uint8";
23075
- }, {
23076
- readonly name: "skipCheck";
23077
- readonly internalType: "bool";
23078
- readonly type: "bool";
23079
- }, {
23080
- readonly name: "updatable";
23081
- readonly internalType: "bool";
23082
- readonly type: "bool";
23083
- }, {
23084
- readonly name: "underlyingFeeds";
23085
- readonly internalType: "address[]";
23086
- readonly type: "address[]";
23087
- }, {
23088
- readonly name: "underlyingStalenessPeriods";
23089
- readonly internalType: "uint32[]";
23090
- readonly type: "uint32[]";
23091
- }, {
23092
- readonly name: "answer";
23093
- readonly internalType: "struct PriceFeedAnswer";
23094
- readonly type: "tuple";
23095
- readonly components: readonly [{
23096
- readonly name: "price";
23097
- readonly internalType: "int256";
23098
- readonly type: "int256";
23099
- }, {
23100
- readonly name: "updatedAt";
23101
- readonly internalType: "uint256";
23102
- readonly type: "uint256";
23103
- }, {
23104
- readonly name: "success";
23105
- readonly internalType: "bool";
23106
- readonly type: "bool";
23107
- }];
23108
- }];
23109
- }];
23110
- readonly stateMutability: "view";
23111
- }, {
23112
- readonly type: "function";
23113
- readonly inputs: readonly [];
23114
- readonly name: "version";
23115
- readonly outputs: readonly [{
23116
- readonly name: "";
23117
- readonly internalType: "uint256";
23118
- readonly type: "uint256";
23119
- }];
23120
- readonly stateMutability: "view";
23121
- }, {
23122
- readonly type: "event";
23123
- readonly anonymous: false;
23124
- readonly inputs: readonly [{
23125
- readonly name: "contractType";
23126
- readonly internalType: "bytes32";
23127
- readonly type: "bytes32";
23128
- readonly indexed: true;
23129
- }, {
23130
- readonly name: "serializer";
23131
- readonly internalType: "address";
23132
- readonly type: "address";
23133
- readonly indexed: true;
23134
- }];
23135
- readonly name: "SetSerializer";
23136
- }];
23137
- address: `0x${string}`;
23138
- functionName: string;
23139
- args: (`0x${string}` | `0x${string}`[])[];
23140
- };
23141
- onResult: (state: PriceOracleData) => void;
23142
22834
  };
23143
22835
  stateHuman(raw?: boolean): PriceOracleV3StateHuman;
23144
22836
  }
@@ -24849,8 +24541,8 @@ declare class MarketRegister extends SDKConstruct {
24849
24541
  get pools(): PoolFactory[];
24850
24542
  get creditManagers(): CreditFactory[];
24851
24543
  findCreditManager(creditManager: Address): CreditFactory;
24852
- findPriceOracle(address: Address): PriceOracleContract;
24853
24544
  findByCreditManager(creditManager: Address): MarketFactory;
24545
+ findByPriceOracle(address: Address): MarketFactory;
24854
24546
  get markets(): MarketFactory[];
24855
24547
  tvl(): Promise<TVL>;
24856
24548
  get curators(): Address[];
@@ -21542,37 +21542,28 @@ var PriceOracleContract = class extends BaseContract {
21542
21542
  await this.sdk.marketRegister.updatePrices([this.address]);
21543
21543
  }
21544
21544
  syncStateMulticall() {
21545
- if (this.version === 310) {
21546
- return {
21547
- call: {
21548
- abi: iPriceFeedCompressorAbi,
21549
- address: this.sdk.addressProvider.getLatestVersion(
21550
- AP_PRICE_FEED_COMPRESSOR
21551
- ),
21552
- functionName: "getPriceFeeds",
21553
- args: [this.address]
21554
- },
21555
- onResult: ([entries, tree]) => {
21556
- this.#loadState(entries, tree);
21557
- }
21558
- };
21545
+ const args = [this.address];
21546
+ if (this.version === 300) {
21547
+ args.push(
21548
+ Array.from(
21549
+ /* @__PURE__ */ new Set([
21550
+ this.underlying,
21551
+ ...this.mainPriceFeeds.keys(),
21552
+ ...this.reservePriceFeeds.keys()
21553
+ ])
21554
+ )
21555
+ );
21559
21556
  }
21560
- const tokens = /* @__PURE__ */ new Set([
21561
- this.underlying,
21562
- ...this.mainPriceFeeds.keys(),
21563
- ...this.reservePriceFeeds.keys()
21564
- ]);
21565
21557
  return {
21566
21558
  call: {
21567
21559
  abi: iPriceFeedCompressorAbi,
21568
21560
  address: this.sdk.addressProvider.getLatestVersion(
21569
21561
  AP_PRICE_FEED_COMPRESSOR
21570
21562
  ),
21571
- functionName: "getPriceOracleState",
21572
- args: [this.address, [this.underlying, ...Array.from(tokens)]]
21563
+ functionName: "getPriceFeeds",
21564
+ args
21573
21565
  },
21574
- onResult: (state) => {
21575
- const { priceFeedMapping: entries, priceFeedStructure: tree } = state;
21566
+ onResult: ([entries, tree]) => {
21576
21567
  this.#loadState(entries, tree);
21577
21568
  }
21578
21569
  };
@@ -22064,14 +22055,6 @@ var MarketRegister = class extends SDKConstruct {
22064
22055
  }
22065
22056
  throw new Error(`cannot find credit manager ${creditManager}`);
22066
22057
  }
22067
- findPriceOracle(address) {
22068
- for (const market of this.markets) {
22069
- if (market.priceOracle.address.toLowerCase() === address.toLowerCase()) {
22070
- return market.priceOracle;
22071
- }
22072
- }
22073
- throw new Error(`cannot find price oracle ${address}`);
22074
- }
22075
22058
  findByCreditManager(creditManager) {
22076
22059
  const market = this.markets.find(
22077
22060
  (m) => m.creditManagers.some(
@@ -22083,6 +22066,14 @@ var MarketRegister = class extends SDKConstruct {
22083
22066
  }
22084
22067
  return market;
22085
22068
  }
22069
+ findByPriceOracle(address) {
22070
+ for (const market of this.markets) {
22071
+ if (market.priceOracle.address.toLowerCase() === address.toLowerCase()) {
22072
+ return market;
22073
+ }
22074
+ }
22075
+ throw new Error(`cannot find price oracle ${address}`);
22076
+ }
22086
22077
  get markets() {
22087
22078
  return this.#markets.values();
22088
22079
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-vfour.66",
3
+ "version": "3.0.0-vfour.68",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.cjs",