@gearbox-protocol/sdk 3.0.0-vfour.70 → 3.0.0-vfour.72

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.
@@ -21397,7 +21397,6 @@ var PriceFeedRegister = class extends SDKConstruct {
21397
21397
  #hooks = new Hooks();
21398
21398
  #feeds = new AddressMap();
21399
21399
  #redstoneUpdater;
21400
- // public readonly zeroPriceFeed: ZeroPriceFeedContract;
21401
21400
  constructor(sdk) {
21402
21401
  super(sdk);
21403
21402
  this.logger = childLogger("PriceFeedRegister", sdk.logger);
@@ -21411,8 +21410,7 @@ var PriceFeedRegister = class extends SDKConstruct {
21411
21410
  * @returns
21412
21411
  */
21413
21412
  async generatePriceFeedsUpdateTxs(priceFeeds) {
21414
- const priceFeedz = priceFeeds ?? this.#feeds.values();
21415
- const updateables = priceFeedz.flatMap((pf) => pf.updatableDependencies());
21413
+ const updateables = priceFeeds ? priceFeeds.flatMap((pf) => pf.updatableDependencies()) : this.#feeds.values();
21416
21414
  const txs = [];
21417
21415
  const redstonePFs = [];
21418
21416
  for (const pf of updateables) {
@@ -21816,6 +21814,7 @@ var MarketFactory = class extends SDKConstruct {
21816
21814
  * Original data received from compressor
21817
21815
  */
21818
21816
  state;
21817
+ zappers;
21819
21818
  constructor(sdk, marketData) {
21820
21819
  super(sdk);
21821
21820
  this.state = marketData;
@@ -21826,6 +21825,7 @@ var MarketFactory = class extends SDKConstruct {
21826
21825
  sdk.provider.addressLabels.set(t.addr, t.symbol);
21827
21826
  }
21828
21827
  this.poolFactory = new PoolFactory(sdk, marketData);
21828
+ this.zappers = marketData.zappers;
21829
21829
  for (let i = 0; i < marketData.creditManagers.length; i++) {
21830
21830
  this.creditManagers.push(new CreditFactory(sdk, marketData, i));
21831
21831
  }
@@ -21849,7 +21849,14 @@ var MarketFactory = class extends SDKConstruct {
21849
21849
  ),
21850
21850
  emergencyLiquidators: this.state.emergencyLiquidators.map(
21851
21851
  (a) => this.labelAddress(a)
21852
- )
21852
+ ),
21853
+ zappers: this.zappers.map((z) => ({
21854
+ address: z.baseParams.addr,
21855
+ contractType: z.baseParams.contractType,
21856
+ version: Number(z.baseParams.version),
21857
+ tokenIn: this.labelAddress(z.tokenIn),
21858
+ tokenOut: this.labelAddress(z.tokenOut)
21859
+ }))
21853
21860
  };
21854
21861
  }
21855
21862
  };
@@ -23127,7 +23134,7 @@ var GearboxSDK = class _GearboxSDK {
23127
23134
  addHook = this.#hooks.addHook.bind(this.#hooks);
23128
23135
  removeHook = this.#hooks.removeHook.bind(this.#hooks);
23129
23136
  static async attach(options) {
23130
- const { logger, riskCurators, blockNumber } = options;
23137
+ const { logger, riskCurators, blockNumber, redstoneHistoricTimestamp } = options;
23131
23138
  let { networkType, addressProvider, chainId } = options;
23132
23139
  const attachClient = viem.createPublicClient({
23133
23140
  transport: createTransport(options)
@@ -23153,15 +23160,29 @@ var GearboxSDK = class _GearboxSDK {
23153
23160
  return new _GearboxSDK({
23154
23161
  provider,
23155
23162
  logger
23156
- }).#attach(addressProvider, riskCurators, blockNumber);
23163
+ }).#attach({
23164
+ addressProvider,
23165
+ riskCurators,
23166
+ blockNumber,
23167
+ redstoneHistoricTimestamp
23168
+ });
23157
23169
  }
23158
23170
  constructor(options) {
23159
23171
  this.#provider = options.provider;
23160
23172
  this.logger = options.logger;
23161
23173
  this.priceFeeds = new PriceFeedRegister(this);
23162
23174
  }
23163
- async #attach(addressProviderAddress, riskCurators, blockNumber) {
23175
+ async #attach(opts) {
23176
+ const {
23177
+ addressProvider,
23178
+ blockNumber,
23179
+ redstoneHistoricTimestamp,
23180
+ riskCurators
23181
+ } = opts;
23164
23182
  const time = Date.now();
23183
+ if (redstoneHistoricTimestamp) {
23184
+ this.priceFeeds.setRedstoneHistoricalTimestamp(redstoneHistoricTimestamp);
23185
+ }
23165
23186
  const block = await this.provider.publicClient.getBlock(
23166
23187
  blockNumber ? { blockNumber: BigInt(blockNumber) } : {
23167
23188
  blockTag: "latest"
@@ -23169,10 +23190,10 @@ var GearboxSDK = class _GearboxSDK {
23169
23190
  );
23170
23191
  this.#currentBlock = block.number;
23171
23192
  this.#timestamp = block.timestamp;
23172
- this.logger?.info("Attaching to address provider", addressProviderAddress);
23193
+ this.logger?.info("Attaching to address provider", addressProvider);
23173
23194
  this.#addressProvider = new AddressProviderContractV3_1(
23174
23195
  this,
23175
- addressProviderAddress
23196
+ addressProvider
23176
23197
  );
23177
23198
  await this.#addressProvider.syncState(this.currentBlock);
23178
23199
  const botListAddress = this.#addressProvider.getAddress(AP_BOT_LIST, 300);
@@ -24357,6 +24357,7 @@ declare class MarketFactory extends SDKConstruct {
24357
24357
  * Original data received from compressor
24358
24358
  */
24359
24359
  readonly state: MarketData;
24360
+ readonly zappers: readonly ZapperData[];
24360
24361
  constructor(sdk: GearboxSDK, marketData: MarketData);
24361
24362
  get dirty(): boolean;
24362
24363
  stateHuman(raw?: boolean): MarketStateHuman;
@@ -24755,6 +24756,10 @@ interface PoolFactoryStateHuman {
24755
24756
  linearModel?: LinearModelStateHuman;
24756
24757
  gauge: GaugeStateHuman;
24757
24758
  }
24759
+ interface ZapperStateHuman extends BaseContractStateHuman {
24760
+ tokenIn: string;
24761
+ tokenOut: string;
24762
+ }
24758
24763
  interface MarketStateHuman {
24759
24764
  pool: PoolFactoryStateHuman;
24760
24765
  creditManagers: CreditFactoryStateHuman[];
@@ -24762,6 +24767,7 @@ interface MarketStateHuman {
24762
24767
  pausableAdmins: string[];
24763
24768
  unpausableAdmins: string[];
24764
24769
  emergencyLiquidators: string[];
24770
+ zappers: ZapperStateHuman[];
24765
24771
  }
24766
24772
  interface GearboxStateHuman {
24767
24773
  block: number;
@@ -24837,6 +24843,7 @@ interface BaseParams {
24837
24843
  type CreditAccountData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iCreditAccountCompressorAbi, "getCreditAccountData">["outputs"]>>;
24838
24844
  type MarketData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iMarketCompressorAbi, "getMarketData">["outputs"]>>;
24839
24845
  type CreditManagerData = Unarray<MarketData["creditManagers"]>;
24846
+ type ZapperData = Unarray<MarketData["zappers"]>;
24840
24847
  type CreditManagerState = CreditManagerData["creditManager"];
24841
24848
  type CreditFacadeState = CreditManagerData["creditFacade"];
24842
24849
  type CreditConfiguratorState = CreditManagerData["creditConfigurator"];
@@ -25006,6 +25013,10 @@ interface SDKOptions {
25006
25013
  * Bring your own logger
25007
25014
  */
25008
25015
  logger?: ILogger;
25016
+ /**
25017
+ * Fixed redstone historic timestamp in ms
25018
+ */
25019
+ redstoneHistoricTimestamp?: number;
25009
25020
  }
25010
25021
  interface SyncStateOptions {
25011
25022
  blockNumber: bigint;
@@ -25321,4 +25332,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
25321
25332
  */
25322
25333
  declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
25323
25334
 
25324
- export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
25335
+ export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
@@ -24357,6 +24357,7 @@ declare class MarketFactory extends SDKConstruct {
24357
24357
  * Original data received from compressor
24358
24358
  */
24359
24359
  readonly state: MarketData;
24360
+ readonly zappers: readonly ZapperData[];
24360
24361
  constructor(sdk: GearboxSDK, marketData: MarketData);
24361
24362
  get dirty(): boolean;
24362
24363
  stateHuman(raw?: boolean): MarketStateHuman;
@@ -24755,6 +24756,10 @@ interface PoolFactoryStateHuman {
24755
24756
  linearModel?: LinearModelStateHuman;
24756
24757
  gauge: GaugeStateHuman;
24757
24758
  }
24759
+ interface ZapperStateHuman extends BaseContractStateHuman {
24760
+ tokenIn: string;
24761
+ tokenOut: string;
24762
+ }
24758
24763
  interface MarketStateHuman {
24759
24764
  pool: PoolFactoryStateHuman;
24760
24765
  creditManagers: CreditFactoryStateHuman[];
@@ -24762,6 +24767,7 @@ interface MarketStateHuman {
24762
24767
  pausableAdmins: string[];
24763
24768
  unpausableAdmins: string[];
24764
24769
  emergencyLiquidators: string[];
24770
+ zappers: ZapperStateHuman[];
24765
24771
  }
24766
24772
  interface GearboxStateHuman {
24767
24773
  block: number;
@@ -24837,6 +24843,7 @@ interface BaseParams {
24837
24843
  type CreditAccountData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iCreditAccountCompressorAbi, "getCreditAccountData">["outputs"]>>;
24838
24844
  type MarketData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iMarketCompressorAbi, "getMarketData">["outputs"]>>;
24839
24845
  type CreditManagerData = Unarray<MarketData["creditManagers"]>;
24846
+ type ZapperData = Unarray<MarketData["zappers"]>;
24840
24847
  type CreditManagerState = CreditManagerData["creditManager"];
24841
24848
  type CreditFacadeState = CreditManagerData["creditFacade"];
24842
24849
  type CreditConfiguratorState = CreditManagerData["creditConfigurator"];
@@ -25006,6 +25013,10 @@ interface SDKOptions {
25006
25013
  * Bring your own logger
25007
25014
  */
25008
25015
  logger?: ILogger;
25016
+ /**
25017
+ * Fixed redstone historic timestamp in ms
25018
+ */
25019
+ redstoneHistoricTimestamp?: number;
25009
25020
  }
25010
25021
  interface SyncStateOptions {
25011
25022
  blockNumber: bigint;
@@ -25321,4 +25332,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
25321
25332
  */
25322
25333
  declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
25323
25334
 
25324
- export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
25335
+ export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
@@ -21395,7 +21395,6 @@ var PriceFeedRegister = class extends SDKConstruct {
21395
21395
  #hooks = new Hooks();
21396
21396
  #feeds = new AddressMap();
21397
21397
  #redstoneUpdater;
21398
- // public readonly zeroPriceFeed: ZeroPriceFeedContract;
21399
21398
  constructor(sdk) {
21400
21399
  super(sdk);
21401
21400
  this.logger = childLogger("PriceFeedRegister", sdk.logger);
@@ -21409,8 +21408,7 @@ var PriceFeedRegister = class extends SDKConstruct {
21409
21408
  * @returns
21410
21409
  */
21411
21410
  async generatePriceFeedsUpdateTxs(priceFeeds) {
21412
- const priceFeedz = priceFeeds ?? this.#feeds.values();
21413
- const updateables = priceFeedz.flatMap((pf) => pf.updatableDependencies());
21411
+ const updateables = priceFeeds ? priceFeeds.flatMap((pf) => pf.updatableDependencies()) : this.#feeds.values();
21414
21412
  const txs = [];
21415
21413
  const redstonePFs = [];
21416
21414
  for (const pf of updateables) {
@@ -21814,6 +21812,7 @@ var MarketFactory = class extends SDKConstruct {
21814
21812
  * Original data received from compressor
21815
21813
  */
21816
21814
  state;
21815
+ zappers;
21817
21816
  constructor(sdk, marketData) {
21818
21817
  super(sdk);
21819
21818
  this.state = marketData;
@@ -21824,6 +21823,7 @@ var MarketFactory = class extends SDKConstruct {
21824
21823
  sdk.provider.addressLabels.set(t.addr, t.symbol);
21825
21824
  }
21826
21825
  this.poolFactory = new PoolFactory(sdk, marketData);
21826
+ this.zappers = marketData.zappers;
21827
21827
  for (let i = 0; i < marketData.creditManagers.length; i++) {
21828
21828
  this.creditManagers.push(new CreditFactory(sdk, marketData, i));
21829
21829
  }
@@ -21847,7 +21847,14 @@ var MarketFactory = class extends SDKConstruct {
21847
21847
  ),
21848
21848
  emergencyLiquidators: this.state.emergencyLiquidators.map(
21849
21849
  (a) => this.labelAddress(a)
21850
- )
21850
+ ),
21851
+ zappers: this.zappers.map((z) => ({
21852
+ address: z.baseParams.addr,
21853
+ contractType: z.baseParams.contractType,
21854
+ version: Number(z.baseParams.version),
21855
+ tokenIn: this.labelAddress(z.tokenIn),
21856
+ tokenOut: this.labelAddress(z.tokenOut)
21857
+ }))
21851
21858
  };
21852
21859
  }
21853
21860
  };
@@ -23125,7 +23132,7 @@ var GearboxSDK = class _GearboxSDK {
23125
23132
  addHook = this.#hooks.addHook.bind(this.#hooks);
23126
23133
  removeHook = this.#hooks.removeHook.bind(this.#hooks);
23127
23134
  static async attach(options) {
23128
- const { logger, riskCurators, blockNumber } = options;
23135
+ const { logger, riskCurators, blockNumber, redstoneHistoricTimestamp } = options;
23129
23136
  let { networkType, addressProvider, chainId } = options;
23130
23137
  const attachClient = createPublicClient({
23131
23138
  transport: createTransport(options)
@@ -23151,15 +23158,29 @@ var GearboxSDK = class _GearboxSDK {
23151
23158
  return new _GearboxSDK({
23152
23159
  provider,
23153
23160
  logger
23154
- }).#attach(addressProvider, riskCurators, blockNumber);
23161
+ }).#attach({
23162
+ addressProvider,
23163
+ riskCurators,
23164
+ blockNumber,
23165
+ redstoneHistoricTimestamp
23166
+ });
23155
23167
  }
23156
23168
  constructor(options) {
23157
23169
  this.#provider = options.provider;
23158
23170
  this.logger = options.logger;
23159
23171
  this.priceFeeds = new PriceFeedRegister(this);
23160
23172
  }
23161
- async #attach(addressProviderAddress, riskCurators, blockNumber) {
23173
+ async #attach(opts) {
23174
+ const {
23175
+ addressProvider,
23176
+ blockNumber,
23177
+ redstoneHistoricTimestamp,
23178
+ riskCurators
23179
+ } = opts;
23162
23180
  const time = Date.now();
23181
+ if (redstoneHistoricTimestamp) {
23182
+ this.priceFeeds.setRedstoneHistoricalTimestamp(redstoneHistoricTimestamp);
23183
+ }
23163
23184
  const block = await this.provider.publicClient.getBlock(
23164
23185
  blockNumber ? { blockNumber: BigInt(blockNumber) } : {
23165
23186
  blockTag: "latest"
@@ -23167,10 +23188,10 @@ var GearboxSDK = class _GearboxSDK {
23167
23188
  );
23168
23189
  this.#currentBlock = block.number;
23169
23190
  this.#timestamp = block.timestamp;
23170
- this.logger?.info("Attaching to address provider", addressProviderAddress);
23191
+ this.logger?.info("Attaching to address provider", addressProvider);
23171
23192
  this.#addressProvider = new AddressProviderContractV3_1(
23172
23193
  this,
23173
- addressProviderAddress
23194
+ addressProvider
23174
23195
  );
23175
23196
  await this.#addressProvider.syncState(this.currentBlock);
23176
23197
  const botListAddress = this.#addressProvider.getAddress(AP_BOT_LIST, 300);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-vfour.70",
3
+ "version": "3.0.0-vfour.72",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.cjs",