@gearbox-protocol/sdk 17.11.0 → 17.12.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.
Files changed (40) hide show
  1. package/dist/cjs/onchain/accounts/intents/utils/price-impact.js +14 -4
  2. package/dist/cjs/permissionless/api/oracles/schemas.js +1 -14
  3. package/dist/cjs/permissionless/api/transactions/InstanceOwnerTransactions.js +16 -12
  4. package/dist/cjs/permissionless/bindings/price-feed-store.js +0 -2
  5. package/dist/esm/dev/AccountOpener.js +1 -1
  6. package/dist/esm/dev/withdrawalUtils.js +1 -1
  7. package/dist/esm/history/trace/extractTransfers.js +1 -1
  8. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
  9. package/dist/esm/onchain/accounts/intents/utils/price-impact.js +14 -4
  10. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  11. package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  12. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  13. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  14. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  15. package/dist/esm/onchain/base/TokensMeta.js +3 -3
  16. package/dist/esm/onchain/core/createAddressProvider.js +1 -1
  17. package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
  18. package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
  19. package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
  20. package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
  21. package/dist/esm/onchain/market/rwa/createDegenNFT.js +1 -1
  22. package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
  23. package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
  24. package/dist/esm/onchain/preview/preview/previewPoolPositionOperation.js +2 -2
  25. package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
  26. package/dist/esm/permissionless/api/oracles/schemas.js +2 -14
  27. package/dist/esm/permissionless/api/transactions/InstanceOwnerTransactions.js +16 -12
  28. package/dist/esm/permissionless/bindings/price-feed-store.js +0 -2
  29. package/dist/types/onchain/accounts/intents/types.d.ts +2 -1
  30. package/dist/types/onchain/accounts/intents/utils/price-impact.d.ts +1 -0
  31. package/dist/types/permissionless/api/index.d.ts +3 -3
  32. package/dist/types/permissionless/api/oracles/index.d.ts +2 -2
  33. package/dist/types/permissionless/api/oracles/schemas.d.ts +13 -42
  34. package/dist/types/permissionless/api/oracles/types.d.ts +5 -17
  35. package/dist/types/permissionless/api/transactions/InstanceOwnerTransactions.d.ts +14 -6
  36. package/dist/types/permissionless/api/transactions/index.d.ts +2 -2
  37. package/dist/types/permissionless/api/transactions/types.d.ts +23 -1
  38. package/dist/types/permissionless/core/pricefeed.d.ts +0 -1
  39. package/dist/types/permissionless/index.d.ts +3 -3
  40. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_onchain_utils_bigint_math = require("../../../utils/bigint-math.js");
2
3
  const require_onchain_constants_math = require("../../../constants/math.js");
3
4
  //#region src/onchain/accounts/intents/utils/price-impact.ts
4
- /** `b1 = b0 / V0`: a dollar of the basket, the reference implementation's anchor. */
5
- const PROBE_UNIT_USD_WAD = require_onchain_constants_math.WAD;
5
+ /** A $100 reference basket limits output-token quantisation in small quotes. */
6
+ const PROBE_UNIT_USD_WAD = 100n * require_onchain_constants_math.WAD;
6
7
  /**
7
- * `V0 = Σ b0ᵢ·pᵢ`, then `b1 = b0 / V0`, proportions kept.
8
+ * `V0 = Σ b0ᵢ·pᵢ`, then scale the basket to $100, proportions kept.
8
9
  *
9
10
  * Refuses only what the reference refuses — a basket worth nothing, or one that
10
11
  * rounds away entirely. Stricter guards here would report nothing where the old
@@ -73,6 +74,8 @@ async function collectPriceImpact(probes, ctx) {
73
74
  const quotes = await Promise.all(probes.map((leg) => leg.probe));
74
75
  let expectedUnd = 0n;
75
76
  let lossUnd = 0n;
77
+ let lowerLossUnd = 0n;
78
+ let upperLossUnd = 0n;
76
79
  for (const [index, leg] of probes.entries()) {
77
80
  const unit = quotes[index];
78
81
  if (unit === void 0 || unit <= 0n) return;
@@ -82,10 +85,17 @@ async function collectPriceImpact(probes, ctx) {
82
85
  if (expectedInUnd <= 0n) return;
83
86
  const loss = toUnderlyingSigned(ctx.toUnderlying, leg.tokenOut, expected - leg.realAmount);
84
87
  if (loss === void 0) return;
88
+ const lower = expected - leg.realAmount - 1n;
89
+ const upper = require_onchain_utils_bigint_math.BigIntMath.ceilDiv((unit + 1n) * leg.basketWad, leg.probeWad) - leg.realAmount;
90
+ const lowerInUnd = toUnderlyingSigned(ctx.toUnderlying, leg.tokenOut, lower);
91
+ const upperInUnd = toUnderlyingSigned(ctx.toUnderlying, leg.tokenOut, upper);
92
+ if (lowerInUnd === void 0 || upperInUnd === void 0) return;
93
+ lowerLossUnd += lowerInUnd - (lower > 0n ? 1n : 0n);
94
+ upperLossUnd += upperInUnd + (upper < 0n ? 1n : 0n);
85
95
  expectedUnd += expectedInUnd;
86
96
  lossUnd += loss;
87
97
  }
88
- if (expectedUnd <= 0n) return;
98
+ if (lowerLossUnd <= 0n && upperLossUnd >= 0n) lossUnd = 0n;
89
99
  return {
90
100
  ...lossRate({
91
101
  lossUnd,
@@ -16,29 +16,17 @@ const priceFeedSchema = zod_v4.z.looseObject({
16
16
  contractType: zod_v4.z.string(),
17
17
  version: zod_v4.z.number(),
18
18
  deployedBy: require_permissionless_api_schemas.addressSchema,
19
- isInStore: zod_v4.z.boolean(),
20
19
  stalenessPeriod: zod_v4.z.number(),
21
20
  name: zod_v4.z.string()
22
21
  });
23
- /** {@link PermissionlessPriceFeedStatus} */
24
- const priceFeedStatusSchema = zod_v4.z.enum([
25
- "private",
26
- "inStore",
27
- "pendingForbidden",
28
- "forbidden"
29
- ]);
30
22
  /** {@link PermissionlessAsset} */
31
23
  const assetSchema = zod_v4.z.looseObject({
32
24
  address: require_permissionless_api_schemas.addressSchema,
33
25
  symbol: zod_v4.z.string(),
34
26
  name: zod_v4.z.string(),
35
27
  decimals: zod_v4.z.number(),
36
- isInStore: zod_v4.z.boolean(),
37
28
  owner: require_permissionless_api_schemas.addressSchema,
38
- priceFeeds: zod_v4.z.array(zod_v4.z.looseObject({
39
- pricefeed: priceFeedSchema,
40
- status: priceFeedStatusSchema
41
- }))
29
+ priceFeeds: zod_v4.z.array(priceFeedSchema)
42
30
  });
43
31
  /** {@link PermissionlessPriceFeedStore} */
44
32
  const priceFeedStoreSchema = zod_v4.z.looseObject({
@@ -59,6 +47,5 @@ const pricesSchema = zod_v4.z.looseObject({
59
47
  //#endregion
60
48
  exports.assetSchema = assetSchema;
61
49
  exports.priceFeedSchema = priceFeedSchema;
62
- exports.priceFeedStatusSchema = priceFeedStatusSchema;
63
50
  exports.priceFeedStoreSchema = priceFeedStoreSchema;
64
51
  exports.pricesSchema = pricesSchema;
@@ -35,6 +35,8 @@ const lower = (value) => value.toLowerCase();
35
35
  * const txs = await permissionless.transactions.addFeeds({
36
36
  * chainId: 1,
37
37
  * owner: curator,
38
+ * feeds: [feed],
39
+ * pairs: [{ asset, priceFeed: feed.address }],
38
40
  * });
39
41
  * ```
40
42
  **/
@@ -46,19 +48,21 @@ var InstanceOwnerTransactions = class {
46
48
  this.#oracles = oracles;
47
49
  }
48
50
  /**
49
- * The batch that adds the owner's private feeds to the store and allows
50
- * them on the assets they were connected to. Only feeds that actually carry
51
- * a connection are added: a feed nobody priced would land in the store
52
- * doing nothing.
51
+ * The batch that adds the named feeds to the store and allows the named
52
+ * edges on it.
53
+ *
54
+ * Both lists come from the caller. Which feeds are private, and which asset
55
+ * each is meant to price, is held wherever the curator prepared them — the
56
+ * backend indexes the store, so a feed that has not reached it yet is not
57
+ * something this client can discover.
58
+ *
59
+ * Only feeds that actually carry an edge are added: a feed nobody priced
60
+ * would land in the store doing nothing.
53
61
  **/
54
- async addFeeds({ chainId, owner }) {
55
- const [batch, store] = await Promise.all([this.#batchContext(chainId), this.#oracles.store({ chainId })]);
56
- const pairs = store.assets.flatMap((asset) => asset.priceFeeds.filter((entry) => entry.status === "private").map((entry) => ({
57
- asset: asset.address,
58
- priceFeed: entry.pricefeed.address
59
- })));
62
+ async addFeeds({ chainId, owner, feeds, pairs }) {
63
+ const batch = await this.#batchContext(chainId);
60
64
  const connected = new Set(pairs.map((pair) => lower(pair.priceFeed)));
61
- const feedsToAdd = store.priceFeeds.filter((feed) => !feed.isInStore && connected.has(lower(feed.address)));
65
+ const feedsToAdd = feeds.filter((feed) => connected.has(lower(feed.address)));
62
66
  const txs = [...feedsToAdd.map((feed) => batch.store.addPriceFeedTx(feed.address, feed.stalenessPeriod, feed.name)), ...pairs.map((pair) => batch.store.allowPriceFeedTx(pair.asset, pair.priceFeed))];
63
67
  return this.#envelope({
64
68
  batch,
@@ -76,7 +80,7 @@ var InstanceOwnerTransactions = class {
76
80
  async changeNames({ chainId, owner, names }) {
77
81
  const [batch, store] = await Promise.all([this.#batchContext(chainId), this.#oracles.store({ chainId })]);
78
82
  const feedToAssets = await this.#feedToAssets(batch.store);
79
- const inStore = new Map(store.priceFeeds.filter((feed) => feed.isInStore).map((feed) => [lower(feed.address), feed]));
83
+ const inStore = new Map(store.priceFeeds.map((feed) => [lower(feed.address), feed]));
80
84
  const txs = [];
81
85
  for (const [address, name] of Object.entries(names)) {
82
86
  const feed = inStore.get(lower(address));
@@ -46,7 +46,6 @@ var PriceFeedStoreContract = class extends require_onchain_base_BaseContract.Bas
46
46
  deployedBy: this.address,
47
47
  stalenessPeriod: info.stalenessPeriod,
48
48
  name: info.name,
49
- isInStore: true,
50
49
  parameters: {}
51
50
  }));
52
51
  }
@@ -277,7 +276,6 @@ var PriceFeedStoreContract = class extends require_onchain_base_BaseContract.Bas
277
276
  deployedBy: this.address,
278
277
  stalenessPeriod: Number(info.stalenessPeriod),
279
278
  name: info.name,
280
- isInStore: true,
281
279
  parameters: {}
282
280
  };
283
281
  });
@@ -1,5 +1,5 @@
1
- import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
2
1
  import { ierc20Abi } from "../abi/iERC20.js";
2
+ import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
3
3
  import { AddressMap } from "../onchain/utils/AddressMap.js";
4
4
  import { AddressSet } from "../onchain/utils/AddressSet.js";
5
5
  import { AssetsMap } from "../onchain/utils/AssetsMap.js";
@@ -1,6 +1,6 @@
1
+ import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
1
2
  import { getNetworkType } from "../onchain/chain/chains.js";
2
3
  import { getWithdrawalCompressorAddress } from "../onchain/accounts/withdrawal-compressor/addresses.js";
3
- import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
4
4
  import "../onchain/index.js";
5
5
  import { iMidasDataFeedAbi, iMidasRedemptionVaultAbi, midasGatewayAbi, midasRedeemerAbi, midasRedemptionVaultPhantomTokenAbi, securitizeRedeemerAbi, securitizeRedemptionGatewayAbi, securitizeRedemptionPhantomTokenAbi } from "./withdrawalAbi.js";
6
6
  import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
@@ -1,5 +1,5 @@
1
- import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
2
1
  import { ierc20Abi } from "../../abi/iERC20.js";
2
+ import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
3
3
  import { AddressMap } from "../../onchain/utils/AddressMap.js";
4
4
  import "../../onchain/index.js";
5
5
  import { UnexpectedFacadeEventOrderError } from "./errors.js";
@@ -1,3 +1,5 @@
1
+ import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
2
+ import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
1
3
  import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
2
4
  import { ADDRESS_0X0 } from "../constants/addresses.js";
3
5
  import { MAX_UINT256 } from "../constants/math.js";
@@ -8,8 +10,6 @@ import "../base/index.js";
8
10
  import { AccountBotsService } from "./bots/AccountBotsService.js";
9
11
  import "./bots/index.js";
10
12
  import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
11
- import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
12
- import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
13
13
  import { expectedBalanceDeltas } from "../market/credit/expectedBalanceDeltas.js";
14
14
  import "../market/index.js";
15
15
  import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
@@ -1,9 +1,10 @@
1
+ import { BigIntMath } from "../../../utils/bigint-math.js";
1
2
  import { PERCENTAGE_FACTOR_1KK, PRICE_DECIMALS, WAD } from "../../../constants/math.js";
2
3
  //#region src/onchain/accounts/intents/utils/price-impact.ts
3
- /** `b1 = b0 / V0`: a dollar of the basket, the reference implementation's anchor. */
4
- const PROBE_UNIT_USD_WAD = WAD;
4
+ /** A $100 reference basket limits output-token quantisation in small quotes. */
5
+ const PROBE_UNIT_USD_WAD = 100n * WAD;
5
6
  /**
6
- * `V0 = Σ b0ᵢ·pᵢ`, then `b1 = b0 / V0`, proportions kept.
7
+ * `V0 = Σ b0ᵢ·pᵢ`, then scale the basket to $100, proportions kept.
7
8
  *
8
9
  * Refuses only what the reference refuses — a basket worth nothing, or one that
9
10
  * rounds away entirely. Stricter guards here would report nothing where the old
@@ -72,6 +73,8 @@ async function collectPriceImpact(probes, ctx) {
72
73
  const quotes = await Promise.all(probes.map((leg) => leg.probe));
73
74
  let expectedUnd = 0n;
74
75
  let lossUnd = 0n;
76
+ let lowerLossUnd = 0n;
77
+ let upperLossUnd = 0n;
75
78
  for (const [index, leg] of probes.entries()) {
76
79
  const unit = quotes[index];
77
80
  if (unit === void 0 || unit <= 0n) return;
@@ -81,10 +84,17 @@ async function collectPriceImpact(probes, ctx) {
81
84
  if (expectedInUnd <= 0n) return;
82
85
  const loss = toUnderlyingSigned(ctx.toUnderlying, leg.tokenOut, expected - leg.realAmount);
83
86
  if (loss === void 0) return;
87
+ const lower = expected - leg.realAmount - 1n;
88
+ const upper = BigIntMath.ceilDiv((unit + 1n) * leg.basketWad, leg.probeWad) - leg.realAmount;
89
+ const lowerInUnd = toUnderlyingSigned(ctx.toUnderlying, leg.tokenOut, lower);
90
+ const upperInUnd = toUnderlyingSigned(ctx.toUnderlying, leg.tokenOut, upper);
91
+ if (lowerInUnd === void 0 || upperInUnd === void 0) return;
92
+ lowerLossUnd += lowerInUnd - (lower > 0n ? 1n : 0n);
93
+ upperLossUnd += upperInUnd + (upper < 0n ? 1n : 0n);
84
94
  expectedUnd += expectedInUnd;
85
95
  lossUnd += loss;
86
96
  }
87
- if (expectedUnd <= 0n) return;
97
+ if (lowerLossUnd <= 0n && upperLossUnd >= 0n) lossUnd = 0n;
88
98
  return {
89
99
  ...lossRate({
90
100
  lossUnd,
@@ -1,3 +1,4 @@
1
+ import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
1
2
  import { AddressSet } from "../../utils/AddressSet.js";
2
3
  import { bytes32ToString } from "../../utils/bytes32ToString.js";
3
4
  import { ADDRESS_0X0 } from "../../constants/addresses.js";
@@ -19,7 +20,6 @@ import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/Securi
19
20
  import "../../market/rwa/securitize/index.js";
20
21
  import "../../market/index.js";
21
22
  import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
22
- import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
23
23
  import { skipLiquidatableAccount } from "./skipLiquidatableAccount.js";
24
24
  //#region src/onchain/accounts/liquidations/LiquidationsService.ts
25
25
  /**
@@ -1,9 +1,9 @@
1
+ import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
1
2
  import { BaseContract } from "../../base/BaseContract.js";
2
3
  import "../../base/index.js";
3
4
  import { sdkErr, sdkOk } from "../../../model/result.js";
4
5
  import "../../../model/index.js";
5
6
  import { decodeDelayedIntent } from "./intent-codec.js";
6
- import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
7
7
  //#region src/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
8
8
  const abi = iRedemptionLoggerV310Abi;
9
9
  /**
@@ -1,5 +1,5 @@
1
- import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
2
1
  import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
2
+ import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
3
3
  //#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
4
4
  const abi = iWithdrawalCompressorV310Abi;
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
2
1
  import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
2
+ import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
3
3
  //#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.ts
4
4
  const abi = iWithdrawalCompressorV311Abi;
5
5
  /**
@@ -1,6 +1,6 @@
1
+ import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
1
2
  import { encodeDelayedIntent } from "./intent-codec.js";
2
3
  import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
3
- import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
4
4
  import { toWithdrawalStatus } from "./types.js";
5
5
  //#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.ts
6
6
  const abi = iWithdrawalCompressorV313Abi;
@@ -1,12 +1,12 @@
1
+ import { iExpirableAbi } from "../../abi/iExpirable.js";
2
+ import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
3
+ import { iVersionAbi } from "../../abi/iVersion.js";
1
4
  import { AddressMap } from "../utils/AddressMap.js";
2
5
  import { AddressSet } from "../utils/AddressSet.js";
3
6
  import { bytes32ToString } from "../utils/bytes32ToString.js";
4
7
  import { getAssetType } from "../chain/chains.js";
5
8
  import { formatBN } from "../utils/formatter.js";
6
9
  import "../utils/index.js";
7
- import { iExpirableAbi } from "../../abi/iExpirable.js";
8
- import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
9
- import { iVersionAbi } from "../../abi/iVersion.js";
10
10
  import { SdkRWADataNotLoadedError } from "../core/errors.js";
11
11
  import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
12
12
  //#region src/onchain/base/TokensMeta.ts
@@ -1,8 +1,8 @@
1
+ import { iVersionAbi } from "../../abi/iVersion.js";
1
2
  import "../constants/address-provider.js";
2
3
  import { isV310 } from "../constants/versions.js";
3
4
  import "../constants/index.js";
4
5
  import { hexEq } from "../utils/hex.js";
5
- import { iVersionAbi } from "../../abi/iVersion.js";
6
6
  import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
7
7
  //#region src/onchain/core/createAddressProvider.ts
8
8
  const OVERRIDE_ADDRESSES = {};
@@ -1,5 +1,5 @@
1
- import { AbstractAdapterContract } from "./AbstractAdapter.js";
2
1
  import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
2
+ import { AbstractAdapterContract } from "./AbstractAdapter.js";
3
3
  //#region src/onchain/market/adapters/contracts/AccountMigratorAdapterContract.ts
4
4
  const abi = accountMigratorAbi;
5
5
  const protocolAbi = accountMigratorAbi;
@@ -1,6 +1,6 @@
1
+ import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
1
2
  import { MissingSerializedParamsError } from "../../../base/errors.js";
2
3
  import "../../../base/index.js";
3
- import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
4
4
  import { iERC4626Abi } from "../abi/targetContractAbi.js";
5
5
  import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
6
6
  import { AbstractAdapterContract } from "./AbstractAdapter.js";
@@ -1,7 +1,7 @@
1
+ import { iPausableAbi } from "../../../abi/iPausable.js";
1
2
  import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
2
3
  import { BaseContract } from "../../base/BaseContract.js";
3
4
  import "../../base/index.js";
4
- import { iPausableAbi } from "../../../abi/iPausable.js";
5
5
  //#region src/onchain/market/credit/CreditFacadeV310BaseContract.ts
6
6
  const abi = [
7
7
  ...iCreditFacadeV310Abi,
@@ -1,3 +1,4 @@
1
+ import { iPausableAbi } from "../../../abi/iPausable.js";
1
2
  import { iPoolV310Abi } from "../../../abi/310/generated.js";
2
3
  import { AddressMap } from "../../utils/AddressMap.js";
3
4
  import { RAY } from "../../constants/math.js";
@@ -7,7 +8,6 @@ import "../../utils/index.js";
7
8
  import { SdkRWADataNotLoadedError } from "../../core/errors.js";
8
9
  import { BaseContract } from "../../base/BaseContract.js";
9
10
  import "../../base/index.js";
10
- import { iPausableAbi } from "../../../abi/iPausable.js";
11
11
  //#region src/onchain/market/pool/PoolV310Contract.ts
12
12
  const abi = [...iPoolV310Abi, ...iPausableAbi];
13
13
  var PoolV310Contract = class extends BaseContract {
@@ -1,6 +1,6 @@
1
+ import { iVersionAbi } from "../../../abi/iVersion.js";
1
2
  import { bytes32ToString } from "../../utils/bytes32ToString.js";
2
3
  import "../../utils/index.js";
3
- import { iVersionAbi } from "../../../abi/iVersion.js";
4
4
  import { iMidasDegenNFTAbi } from "../../../abi/rwa/iMidasDegenNFT.js";
5
5
  import { DEGEN_NFT_MIDAS } from "./midas/constants.js";
6
6
  import { MidasDegenNFT } from "./midas/MidasDegenNFT.js";
@@ -1,5 +1,5 @@
1
- import { ZapperContract } from "./ZapperContract.js";
2
1
  import { iethZapperAbi } from "../../../abi/iETHZapper.js";
2
+ import { ZapperContract } from "./ZapperContract.js";
3
3
  //#region src/onchain/market/zapper/IETHZapperContract.ts
4
4
  const abi = iethZapperAbi;
5
5
  var IETHZapperContract = class extends ZapperContract {
@@ -1,8 +1,8 @@
1
+ import { iZapperAbi } from "../../../abi/iZapper.js";
1
2
  import { BaseContract } from "../../base/BaseContract.js";
2
3
  import "../../base/index.js";
3
4
  import { sdkErr, sdkOk } from "../../../model/result.js";
4
5
  import "../../../model/index.js";
5
- import { iZapperAbi } from "../../../abi/iZapper.js";
6
6
  //#region src/onchain/market/zapper/ZapperContract.ts
7
7
  /**
8
8
  * Base contract for every Gearbox zapper. Specialized zappers (e.g.
@@ -1,8 +1,8 @@
1
- import { iPoolV310Abi } from "../../../abi/310/generated.js";
2
1
  import { ierc20Abi } from "../../../abi/iERC20.js";
2
+ import { iZapperAbi } from "../../../abi/iZapper.js";
3
+ import { iPoolV310Abi } from "../../../abi/310/generated.js";
3
4
  import { sdkErr, sdkOk } from "../../../model/result.js";
4
5
  import "../../../model/index.js";
5
- import { iZapperAbi } from "../../../abi/iZapper.js";
6
6
  //#region src/onchain/preview/preview/previewPoolPositionOperation.ts
7
7
  function previewRead(operation) {
8
8
  switch (operation.operation) {
@@ -1,6 +1,6 @@
1
1
  import { errorAbis } from "../../../abi/errors.js";
2
- import { generateCastTraceCall } from "./cast.js";
3
2
  import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
3
+ import { generateCastTraceCall } from "./cast.js";
4
4
  import { simulateMulticall } from "./simulateMulticall.js";
5
5
  import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
6
6
  import { getAction, parseAccount } from "viem/utils";
@@ -15,29 +15,17 @@ const priceFeedSchema = z.looseObject({
15
15
  contractType: z.string(),
16
16
  version: z.number(),
17
17
  deployedBy: addressSchema,
18
- isInStore: z.boolean(),
19
18
  stalenessPeriod: z.number(),
20
19
  name: z.string()
21
20
  });
22
- /** {@link PermissionlessPriceFeedStatus} */
23
- const priceFeedStatusSchema = z.enum([
24
- "private",
25
- "inStore",
26
- "pendingForbidden",
27
- "forbidden"
28
- ]);
29
21
  /** {@link PermissionlessAsset} */
30
22
  const assetSchema = z.looseObject({
31
23
  address: addressSchema,
32
24
  symbol: z.string(),
33
25
  name: z.string(),
34
26
  decimals: z.number(),
35
- isInStore: z.boolean(),
36
27
  owner: addressSchema,
37
- priceFeeds: z.array(z.looseObject({
38
- pricefeed: priceFeedSchema,
39
- status: priceFeedStatusSchema
40
- }))
28
+ priceFeeds: z.array(priceFeedSchema)
41
29
  });
42
30
  /** {@link PermissionlessPriceFeedStore} */
43
31
  const priceFeedStoreSchema = z.looseObject({
@@ -56,4 +44,4 @@ const pricesSchema = z.looseObject({
56
44
  time: z.number()
57
45
  });
58
46
  //#endregion
59
- export { assetSchema, priceFeedSchema, priceFeedStatusSchema, priceFeedStoreSchema, pricesSchema };
47
+ export { assetSchema, priceFeedSchema, priceFeedStoreSchema, pricesSchema };
@@ -34,6 +34,8 @@ const lower = (value) => value.toLowerCase();
34
34
  * const txs = await permissionless.transactions.addFeeds({
35
35
  * chainId: 1,
36
36
  * owner: curator,
37
+ * feeds: [feed],
38
+ * pairs: [{ asset, priceFeed: feed.address }],
37
39
  * });
38
40
  * ```
39
41
  **/
@@ -45,19 +47,21 @@ var InstanceOwnerTransactions = class {
45
47
  this.#oracles = oracles;
46
48
  }
47
49
  /**
48
- * The batch that adds the owner's private feeds to the store and allows
49
- * them on the assets they were connected to. Only feeds that actually carry
50
- * a connection are added: a feed nobody priced would land in the store
51
- * doing nothing.
50
+ * The batch that adds the named feeds to the store and allows the named
51
+ * edges on it.
52
+ *
53
+ * Both lists come from the caller. Which feeds are private, and which asset
54
+ * each is meant to price, is held wherever the curator prepared them — the
55
+ * backend indexes the store, so a feed that has not reached it yet is not
56
+ * something this client can discover.
57
+ *
58
+ * Only feeds that actually carry an edge are added: a feed nobody priced
59
+ * would land in the store doing nothing.
52
60
  **/
53
- async addFeeds({ chainId, owner }) {
54
- const [batch, store] = await Promise.all([this.#batchContext(chainId), this.#oracles.store({ chainId })]);
55
- const pairs = store.assets.flatMap((asset) => asset.priceFeeds.filter((entry) => entry.status === "private").map((entry) => ({
56
- asset: asset.address,
57
- priceFeed: entry.pricefeed.address
58
- })));
61
+ async addFeeds({ chainId, owner, feeds, pairs }) {
62
+ const batch = await this.#batchContext(chainId);
59
63
  const connected = new Set(pairs.map((pair) => lower(pair.priceFeed)));
60
- const feedsToAdd = store.priceFeeds.filter((feed) => !feed.isInStore && connected.has(lower(feed.address)));
64
+ const feedsToAdd = feeds.filter((feed) => connected.has(lower(feed.address)));
61
65
  const txs = [...feedsToAdd.map((feed) => batch.store.addPriceFeedTx(feed.address, feed.stalenessPeriod, feed.name)), ...pairs.map((pair) => batch.store.allowPriceFeedTx(pair.asset, pair.priceFeed))];
62
66
  return this.#envelope({
63
67
  batch,
@@ -75,7 +79,7 @@ var InstanceOwnerTransactions = class {
75
79
  async changeNames({ chainId, owner, names }) {
76
80
  const [batch, store] = await Promise.all([this.#batchContext(chainId), this.#oracles.store({ chainId })]);
77
81
  const feedToAssets = await this.#feedToAssets(batch.store);
78
- const inStore = new Map(store.priceFeeds.filter((feed) => feed.isInStore).map((feed) => [lower(feed.address), feed]));
82
+ const inStore = new Map(store.priceFeeds.map((feed) => [lower(feed.address), feed]));
79
83
  const txs = [];
80
84
  for (const [address, name] of Object.entries(names)) {
81
85
  const feed = inStore.get(lower(address));
@@ -45,7 +45,6 @@ var PriceFeedStoreContract = class extends BaseContract {
45
45
  deployedBy: this.address,
46
46
  stalenessPeriod: info.stalenessPeriod,
47
47
  name: info.name,
48
- isInStore: true,
49
48
  parameters: {}
50
49
  }));
51
50
  }
@@ -276,7 +275,6 @@ var PriceFeedStoreContract = class extends BaseContract {
276
275
  deployedBy: this.address,
277
276
  stalenessPeriod: Number(info.stalenessPeriod),
278
277
  name: info.name,
279
- isInStore: true,
280
278
  parameters: {}
281
279
  };
282
280
  });
@@ -55,7 +55,8 @@ interface ExecutionCost {
55
55
  interface SimulationPrices {
56
56
  /**
57
57
  * What the routed legs lost to market depth. `undefined` where nothing was
58
- * routed or nothing could be measured — never a manufactured zero.
58
+ * routed or nothing could be measured. Zero also represents a sign that
59
+ * cannot be distinguished within the routed outputs' rounding precision.
59
60
  */
60
61
  priceImpact: PathLossRate | undefined;
61
62
  /**
@@ -45,6 +45,7 @@ declare function lossRate(args: {
45
45
  declare function collectPriceImpact(probes: LegProbe[], ctx: {
46
46
  totalValue: bigint;
47
47
  netValue: bigint;
48
+ /** Oracle conversion rounded up, as in safeConvert. */
48
49
  toUnderlying: (from: Address, amount: bigint) => bigint;
49
50
  toUnderlyingAmount: (value: bigint) => TokenAmount;
50
51
  }): Promise<PathLossRate | undefined>;
@@ -3,9 +3,9 @@ import { AttachChainsArgs, ChainScope, ChainSummaryArgs, PermissionlessChain, Pe
3
3
  import { ChainsNamespace } from "./chains/ChainsNamespace.js";
4
4
  import { DeployArgs, DeployContractArgs, DeployPriceFeedArgs, PreparedDeployment, PreparedPriceFeedDeployment } from "./deploy/types.js";
5
5
  import { DEFAULT_DEPLOY_SALT, PermissionlessDeploy, priceFeedSalt } from "./deploy/PermissionlessDeploy.js";
6
- import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStatus, PermissionlessPriceFeedStore, PermissionlessPrices } from "./oracles/types.js";
6
+ import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStore, PermissionlessPrices } from "./oracles/types.js";
7
7
  import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./oracles/PermissionlessOracles.js";
8
- import { ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs } from "./transactions/types.js";
8
+ import { AddFeedsArgs, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs, PriceFeedPair } from "./transactions/types.js";
9
9
  import { InstanceOwnerTransactions } from "./transactions/InstanceOwnerTransactions.js";
10
10
  import { GearboxPermissionless } from "./GearboxPermissionless.js";
11
11
  import "./chains/index.js";
@@ -14,4 +14,4 @@ import "./deploy/index.js";
14
14
  import { PermissionlessChainUnreachableError, PermissionlessNotAttachedError, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError } from "./errors.js";
15
15
  import "./oracles/index.js";
16
16
  import "./transactions/index.js";
17
- export { AttachChainsArgs, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, DEFAULT_DEPLOY_SALT, DeployArgs, DeployContractArgs, DeployPriceFeedArgs, ForbidFeedsArgs, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetPricesArgs, InstanceOwnerTransactions, InstanceTxsArgs, PermissionlessAsset, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedStatus, PermissionlessPriceFeedStore, PermissionlessPrices, PreparedDeployment, PreparedPriceFeedDeployment, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, deriveEffectiveStalenessPeriod, priceFeedSalt };
17
+ export { AddFeedsArgs, AttachChainsArgs, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, DEFAULT_DEPLOY_SALT, DeployArgs, DeployContractArgs, DeployPriceFeedArgs, ForbidFeedsArgs, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetPricesArgs, InstanceOwnerTransactions, InstanceTxsArgs, PermissionlessAsset, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedStore, PermissionlessPrices, PreparedDeployment, PreparedPriceFeedDeployment, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, deriveEffectiveStalenessPeriod, priceFeedSalt };
@@ -1,3 +1,3 @@
1
- import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStatus, PermissionlessPriceFeedStore, PermissionlessPrices } from "./types.js";
1
+ import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStore, PermissionlessPrices } from "./types.js";
2
2
  import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./PermissionlessOracles.js";
3
- export { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GetPricesArgs, PermissionlessAsset, PermissionlessOracles, PermissionlessPriceFeedStatus, PermissionlessPriceFeedStore, PermissionlessPrices };
3
+ export { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GetPricesArgs, PermissionlessAsset, PermissionlessOracles, PermissionlessPriceFeedStore, PermissionlessPrices };
@@ -14,41 +14,23 @@ declare const priceFeedSchema: z.ZodObject<{
14
14
  contractType: z.ZodString;
15
15
  version: z.ZodNumber;
16
16
  deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
17
- isInStore: z.ZodBoolean;
18
17
  stalenessPeriod: z.ZodNumber;
19
18
  name: z.ZodString;
20
19
  }, z.core.$loose>;
21
- /** {@link PermissionlessPriceFeedStatus} */
22
- declare const priceFeedStatusSchema: z.ZodEnum<{
23
- forbidden: "forbidden";
24
- inStore: "inStore";
25
- pendingForbidden: "pendingForbidden";
26
- private: "private";
27
- }>;
28
20
  /** {@link PermissionlessAsset} */
29
21
  declare const assetSchema: z.ZodObject<{
30
22
  address: z.ZodCustom<`0x${string}`, `0x${string}`>;
31
23
  symbol: z.ZodString;
32
24
  name: z.ZodString;
33
25
  decimals: z.ZodNumber;
34
- isInStore: z.ZodBoolean;
35
26
  owner: z.ZodCustom<`0x${string}`, `0x${string}`>;
36
27
  priceFeeds: z.ZodArray<z.ZodObject<{
37
- pricefeed: z.ZodObject<{
38
- address: z.ZodCustom<`0x${string}`, `0x${string}`>;
39
- contractType: z.ZodString;
40
- version: z.ZodNumber;
41
- deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
42
- isInStore: z.ZodBoolean;
43
- stalenessPeriod: z.ZodNumber;
44
- name: z.ZodString;
45
- }, z.core.$loose>;
46
- status: z.ZodEnum<{
47
- forbidden: "forbidden";
48
- inStore: "inStore";
49
- pendingForbidden: "pendingForbidden";
50
- private: "private";
51
- }>;
28
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
29
+ contractType: z.ZodString;
30
+ version: z.ZodNumber;
31
+ deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
32
+ stalenessPeriod: z.ZodNumber;
33
+ name: z.ZodString;
52
34
  }, z.core.$loose>>;
53
35
  }, z.core.$loose>;
54
36
  /** {@link PermissionlessPriceFeedStore} */
@@ -63,24 +45,14 @@ declare const priceFeedStoreSchema: z.ZodObject<{
63
45
  symbol: z.ZodString;
64
46
  name: z.ZodString;
65
47
  decimals: z.ZodNumber;
66
- isInStore: z.ZodBoolean;
67
48
  owner: z.ZodCustom<`0x${string}`, `0x${string}`>;
68
49
  priceFeeds: z.ZodArray<z.ZodObject<{
69
- pricefeed: z.ZodObject<{
70
- address: z.ZodCustom<`0x${string}`, `0x${string}`>;
71
- contractType: z.ZodString;
72
- version: z.ZodNumber;
73
- deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
74
- isInStore: z.ZodBoolean;
75
- stalenessPeriod: z.ZodNumber;
76
- name: z.ZodString;
77
- }, z.core.$loose>;
78
- status: z.ZodEnum<{
79
- forbidden: "forbidden";
80
- inStore: "inStore";
81
- pendingForbidden: "pendingForbidden";
82
- private: "private";
83
- }>;
50
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
51
+ contractType: z.ZodString;
52
+ version: z.ZodNumber;
53
+ deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
54
+ stalenessPeriod: z.ZodNumber;
55
+ name: z.ZodString;
84
56
  }, z.core.$loose>>;
85
57
  }, z.core.$loose>>;
86
58
  priceFeeds: z.ZodArray<z.ZodObject<{
@@ -88,7 +60,6 @@ declare const priceFeedStoreSchema: z.ZodObject<{
88
60
  contractType: z.ZodString;
89
61
  version: z.ZodNumber;
90
62
  deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
91
- isInStore: z.ZodBoolean;
92
63
  stalenessPeriod: z.ZodNumber;
93
64
  name: z.ZodString;
94
65
  }, z.core.$loose>>;
@@ -100,4 +71,4 @@ declare const pricesSchema: z.ZodObject<{
100
71
  time: z.ZodNumber;
101
72
  }, z.core.$loose>;
102
73
  //#endregion
103
- export { assetSchema, priceFeedSchema, priceFeedStatusSchema, priceFeedStoreSchema, pricesSchema };
74
+ export { assetSchema, priceFeedSchema, priceFeedStoreSchema, pricesSchema };
@@ -3,29 +3,17 @@ import "../../core/index.js";
3
3
  import { Address } from "viem";
4
4
  //#region src/permissionless/api/oracles/types.d.ts
5
5
  /**
6
- * Where a feed stands for the asset it prices:
7
- *
8
- * - `private` — known to the backend only, not yet in the PriceFeedStore;
9
- * - `inStore` — allowed for the asset on chain;
10
- * - `pendingForbidden` — still allowed, with a removal prepared;
11
- * - `forbidden` — no longer allowed for the asset.
12
- **/
13
- type PermissionlessPriceFeedStatus = "private" | "inStore" | "pendingForbidden" | "forbidden";
14
- /**
15
- * One asset of a chain, with the feeds attached to it. The key is spelled
16
- * `pricefeed` because that is what the backend answers with.
6
+ * One asset of a chain, with the feeds allowed for it. The backend indexes
7
+ * the chain, so every feed listed here is one the PriceFeedStore carries and
8
+ * allows for the asset.
17
9
  **/
18
10
  interface PermissionlessAsset {
19
11
  address: Address;
20
12
  symbol: string;
21
13
  name: string;
22
14
  decimals: number;
23
- isInStore: boolean;
24
15
  owner: Address;
25
- priceFeeds: Array<{
26
- pricefeed: PriceFeed;
27
- status: PermissionlessPriceFeedStatus;
28
- }>;
16
+ priceFeeds: PriceFeed[];
29
17
  }
30
18
  /**
31
19
  * The PriceFeedStore of one chain as the backend has indexed it: the assets
@@ -60,4 +48,4 @@ interface GetPricesArgs {
60
48
  priceFeeds: Address[];
61
49
  }
62
50
  //#endregion
63
- export { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStatus, PermissionlessPriceFeedStore, PermissionlessPrices };
51
+ export { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStore, PermissionlessPrices };
@@ -1,7 +1,7 @@
1
1
  import { ChainsNamespace } from "../chains/ChainsNamespace.js";
2
2
  import { PermissionlessOracles } from "../oracles/PermissionlessOracles.js";
3
3
  import { InstanceTxs } from "../../utils/governance/types.js";
4
- import { ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs } from "./types.js";
4
+ import { AddFeedsArgs, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs } from "./types.js";
5
5
  //#region src/permissionless/api/transactions/InstanceOwnerTransactions.d.ts
6
6
  /**
7
7
  * The Safe batches an instance owner executes to apply what a curator
@@ -21,6 +21,8 @@ import { ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceT
21
21
  * const txs = await permissionless.transactions.addFeeds({
22
22
  * chainId: 1,
23
23
  * owner: curator,
24
+ * feeds: [feed],
25
+ * pairs: [{ asset, priceFeed: feed.address }],
24
26
  * });
25
27
  * ```
26
28
  **/
@@ -28,12 +30,18 @@ declare class InstanceOwnerTransactions {
28
30
  #private;
29
31
  constructor(chains: ChainsNamespace, oracles: PermissionlessOracles);
30
32
  /**
31
- * The batch that adds the owner's private feeds to the store and allows
32
- * them on the assets they were connected to. Only feeds that actually carry
33
- * a connection are added: a feed nobody priced would land in the store
34
- * doing nothing.
33
+ * The batch that adds the named feeds to the store and allows the named
34
+ * edges on it.
35
+ *
36
+ * Both lists come from the caller. Which feeds are private, and which asset
37
+ * each is meant to price, is held wherever the curator prepared them — the
38
+ * backend indexes the store, so a feed that has not reached it yet is not
39
+ * something this client can discover.
40
+ *
41
+ * Only feeds that actually carry an edge are added: a feed nobody priced
42
+ * would land in the store doing nothing.
35
43
  **/
36
- addFeeds({ chainId, owner }: InstanceTxsArgs): Promise<InstanceTxs>;
44
+ addFeeds({ chainId, owner, feeds, pairs }: AddFeedsArgs): Promise<InstanceTxs>;
37
45
  /**
38
46
  * The batch that renames feeds already in the store. A name is part of what
39
47
  * the store holds, so changing one is a remove and a fresh add, followed by
@@ -1,3 +1,3 @@
1
- import { ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs } from "./types.js";
1
+ import { AddFeedsArgs, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs, PriceFeedPair } from "./types.js";
2
2
  import { InstanceOwnerTransactions } from "./InstanceOwnerTransactions.js";
3
- export { ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceOwnerTransactions, InstanceTxsArgs };
3
+ export { AddFeedsArgs, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceOwnerTransactions, InstanceTxsArgs, PriceFeedPair };
@@ -1,3 +1,4 @@
1
+ import { PriceFeed } from "../../core/pricefeed.js";
1
2
  import { Address } from "viem";
2
3
  //#region src/permissionless/api/transactions/types.d.ts
3
4
  /**
@@ -17,6 +18,27 @@ interface InstanceTxsArgs {
17
18
  **/
18
19
  owner: Address;
19
20
  }
21
+ /**
22
+ * One asset-to-feed edge the store has to carry, see
23
+ * {@link AddFeedsArgs.pairs}.
24
+ **/
25
+ interface PriceFeedPair {
26
+ asset: Address;
27
+ priceFeed: Address;
28
+ }
29
+ /** Args of {@link InstanceOwnerTransactions.addFeeds}. */
30
+ interface AddFeedsArgs extends InstanceTxsArgs {
31
+ /**
32
+ * The feeds to put in the store. Only what the store records is read, so a
33
+ * caller holding a whole {@link PriceFeed} passes it unchanged.
34
+ **/
35
+ feeds: Array<Pick<PriceFeed, "address" | "stalenessPeriod" | "name">>;
36
+ /**
37
+ * The edges to allow. Independent of {@link feeds}: an edge may name a feed
38
+ * the store already carries, which is allowed without adding it again.
39
+ **/
40
+ pairs: PriceFeedPair[];
41
+ }
20
42
  /** Args of {@link InstanceOwnerTransactions.changeNames}. */
21
43
  interface ChangeNamesArgs extends InstanceTxsArgs {
22
44
  /** The new name of each feed, keyed by the feed's address. */
@@ -33,4 +55,4 @@ interface ForbidFeedsArgs extends InstanceTxsArgs {
33
55
  tokens: Record<Address, Address[]>;
34
56
  }
35
57
  //#endregion
36
- export { ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs };
58
+ export { AddFeedsArgs, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs, PriceFeedPair };
@@ -5,7 +5,6 @@ interface PriceFeed {
5
5
  contractType: string;
6
6
  version: number;
7
7
  deployedBy: Address;
8
- isInStore: boolean;
9
8
  stalenessPeriod: number;
10
9
  name: string;
11
10
  }
@@ -11,7 +11,7 @@ import "./core/index.js";
11
11
  import { FunctionParams, ValueParams, encodeFunctionParams } from "./utils/abi-encoder.js";
12
12
  import { DeployArgs, DeployContractArgs, DeployPriceFeedArgs, PreparedDeployment, PreparedPriceFeedDeployment } from "./api/deploy/types.js";
13
13
  import { DEFAULT_DEPLOY_SALT, PermissionlessDeploy, priceFeedSalt } from "./api/deploy/PermissionlessDeploy.js";
14
- import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStatus, PermissionlessPriceFeedStore, PermissionlessPrices } from "./api/oracles/types.js";
14
+ import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStore, PermissionlessPrices } from "./api/oracles/types.js";
15
15
  import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./api/oracles/PermissionlessOracles.js";
16
16
  import { AddressProviderContract } from "./bindings/address-provider.js";
17
17
  import { BytecodeRepositoryContract } from "./bindings/bytecode-repository.js";
@@ -31,7 +31,7 @@ import { RoutingManagerContract } from "./bindings/router/routing-manager.js";
31
31
  import { TreasurySplitterContract } from "./bindings/treasury-splitter.js";
32
32
  import "./bindings/index.js";
33
33
  import { InstanceTxs, TimelockTxs } from "./utils/governance/types.js";
34
- import { ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs } from "./api/transactions/types.js";
34
+ import { AddFeedsArgs, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs, PriceFeedPair } from "./api/transactions/types.js";
35
35
  import { InstanceOwnerTransactions } from "./api/transactions/InstanceOwnerTransactions.js";
36
36
  import { GearboxPermissionless } from "./api/GearboxPermissionless.js";
37
37
  import { deriveEffectiveStalenessPeriod } from "./api/deploy/effective-staleness.js";
@@ -52,4 +52,4 @@ import { getPrices } from "./utils/price-update/get-prices.js";
52
52
  import { GetUpdatablePriceFeedsArgs, getUpdatablePriceFeeds } from "./utils/price-update/get-updatable-feeds.js";
53
53
  import { normalizeSignature } from "./utils/signature.js";
54
54
  import "./utils/index.js";
55
- export { AccessMode, AddAssetParams, AddressProviderContract, Addresses, AllowTokenParams, ArchiveTransport, ArchiveTransportConfig, AttachChainsArgs, AuditEvent, Auditor, BYTECODE_REPOSITORY, Batch, Bytecode, BytecodeRepositoryContract, CCMConstructorParams, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ConstructorParams, CreditManagerFees, CrossChainCall, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, DeployArgs, DeployContractArgs, DeployParams, DeployPriceFeedArgs, Deployment, DeploymentExtended, ForbidAdapterParams, ForbidFeedsArgs, ForbidTokenParams, FunctionParams, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetPricesArgs, GetUpdatablePriceFeedsArgs, GovernorContract, INSTANCE_MANAGER, InputValueParams, InstanceManagerContract, InstanceOwnerTransactions, InstanceTxs, InstanceTxsArgs, MAINNET_CCM_CONSTRUCTOR_PARAMS, MAINNET_DEPLOYMENT_BLOCK, MAINNET_DEPLOYMENT_CCM_SALT, MAINNET_DEPLOYMENT_IM_SALT, MARKET_CONFIGURATOR_FACTORY, Market, MarketConfiguratorContract, MarketConfiguratorFactoryContract, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PauseCreditManagerParams, PeripheryDomain, PermissionlessAsset, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedStatus, PermissionlessPriceFeedStore, PermissionlessPrices, PreparedDeployment, PreparedPriceFeedDeployment, PriceFeed, PriceFeedConstructorParam, PriceFeedNotInStoreError, PriceFeedParamType, PriceFeedParams, PriceFeedSaltMissingError, PriceFeedSetupParams, PriceFeedStalenessUnknownError, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RecoveryMessage, RoutingManagerContract, SafeBatch, SafeMeta, SafeTx, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, Signature, TOKEN_COMPRESSOR, TimeLockContract, TimelockTransaction, TimelockTxParams, TimelockTxs, TokenCompressorContract, TreasurySplitterContract, UnpauseCreditManagerParams, ValueParams, WithdrawalCompressorContract, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, chunkedLogsTransport, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCallData, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, deriveEffectiveStalenessPeriod, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, priceFeedSalt, priceFeedSetupParams, shortenHash, significantTrunc };
55
+ export { AccessMode, AddAssetParams, AddFeedsArgs, AddressProviderContract, Addresses, AllowTokenParams, ArchiveTransport, ArchiveTransportConfig, AttachChainsArgs, AuditEvent, Auditor, BYTECODE_REPOSITORY, Batch, Bytecode, BytecodeRepositoryContract, CCMConstructorParams, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ConstructorParams, CreditManagerFees, CrossChainCall, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, DeployArgs, DeployContractArgs, DeployParams, DeployPriceFeedArgs, Deployment, DeploymentExtended, ForbidAdapterParams, ForbidFeedsArgs, ForbidTokenParams, FunctionParams, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetPricesArgs, GetUpdatablePriceFeedsArgs, GovernorContract, INSTANCE_MANAGER, InputValueParams, InstanceManagerContract, InstanceOwnerTransactions, InstanceTxs, InstanceTxsArgs, MAINNET_CCM_CONSTRUCTOR_PARAMS, MAINNET_DEPLOYMENT_BLOCK, MAINNET_DEPLOYMENT_CCM_SALT, MAINNET_DEPLOYMENT_IM_SALT, MARKET_CONFIGURATOR_FACTORY, Market, MarketConfiguratorContract, MarketConfiguratorFactoryContract, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PauseCreditManagerParams, PeripheryDomain, PermissionlessAsset, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedStore, PermissionlessPrices, PreparedDeployment, PreparedPriceFeedDeployment, PriceFeed, PriceFeedConstructorParam, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedParamType, PriceFeedParams, PriceFeedSaltMissingError, PriceFeedSetupParams, PriceFeedStalenessUnknownError, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RecoveryMessage, RoutingManagerContract, SafeBatch, SafeMeta, SafeTx, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, Signature, TOKEN_COMPRESSOR, TimeLockContract, TimelockTransaction, TimelockTxParams, TimelockTxs, TokenCompressorContract, TreasurySplitterContract, UnpauseCreditManagerParams, ValueParams, WithdrawalCompressorContract, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, chunkedLogsTransport, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCallData, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, deriveEffectiveStalenessPeriod, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, priceFeedSalt, priceFeedSetupParams, shortenHash, significantTrunc };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "17.11.0",
3
+ "version": "17.12.1",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {