@gearbox-protocol/sdk 18.3.1 → 18.4.0
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.
- package/dist/cjs/abi/310/iKillSwitchProxy.js +130 -0
- package/dist/cjs/onchain/index.js +18 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/iTreehouseFastlaneAdapter.js +113 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/iTreehouseRedemptionGatewayAdapter.js +258 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/iTreehouseRouterAdapter.js +161 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/index.js +6 -0
- package/dist/cjs/onchain/market/adapters/abi/index.js +13 -0
- package/dist/cjs/onchain/market/adapters/abi/treehouse/iTreehouseFastlane.js +39 -0
- package/dist/cjs/onchain/market/adapters/abi/treehouse/iTreehouseRedemptionGateway.js +230 -0
- package/dist/cjs/onchain/market/adapters/abi/treehouse/iTreehouseRouter.js +29 -0
- package/dist/cjs/onchain/market/adapters/abi/treehouse/index.js +7 -0
- package/dist/cjs/onchain/market/adapters/contracts/TreehouseFastlaneAdapterContract.js +72 -0
- package/dist/cjs/onchain/market/adapters/contracts/TreehouseRedemptionGatewayAdapterContract.js +117 -0
- package/dist/cjs/onchain/market/adapters/contracts/TreehouseRouterAdapterContract.js +61 -0
- package/dist/cjs/onchain/market/adapters/contracts/index.js +6 -0
- package/dist/cjs/onchain/market/adapters/createAdapter.js +6 -0
- package/dist/cjs/onchain/market/adapters/index.js +18 -0
- package/dist/cjs/onchain/market/index.js +18 -0
- package/dist/cjs/permissionless/api/index.js +31 -0
- package/dist/cjs/permissionless/api/oracles/PermissionlessOracles.js +637 -65
- package/dist/cjs/permissionless/api/oracles/enrich.js +99 -0
- package/dist/cjs/permissionless/api/oracles/index.js +33 -0
- package/dist/cjs/permissionless/api/oracles/onchain-feed.js +25 -0
- package/dist/cjs/permissionless/api/oracles/schemas.js +84 -59
- package/dist/cjs/permissionless/api/oracles/score/formula.js +56 -0
- package/dist/cjs/permissionless/api/oracles/score/index.js +11 -0
- package/dist/cjs/permissionless/api/oracles/score/run.js +252 -0
- package/dist/cjs/permissionless/api/oracles/score/types.js +1 -0
- package/dist/cjs/permissionless/api/oracles/stress/classify.js +258 -0
- package/dist/cjs/permissionless/api/oracles/stress/index.js +24 -0
- package/dist/cjs/permissionless/api/oracles/stress/override.js +125 -0
- package/dist/cjs/permissionless/api/oracles/stress/run.js +485 -0
- package/dist/cjs/permissionless/api/oracles/stress/score.js +98 -0
- package/dist/cjs/permissionless/api/oracles/stress/types.js +1 -0
- package/dist/cjs/permissionless/api/schemas.js +0 -3
- package/dist/cjs/permissionless/api/transactions/InstanceOwnerTransactions.js +14 -3
- package/dist/cjs/permissionless/api/transactions/lp-price-feeds.js +10 -4
- package/dist/cjs/permissionless/bindings/bytecode-repository.js +8 -0
- package/dist/cjs/permissionless/bindings/governance/governor.js +1 -1
- package/dist/cjs/permissionless/bindings/index.js +8 -3
- package/dist/cjs/permissionless/bindings/kill-switch-proxy.js +188 -0
- package/dist/cjs/permissionless/bindings/market-configurator-factory.js +39 -1
- package/dist/cjs/permissionless/bindings/market-configurator.js +142 -0
- package/dist/cjs/permissionless/index.js +42 -3
- package/dist/cjs/permissionless/utils/index.js +3 -0
- package/dist/cjs/permissionless/utils/literals.js +2 -0
- package/dist/cjs/permissionless/utils/price-update/get-prices.js +64 -0
- package/dist/cjs/permissionless/utils/price-update/index.js +2 -0
- package/dist/cjs/testnets/TestnetsAPI.js +179 -0
- package/dist/cjs/testnets/errors/TestnetNotFoundError.js +15 -0
- package/dist/cjs/testnets/errors/TestnetRequestFailedError.js +24 -0
- package/dist/cjs/testnets/errors/TestnetStatusError.js +19 -0
- package/dist/cjs/testnets/errors/TestnetValidationError.js +24 -0
- package/dist/cjs/testnets/errors/TestnetWaitTimeoutError.js +30 -0
- package/dist/cjs/testnets/errors/TestnetsError.js +34 -0
- package/dist/cjs/testnets/errors/index.js +13 -0
- package/dist/cjs/testnets/index.js +32 -0
- package/dist/cjs/testnets/package.json +1 -0
- package/dist/cjs/testnets/schemas.js +242 -0
- package/dist/cjs/testnets/types.js +1 -0
- package/dist/esm/abi/310/iKillSwitchProxy.js +129 -0
- package/dist/esm/onchain/index.js +10 -1
- package/dist/esm/onchain/market/adapters/abi/adapters/iTreehouseFastlaneAdapter.js +112 -0
- package/dist/esm/onchain/market/adapters/abi/adapters/iTreehouseRedemptionGatewayAdapter.js +257 -0
- package/dist/esm/onchain/market/adapters/abi/adapters/iTreehouseRouterAdapter.js +160 -0
- package/dist/esm/onchain/market/adapters/abi/adapters/index.js +4 -1
- package/dist/esm/onchain/market/adapters/abi/index.js +8 -1
- package/dist/esm/onchain/market/adapters/abi/treehouse/iTreehouseFastlane.js +38 -0
- package/dist/esm/onchain/market/adapters/abi/treehouse/iTreehouseRedemptionGateway.js +229 -0
- package/dist/esm/onchain/market/adapters/abi/treehouse/iTreehouseRouter.js +28 -0
- package/dist/esm/onchain/market/adapters/abi/treehouse/index.js +4 -0
- package/dist/esm/onchain/market/adapters/contracts/TreehouseFastlaneAdapterContract.js +71 -0
- package/dist/esm/onchain/market/adapters/contracts/TreehouseRedemptionGatewayAdapterContract.js +116 -0
- package/dist/esm/onchain/market/adapters/contracts/TreehouseRouterAdapterContract.js +60 -0
- package/dist/esm/onchain/market/adapters/contracts/index.js +4 -1
- package/dist/esm/onchain/market/adapters/createAdapter.js +6 -0
- package/dist/esm/onchain/market/adapters/index.js +10 -1
- package/dist/esm/onchain/market/index.js +10 -1
- package/dist/esm/permissionless/api/index.js +7 -1
- package/dist/esm/permissionless/api/oracles/PermissionlessOracles.js +639 -67
- package/dist/esm/permissionless/api/oracles/enrich.js +94 -0
- package/dist/esm/permissionless/api/oracles/index.js +10 -1
- package/dist/esm/permissionless/api/oracles/onchain-feed.js +24 -0
- package/dist/esm/permissionless/api/oracles/schemas.js +80 -58
- package/dist/esm/permissionless/api/oracles/score/formula.js +51 -0
- package/dist/esm/permissionless/api/oracles/score/index.js +4 -0
- package/dist/esm/permissionless/api/oracles/score/run.js +250 -0
- package/dist/esm/permissionless/api/oracles/score/types.js +1 -0
- package/dist/esm/permissionless/api/oracles/stress/classify.js +256 -0
- package/dist/esm/permissionless/api/oracles/stress/index.js +6 -0
- package/dist/esm/permissionless/api/oracles/stress/override.js +119 -0
- package/dist/esm/permissionless/api/oracles/stress/run.js +478 -0
- package/dist/esm/permissionless/api/oracles/stress/score.js +95 -0
- package/dist/esm/permissionless/api/oracles/stress/types.js +1 -0
- package/dist/esm/permissionless/api/schemas.js +2 -4
- package/dist/esm/permissionless/api/transactions/InstanceOwnerTransactions.js +14 -3
- package/dist/esm/permissionless/api/transactions/lp-price-feeds.js +10 -4
- package/dist/esm/permissionless/bindings/bytecode-repository.js +8 -0
- package/dist/esm/permissionless/bindings/governance/governor.js +1 -1
- package/dist/esm/permissionless/bindings/index.js +5 -4
- package/dist/esm/permissionless/bindings/kill-switch-proxy.js +184 -0
- package/dist/esm/permissionless/bindings/market-configurator-factory.js +37 -0
- package/dist/esm/permissionless/bindings/market-configurator.js +143 -1
- package/dist/esm/permissionless/index.js +13 -6
- package/dist/esm/permissionless/utils/index.js +3 -3
- package/dist/esm/permissionless/utils/literals.js +2 -1
- package/dist/esm/permissionless/utils/price-update/get-prices.js +63 -1
- package/dist/esm/permissionless/utils/price-update/index.js +2 -2
- package/dist/esm/testnets/TestnetsAPI.js +178 -0
- package/dist/esm/testnets/errors/TestnetNotFoundError.js +14 -0
- package/dist/esm/testnets/errors/TestnetRequestFailedError.js +23 -0
- package/dist/esm/testnets/errors/TestnetStatusError.js +18 -0
- package/dist/esm/testnets/errors/TestnetValidationError.js +23 -0
- package/dist/esm/testnets/errors/TestnetWaitTimeoutError.js +29 -0
- package/dist/esm/testnets/errors/TestnetsError.js +33 -0
- package/dist/esm/testnets/errors/index.js +7 -0
- package/dist/esm/testnets/index.js +11 -0
- package/dist/esm/testnets/package.json +1 -0
- package/dist/esm/testnets/schemas.js +228 -0
- package/dist/esm/testnets/types.js +1 -0
- package/dist/types/abi/310/iKillSwitchProxy.d.ts +114 -0
- package/dist/types/onchain/index.d.ts +10 -1
- package/dist/types/onchain/market/adapters/abi/adapters/iTreehouseFastlaneAdapter.d.ts +101 -0
- package/dist/types/onchain/market/adapters/abi/adapters/iTreehouseRedemptionGatewayAdapter.d.ts +237 -0
- package/dist/types/onchain/market/adapters/abi/adapters/iTreehouseRouterAdapter.d.ts +146 -0
- package/dist/types/onchain/market/adapters/abi/adapters/index.d.ts +4 -1
- package/dist/types/onchain/market/adapters/abi/index.d.ts +8 -1
- package/dist/types/onchain/market/adapters/abi/treehouse/iTreehouseFastlane.d.ts +33 -0
- package/dist/types/onchain/market/adapters/abi/treehouse/iTreehouseRedemptionGateway.d.ts +207 -0
- package/dist/types/onchain/market/adapters/abi/treehouse/iTreehouseRouter.d.ts +27 -0
- package/dist/types/onchain/market/adapters/abi/treehouse/index.d.ts +4 -0
- package/dist/types/onchain/market/adapters/contracts/TreehouseFastlaneAdapterContract.d.ts +156 -0
- package/dist/types/onchain/market/adapters/contracts/TreehouseRedemptionGatewayAdapterContract.d.ts +481 -0
- package/dist/types/onchain/market/adapters/contracts/TreehouseRouterAdapterContract.d.ts +193 -0
- package/dist/types/onchain/market/adapters/contracts/index.d.ts +4 -1
- package/dist/types/onchain/market/adapters/index.d.ts +10 -1
- package/dist/types/onchain/market/index.d.ts +10 -1
- package/dist/types/permissionless/api/index.d.ts +10 -2
- package/dist/types/permissionless/api/oracles/PermissionlessOracles.d.ts +237 -47
- package/dist/types/permissionless/api/oracles/enrich.d.ts +59 -0
- package/dist/types/permissionless/api/oracles/index.d.ts +12 -2
- package/dist/types/permissionless/api/oracles/onchain-feed.d.ts +15 -0
- package/dist/types/permissionless/api/oracles/schemas.d.ts +147 -41
- package/dist/types/permissionless/api/oracles/score/formula.d.ts +36 -0
- package/dist/types/permissionless/api/oracles/score/index.d.ts +4 -0
- package/dist/types/permissionless/api/oracles/score/run.d.ts +42 -0
- package/dist/types/permissionless/api/oracles/score/types.d.ts +118 -0
- package/dist/types/permissionless/api/oracles/stress/classify.d.ts +57 -0
- package/dist/types/permissionless/api/oracles/stress/index.d.ts +6 -0
- package/dist/types/permissionless/api/oracles/stress/override.d.ts +59 -0
- package/dist/types/permissionless/api/oracles/stress/run.d.ts +100 -0
- package/dist/types/permissionless/api/oracles/stress/score.d.ts +57 -0
- package/dist/types/permissionless/api/oracles/stress/types.d.ts +272 -0
- package/dist/types/permissionless/api/oracles/types.d.ts +320 -125
- package/dist/types/permissionless/api/schemas.d.ts +0 -2
- package/dist/types/permissionless/api/transactions/lp-price-feeds.d.ts +9 -1
- package/dist/types/permissionless/bindings/bytecode-repository.d.ts +10 -1
- package/dist/types/permissionless/bindings/index.d.ts +4 -3
- package/dist/types/permissionless/bindings/kill-switch-proxy.d.ts +205 -0
- package/dist/types/permissionless/bindings/market-configurator-factory.d.ts +30 -0
- package/dist/types/permissionless/bindings/market-configurator.d.ts +30 -1
- package/dist/types/permissionless/bindings/types.d.ts +27 -0
- package/dist/types/permissionless/index.d.ts +15 -6
- package/dist/types/permissionless/utils/index.d.ts +3 -3
- package/dist/types/permissionless/utils/literals.d.ts +1 -0
- package/dist/types/permissionless/utils/price-update/get-prices.d.ts +33 -0
- package/dist/types/permissionless/utils/price-update/index.d.ts +2 -2
- package/dist/types/testnets/TestnetsAPI.d.ts +108 -0
- package/dist/types/testnets/errors/TestnetNotFoundError.d.ts +12 -0
- package/dist/types/testnets/errors/TestnetRequestFailedError.d.ts +11 -0
- package/dist/types/testnets/errors/TestnetStatusError.d.ts +15 -0
- package/dist/types/testnets/errors/TestnetValidationError.d.ts +16 -0
- package/dist/types/testnets/errors/TestnetWaitTimeoutError.d.ts +21 -0
- package/dist/types/testnets/errors/TestnetsError.d.ts +47 -0
- package/dist/types/testnets/errors/index.d.ts +7 -0
- package/dist/types/testnets/index.d.ts +11 -0
- package/dist/types/testnets/schemas.d.ts +554 -0
- package/dist/types/testnets/types.d.ts +717 -0
- package/package.json +6 -1
|
@@ -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
|
|
@@ -13,10 +13,12 @@ import "./core/index.js";
|
|
|
13
13
|
import { FunctionParams, ValueParams, encodeFunctionParams } from "./utils/abi-encoder.js";
|
|
14
14
|
import { DeployArgs, DeployContractArgs, DeployPriceFeedArgs, PreparedDeployment, PreparedPriceFeedDeployment } from "./api/deploy/types.js";
|
|
15
15
|
import { DEFAULT_DEPLOY_SALT, PermissionlessDeploy, priceFeedSalt } from "./api/deploy/PermissionlessDeploy.js";
|
|
16
|
-
import {
|
|
16
|
+
import { AssetScore, AssetScoresArgs, FeedPairScore, FeedPairScoreArgs, GroupImpact, MarketScore, ScoredFeed } from "./api/oracles/score/types.js";
|
|
17
|
+
import { BreakingPoint, FeedOutcome, GroupReport, GroupScenarioOutcome, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs } from "./api/oracles/stress/types.js";
|
|
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";
|
|
17
19
|
import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./api/oracles/PermissionlessOracles.js";
|
|
18
20
|
import { AddressProviderContract } from "./bindings/address-provider.js";
|
|
19
|
-
import { BytecodeRepositoryContract } from "./bindings/bytecode-repository.js";
|
|
21
|
+
import { BytecodeRepositoryContract, ComputeAddressArgs } from "./bindings/bytecode-repository.js";
|
|
20
22
|
import { TokenCompressorContract } from "./bindings/compressors/token-compressor.js";
|
|
21
23
|
import { WithdrawalCompressorContract } from "./bindings/compressors/withdrawal-compressor.js";
|
|
22
24
|
import { ConstructorParams, CrossChainMultisigContract, Proposal } from "./bindings/cross-chain-multisig.js";
|
|
@@ -24,7 +26,8 @@ import { QueuedAndExecutedTransaction, SafeBatch, SafeMeta, SafeTx, TimelockTran
|
|
|
24
26
|
import { GovernorContract } from "./bindings/governance/governor.js";
|
|
25
27
|
import { TimeLockContract } from "./bindings/governance/timelock.js";
|
|
26
28
|
import { InstanceManagerContract } from "./bindings/instance-manager.js";
|
|
27
|
-
import {
|
|
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";
|
|
28
31
|
import { MarketConfiguratorContract } from "./bindings/market-configurator.js";
|
|
29
32
|
import { MarketConfiguratorFactoryContract } from "./bindings/market-configurator-factory.js";
|
|
30
33
|
import { PriceFeedStoreContract } from "./bindings/price-feed-store.js";
|
|
@@ -38,6 +41,12 @@ import { InstanceOwnerTransactions } from "./api/transactions/InstanceOwnerTrans
|
|
|
38
41
|
import { GearboxPermissionless } from "./api/GearboxPermissionless.js";
|
|
39
42
|
import { deriveEffectiveStalenessPeriod } from "./api/deploy/effective-staleness.js";
|
|
40
43
|
import { PermissionlessChainUnreachableError, PermissionlessNotAttachedError, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError } from "./api/errors.js";
|
|
44
|
+
import { SCORE_MULTIPLIER, factorOf, finalPrice, scoreOfFactor, worstOf } from "./api/oracles/score/formula.js";
|
|
45
|
+
import { runAssetScores, runFeedPairScore } from "./api/oracles/score/run.js";
|
|
46
|
+
import { TreeNode, classifySources, sourcesByFeed } from "./api/oracles/stress/classify.js";
|
|
47
|
+
import { UNBOUNDED_DOWN, UNBOUNDED_UP, groupOverride, perturb, rateStub, roundDataStub } from "./api/oracles/stress/override.js";
|
|
48
|
+
import { DEFAULT_SCENARIOS, RATE_FEED_TYPE, readFeedTrees, readForest, readRateTargets, readUnder, runStressTest } from "./api/oracles/stress/run.js";
|
|
49
|
+
import { scoreGroup, slotHarm, verdictOf } from "./api/oracles/stress/score.js";
|
|
41
50
|
import "./api/index.js";
|
|
42
51
|
import { ArchiveTransport, ArchiveTransportConfig } from "./chains/archive-transport.js";
|
|
43
52
|
import { chunkedLogsTransport } from "./chains/chunked-log-transport.js";
|
|
@@ -48,10 +57,10 @@ import { PUBLIC_CREATE2_FACTORY, checkCreate2Deployment, checkCreate2DeploymentA
|
|
|
48
57
|
import { convertPercent, deepJsonParse, formatBytecodeSize, formatBytecodeVersion, shortenHash, significantTrunc } from "./utils/format.js";
|
|
49
58
|
import { calculateChecksum, convertRawTxToSafeMultisigTx, getSafeBatch, getSafeBatches } from "./utils/governance/batch.js";
|
|
50
59
|
import { convertQueueBatchToExecuteTx } from "./utils/governance/timelock-txs.js";
|
|
51
|
-
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";
|
|
52
61
|
import { getPriceUpdateTx } from "./utils/price-update/get-price-update-tx.js";
|
|
53
|
-
import { getPrices } from "./utils/price-update/get-prices.js";
|
|
62
|
+
import { getFeedDecimals, getLatestPrices, getPrices } from "./utils/price-update/get-prices.js";
|
|
54
63
|
import { GetUpdatablePriceFeedsArgs, getUpdatablePriceFeeds } from "./utils/price-update/get-updatable-feeds.js";
|
|
55
64
|
import { normalizeSignature } from "./utils/signature.js";
|
|
56
65
|
import "./utils/index.js";
|
|
57
|
-
export { AccessMode, AddAssetParams, AddFeedsArgs, AddressProviderContract, Addresses, AllowTokenParams, ArchiveTransport, ArchiveTransportConfig, AssetArgs, 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,
|
|
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, FeedPairScore, FeedPairScoreArgs, 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, 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, readFeedTrees, readForest, readRateTargets, readUnder, roundDataStub, runAssetScores, runFeedPairScore, 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
|
-
import { getPrices } from "./price-update/get-prices.js";
|
|
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, 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
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
import { Address, PublicClient } from "viem";
|
|
2
2
|
//#region src/permissionless/utils/price-update/get-prices.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The scale each feed's answer is in, in one multicall.
|
|
5
|
+
*
|
|
6
|
+
* Part of the Chainlink interface every feed in a Gearbox tree implements,
|
|
7
|
+
* and the only way to read an answer that is not an oracle's own: a feed an
|
|
8
|
+
* oracle holds reports 8 decimals by construction, while the feeds beneath a
|
|
9
|
+
* composite are whatever was deployed — an ETH/USD aggregator at 8 and a
|
|
10
|
+
* rate leg at 18 sit under the same parent.
|
|
11
|
+
*
|
|
12
|
+
* `null` is a feed that would not answer, which a caller should treat as
|
|
13
|
+
* unknown rather than defaulting it to 8.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getFeedDecimals({ client, priceFeeds }: {
|
|
16
|
+
client: PublicClient;
|
|
17
|
+
priceFeeds: Address[];
|
|
18
|
+
}): Promise<Record<Address, number | null>>;
|
|
19
|
+
/**
|
|
20
|
+
* What the feeds report as they stand, in one multicall.
|
|
21
|
+
*
|
|
22
|
+
* What {@link getPrices} does without the part that makes it expensive: no
|
|
23
|
+
* `OnchainSDK` to attach and no update transactions to assemble, which is the
|
|
24
|
+
* whole cost of that call and is wasted on a feed that answers already. A feed
|
|
25
|
+
* that needs a fresh answer before it will be read comes back `null` here, so
|
|
26
|
+
* a caller that must price those falls back to {@link getPrices} for them and
|
|
27
|
+
* pays once for the few rather than once for all.
|
|
28
|
+
*
|
|
29
|
+
* `null` is also a feed whose read reverted for any other reason, which is not
|
|
30
|
+
* a zero.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getLatestPrices({ client, priceFeeds }: {
|
|
33
|
+
client: PublicClient;
|
|
34
|
+
priceFeeds: Address[];
|
|
35
|
+
}): Promise<Record<Address, bigint | null>>;
|
|
3
36
|
export declare function getPrices({ client, priceFeeds, chunkSize, gasLimit }: {
|
|
4
37
|
client: PublicClient;
|
|
5
38
|
priceFeeds: Address[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { getPriceUpdateTx } from "./get-price-update-tx.js";
|
|
2
|
-
import { getPrices } from "./get-prices.js";
|
|
2
|
+
import { getFeedDecimals, getLatestPrices, getPrices } from "./get-prices.js";
|
|
3
3
|
import { GetUpdatablePriceFeedsArgs, getUpdatablePriceFeeds } from "./get-updatable-feeds.js";
|
|
4
|
-
export { GetUpdatablePriceFeedsArgs, getPriceUpdateTx, getPrices, getUpdatablePriceFeeds };
|
|
4
|
+
export { GetUpdatablePriceFeedsArgs, getFeedDecimals, getLatestPrices, getPriceUpdateTx, getPrices, getUpdatablePriceFeeds };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ILogger } from "../onchain/types/logger.js";
|
|
2
|
+
import { CreateTestnetRequest, Testnet, TestnetFiles, TestnetStatus } from "./types.js";
|
|
3
|
+
//#region src/testnets/TestnetsAPI.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options of a {@link TestnetsAPI}.
|
|
6
|
+
**/
|
|
7
|
+
export interface TestnetsAPIOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Base URL of anvil-manager.
|
|
10
|
+
*
|
|
11
|
+
* @defaultValue `"https://anvil.gearbox.foundation"`
|
|
12
|
+
**/
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
/**
|
|
15
|
+
* API key sent as a bearer token with every request. Without it the private
|
|
16
|
+
* routes (create, kill) answer 401, which surfaces as a
|
|
17
|
+
* {@link TestnetStatusError}.
|
|
18
|
+
**/
|
|
19
|
+
apiKey?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Timeout of one request, in milliseconds.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue `30_000`
|
|
24
|
+
**/
|
|
25
|
+
timeout?: number;
|
|
26
|
+
logger?: ILogger;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Options of {@link TestnetsAPI.waitUntilReady}.
|
|
30
|
+
**/
|
|
31
|
+
export interface WaitUntilReadyOptions {
|
|
32
|
+
/**
|
|
33
|
+
* How long to wait for the testnet to become ready, in milliseconds.
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue `600_000` (10 minutes)
|
|
36
|
+
**/
|
|
37
|
+
timeout?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Pause between two status polls, in milliseconds.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue `5_000`
|
|
42
|
+
**/
|
|
43
|
+
interval?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Client for anvil-manager, which runs the anvil forks Gearbox calls
|
|
47
|
+
* testnets. It manages non-persistent testnets only, addressed by their
|
|
48
|
+
* execution id.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* const testnets = new TestnetsAPI({ apiKey: process.env.ANVIL_MANAGER_API_KEY });
|
|
52
|
+
* const { executionId } = await testnets.create({ network: "Mainnet", timeout: "2h" });
|
|
53
|
+
* const status = await testnets.waitUntilReady(executionId);
|
|
54
|
+
* // ... use status.rpcUrl ...
|
|
55
|
+
* await testnets.kill(executionId);
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* Every method throws a {@link TestnetsError} subclass when it fails, except
|
|
59
|
+
* when a response body is not JSON: then it rejects with the error of
|
|
60
|
+
* `response.json()`.
|
|
61
|
+
**/
|
|
62
|
+
export declare class TestnetsAPI {
|
|
63
|
+
#private;
|
|
64
|
+
protected readonly logger?: ILogger;
|
|
65
|
+
constructor(options?: TestnetsAPIOptions);
|
|
66
|
+
/**
|
|
67
|
+
* Base URL every request of this client is sent to.
|
|
68
|
+
**/
|
|
69
|
+
get baseUrl(): string;
|
|
70
|
+
/**
|
|
71
|
+
* Every testnet anvil-manager knows of, persistent ones included.
|
|
72
|
+
**/
|
|
73
|
+
list(): Promise<Testnet[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Status of one testnet.
|
|
76
|
+
*
|
|
77
|
+
* @param id - Execution id of the testnet.
|
|
78
|
+
* @throws {@link TestnetNotFoundError} when there is no such testnet.
|
|
79
|
+
**/
|
|
80
|
+
get(id: string): Promise<TestnetStatus>;
|
|
81
|
+
/**
|
|
82
|
+
* Starts a testnet. It answers as soon as the testnet is created, long
|
|
83
|
+
* before it is {@link TestnetStatus.ready}.
|
|
84
|
+
*
|
|
85
|
+
* @param files - Saved in the testnet's shared dir, where scripts and tasks
|
|
86
|
+
* can read them.
|
|
87
|
+
**/
|
|
88
|
+
create(request: CreateTestnetRequest, files?: TestnetFiles): Promise<TestnetStatus>;
|
|
89
|
+
/**
|
|
90
|
+
* Stops a testnet. Stopping one that is already stopped succeeds.
|
|
91
|
+
*
|
|
92
|
+
* @param id - Execution id of the testnet.
|
|
93
|
+
* @throws {@link TestnetNotFoundError} when there is no such testnet.
|
|
94
|
+
* @throws {@link TestnetStatusError} with status 400 when the testnet is
|
|
95
|
+
* persistent.
|
|
96
|
+
**/
|
|
97
|
+
kill(id: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Polls a testnet's status until it is {@link TestnetStatus.ready}.
|
|
100
|
+
*
|
|
101
|
+
* @param id - Execution id of the testnet.
|
|
102
|
+
* @returns The first status that is ready.
|
|
103
|
+
* @throws {@link TestnetWaitTimeoutError} when the testnet is not ready in
|
|
104
|
+
* time. Any error of a poll is thrown as is, without retrying.
|
|
105
|
+
**/
|
|
106
|
+
waitUntilReady(id: string, options?: WaitUntilReadyOptions): Promise<TestnetStatus>;
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TestnetStatusError } from "./TestnetStatusError.js";
|
|
2
|
+
//#region src/testnets/errors/TestnetNotFoundError.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when anvil-manager answered 404: there is no testnet with that
|
|
5
|
+
* execution id.
|
|
6
|
+
**/
|
|
7
|
+
export declare class TestnetNotFoundError extends TestnetStatusError {
|
|
8
|
+
name: string;
|
|
9
|
+
readonly status: 404;
|
|
10
|
+
constructor(url: string, details?: string);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TestnetsError } from "./TestnetsError.js";
|
|
2
|
+
//#region src/testnets/errors/TestnetRequestFailedError.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when a request to anvil-manager never completed: the network was
|
|
5
|
+
* down, or it took longer than the client's timeout.
|
|
6
|
+
**/
|
|
7
|
+
export declare class TestnetRequestFailedError extends TestnetsError {
|
|
8
|
+
name: string;
|
|
9
|
+
constructor(url: string, cause: unknown);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TestnetsError } from "./TestnetsError.js";
|
|
2
|
+
//#region src/testnets/errors/TestnetStatusError.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when anvil-manager answered with a status outside the 2xx range. What
|
|
5
|
+
* it said about it, when it said anything, is the `details` of the error.
|
|
6
|
+
**/
|
|
7
|
+
export declare class TestnetStatusError extends TestnetsError {
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Status anvil-manager answered with.
|
|
11
|
+
**/
|
|
12
|
+
readonly status: number;
|
|
13
|
+
constructor(url: string, status: number, details?: string);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestnetsError } from "./TestnetsError.js";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
//#region src/testnets/errors/TestnetValidationError.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when anvil-manager answered, but with a payload the testnet schemas
|
|
6
|
+
* do not describe, i.e. the two are of different versions.
|
|
7
|
+
**/
|
|
8
|
+
export declare class TestnetValidationError extends TestnetsError {
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* The zod failure itself, e.g. for `z.treeifyError(error.zodError)`.
|
|
12
|
+
**/
|
|
13
|
+
readonly zodError: z.core.$ZodError;
|
|
14
|
+
constructor(url: string, zodError: z.core.$ZodError);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|