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

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 (31) hide show
  1. package/dist/cjs/abi/310/iKillSwitchProxy.js +130 -0
  2. package/dist/cjs/permissionless/bindings/bytecode-repository.js +8 -0
  3. package/dist/cjs/permissionless/bindings/governance/governor.js +1 -1
  4. package/dist/cjs/permissionless/bindings/index.js +7 -2
  5. package/dist/cjs/permissionless/bindings/kill-switch-proxy.js +188 -0
  6. package/dist/cjs/permissionless/bindings/market-configurator-factory.js +39 -1
  7. package/dist/cjs/permissionless/bindings/market-configurator.js +142 -0
  8. package/dist/cjs/permissionless/index.js +8 -2
  9. package/dist/cjs/permissionless/utils/index.js +1 -0
  10. package/dist/cjs/permissionless/utils/literals.js +2 -0
  11. package/dist/esm/abi/310/iKillSwitchProxy.js +129 -0
  12. package/dist/esm/permissionless/bindings/bytecode-repository.js +8 -0
  13. package/dist/esm/permissionless/bindings/governance/governor.js +1 -1
  14. package/dist/esm/permissionless/bindings/index.js +4 -3
  15. package/dist/esm/permissionless/bindings/kill-switch-proxy.js +184 -0
  16. package/dist/esm/permissionless/bindings/market-configurator-factory.js +37 -0
  17. package/dist/esm/permissionless/bindings/market-configurator.js +143 -1
  18. package/dist/esm/permissionless/index.js +5 -4
  19. package/dist/esm/permissionless/utils/index.js +2 -2
  20. package/dist/esm/permissionless/utils/literals.js +2 -1
  21. package/dist/types/abi/310/iKillSwitchProxy.d.ts +114 -0
  22. package/dist/types/permissionless/bindings/bytecode-repository.d.ts +10 -1
  23. package/dist/types/permissionless/bindings/index.d.ts +4 -3
  24. package/dist/types/permissionless/bindings/kill-switch-proxy.d.ts +205 -0
  25. package/dist/types/permissionless/bindings/market-configurator-factory.d.ts +30 -0
  26. package/dist/types/permissionless/bindings/market-configurator.d.ts +30 -1
  27. package/dist/types/permissionless/bindings/types.d.ts +27 -0
  28. package/dist/types/permissionless/index.d.ts +5 -4
  29. package/dist/types/permissionless/utils/index.d.ts +2 -2
  30. package/dist/types/permissionless/utils/literals.d.ts +1 -0
  31. package/package.json +1 -1
@@ -0,0 +1,114 @@
1
+ //#region src/abi/310/iKillSwitchProxy.d.ts
2
+ export declare const iKillSwitchProxyAbi: readonly [{
3
+ readonly type: "constructor";
4
+ readonly inputs: readonly [{
5
+ readonly name: "_owner";
6
+ readonly internalType: "address";
7
+ readonly type: "address";
8
+ }, {
9
+ readonly name: "_caller";
10
+ readonly internalType: "address";
11
+ readonly type: "address";
12
+ }];
13
+ readonly stateMutability: "nonpayable";
14
+ }, {
15
+ readonly type: "function";
16
+ readonly inputs: readonly [];
17
+ readonly name: "caller";
18
+ readonly outputs: readonly [{
19
+ readonly name: "";
20
+ readonly internalType: "address";
21
+ readonly type: "address";
22
+ }];
23
+ readonly stateMutability: "view";
24
+ }, {
25
+ readonly type: "function";
26
+ readonly inputs: readonly [];
27
+ readonly name: "contractType";
28
+ readonly outputs: readonly [{
29
+ readonly name: "";
30
+ readonly internalType: "bytes32";
31
+ readonly type: "bytes32";
32
+ }];
33
+ readonly stateMutability: "view";
34
+ }, {
35
+ readonly type: "function";
36
+ readonly inputs: readonly [];
37
+ readonly name: "isKilled";
38
+ readonly outputs: readonly [{
39
+ readonly name: "";
40
+ readonly internalType: "bool";
41
+ readonly type: "bool";
42
+ }];
43
+ readonly stateMutability: "view";
44
+ }, {
45
+ readonly type: "function";
46
+ readonly inputs: readonly [];
47
+ readonly name: "kill";
48
+ readonly outputs: readonly [];
49
+ readonly stateMutability: "nonpayable";
50
+ }, {
51
+ readonly type: "function";
52
+ readonly inputs: readonly [];
53
+ readonly name: "owner";
54
+ readonly outputs: readonly [{
55
+ readonly name: "";
56
+ readonly internalType: "address";
57
+ readonly type: "address";
58
+ }];
59
+ readonly stateMutability: "view";
60
+ }, {
61
+ readonly type: "function";
62
+ readonly inputs: readonly [{
63
+ readonly name: "target";
64
+ readonly internalType: "address";
65
+ readonly type: "address";
66
+ }, {
67
+ readonly name: "data";
68
+ readonly internalType: "bytes";
69
+ readonly type: "bytes";
70
+ }];
71
+ readonly name: "proxyCall";
72
+ readonly outputs: readonly [{
73
+ readonly name: "result";
74
+ readonly internalType: "bytes";
75
+ readonly type: "bytes";
76
+ }];
77
+ readonly stateMutability: "nonpayable";
78
+ }, {
79
+ readonly type: "function";
80
+ readonly inputs: readonly [];
81
+ readonly name: "version";
82
+ readonly outputs: readonly [{
83
+ readonly name: "";
84
+ readonly internalType: "uint256";
85
+ readonly type: "uint256";
86
+ }];
87
+ readonly stateMutability: "view";
88
+ }, {
89
+ readonly type: "event";
90
+ readonly anonymous: false;
91
+ readonly inputs: readonly [];
92
+ readonly name: "Killed";
93
+ }, {
94
+ readonly type: "error";
95
+ readonly inputs: readonly [{
96
+ readonly name: "caller";
97
+ readonly internalType: "address";
98
+ readonly type: "address";
99
+ }];
100
+ readonly name: "CallerIsNotOwnerException";
101
+ }, {
102
+ readonly type: "error";
103
+ readonly inputs: readonly [];
104
+ readonly name: "KilledException";
105
+ }, {
106
+ readonly type: "error";
107
+ readonly inputs: readonly [];
108
+ readonly name: "OnlyCallerException";
109
+ }, {
110
+ readonly type: "error";
111
+ readonly inputs: readonly [];
112
+ readonly name: "OwnerSameAsCallerException";
113
+ }];
114
+ //#endregion
@@ -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 {};
@@ -229,6 +229,36 @@ export declare class MarketConfiguratorFactoryContract extends BaseContract<type
229
229
  curatorName: string;
230
230
  deployGovernor: boolean;
231
231
  }): RawTx;
232
+ /**
233
+ * Builds transactions that deploy market configurator with kill switch proxy as its emergency admin:
234
+ * 1. kill switch proxy deployment via bytecode repository (skipped if already deployed)
235
+ * 2. market configurator creation with proxy as emergency admin
236
+ *
237
+ * Transactions must be sent in this order by `admin`, e.g. as one Safe batch.
238
+ * When `deployGovernor` is true, proxy also becomes governor's veto admin.
239
+ *
240
+ * @param args.admin - address that sends transactions, becomes market configurator admin
241
+ * @param args.emergencyAdmin - address that executes emergency actions through the proxy
242
+ * @param args.killSwitchOwner - address that can kill the proxy, defaults to `admin`
243
+ * @throws {KillSwitchProxyNotAllowedError} if kill switch proxy is not allowed in bytecode repository,
244
+ * use {@link createMarketConfiguratorTx} to deploy market configurator without it
245
+ */
246
+ createMarketConfiguratorWithKillSwitchTxs(args: {
247
+ admin: Address;
248
+ emergencyAdmin: Address;
249
+ killSwitchOwner?: Address;
250
+ adminFeeTreasury: Address;
251
+ curatorName: string;
252
+ deployGovernor: boolean;
253
+ }): Promise<{
254
+ killSwitchProxy: Address;
255
+ /**
256
+ * True if proxy with the same deployer, owner, caller and curator name already exists,
257
+ * in which case it is reused and its deployment transaction is omitted
258
+ */
259
+ isKillSwitchProxyDeployed: boolean;
260
+ txs: RawTx[];
261
+ }>;
232
262
  getMarketConfigurators(): Promise<Address[]>;
233
263
  getShutdownMarketConfigurators(): Promise<Address[]>;
234
264
  syncMarketConfigurators(fromBlock: bigint, toBlock: bigint): Promise<{
@@ -3,7 +3,7 @@ import { RawTx } from "../../onchain/types/transactions.js";
3
3
  import { BaseContract } from "../../onchain/base/BaseContract.js";
4
4
  import "../../onchain/index.js";
5
5
  import { AddressProviderContract } from "./address-provider.js";
6
- import { AddAssetParams, AllowTokenParams, DeployParams, ForbidAdapterParams, ForbidTokenParams, Market, PauseCreditManagerParams, PeripheryDomain, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, UnpauseCreditManagerParams } from "./types.js";
6
+ import { AddAssetParams, AllowTokenParams, DeployParams, EmergencyAdmin, ForbidAdapterParams, ForbidTokenParams, Market, PauseCreditManagerParams, PeripheryDomain, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, UnpauseCreditManagerParams } from "./types.js";
7
7
  import { CreditFactory } from "./factory/credit-factory.js";
8
8
  import { LossPolicyFactory } from "./factory/loss-policy-factory.js";
9
9
  import { PoolFactory } from "./factory/pool-factory.js";
@@ -1536,6 +1536,7 @@ declare const abi: readonly [{
1536
1536
  readonly name: "UnauthorizedFactoryException";
1537
1537
  }];
1538
1538
  export declare class MarketConfiguratorContract extends BaseContract<typeof abi> {
1539
+ #private;
1539
1540
  readonly creditFactory: CreditFactory;
1540
1541
  readonly poolFactory: PoolFactory;
1541
1542
  readonly priceOracleFactory: PriceOracleFactory;
@@ -1647,6 +1648,26 @@ export declare class MarketConfiguratorContract extends BaseContract<typeof abi>
1647
1648
  emergencyLiquidators: Address[];
1648
1649
  }>;
1649
1650
  multipause(): Promise<Address | undefined>;
1651
+ /**
1652
+ * Returns emergency admin of the market configurator.
1653
+ * If it is a `KILL_SWITCH_PROXY`, emergency transactions must be sent by proxy's caller via `proxyCall`,
1654
+ * otherwise directly by emergency admin itself
1655
+ * @param emergencyAdmin - emergency admin address, read from the market configurator if not provided
1656
+ */
1657
+ getEmergencyAdmin(emergencyAdmin?: Address): Promise<EmergencyAdmin>;
1658
+ /**
1659
+ * Routes emergency transaction to the market configurator through its emergency admin:
1660
+ * returns transaction as is for direct emergency admin, or wraps it into `proxyCall` of kill switch proxy
1661
+ * @param tx - emergency transaction to the market configurator, e.g. built by `emergencyConfigurePool`
1662
+ * @param emergencyAdmin - result of {@link getEmergencyAdmin}
1663
+ * @throws if transaction is not addressed to this market configurator or kill switch proxy is killed
1664
+ */
1665
+ wrapEmergencyTx(tx: RawTx, emergencyAdmin: EmergencyAdmin): RawTx;
1666
+ /**
1667
+ * Reads emergency admin and routes emergency transaction through it, see {@link wrapEmergencyTx}
1668
+ * @param tx - emergency transaction to the market configurator, e.g. built by `emergencyConfigurePool`
1669
+ */
1670
+ emergencyTx(tx: RawTx): Promise<RawTx>;
1650
1671
  grantRole(role: string, address: Address): RawTx;
1651
1672
  revokeRole(role: string, address: Address): RawTx;
1652
1673
  setEmergencyAdmin(newEmergencyAdmin: Address): RawTx;
@@ -1667,6 +1688,14 @@ export declare class MarketConfiguratorContract extends BaseContract<typeof abi>
1667
1688
  emergencyConfigureCreditSuite(creditManager: Address, calldata: Hex): RawTx;
1668
1689
  emergencyConfigurePriceOracle(pool: Address, calldata: Hex): RawTx;
1669
1690
  emergencyConfigureLossPolicy(pool: Address, calldata: Hex): RawTx;
1691
+ /**
1692
+ * Note: current interest rate model factory forbids all emergency configuration calls
1693
+ */
1694
+ emergencyConfigureInterestRateModel(pool: Address, calldata: Hex): RawTx;
1695
+ /**
1696
+ * Note: current rate keeper factory forbids all emergency configuration calls
1697
+ */
1698
+ emergencyConfigureRateKeeper(pool: Address, calldata: Hex): RawTx;
1670
1699
  }
1671
1700
  //#endregion
1672
1701
  export {};
@@ -66,4 +66,31 @@ export declare enum AccessMode {
66
66
  Forbidden = 2
67
67
  }
68
68
  export type PeripheryDomain = "ZAPPER" | "DEGEN_NFT";
69
+ /**
70
+ * Emergency admin of a market configurator, as seen by the SDK
71
+ * - `direct`: emergency admin is an EOA or Safe that calls the market configurator itself
72
+ * - `killSwitch`: emergency admin is a `KILL_SWITCH_PROXY`, `caller` executes emergency calls
73
+ * via `proxyCall` until `owner` kills the proxy
74
+ */
75
+ export type EmergencyAdmin = {
76
+ type: "direct";
77
+ address: Address;
78
+ /**
79
+ * Address that must send emergency transactions
80
+ */
81
+ executor: Address;
82
+ } | {
83
+ type: "killSwitch";
84
+ /**
85
+ * Address of the kill switch proxy
86
+ */
87
+ address: Address;
88
+ caller: Address;
89
+ owner: Address;
90
+ isKilled: boolean;
91
+ /**
92
+ * Address that must send emergency transactions, i.e. proxy caller
93
+ */
94
+ executor: Address;
95
+ };
69
96
  //#endregion
@@ -18,7 +18,7 @@ import { BreakingPoint, FeedOutcome, GroupReport, GroupScenarioOutcome, SlotOutc
18
18
  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 "./api/oracles/types.js";
19
19
  import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./api/oracles/PermissionlessOracles.js";
20
20
  import { AddressProviderContract } from "./bindings/address-provider.js";
21
- import { BytecodeRepositoryContract } from "./bindings/bytecode-repository.js";
21
+ import { BytecodeRepositoryContract, ComputeAddressArgs } from "./bindings/bytecode-repository.js";
22
22
  import { TokenCompressorContract } from "./bindings/compressors/token-compressor.js";
23
23
  import { WithdrawalCompressorContract } from "./bindings/compressors/withdrawal-compressor.js";
24
24
  import { ConstructorParams, CrossChainMultisigContract, Proposal } from "./bindings/cross-chain-multisig.js";
@@ -26,7 +26,8 @@ import { QueuedAndExecutedTransaction, SafeBatch, SafeMeta, SafeTx, TimelockTran
26
26
  import { GovernorContract } from "./bindings/governance/governor.js";
27
27
  import { TimeLockContract } from "./bindings/governance/timelock.js";
28
28
  import { InstanceManagerContract } from "./bindings/instance-manager.js";
29
- import { AccessMode, AddAssetParams, AllowTokenParams, CreditManagerFees, DeployParams, ForbidAdapterParams, ForbidTokenParams, Market, PauseCreditManagerParams, PeripheryDomain, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, UnpauseCreditManagerParams } from "./bindings/types.js";
29
+ import { KILL_SWITCH_PROXY_MINOR_VERSION, KillSwitchProxyContract, KillSwitchProxyNotAllowedError, PreparedKillSwitchProxyDeployment, killSwitchProxySalt } from "./bindings/kill-switch-proxy.js";
30
+ import { AccessMode, AddAssetParams, AllowTokenParams, CreditManagerFees, DeployParams, EmergencyAdmin, ForbidAdapterParams, ForbidTokenParams, Market, PauseCreditManagerParams, PeripheryDomain, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, UnpauseCreditManagerParams } from "./bindings/types.js";
30
31
  import { MarketConfiguratorContract } from "./bindings/market-configurator.js";
31
32
  import { MarketConfiguratorFactoryContract } from "./bindings/market-configurator-factory.js";
32
33
  import { PriceFeedStoreContract } from "./bindings/price-feed-store.js";
@@ -56,10 +57,10 @@ import { PUBLIC_CREATE2_FACTORY, checkCreate2Deployment, checkCreate2DeploymentA
56
57
  import { convertPercent, deepJsonParse, formatBytecodeSize, formatBytecodeVersion, shortenHash, significantTrunc } from "./utils/format.js";
57
58
  import { calculateChecksum, convertRawTxToSafeMultisigTx, getSafeBatch, getSafeBatches } from "./utils/governance/batch.js";
58
59
  import { convertQueueBatchToExecuteTx } from "./utils/governance/timelock-txs.js";
59
- import { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, INSTANCE_MANAGER, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, TOKEN_COMPRESSOR } from "./utils/literals.js";
60
+ import { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, INSTANCE_MANAGER, KILL_SWITCH_PROXY, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, TOKEN_COMPRESSOR } from "./utils/literals.js";
60
61
  import { getPriceUpdateTx } from "./utils/price-update/get-price-update-tx.js";
61
62
  import { getFeedDecimals, getLatestPrices, getPrices } from "./utils/price-update/get-prices.js";
62
63
  import { GetUpdatablePriceFeedsArgs, getUpdatablePriceFeeds } from "./utils/price-update/get-updatable-feeds.js";
63
64
  import { normalizeSignature } from "./utils/signature.js";
64
65
  import "./utils/index.js";
65
- export { AccessMode, AddAssetParams, AddFeedsArgs, AddressProviderContract, Addresses, AllowTokenParams, ArchiveTransport, ArchiveTransportConfig, AssetArgs, AssetCap, AssetScore, AssetScoresArgs, AssetsArgs, AttachChainsArgs, AuditEvent, Auditor, BYTECODE_REPOSITORY, Batch, BreakingPoint, Bytecode, BytecodeRepositoryContract, CCMConstructorParams, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ConstructorParams, CreditManagerFees, CrossChainCall, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, DEFAULT_SCENARIOS, DeployArgs, DeployContractArgs, DeployParams, DeployPriceFeedArgs, Deployment, DeploymentExtended, FeedCap, FeedOutcome, ForbidAdapterParams, ForbidFeedsArgs, ForbidTokenParams, FunctionParams, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetUpdatablePriceFeedsArgs, GovernorContract, GroupImpact, GroupReport, GroupScenarioOutcome, 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, MarketCap, MarketConfiguratorContract, MarketConfiguratorFactoryContract, MarketScore, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PauseCreditManagerParams, PeripheryDomain, 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, PriceFeed, PriceFeedArgs, PriceFeedChartPoint, PriceFeedConstructorParam, PriceFeedDecimals, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedParamType, PriceFeedParams, PriceFeedPrice, PriceFeedPriceChart, PriceFeedRef, PriceFeedSaltMissingError, PriceFeedSetupParams, PriceFeedStalenessUnknownError, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RATE_FEED_TYPE, REVERT_SCORE, RecoveryMessage, RoutingManagerContract, SCORE_MULTIPLIER, SafeBatch, SafeMeta, SafeTx, ScoredFeed, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, Signature, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TOKEN_COMPRESSOR, TimeLockContract, TimelockTransaction, TimelockTxParams, TimelockTxs, TokenCompressorContract, TreasurySplitterContract, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, UnpauseCreditManagerParams, ValueParams, WithdrawalCompressorContract, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, chunkedLogsTransport, classifySources, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCallData, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, deriveEffectiveStalenessPeriod, encodeFunctionParams, factorOf, finalPrice, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getFeedDecimals, getLatestPrices, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, groupOverride, handleSalt, normalizeSignature, perturb, priceFeedSalt, priceFeedSetupParams, rateStub, readForest, readRateTargets, readUnder, roundDataStub, runAssetScores, runStressTest, scoreGroup, scoreOfFactor, shortenHash, significantTrunc, slotHarm, sourcesByFeed, verdictOf, worstOf };
66
+ export { AccessMode, AddAssetParams, AddFeedsArgs, AddressProviderContract, Addresses, AllowTokenParams, ArchiveTransport, ArchiveTransportConfig, AssetArgs, AssetCap, AssetScore, AssetScoresArgs, AssetsArgs, AttachChainsArgs, AuditEvent, Auditor, BYTECODE_REPOSITORY, Batch, BreakingPoint, Bytecode, BytecodeRepositoryContract, CCMConstructorParams, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ComputeAddressArgs, ConstructorParams, CreditManagerFees, CrossChainCall, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, DEFAULT_SCENARIOS, DeployArgs, DeployContractArgs, DeployParams, DeployPriceFeedArgs, Deployment, DeploymentExtended, EmergencyAdmin, FeedCap, FeedOutcome, ForbidAdapterParams, ForbidFeedsArgs, ForbidTokenParams, FunctionParams, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetUpdatablePriceFeedsArgs, GovernorContract, GroupImpact, GroupReport, GroupScenarioOutcome, INSTANCE_MANAGER, InputValueParams, InstanceManagerContract, InstanceOwnerTransactions, InstanceTxs, InstanceTxsArgs, KILL_SWITCH_PROXY, KILL_SWITCH_PROXY_MINOR_VERSION, KillSwitchProxyContract, KillSwitchProxyNotAllowedError, MAINNET_CCM_CONSTRUCTOR_PARAMS, MAINNET_DEPLOYMENT_BLOCK, MAINNET_DEPLOYMENT_CCM_SALT, MAINNET_DEPLOYMENT_IM_SALT, MARKET_CONFIGURATOR_FACTORY, Market, MarketCap, MarketConfiguratorContract, MarketConfiguratorFactoryContract, MarketScore, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PauseCreditManagerParams, PeripheryDomain, 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, PreparedKillSwitchProxyDeployment, PreparedPriceFeedDeployment, PriceChartArgs, PriceFeed, PriceFeedArgs, PriceFeedChartPoint, PriceFeedConstructorParam, PriceFeedDecimals, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedParamType, PriceFeedParams, PriceFeedPrice, PriceFeedPriceChart, PriceFeedRef, PriceFeedSaltMissingError, PriceFeedSetupParams, PriceFeedStalenessUnknownError, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RATE_FEED_TYPE, REVERT_SCORE, RecoveryMessage, RoutingManagerContract, SCORE_MULTIPLIER, SafeBatch, SafeMeta, SafeTx, ScoredFeed, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, Signature, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TOKEN_COMPRESSOR, TimeLockContract, TimelockTransaction, TimelockTxParams, TimelockTxs, TokenCompressorContract, TreasurySplitterContract, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, UnpauseCreditManagerParams, ValueParams, WithdrawalCompressorContract, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, chunkedLogsTransport, classifySources, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCallData, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, deriveEffectiveStalenessPeriod, encodeFunctionParams, factorOf, finalPrice, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getFeedDecimals, getLatestPrices, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, groupOverride, handleSalt, killSwitchProxySalt, normalizeSignature, perturb, priceFeedSalt, priceFeedSetupParams, rateStub, readForest, readRateTargets, readUnder, roundDataStub, runAssetScores, runStressTest, scoreGroup, scoreOfFactor, shortenHash, significantTrunc, slotHarm, sourcesByFeed, verdictOf, worstOf };
@@ -6,10 +6,10 @@ import { convertPercent, deepJsonParse, formatBytecodeSize, formatBytecodeVersio
6
6
  import { calculateChecksum, convertRawTxToSafeMultisigTx, getSafeBatch, getSafeBatches } from "./governance/batch.js";
7
7
  import { convertQueueBatchToExecuteTx } from "./governance/timelock-txs.js";
8
8
  import "./governance/index.js";
9
- import { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, INSTANCE_MANAGER, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, TOKEN_COMPRESSOR } from "./literals.js";
9
+ import { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, INSTANCE_MANAGER, KILL_SWITCH_PROXY, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, TOKEN_COMPRESSOR } from "./literals.js";
10
10
  import { getPriceUpdateTx } from "./price-update/get-price-update-tx.js";
11
11
  import { getFeedDecimals, getLatestPrices, getPrices } from "./price-update/get-prices.js";
12
12
  import { GetUpdatablePriceFeedsArgs, getUpdatablePriceFeeds } from "./price-update/get-updatable-feeds.js";
13
13
  import "./price-update/index.js";
14
14
  import { normalizeSignature } from "./signature.js";
15
- export { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, FunctionParams, GetUpdatablePriceFeedsArgs, INSTANCE_MANAGER, InstanceTxs, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, TOKEN_COMPRESSOR, TimelockTxs, ValueParams, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getFeedDecimals, getLatestPrices, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, shortenHash, significantTrunc };
15
+ export { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, FunctionParams, GetUpdatablePriceFeedsArgs, INSTANCE_MANAGER, InstanceTxs, KILL_SWITCH_PROXY, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, TOKEN_COMPRESSOR, TimelockTxs, ValueParams, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getFeedDecimals, getLatestPrices, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, shortenHash, significantTrunc };
@@ -6,4 +6,5 @@ export declare const TOKEN_COMPRESSOR = "GLOBAL::TOKEN_COMPRESSOR";
6
6
  export declare const CROSS_CHAIN_MULTISIG = "CROSS_CHAIN_MULTISIG";
7
7
  export declare const PRICE_FEED_STORE = "PRICE_FEED_STORE";
8
8
  export declare const MARKET_CONFIGURATOR_FACTORY = "MARKET_CONFIGURATOR_FACTORY";
9
+ export declare const KILL_SWITCH_PROXY = "KILL_SWITCH_PROXY";
9
10
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "18.2.0-next.12",
3
+ "version": "18.2.0-next.13",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {