@gearbox-protocol/sdk 18.2.0-next.12 → 18.2.0-next.14

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 (56) hide show
  1. package/dist/cjs/abi/310/iKillSwitchProxy.js +130 -0
  2. package/dist/cjs/permissionless/api/index.js +2 -1
  3. package/dist/cjs/permissionless/api/oracles/PermissionlessOracles.js +40 -5
  4. package/dist/cjs/permissionless/api/oracles/index.js +2 -1
  5. package/dist/cjs/permissionless/api/oracles/score/formula.js +19 -24
  6. package/dist/cjs/permissionless/api/oracles/score/index.js +1 -1
  7. package/dist/cjs/permissionless/api/oracles/score/run.js +186 -105
  8. package/dist/cjs/permissionless/api/oracles/stress/index.js +1 -0
  9. package/dist/cjs/permissionless/api/oracles/stress/run.js +63 -13
  10. package/dist/cjs/permissionless/bindings/bytecode-repository.js +8 -0
  11. package/dist/cjs/permissionless/bindings/governance/governor.js +1 -1
  12. package/dist/cjs/permissionless/bindings/index.js +7 -2
  13. package/dist/cjs/permissionless/bindings/kill-switch-proxy.js +188 -0
  14. package/dist/cjs/permissionless/bindings/market-configurator-factory.js +39 -1
  15. package/dist/cjs/permissionless/bindings/market-configurator.js +142 -0
  16. package/dist/cjs/permissionless/index.js +10 -3
  17. package/dist/cjs/permissionless/utils/index.js +1 -0
  18. package/dist/cjs/permissionless/utils/literals.js +2 -0
  19. package/dist/esm/abi/310/iKillSwitchProxy.js +129 -0
  20. package/dist/esm/permissionless/api/index.js +4 -4
  21. package/dist/esm/permissionless/api/oracles/PermissionlessOracles.js +41 -6
  22. package/dist/esm/permissionless/api/oracles/index.js +4 -4
  23. package/dist/esm/permissionless/api/oracles/score/formula.js +20 -24
  24. package/dist/esm/permissionless/api/oracles/score/index.js +3 -3
  25. package/dist/esm/permissionless/api/oracles/score/run.js +187 -107
  26. package/dist/esm/permissionless/api/oracles/stress/index.js +2 -2
  27. package/dist/esm/permissionless/api/oracles/stress/run.js +64 -15
  28. package/dist/esm/permissionless/bindings/bytecode-repository.js +8 -0
  29. package/dist/esm/permissionless/bindings/governance/governor.js +1 -1
  30. package/dist/esm/permissionless/bindings/index.js +4 -3
  31. package/dist/esm/permissionless/bindings/kill-switch-proxy.js +184 -0
  32. package/dist/esm/permissionless/bindings/market-configurator-factory.js +37 -0
  33. package/dist/esm/permissionless/bindings/market-configurator.js +143 -1
  34. package/dist/esm/permissionless/index.js +8 -7
  35. package/dist/esm/permissionless/utils/index.js +2 -2
  36. package/dist/esm/permissionless/utils/literals.js +2 -1
  37. package/dist/types/abi/310/iKillSwitchProxy.d.ts +114 -0
  38. package/dist/types/permissionless/api/index.d.ts +5 -5
  39. package/dist/types/permissionless/api/oracles/PermissionlessOracles.d.ts +30 -6
  40. package/dist/types/permissionless/api/oracles/index.d.ts +5 -5
  41. package/dist/types/permissionless/api/oracles/score/formula.d.ts +14 -17
  42. package/dist/types/permissionless/api/oracles/score/index.d.ts +4 -4
  43. package/dist/types/permissionless/api/oracles/score/run.d.ts +28 -10
  44. package/dist/types/permissionless/api/oracles/score/types.d.ts +33 -28
  45. package/dist/types/permissionless/api/oracles/stress/index.d.ts +2 -2
  46. package/dist/types/permissionless/api/oracles/stress/run.d.ts +11 -0
  47. package/dist/types/permissionless/bindings/bytecode-repository.d.ts +10 -1
  48. package/dist/types/permissionless/bindings/index.d.ts +4 -3
  49. package/dist/types/permissionless/bindings/kill-switch-proxy.d.ts +205 -0
  50. package/dist/types/permissionless/bindings/market-configurator-factory.d.ts +30 -0
  51. package/dist/types/permissionless/bindings/market-configurator.d.ts +30 -1
  52. package/dist/types/permissionless/bindings/types.d.ts +27 -0
  53. package/dist/types/permissionless/index.d.ts +9 -8
  54. package/dist/types/permissionless/utils/index.d.ts +2 -2
  55. package/dist/types/permissionless/utils/literals.d.ts +1 -0
  56. package/package.json +1 -1
@@ -5,7 +5,7 @@ import { AttachChainsArgs, ChainScope, ChainSummaryArgs, PermissionlessChain, Pe
5
5
  import { ChainsNamespace } from "./chains/ChainsNamespace.js";
6
6
  import { DeployArgs, DeployContractArgs, DeployPriceFeedArgs, PreparedDeployment, PreparedPriceFeedDeployment } from "./deploy/types.js";
7
7
  import { DEFAULT_DEPLOY_SALT, PermissionlessDeploy, priceFeedSalt } from "./deploy/PermissionlessDeploy.js";
8
- import { AssetScore, AssetScoresArgs, GroupImpact, MarketScore, ScoredFeed } from "./oracles/score/types.js";
8
+ import { AssetScore, AssetScoresArgs, FeedPairScore, FeedPairScoreArgs, GroupImpact, MarketScore, ScoredFeed } from "./oracles/score/types.js";
9
9
  import { BreakingPoint, FeedOutcome, GroupReport, GroupScenarioOutcome, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs } from "./oracles/stress/types.js";
10
10
  import { AssetArgs, AssetCap, AssetsArgs, FeedCap, MarketCap, PermissionlessAsset, PermissionlessAssetDetails, PermissionlessAssetMarket, PermissionlessAssetMarketFeed, PermissionlessAssetQuota, PermissionlessAssetSummary, PermissionlessIndexedAssetDetails, PermissionlessIndexedAssetSummary, PermissionlessIndexedPriceFeedDetails, PermissionlessIndexedPriceFeedMarket, PermissionlessMarket, PermissionlessMarketSlot, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedStore, PermissionlessQuotaTotals, PriceFeedArgs, PriceFeedDecimals, PriceFeedPrice, PriceFeedRef } from "./oracles/types.js";
11
11
  import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./oracles/PermissionlessOracles.js";
@@ -17,12 +17,12 @@ import "./chains/index.js";
17
17
  import { deriveEffectiveStalenessPeriod } from "./deploy/effective-staleness.js";
18
18
  import "./deploy/index.js";
19
19
  import { PermissionlessChainUnreachableError, PermissionlessNotAttachedError, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError } from "./errors.js";
20
- import { REVERT_SCORE, SCORE_MULTIPLIER, factorOf, finalPrice, scoreOfFactor, worstOf } from "./oracles/score/formula.js";
21
- import { runAssetScores } from "./oracles/score/run.js";
20
+ import { SCORE_MULTIPLIER, factorOf, finalPrice, scoreOfFactor, worstOf } from "./oracles/score/formula.js";
21
+ import { runAssetScores, runFeedPairScore } from "./oracles/score/run.js";
22
22
  import { TreeNode, classifySources, sourcesByFeed } from "./oracles/stress/classify.js";
23
23
  import { UNBOUNDED_DOWN, UNBOUNDED_UP, groupOverride, perturb, rateStub, roundDataStub } from "./oracles/stress/override.js";
24
- import { DEFAULT_SCENARIOS, RATE_FEED_TYPE, readForest, readRateTargets, readUnder, runStressTest } from "./oracles/stress/run.js";
24
+ import { DEFAULT_SCENARIOS, RATE_FEED_TYPE, readFeedTrees, readForest, readRateTargets, readUnder, runStressTest } from "./oracles/stress/run.js";
25
25
  import { scoreGroup, slotHarm, verdictOf } from "./oracles/stress/score.js";
26
26
  import "./oracles/index.js";
27
27
  import "./transactions/index.js";
28
- export { AddFeedsArgs, AssetArgs, AssetCap, AssetScore, AssetScoresArgs, AssetsArgs, AttachChainsArgs, BreakingPoint, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, DEFAULT_DEPLOY_SALT, DEFAULT_SCENARIOS, DeployArgs, DeployContractArgs, DeployPriceFeedArgs, FeedCap, FeedOutcome, ForbidFeedsArgs, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GroupImpact, GroupReport, GroupScenarioOutcome, InstanceOwnerTransactions, InstanceTxsArgs, MarketCap, MarketScore, PermissionlessAnalytics, PermissionlessAsset, PermissionlessAssetDetails, PermissionlessAssetMarket, PermissionlessAssetMarketFeed, PermissionlessAssetQuota, PermissionlessAssetSummary, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessIndexedAssetDetails, PermissionlessIndexedAssetSummary, PermissionlessIndexedPriceFeedDetails, PermissionlessIndexedPriceFeedMarket, PermissionlessMarket, PermissionlessMarketSlot, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedStore, PermissionlessQuotaTotals, PreparedDeployment, PreparedPriceFeedDeployment, PriceChartArgs, PriceFeedArgs, PriceFeedChartPoint, PriceFeedDecimals, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedPrice, PriceFeedPriceChart, PriceFeedRef, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, RATE_FEED_TYPE, REVERT_SCORE, SCORE_MULTIPLIER, ScoredFeed, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, classifySources, deriveEffectiveStalenessPeriod, factorOf, finalPrice, groupOverride, perturb, priceFeedSalt, rateStub, readForest, readRateTargets, readUnder, roundDataStub, runAssetScores, runStressTest, scoreGroup, scoreOfFactor, slotHarm, sourcesByFeed, verdictOf, worstOf };
28
+ export { AddFeedsArgs, AssetArgs, AssetCap, AssetScore, AssetScoresArgs, AssetsArgs, AttachChainsArgs, BreakingPoint, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, DEFAULT_DEPLOY_SALT, DEFAULT_SCENARIOS, DeployArgs, DeployContractArgs, DeployPriceFeedArgs, FeedCap, FeedOutcome, FeedPairScore, FeedPairScoreArgs, ForbidFeedsArgs, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GroupImpact, GroupReport, GroupScenarioOutcome, InstanceOwnerTransactions, InstanceTxsArgs, MarketCap, MarketScore, PermissionlessAnalytics, PermissionlessAsset, PermissionlessAssetDetails, PermissionlessAssetMarket, PermissionlessAssetMarketFeed, PermissionlessAssetQuota, PermissionlessAssetSummary, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessIndexedAssetDetails, PermissionlessIndexedAssetSummary, PermissionlessIndexedPriceFeedDetails, PermissionlessIndexedPriceFeedMarket, PermissionlessMarket, PermissionlessMarketSlot, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedStore, PermissionlessQuotaTotals, PreparedDeployment, PreparedPriceFeedDeployment, PriceChartArgs, PriceFeedArgs, PriceFeedChartPoint, PriceFeedDecimals, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedPrice, PriceFeedPriceChart, PriceFeedRef, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, RATE_FEED_TYPE, SCORE_MULTIPLIER, ScoredFeed, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, classifySources, deriveEffectiveStalenessPeriod, factorOf, finalPrice, groupOverride, perturb, priceFeedSalt, rateStub, readFeedTrees, readForest, readRateTargets, readUnder, roundDataStub, runAssetScores, runFeedPairScore, runStressTest, scoreGroup, scoreOfFactor, slotHarm, sourcesByFeed, verdictOf, worstOf };
@@ -2,7 +2,7 @@ import { PriceFeedData } from "../../../model/opportunities.js";
2
2
  import { AbstractOffchainNamespace } from "../../../offchain/AbstractOffchainNamespace.js";
3
3
  import { GearboxPermissionlessOptions } from "../types.js";
4
4
  import { ChainsNamespace } from "../chains/ChainsNamespace.js";
5
- import { AssetScore, AssetScoresArgs } from "./score/types.js";
5
+ import { AssetScore, AssetScoresArgs, FeedPairScore, FeedPairScoreArgs } from "./score/types.js";
6
6
  import { StressReport, StressTestArgs } from "./stress/types.js";
7
7
  import { AssetArgs, AssetCap, AssetsArgs, FeedCap, MarketCap, PermissionlessAssetDetails, PermissionlessAssetSummary, PermissionlessMarketSlot, PermissionlessPriceFeedDetails, PermissionlessPriceFeedStore, PriceFeedArgs, PriceFeedDecimals, PriceFeedPrice, PriceFeedRef } from "./types.js";
8
8
  //#region src/permissionless/api/oracles/PermissionlessOracles.d.ts
@@ -192,14 +192,16 @@ export declare class PermissionlessOracles extends AbstractOffchainNamespace {
192
192
  * three leaves anything to simulate.
193
193
  **/
194
194
  /**
195
- * Every asset's score out of 10 for how its markets guard its price.
195
+ * Every asset's manipulation resistance: how far, from 1 to 10 times, a
196
+ * lying source can push the price its markets hold for it.
196
197
  *
197
198
  * Each source group behind an asset's feeds — Chainlink, Redstone, Lido and
198
- * so on — is made in turn to answer five times what it answers now, and a
199
+ * so on — is made in turn to answer ten times what it answers now, and a
199
200
  * market scores by how far that moves its final price, `min(main,
200
- * reserve)`: 10 for not at all, 0 for the full five times, on a log scale.
201
- * A price that stops answering scores 5. An asset scores its worst running
202
- * market that takes it as collateral.
201
+ * reserve)`, as a multiple either way: 1 for not at all, 1.04 for 4%, 10
202
+ * for the whole lie. A group under which the price stops answering moves
203
+ * nothing and is listed rather than scored. An asset scores its worst
204
+ * running market, underlying or collateral.
203
205
  *
204
206
  * Simulated on the chain as it stands, through state overrides in
205
207
  * `eth_call`: one call per source group per chain, so the node behind the
@@ -215,6 +217,28 @@ export declare class PermissionlessOracles extends AbstractOffchainNamespace {
215
217
  * {@link GearboxPermissionless.attach} has resolved.
216
218
  **/
217
219
  assetScores({ chainId }?: AssetScoresArgs): Promise<AssetScore[]>;
220
+ /**
221
+ * The manipulation resistance of any main feed and reserve on a chain,
222
+ * scored the way {@link assetScores} scores a market holding them — for
223
+ * trying a pair before any market does.
224
+ *
225
+ * ```ts
226
+ * const pair = await permissionless.oracles.feedPairScore({
227
+ * chainId: 1,
228
+ * main: "0x…",
229
+ * reserve: "0x…",
230
+ * });
231
+ * ```
232
+ *
233
+ * Reads the chain directly, through state overrides in `eth_call`, so the
234
+ * client has to have attached and the node behind it has to accept them.
235
+ *
236
+ * @throws When the client has not attached, when the chain has no client or
237
+ * no PriceFeedCompressor, or when there is nothing to score: a feed the
238
+ * compressor cannot read, a `ZeroPriceFeed` main, or a final price that does
239
+ * not answer.
240
+ **/
241
+ feedPairScore({ chainId, main, reserve }: FeedPairScoreArgs): Promise<FeedPairScore>;
218
242
  stressTest({ chainId, ...options }: StressTestArgs): Promise<StressReport>;
219
243
  /**
220
244
  * The feeds one feed reads from, recursively.
@@ -1,13 +1,13 @@
1
- import { AssetScore, AssetScoresArgs, GroupImpact, MarketScore, ScoredFeed } from "./score/types.js";
1
+ import { AssetScore, AssetScoresArgs, FeedPairScore, FeedPairScoreArgs, GroupImpact, MarketScore, ScoredFeed } from "./score/types.js";
2
2
  import { BreakingPoint, FeedOutcome, GroupReport, GroupScenarioOutcome, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs } from "./stress/types.js";
3
3
  import { AssetArgs, AssetCap, AssetsArgs, FeedCap, MarketCap, PermissionlessAsset, PermissionlessAssetDetails, PermissionlessAssetMarket, PermissionlessAssetMarketFeed, PermissionlessAssetQuota, PermissionlessAssetSummary, PermissionlessIndexedAssetDetails, PermissionlessIndexedAssetSummary, PermissionlessIndexedPriceFeedDetails, PermissionlessIndexedPriceFeedMarket, PermissionlessMarket, PermissionlessMarketSlot, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedStore, PermissionlessQuotaTotals, PriceFeedArgs, PriceFeedDecimals, PriceFeedPrice, PriceFeedRef } from "./types.js";
4
4
  import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./PermissionlessOracles.js";
5
- import { REVERT_SCORE, SCORE_MULTIPLIER, factorOf, finalPrice, scoreOfFactor, worstOf } from "./score/formula.js";
6
- import { runAssetScores } from "./score/run.js";
5
+ import { SCORE_MULTIPLIER, factorOf, finalPrice, scoreOfFactor, worstOf } from "./score/formula.js";
6
+ import { runAssetScores, runFeedPairScore } from "./score/run.js";
7
7
  import "./score/index.js";
8
8
  import { TreeNode, classifySources, sourcesByFeed } from "./stress/classify.js";
9
9
  import { UNBOUNDED_DOWN, UNBOUNDED_UP, groupOverride, perturb, rateStub, roundDataStub } from "./stress/override.js";
10
- import { DEFAULT_SCENARIOS, RATE_FEED_TYPE, readForest, readRateTargets, readUnder, runStressTest } from "./stress/run.js";
10
+ import { DEFAULT_SCENARIOS, RATE_FEED_TYPE, readFeedTrees, readForest, readRateTargets, readUnder, runStressTest } from "./stress/run.js";
11
11
  import { scoreGroup, slotHarm, verdictOf } from "./stress/score.js";
12
12
  import "./stress/index.js";
13
- export { AssetArgs, AssetCap, AssetScore, AssetScoresArgs, AssetsArgs, BreakingPoint, DEFAULT_SCENARIOS, FeedCap, FeedOutcome, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GroupImpact, GroupReport, GroupScenarioOutcome, MarketCap, MarketScore, PermissionlessAsset, PermissionlessAssetDetails, PermissionlessAssetMarket, PermissionlessAssetMarketFeed, PermissionlessAssetQuota, PermissionlessAssetSummary, PermissionlessIndexedAssetDetails, PermissionlessIndexedAssetSummary, PermissionlessIndexedPriceFeedDetails, PermissionlessIndexedPriceFeedMarket, PermissionlessMarket, PermissionlessMarketSlot, PermissionlessOracles, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedStore, PermissionlessQuotaTotals, PriceFeedArgs, PriceFeedDecimals, PriceFeedPrice, PriceFeedRef, RATE_FEED_TYPE, REVERT_SCORE, SCORE_MULTIPLIER, ScoredFeed, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, classifySources, factorOf, finalPrice, groupOverride, perturb, rateStub, readForest, readRateTargets, readUnder, roundDataStub, runAssetScores, runStressTest, scoreGroup, scoreOfFactor, slotHarm, sourcesByFeed, verdictOf, worstOf };
13
+ export { AssetArgs, AssetCap, AssetScore, AssetScoresArgs, AssetsArgs, BreakingPoint, DEFAULT_SCENARIOS, FeedCap, FeedOutcome, FeedPairScore, FeedPairScoreArgs, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GroupImpact, GroupReport, GroupScenarioOutcome, MarketCap, MarketScore, PermissionlessAsset, PermissionlessAssetDetails, PermissionlessAssetMarket, PermissionlessAssetMarketFeed, PermissionlessAssetQuota, PermissionlessAssetSummary, PermissionlessIndexedAssetDetails, PermissionlessIndexedAssetSummary, PermissionlessIndexedPriceFeedDetails, PermissionlessIndexedPriceFeedMarket, PermissionlessMarket, PermissionlessMarketSlot, PermissionlessOracles, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedStore, PermissionlessQuotaTotals, PriceFeedArgs, PriceFeedDecimals, PriceFeedPrice, PriceFeedRef, RATE_FEED_TYPE, SCORE_MULTIPLIER, ScoredFeed, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, classifySources, factorOf, finalPrice, groupOverride, perturb, rateStub, readFeedTrees, readForest, readRateTargets, readUnder, roundDataStub, runAssetScores, runFeedPairScore, runStressTest, scoreGroup, scoreOfFactor, slotHarm, sourcesByFeed, verdictOf, worstOf };
@@ -1,23 +1,17 @@
1
1
  import { GroupImpact } from "./types.js";
2
2
  //#region src/permissionless/api/oracles/score/formula.d.ts
3
3
  /** What every source of a group is made to answer, as a multiple of now. */
4
- export declare const SCORE_MULTIPLIER = 5;
4
+ export declare const SCORE_MULTIPLIER = 10;
5
5
  /**
6
- * The score of a price that stops answering under the lie.
6
+ * How far the final price moved, as a multiple of where it was, either way:
7
+ * 1 for a price that did not move, 1.04 for one 4% off, and
8
+ * {@link SCORE_MULTIPLIER} for one that took the whole lie — the most it can
9
+ * take from one leg, and where a price over two legs of one group, moved
10
+ * further, is held too.
7
11
  *
8
- * Half marks: nobody can borrow against a wrong number, but nobody can be
9
- * liquidated either until the feed is replaced.
12
+ * `null` for a price that stopped answering, which is not a move.
10
13
  */
11
- export declare const REVERT_SCORE = 5;
12
- /**
13
- * 0 to 10 by how far the final price moved, on a log scale against the lie
14
- * itself: 10 for a price that did not move, 0 for one that moved by the full
15
- * {@link SCORE_MULTIPLIER} or more, either way. Rounded to a half point.
16
- *
17
- * A bound holding a price within a few percent keeps a 10; a price that let
18
- * half the lie through, ×√5, scores 5.
19
- */
20
- export declare function scoreOfFactor(factor: number | null): number;
14
+ export declare function scoreOfFactor(factor: number | null): number | null;
21
15
  /**
22
16
  * The price a market settles on: the lower of main and reserve, or the main
23
17
  * feed's alone where there is no reserve to compare it with. `null` where a
@@ -27,9 +21,12 @@ export declare function finalPrice(main: bigint | null, reserve: bigint | null |
27
21
  /** `stressed / base` as a float, `null` where the stressed price is gone. */
28
22
  export declare function factorOf(base: bigint, stressed: bigint | null): number | null;
29
23
  /**
30
- * The market's score and the group it comes from: the lowest of its groups,
31
- * ties going to the group that moved the price further. 10 where no source
32
- * feeds the price at all, since nothing can be made to lie about it.
24
+ * The market's score and the group it comes from: the furthest any group
25
+ * moved its price. 1 where nothing moved it — no group did, or no source
26
+ * feeds the price at all.
27
+ *
28
+ * A group under which the price stops answering moves nothing and does not
29
+ * set the score; it is listed after those that do, for a reader to see.
33
30
  */
34
31
  export declare function worstOf(impacts: GroupImpact[]): {
35
32
  score: number;
@@ -1,4 +1,4 @@
1
- import { AssetScore, AssetScoresArgs, GroupImpact, MarketScore, ScoredFeed } from "./types.js";
2
- import { REVERT_SCORE, SCORE_MULTIPLIER, factorOf, finalPrice, scoreOfFactor, worstOf } from "./formula.js";
3
- import { runAssetScores } from "./run.js";
4
- export { AssetScore, AssetScoresArgs, GroupImpact, MarketScore, REVERT_SCORE, SCORE_MULTIPLIER, ScoredFeed, factorOf, finalPrice, runAssetScores, scoreOfFactor, worstOf };
1
+ import { AssetScore, AssetScoresArgs, FeedPairScore, FeedPairScoreArgs, GroupImpact, MarketScore, ScoredFeed } from "./types.js";
2
+ import { SCORE_MULTIPLIER, factorOf, finalPrice, scoreOfFactor, worstOf } from "./formula.js";
3
+ import { runAssetScores, runFeedPairScore } from "./run.js";
4
+ export { AssetScore, AssetScoresArgs, FeedPairScore, FeedPairScoreArgs, GroupImpact, MarketScore, SCORE_MULTIPLIER, ScoredFeed, factorOf, finalPrice, runAssetScores, runFeedPairScore, scoreOfFactor, worstOf };
@@ -1,24 +1,42 @@
1
- import { AssetScore } from "./types.js";
1
+ import { AssetScore, FeedPairScore } from "./types.js";
2
2
  import { PermissionlessMarketSlot } from "../types.js";
3
3
  import { Address, Chain, PublicClient, Transport } from "viem";
4
4
  //#region src/permissionless/api/oracles/score/run.d.ts
5
+ type Logger = {
6
+ warn(message: string): void;
7
+ };
5
8
  /**
6
9
  * Every asset of one chain, scored by what each of its source groups can do
7
10
  * to the price its running markets hold for it.
8
11
  *
9
- * One read of the oracles' feed trees, one of the LP feeds' rate contracts,
10
- * one of every market feed as it stands — then one `eth_call` per source
11
- * group, with the group's sources overridden to answer
12
- * {@link SCORE_MULTIPLIER} times what they answer now and every market feed
13
- * read under it.
12
+ * One read of the oracles' feed trees, then the simulation of every market's
13
+ * main and reserve pair at once — see {@link simulatePairs}.
14
14
  **/
15
15
  export declare function runAssetScores({ client, chainId, slots, compressor, logger }: {
16
16
  client: PublicClient<Transport, Chain>;
17
17
  chainId: number;
18
18
  slots: PermissionlessMarketSlot[];
19
19
  compressor: Address;
20
- logger?: {
21
- warn(message: string): void;
22
- };
20
+ logger?: Logger;
23
21
  }): Promise<AssetScore[]>;
24
- //#endregion
22
+ /**
23
+ * Any main feed and reserve on a chain, scored the way a market holding them
24
+ * would be — whether or not any market does yet.
25
+ *
26
+ * The two trees are read off the compressor by feed rather than by oracle,
27
+ * so a feed the curator has only just deployed scores as well as one in use.
28
+ *
29
+ * @throws Where there is nothing to score: the compressor cannot read a
30
+ * feed, the main feed is a `ZeroPriceFeed`, or the final price does not
31
+ * answer even with every pull feed under it freshened.
32
+ **/
33
+ export declare function runFeedPairScore({ client, chainId, compressor, main, reserve, logger }: {
34
+ client: PublicClient<Transport, Chain>;
35
+ chainId: number;
36
+ compressor: Address;
37
+ main: Address;
38
+ reserve?: Address;
39
+ logger?: Logger;
40
+ }): Promise<FeedPairScore>;
41
+ //#endregion
42
+ export {};
@@ -5,7 +5,10 @@ import { Address } from "viem";
5
5
  **/
6
6
  export interface ScoredFeed {
7
7
  feed: Address;
8
- /** The store's name for the feed, `null` where it has none. */
8
+ /**
9
+ * The store's name for the feed, `null` where it has none or where the
10
+ * feed was named by address alone, as a pair to score is.
11
+ */
9
12
  name: string | null;
10
13
  /** Gearbox contract type of the feed itself, `""` for one it never deployed. */
11
14
  contractType: string;
@@ -35,30 +38,22 @@ export interface GroupImpact {
35
38
  * a price that stopped answering.
36
39
  */
37
40
  factor: number | null;
38
- /**
39
- * The same, against the market's own underlying: what an account is
40
- * valued by. A lie that moves collateral and underlying alike leaves it at
41
- * 1. `null` where either price stopped answering.
42
- */
43
- ratioFactor: number | null;
44
- /** 0 to 10, by {@link scoreOfFactor}. */
45
- score: number;
41
+ /** 1 to 10, by {@link scoreOfFactor}; `null` where the price stopped answering. */
42
+ score: number | null;
46
43
  }
47
44
  /**
48
- * How well one market guards one asset's price, out of 10.
45
+ * How far the price a main and a reserve feed give together can be pushed:
46
+ * their manipulation resistance, from 1 (does not move) to 10 (takes the
47
+ * whole lie).
49
48
  *
50
- * Every source group behind the asset's feeds is made, one group at a time,
51
- * to answer {@link SCORE_MULTIPLIER} times what it answers now. The market
52
- * scores by the group that moves its final price — `min(main, reserve)` —
53
- * the furthest.
49
+ * Every source group behind the two feeds is made, one group at a time, to
50
+ * answer {@link SCORE_MULTIPLIER} times what it answers now. The pair scores
51
+ * by the group that moves its final price — `min(main, reserve)` — the
52
+ * furthest, as a multiple either way.
54
53
  **/
55
- export interface MarketScore {
56
- market: Address;
57
- marketName: string | null;
58
- marketConfigurator: Address;
59
- curatorName: string | null;
54
+ export interface FeedPairScore {
60
55
  main: ScoredFeed;
61
- /** `null` where the market holds no reserve for the asset at all. */
56
+ /** `null` where there is no reserve at all. */
62
57
  reserve: ScoredFeed | null;
63
58
  /**
64
59
  * The final price is `min(main, reserve)`: a reserve is present, is not a
@@ -70,7 +65,7 @@ export interface MarketScore {
70
65
  price: number;
71
66
  /** Every group behind the two feeds, the most damaging first. */
72
67
  impacts: GroupImpact[];
73
- /** The group the score comes from; `null` where no source feeds the price. */
68
+ /** The group the score comes from; `null` where no group moves the price. */
74
69
  worst: GroupImpact | null;
75
70
  /**
76
71
  * The score rests on a source nothing could name.
@@ -81,23 +76,27 @@ export interface MarketScore {
81
76
  */
82
77
  unverified: boolean;
83
78
  score: number;
84
- /** How the market is set up, where that explains its score. */
79
+ /** How the pair is set up, where that explains its score. */
85
80
  notes: string[];
86
81
  }
82
+ /** One market's price for one asset, scored as the pair of feeds it holds. */
83
+ export interface MarketScore extends FeedPairScore {
84
+ market: Address;
85
+ marketName: string | null;
86
+ marketConfigurator: Address;
87
+ curatorName: string | null;
88
+ }
87
89
  /**
88
90
  * One asset's score: its worst market's.
89
91
  *
90
- * The minimum, not an average, because the asset is only as well guarded as
91
- * the most exposed market that accepts it.
92
+ * The maximum, not an average, because the asset is only as well guarded as
93
+ * the most exposed market that prices it.
92
94
  **/
93
95
  export interface AssetScore {
94
96
  chainId: number;
95
97
  asset: Address;
96
98
  symbol: string | null;
97
- /**
98
- * `null` for an asset no running market accepts as collateral: every
99
- * market has it switched off, or it is only ever a market's underlying.
100
- */
99
+ /** `null` for an asset no running market prices: it is switched off in all. */
101
100
  score: number | null;
102
101
  /** Some market's score rests on a source nothing could name. */
103
102
  unverified: boolean;
@@ -110,4 +109,10 @@ export interface AssetScoresArgs {
110
109
  /** Omitted scores every chain the backend serves markets for. */
111
110
  chainId?: number;
112
111
  }
112
+ export interface FeedPairScoreArgs {
113
+ chainId: number;
114
+ main: Address;
115
+ /** Omitted scores the main feed alone, as a market with no reserve. */
116
+ reserve?: Address;
117
+ }
113
118
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { BreakingPoint, FeedOutcome, GroupReport, GroupScenarioOutcome, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs } from "./types.js";
2
2
  import { TreeNode, classifySources, sourcesByFeed } from "./classify.js";
3
3
  import { UNBOUNDED_DOWN, UNBOUNDED_UP, groupOverride, perturb, rateStub, roundDataStub } from "./override.js";
4
- import { DEFAULT_SCENARIOS, RATE_FEED_TYPE, readForest, readRateTargets, readUnder, runStressTest } from "./run.js";
4
+ import { DEFAULT_SCENARIOS, RATE_FEED_TYPE, readFeedTrees, readForest, readRateTargets, readUnder, runStressTest } from "./run.js";
5
5
  import { scoreGroup, slotHarm, verdictOf } from "./score.js";
6
- export { BreakingPoint, DEFAULT_SCENARIOS, FeedOutcome, GroupReport, GroupScenarioOutcome, RATE_FEED_TYPE, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, classifySources, groupOverride, perturb, rateStub, readForest, readRateTargets, readUnder, roundDataStub, runStressTest, scoreGroup, slotHarm, sourcesByFeed, verdictOf };
6
+ export { BreakingPoint, DEFAULT_SCENARIOS, FeedOutcome, GroupReport, GroupScenarioOutcome, RATE_FEED_TYPE, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, classifySources, groupOverride, perturb, rateStub, readFeedTrees, readForest, readRateTargets, readUnder, roundDataStub, runStressTest, scoreGroup, slotHarm, sourcesByFeed, verdictOf };
@@ -27,6 +27,17 @@ export declare function readForest(client: PublicClient<Transport, Chain>, compr
27
27
  answers: Map<Address, bigint | null>;
28
28
  unreadableOracles: Address[];
29
29
  }>;
30
+ /**
31
+ * The trees under a handful of feeds, flattened, whether or not any oracle
32
+ * holds them.
33
+ *
34
+ * One call for all of them: the compressor walks the feeds it is given the
35
+ * way it walks an oracle's, and answers with the same nodes.
36
+ */
37
+ export declare function readFeedTrees(client: PublicClient<Transport, Chain>, compressor: Address, feeds: Address[]): Promise<{
38
+ nodes: Map<Address, TreeNode>;
39
+ answers: Map<Address, bigint | null>;
40
+ }>;
30
41
  /**
31
42
  * Where each rate-bearing feed reads its rate, and what it will accept.
32
43
  *
@@ -1145,11 +1145,15 @@ declare const abi: readonly [{
1145
1145
  }];
1146
1146
  readonly name: "VersionNotFoundException";
1147
1147
  }];
1148
- interface ComputeAddressArgs {
1148
+ export interface ComputeAddressArgs {
1149
1149
  contractType: string;
1150
1150
  version: number;
1151
1151
  encodedParams: Hex;
1152
1152
  salt: Hex;
1153
+ /**
1154
+ * Deployer, i.e. address that will call `deploy` on the bytecode repository.
1155
+ * It is mixed into the salt, so it is not necessarily the owner of the deployed contract
1156
+ */
1153
1157
  owner: Address;
1154
1158
  }
1155
1159
  export declare class BytecodeRepositoryContract extends BaseContract<typeof abi> {
@@ -1171,6 +1175,11 @@ export declare class BytecodeRepositoryContract extends BaseContract<typeof abi>
1171
1175
  isBytecodeUploaded(hash: `0x${string}`): Promise<boolean>;
1172
1176
  isBytecodeAudited(hash: `0x${string}`): Promise<boolean>;
1173
1177
  getLatestVersion(type_: string): Promise<bigint>;
1178
+ /**
1179
+ * Returns the latest allowed patch version of the contract type within given minor version
1180
+ * @throws if no bytecode of this contract type and minor version is allowed
1181
+ */
1182
+ getLatestPatchVersion(type_: string, minorVersion: number): Promise<number>;
1174
1183
  getAllowedBytecodeHash(type_: string, version: number): Promise<Hex>;
1175
1184
  isPublicDomain(domain: string): Promise<boolean>;
1176
1185
  isSystemDomain(domain: string): Promise<boolean>;
@@ -1,5 +1,5 @@
1
1
  import { AddressProviderContract } from "./address-provider.js";
2
- import { BytecodeRepositoryContract } from "./bytecode-repository.js";
2
+ import { BytecodeRepositoryContract, ComputeAddressArgs } from "./bytecode-repository.js";
3
3
  import { TokenCompressorContract } from "./compressors/token-compressor.js";
4
4
  import { WithdrawalCompressorContract } from "./compressors/withdrawal-compressor.js";
5
5
  import "./compressors/index.js";
@@ -9,7 +9,8 @@ import { GovernorContract } from "./governance/governor.js";
9
9
  import { TimeLockContract } from "./governance/timelock.js";
10
10
  import "./governance/index.js";
11
11
  import { InstanceManagerContract } from "./instance-manager.js";
12
- import { AccessMode, AddAssetParams, AllowTokenParams, CreditManagerFees, DeployParams, ForbidAdapterParams, ForbidTokenParams, Market, PauseCreditManagerParams, PeripheryDomain, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, UnpauseCreditManagerParams } from "./types.js";
12
+ import { KILL_SWITCH_PROXY_MINOR_VERSION, KillSwitchProxyContract, KillSwitchProxyNotAllowedError, PreparedKillSwitchProxyDeployment, killSwitchProxySalt } from "./kill-switch-proxy.js";
13
+ import { AccessMode, AddAssetParams, AllowTokenParams, CreditManagerFees, DeployParams, EmergencyAdmin, ForbidAdapterParams, ForbidTokenParams, Market, PauseCreditManagerParams, PeripheryDomain, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, UnpauseCreditManagerParams } from "./types.js";
13
14
  import { MarketConfiguratorContract } from "./market-configurator.js";
14
15
  import { MarketConfiguratorFactoryContract } from "./market-configurator-factory.js";
15
16
  import { PriceFeedStoreContract } from "./price-feed-store.js";
@@ -17,4 +18,4 @@ import { priceFeedSetupParams } from "./pricefeeds/index.js";
17
18
  import { RoutingManagerContract } from "./router/routing-manager.js";
18
19
  import "./router/index.js";
19
20
  import { TreasurySplitterContract } from "./treasury-splitter.js";
20
- export { AccessMode, AddAssetParams, AddressProviderContract, AllowTokenParams, BytecodeRepositoryContract, ConstructorParams, CreditManagerFees, CrossChainMultisigContract, DeployParams, ForbidAdapterParams, ForbidTokenParams, GovernorContract, InstanceManagerContract, Market, MarketConfiguratorContract, MarketConfiguratorFactoryContract, PauseCreditManagerParams, PeripheryDomain, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RoutingManagerContract, SafeBatch, SafeMeta, SafeTx, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, TimeLockContract, TimelockTransaction, TimelockTxParams, TokenCompressorContract, TreasurySplitterContract, UnpauseCreditManagerParams, WithdrawalCompressorContract, priceFeedSetupParams };
21
+ export { AccessMode, AddAssetParams, AddressProviderContract, AllowTokenParams, BytecodeRepositoryContract, ComputeAddressArgs, ConstructorParams, CreditManagerFees, CrossChainMultisigContract, DeployParams, EmergencyAdmin, ForbidAdapterParams, ForbidTokenParams, GovernorContract, InstanceManagerContract, KILL_SWITCH_PROXY_MINOR_VERSION, KillSwitchProxyContract, KillSwitchProxyNotAllowedError, Market, MarketConfiguratorContract, MarketConfiguratorFactoryContract, PauseCreditManagerParams, PeripheryDomain, PreparedKillSwitchProxyDeployment, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RoutingManagerContract, SafeBatch, SafeMeta, SafeTx, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, TimeLockContract, TimelockTransaction, TimelockTxParams, TokenCompressorContract, TreasurySplitterContract, UnpauseCreditManagerParams, WithdrawalCompressorContract, killSwitchProxySalt, priceFeedSetupParams };
@@ -0,0 +1,205 @@
1
+ import { ParsedCallArgs } from "../../onchain/base/types.js";
2
+ import { RawTx } from "../../onchain/types/transactions.js";
3
+ import { BaseContract } from "../../onchain/base/BaseContract.js";
4
+ import "../../onchain/index.js";
5
+ import { BytecodeRepositoryContract } from "./bytecode-repository.js";
6
+ import { Address, BaseError, Chain, DecodeFunctionDataReturnType, Hex, PublicClient, Transport } from "viem";
7
+ //#region src/permissionless/bindings/kill-switch-proxy.d.ts
8
+ declare const abi: readonly [{
9
+ readonly type: "constructor";
10
+ readonly inputs: readonly [{
11
+ readonly name: "_owner";
12
+ readonly internalType: "address";
13
+ readonly type: "address";
14
+ }, {
15
+ readonly name: "_caller";
16
+ readonly internalType: "address";
17
+ readonly type: "address";
18
+ }];
19
+ readonly stateMutability: "nonpayable";
20
+ }, {
21
+ readonly type: "function";
22
+ readonly inputs: readonly [];
23
+ readonly name: "caller";
24
+ readonly outputs: readonly [{
25
+ readonly name: "";
26
+ readonly internalType: "address";
27
+ readonly type: "address";
28
+ }];
29
+ readonly stateMutability: "view";
30
+ }, {
31
+ readonly type: "function";
32
+ readonly inputs: readonly [];
33
+ readonly name: "contractType";
34
+ readonly outputs: readonly [{
35
+ readonly name: "";
36
+ readonly internalType: "bytes32";
37
+ readonly type: "bytes32";
38
+ }];
39
+ readonly stateMutability: "view";
40
+ }, {
41
+ readonly type: "function";
42
+ readonly inputs: readonly [];
43
+ readonly name: "isKilled";
44
+ readonly outputs: readonly [{
45
+ readonly name: "";
46
+ readonly internalType: "bool";
47
+ readonly type: "bool";
48
+ }];
49
+ readonly stateMutability: "view";
50
+ }, {
51
+ readonly type: "function";
52
+ readonly inputs: readonly [];
53
+ readonly name: "kill";
54
+ readonly outputs: readonly [];
55
+ readonly stateMutability: "nonpayable";
56
+ }, {
57
+ readonly type: "function";
58
+ readonly inputs: readonly [];
59
+ readonly name: "owner";
60
+ readonly outputs: readonly [{
61
+ readonly name: "";
62
+ readonly internalType: "address";
63
+ readonly type: "address";
64
+ }];
65
+ readonly stateMutability: "view";
66
+ }, {
67
+ readonly type: "function";
68
+ readonly inputs: readonly [{
69
+ readonly name: "target";
70
+ readonly internalType: "address";
71
+ readonly type: "address";
72
+ }, {
73
+ readonly name: "data";
74
+ readonly internalType: "bytes";
75
+ readonly type: "bytes";
76
+ }];
77
+ readonly name: "proxyCall";
78
+ readonly outputs: readonly [{
79
+ readonly name: "result";
80
+ readonly internalType: "bytes";
81
+ readonly type: "bytes";
82
+ }];
83
+ readonly stateMutability: "nonpayable";
84
+ }, {
85
+ readonly type: "function";
86
+ readonly inputs: readonly [];
87
+ readonly name: "version";
88
+ readonly outputs: readonly [{
89
+ readonly name: "";
90
+ readonly internalType: "uint256";
91
+ readonly type: "uint256";
92
+ }];
93
+ readonly stateMutability: "view";
94
+ }, {
95
+ readonly type: "event";
96
+ readonly anonymous: false;
97
+ readonly inputs: readonly [];
98
+ readonly name: "Killed";
99
+ }, {
100
+ readonly type: "error";
101
+ readonly inputs: readonly [{
102
+ readonly name: "caller";
103
+ readonly internalType: "address";
104
+ readonly type: "address";
105
+ }];
106
+ readonly name: "CallerIsNotOwnerException";
107
+ }, {
108
+ readonly type: "error";
109
+ readonly inputs: readonly [];
110
+ readonly name: "KilledException";
111
+ }, {
112
+ readonly type: "error";
113
+ readonly inputs: readonly [];
114
+ readonly name: "OnlyCallerException";
115
+ }, {
116
+ readonly type: "error";
117
+ readonly inputs: readonly [];
118
+ readonly name: "OwnerSameAsCallerException";
119
+ }];
120
+ /**
121
+ * Minor version of kill switch proxy, the latest allowed patch of it is deployed
122
+ */
123
+ export declare const KILL_SWITCH_PROXY_MINOR_VERSION = 310;
124
+ /**
125
+ * Salt of kill switch proxy deployed together with market configurator,
126
+ * makes each curator's market configurator get its own proxy
127
+ */
128
+ export declare function killSwitchProxySalt(curatorName: string): Hex;
129
+ /**
130
+ * Thrown when bytecode repository has no allowed kill switch proxy bytecode,
131
+ * so its address can't be computed and it can't be deployed
132
+ */
133
+ export declare class KillSwitchProxyNotAllowedError extends BaseError {
134
+ name: string;
135
+ readonly bytecodeRepository: Address;
136
+ constructor(bytecodeRepository: Address);
137
+ }
138
+ export interface PreparedKillSwitchProxyDeployment {
139
+ address: Address;
140
+ version: number;
141
+ encodedParams: Hex;
142
+ salt: Hex;
143
+ isAlreadyDeployed: boolean;
144
+ /**
145
+ * Whether already deployed proxy is killed, always false for not yet deployed one
146
+ */
147
+ isKilled: boolean;
148
+ /**
149
+ * Bytecode repository `deploy` transaction, must be sent by the deployer
150
+ */
151
+ tx: RawTx;
152
+ }
153
+ /**
154
+ * Kill switch proxy forwards calls of its `caller` via `proxyCall` until `owner` kills it.
155
+ * It is used as market configurator's emergency admin, so that emergency powers
156
+ * can be revoked instantly without going through the timelock.
157
+ */
158
+ export declare class KillSwitchProxyContract extends BaseContract<typeof abi> {
159
+ #private;
160
+ constructor(addr: Address, client: PublicClient<Transport, Chain>);
161
+ /**
162
+ * Encodes `constructor(address _owner, address _caller)` params
163
+ * @throws if any address is zero or owner equals caller (constructor reverts in that case)
164
+ */
165
+ static encodeConstructorParams(args: {
166
+ owner: Address;
167
+ caller: Address;
168
+ }): Hex;
169
+ /**
170
+ * Returns whether some patch of kill switch proxy v3.10 is allowed in bytecode repository
171
+ */
172
+ static isAvailable(bcr: BytecodeRepositoryContract): Promise<boolean>;
173
+ /**
174
+ * Computes address of kill switch proxy and prepares its deployment via bytecode repository
175
+ * @param bcr - bytecode repository
176
+ * @param args.deployer - address that will send deployment transaction, it is mixed into the salt
177
+ * @param args.owner - address that can kill the proxy
178
+ * @param args.caller - address that can call through the proxy
179
+ * @param args.salt - deployment salt
180
+ * @throws {KillSwitchProxyNotAllowedError} if kill switch proxy is not allowed in bytecode repository
181
+ */
182
+ static prepareDeploy(bcr: BytecodeRepositoryContract, args: {
183
+ deployer: Address;
184
+ owner: Address;
185
+ caller: Address;
186
+ salt: Hex;
187
+ }): Promise<PreparedKillSwitchProxyDeployment>;
188
+ isKilled(): Promise<boolean>;
189
+ state(): Promise<{
190
+ caller: Address;
191
+ owner: Address;
192
+ isKilled: boolean;
193
+ }>;
194
+ /**
195
+ * Wraps transaction into `proxyCall`, must be sent by proxy's caller
196
+ */
197
+ proxyCallTx(tx: RawTx): RawTx;
198
+ /**
199
+ * Permanently disables `proxyCall`, must be sent by proxy's owner
200
+ */
201
+ killTx(): RawTx;
202
+ protected parseFunctionParams(params: DecodeFunctionDataReturnType<typeof abi>): ParsedCallArgs;
203
+ }
204
+ //#endregion
205
+ export {};