@varla/sdk 2.13.0 → 2.14.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/AGENTS.md +6 -6
- package/CHANGELOG.md +17 -0
- package/dist/abi/full/VarlaOracle.d.ts +72 -0
- package/dist/abi/full/VarlaOracle.d.ts.map +1 -1
- package/dist/abi/full/VarlaOracle.js +93 -0
- package/dist/abi/full/VarlaOracle.js.map +1 -1
- package/dist/abi/subsets/VarlaOracle.registry.d.ts +42 -0
- package/dist/abi/subsets/VarlaOracle.registry.d.ts.map +1 -1
- package/dist/abi/subsets/VarlaOracle.registry.js +54 -0
- package/dist/abi/subsets/VarlaOracle.registry.js.map +1 -1
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +1 -0
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/oracleUpdaterRouter.d.ts +17 -0
- package/dist/actions/oracleUpdaterRouter.d.ts.map +1 -1
- package/dist/actions/oracleUpdaterRouter.js +23 -0
- package/dist/actions/oracleUpdaterRouter.js.map +1 -1
- package/dist/actions/proxyAdmin.d.ts +68 -0
- package/dist/actions/proxyAdmin.d.ts.map +1 -0
- package/dist/actions/proxyAdmin.js +76 -0
- package/dist/actions/proxyAdmin.js.map +1 -0
- package/dist/actions/rbac.d.ts +62 -0
- package/dist/actions/rbac.d.ts.map +1 -1
- package/dist/actions/rbac.js +64 -0
- package/dist/actions/rbac.js.map +1 -1
- package/dist/addresses/index.d.ts +1 -1
- package/dist/addresses/index.d.ts.map +1 -1
- package/dist/addresses/index.js +1 -1
- package/dist/addresses/index.js.map +1 -1
- package/dist/addresses/polygon.d.ts.map +1 -1
- package/dist/addresses/polygon.js +12 -10
- package/dist/addresses/polygon.js.map +1 -1
- package/dist/addresses/polygonProxy.d.ts +3 -0
- package/dist/addresses/polygonProxy.d.ts.map +1 -0
- package/dist/addresses/polygonProxy.js +15 -0
- package/dist/addresses/polygonProxy.js.map +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +9 -15
- package/dist/contracts.js.map +1 -1
- package/dist/generated.d.ts +115 -1
- package/dist/generated.d.ts.map +1 -1
- package/dist/generated.js +1 -1
- package/dist/generated.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/full/VarlaOracle.ts +93 -0
- package/src/abi/subsets/VarlaOracle.registry.ts +54 -0
- package/src/actions/index.ts +1 -0
- package/src/actions/oracleUpdaterRouter.ts +35 -0
- package/src/actions/proxyAdmin.ts +124 -0
- package/src/actions/rbac.ts +110 -0
- package/src/addresses/index.ts +1 -1
- package/src/addresses/polygon.json +10 -10
- package/src/addresses/polygon.ts +13 -11
- package/src/addresses/polygonProxy.ts +18 -0
- package/src/contracts.ts +11 -17
- package/src/generated.ts +1 -1
|
@@ -170,6 +170,22 @@ export const VARLAORACLE_ABI_REGISTRY = [
|
|
|
170
170
|
"name": "InvalidMaxStaleness",
|
|
171
171
|
"type": "error"
|
|
172
172
|
},
|
|
173
|
+
{
|
|
174
|
+
"inputs": [
|
|
175
|
+
{
|
|
176
|
+
"internalType": "uint256",
|
|
177
|
+
"name": "value",
|
|
178
|
+
"type": "uint256"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"internalType": "uint256",
|
|
182
|
+
"name": "floor",
|
|
183
|
+
"type": "uint256"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"name": "InvalidMinLiquidity",
|
|
187
|
+
"type": "error"
|
|
188
|
+
},
|
|
173
189
|
{
|
|
174
190
|
"inputs": [
|
|
175
191
|
{
|
|
@@ -396,6 +412,25 @@ export const VARLAORACLE_ABI_REGISTRY = [
|
|
|
396
412
|
"name": "LowLiquidityConfigUpdated",
|
|
397
413
|
"type": "event"
|
|
398
414
|
},
|
|
415
|
+
{
|
|
416
|
+
"anonymous": false,
|
|
417
|
+
"inputs": [
|
|
418
|
+
{
|
|
419
|
+
"indexed": false,
|
|
420
|
+
"internalType": "bool",
|
|
421
|
+
"name": "oldValue",
|
|
422
|
+
"type": "bool"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"indexed": false,
|
|
426
|
+
"internalType": "bool",
|
|
427
|
+
"name": "newValue",
|
|
428
|
+
"type": "bool"
|
|
429
|
+
}
|
|
430
|
+
],
|
|
431
|
+
"name": "LowLiquidityGraceBlocksLiquidationUpdated",
|
|
432
|
+
"type": "event"
|
|
433
|
+
},
|
|
399
434
|
{
|
|
400
435
|
"anonymous": false,
|
|
401
436
|
"inputs": [
|
|
@@ -440,6 +475,25 @@ export const VARLAORACLE_ABI_REGISTRY = [
|
|
|
440
475
|
"name": "MaxStalenessUpdated",
|
|
441
476
|
"type": "event"
|
|
442
477
|
},
|
|
478
|
+
{
|
|
479
|
+
"anonymous": false,
|
|
480
|
+
"inputs": [
|
|
481
|
+
{
|
|
482
|
+
"indexed": false,
|
|
483
|
+
"internalType": "uint256",
|
|
484
|
+
"name": "oldMinLiquidity",
|
|
485
|
+
"type": "uint256"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"indexed": false,
|
|
489
|
+
"internalType": "uint256",
|
|
490
|
+
"name": "newMinLiquidity",
|
|
491
|
+
"type": "uint256"
|
|
492
|
+
}
|
|
493
|
+
],
|
|
494
|
+
"name": "MinLiquidityUpdated",
|
|
495
|
+
"type": "event"
|
|
496
|
+
},
|
|
443
497
|
{
|
|
444
498
|
"anonymous": false,
|
|
445
499
|
"inputs": [
|
package/src/actions/index.ts
CHANGED
|
@@ -248,6 +248,41 @@ export async function signOracleUpdaterRouterUpdate(params: {
|
|
|
248
248
|
return params.walletClient.sign({ hash: digest });
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
// ── Publisher management ────────────────────────────────────────────────────
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Read whether `publisher` is whitelisted on the OracleUpdaterRouter.
|
|
255
|
+
*/
|
|
256
|
+
export async function readIsPublisher(params: {
|
|
257
|
+
publicClient: Pick<PublicClient, "readContract">;
|
|
258
|
+
routerAddress: Address;
|
|
259
|
+
publisher: Address;
|
|
260
|
+
}): Promise<boolean> {
|
|
261
|
+
const result = await params.publicClient.readContract({
|
|
262
|
+
address: params.routerAddress,
|
|
263
|
+
abi: abis.ORACLEUPDATERROUTER_ABI,
|
|
264
|
+
functionName: "isPublisher",
|
|
265
|
+
args: [params.publisher],
|
|
266
|
+
});
|
|
267
|
+
return result as boolean;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** Change the AccessManager authority for OracleUpdaterRouter. */
|
|
271
|
+
export async function prepareOracleUpdaterRouterSetAuthority(params: {
|
|
272
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
273
|
+
routerAddress: Address;
|
|
274
|
+
account: Address;
|
|
275
|
+
newAuthority: Address;
|
|
276
|
+
}): Promise<any> {
|
|
277
|
+
return await params.publicClient.simulateContract({
|
|
278
|
+
address: params.routerAddress,
|
|
279
|
+
abi: abis.ORACLEUPDATERROUTER_ABI,
|
|
280
|
+
functionName: "setAuthority",
|
|
281
|
+
args: [params.newAuthority],
|
|
282
|
+
account: params.account,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
251
286
|
export async function prepareOracleUpdaterRouterUpdatePricesWithSig(params: {
|
|
252
287
|
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
253
288
|
routerAddress: Address;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Note: explicit .js extension is required for Node ESM resolution.
|
|
2
|
+
|
|
3
|
+
import type { Address, Hex } from "viem";
|
|
4
|
+
|
|
5
|
+
import { abis } from "../generated.js";
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// VarlaProxyAdmin — critical admin/governance actions
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
/** Pause all proxy upgrades (emergency). Restricted by AccessManager. */
|
|
12
|
+
export async function prepareProxyAdminPause(params: {
|
|
13
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
14
|
+
proxyAdminAddress: Address;
|
|
15
|
+
account: Address;
|
|
16
|
+
}): Promise<any> {
|
|
17
|
+
return await params.publicClient.simulateContract({
|
|
18
|
+
address: params.proxyAdminAddress,
|
|
19
|
+
abi: abis.VARLAPROXYADMIN_ABI,
|
|
20
|
+
functionName: "pause",
|
|
21
|
+
args: [],
|
|
22
|
+
account: params.account,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Unpause proxy upgrades. Restricted by AccessManager. */
|
|
27
|
+
export async function prepareProxyAdminUnpause(params: {
|
|
28
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
29
|
+
proxyAdminAddress: Address;
|
|
30
|
+
account: Address;
|
|
31
|
+
}): Promise<any> {
|
|
32
|
+
return await params.publicClient.simulateContract({
|
|
33
|
+
address: params.proxyAdminAddress,
|
|
34
|
+
abi: abis.VARLAPROXYADMIN_ABI,
|
|
35
|
+
functionName: "unpause",
|
|
36
|
+
args: [],
|
|
37
|
+
account: params.account,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Upgrade a proxy to a new implementation. Restricted by AccessManager. */
|
|
42
|
+
export async function prepareProxyAdminUpgrade(params: {
|
|
43
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
44
|
+
proxyAdminAddress: Address;
|
|
45
|
+
account: Address;
|
|
46
|
+
proxy: Address;
|
|
47
|
+
implementation: Address;
|
|
48
|
+
}): Promise<any> {
|
|
49
|
+
return await params.publicClient.simulateContract({
|
|
50
|
+
address: params.proxyAdminAddress,
|
|
51
|
+
abi: abis.VARLAPROXYADMIN_ABI,
|
|
52
|
+
functionName: "upgrade",
|
|
53
|
+
args: [params.proxy, params.implementation],
|
|
54
|
+
account: params.account,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Upgrade a proxy + call initializer in one tx. Restricted by AccessManager. */
|
|
59
|
+
export async function prepareProxyAdminUpgradeAndCall(params: {
|
|
60
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
61
|
+
proxyAdminAddress: Address;
|
|
62
|
+
account: Address;
|
|
63
|
+
proxy: Address;
|
|
64
|
+
implementation: Address;
|
|
65
|
+
data: Hex;
|
|
66
|
+
}): Promise<any> {
|
|
67
|
+
return await params.publicClient.simulateContract({
|
|
68
|
+
address: params.proxyAdminAddress,
|
|
69
|
+
abi: abis.VARLAPROXYADMIN_ABI,
|
|
70
|
+
functionName: "upgradeAndCall",
|
|
71
|
+
args: [params.proxy, params.implementation, params.data],
|
|
72
|
+
account: params.account,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Register a proxy/admin pair. Restricted by AccessManager. */
|
|
77
|
+
export async function prepareProxyAdminRegisterProxy(params: {
|
|
78
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
79
|
+
proxyAdminAddress: Address;
|
|
80
|
+
account: Address;
|
|
81
|
+
proxy: Address;
|
|
82
|
+
proxyAdmin: Address;
|
|
83
|
+
}): Promise<any> {
|
|
84
|
+
return await params.publicClient.simulateContract({
|
|
85
|
+
address: params.proxyAdminAddress,
|
|
86
|
+
abi: abis.VARLAPROXYADMIN_ABI,
|
|
87
|
+
functionName: "registerProxy",
|
|
88
|
+
args: [params.proxy, params.proxyAdmin],
|
|
89
|
+
account: params.account,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Transfer proxy admin ownership to a new address. Restricted by AccessManager. */
|
|
94
|
+
export async function prepareProxyAdminSetProxyAdminOwner(params: {
|
|
95
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
96
|
+
proxyAdminAddress: Address;
|
|
97
|
+
account: Address;
|
|
98
|
+
proxy: Address;
|
|
99
|
+
newOwner: Address;
|
|
100
|
+
}): Promise<any> {
|
|
101
|
+
return await params.publicClient.simulateContract({
|
|
102
|
+
address: params.proxyAdminAddress,
|
|
103
|
+
abi: abis.VARLAPROXYADMIN_ABI,
|
|
104
|
+
functionName: "setProxyAdminOwner",
|
|
105
|
+
args: [params.proxy, params.newOwner],
|
|
106
|
+
account: params.account,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Change the AccessManager authority for VarlaProxyAdmin. */
|
|
111
|
+
export async function prepareProxyAdminSetAuthority(params: {
|
|
112
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
113
|
+
proxyAdminAddress: Address;
|
|
114
|
+
account: Address;
|
|
115
|
+
newAuthority: Address;
|
|
116
|
+
}): Promise<any> {
|
|
117
|
+
return await params.publicClient.simulateContract({
|
|
118
|
+
address: params.proxyAdminAddress,
|
|
119
|
+
abi: abis.VARLAPROXYADMIN_ABI,
|
|
120
|
+
functionName: "setAuthority",
|
|
121
|
+
args: [params.newAuthority],
|
|
122
|
+
account: params.account,
|
|
123
|
+
});
|
|
124
|
+
}
|
package/src/actions/rbac.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import type { Address, Hex } from "viem";
|
|
4
4
|
|
|
5
|
+
import { abis } from "../generated.js";
|
|
6
|
+
|
|
5
7
|
// ---------------------------------------------------------------------------
|
|
6
8
|
// Common signatures (DevEx)
|
|
7
9
|
// ---------------------------------------------------------------------------
|
|
@@ -78,3 +80,111 @@ export async function assertCanCallImmediate(params: {
|
|
|
78
80
|
throw new Error(`AccessManager.canCall denied or delayed (delay=${r.delay})`);
|
|
79
81
|
}
|
|
80
82
|
}
|
|
83
|
+
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
// VarlaAccessManager — mutating RBAC actions
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
|
|
88
|
+
/** Grant a role to an account. Requires ADMIN role (0). */
|
|
89
|
+
export async function prepareGrantRole(params: {
|
|
90
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
91
|
+
accessManagerAddress: Address;
|
|
92
|
+
account: Address;
|
|
93
|
+
roleId: bigint;
|
|
94
|
+
grantee: Address;
|
|
95
|
+
executionDelay: number;
|
|
96
|
+
}): Promise<any> {
|
|
97
|
+
return await params.publicClient.simulateContract({
|
|
98
|
+
address: params.accessManagerAddress,
|
|
99
|
+
abi: abis.VARLAACCESSMANAGER_ABI,
|
|
100
|
+
functionName: "grantRole",
|
|
101
|
+
args: [params.roleId, params.grantee, params.executionDelay],
|
|
102
|
+
account: params.account,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Revoke a role from an account. Requires ADMIN role (0). */
|
|
107
|
+
export async function prepareRevokeRole(params: {
|
|
108
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
109
|
+
accessManagerAddress: Address;
|
|
110
|
+
account: Address;
|
|
111
|
+
roleId: bigint;
|
|
112
|
+
target: Address;
|
|
113
|
+
}): Promise<any> {
|
|
114
|
+
return await params.publicClient.simulateContract({
|
|
115
|
+
address: params.accessManagerAddress,
|
|
116
|
+
abi: abis.VARLAACCESSMANAGER_ABI,
|
|
117
|
+
functionName: "revokeRole",
|
|
118
|
+
args: [params.roleId, params.target],
|
|
119
|
+
account: params.account,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Map function selectors on a target to a role. Requires ADMIN role (0). */
|
|
124
|
+
export async function prepareSetTargetFunctionRole(params: {
|
|
125
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
126
|
+
accessManagerAddress: Address;
|
|
127
|
+
account: Address;
|
|
128
|
+
target: Address;
|
|
129
|
+
selectors: readonly Hex[];
|
|
130
|
+
roleId: bigint;
|
|
131
|
+
}): Promise<any> {
|
|
132
|
+
return await params.publicClient.simulateContract({
|
|
133
|
+
address: params.accessManagerAddress,
|
|
134
|
+
abi: abis.VARLAACCESSMANAGER_ABI,
|
|
135
|
+
functionName: "setTargetFunctionRole",
|
|
136
|
+
args: [params.target, params.selectors, params.roleId],
|
|
137
|
+
account: params.account,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Close or open a target contract. When closed, all restricted calls revert. */
|
|
142
|
+
export async function prepareSetTargetClosed(params: {
|
|
143
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
144
|
+
accessManagerAddress: Address;
|
|
145
|
+
account: Address;
|
|
146
|
+
target: Address;
|
|
147
|
+
closed: boolean;
|
|
148
|
+
}): Promise<any> {
|
|
149
|
+
return await params.publicClient.simulateContract({
|
|
150
|
+
address: params.accessManagerAddress,
|
|
151
|
+
abi: abis.VARLAACCESSMANAGER_ABI,
|
|
152
|
+
functionName: "setTargetClosed",
|
|
153
|
+
args: [params.target, params.closed],
|
|
154
|
+
account: params.account,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Set the admin role for a given role (role hierarchy). */
|
|
159
|
+
export async function prepareSetRoleAdmin(params: {
|
|
160
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
161
|
+
accessManagerAddress: Address;
|
|
162
|
+
account: Address;
|
|
163
|
+
roleId: bigint;
|
|
164
|
+
adminRoleId: bigint;
|
|
165
|
+
}): Promise<any> {
|
|
166
|
+
return await params.publicClient.simulateContract({
|
|
167
|
+
address: params.accessManagerAddress,
|
|
168
|
+
abi: abis.VARLAACCESSMANAGER_ABI,
|
|
169
|
+
functionName: "setRoleAdmin",
|
|
170
|
+
args: [params.roleId, params.adminRoleId],
|
|
171
|
+
account: params.account,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Set the guardian role for a given role. */
|
|
176
|
+
export async function prepareSetRoleGuardian(params: {
|
|
177
|
+
publicClient: { simulateContract: (args: any) => Promise<any> };
|
|
178
|
+
accessManagerAddress: Address;
|
|
179
|
+
account: Address;
|
|
180
|
+
roleId: bigint;
|
|
181
|
+
guardianRoleId: bigint;
|
|
182
|
+
}): Promise<any> {
|
|
183
|
+
return await params.publicClient.simulateContract({
|
|
184
|
+
address: params.accessManagerAddress,
|
|
185
|
+
abi: abis.VARLAACCESSMANAGER_ABI,
|
|
186
|
+
functionName: "setRoleGuardian",
|
|
187
|
+
args: [params.roleId, params.guardianRoleId],
|
|
188
|
+
account: params.account,
|
|
189
|
+
});
|
|
190
|
+
}
|
package/src/addresses/index.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"generatedAt": "",
|
|
4
4
|
"deploymentsDir": "polygon",
|
|
5
5
|
"contracts": {
|
|
6
|
-
"VarlaAccessManager": "
|
|
7
|
-
"VarlaOracle": "
|
|
8
|
-
"VarlaCore": "
|
|
9
|
-
"VarlaPool": "
|
|
10
|
-
"OracleUpdaterRouter": "
|
|
11
|
-
"VarlaLiquidator": "
|
|
12
|
-
"VarlaMergeLiquidator": "
|
|
13
|
-
"VarlaConvertLiquidator": "
|
|
14
|
-
"PolymarketCtfAdapter": "
|
|
15
|
-
"PolymarketNegRiskMergeAdapter": "
|
|
6
|
+
"VarlaAccessManager": "0xEAC5659248A4f4c8440961874FA7994c6B821ad0",
|
|
7
|
+
"VarlaOracle": "0x6D6d16860c9366a97AbC02402cFe7988F9c20a8d",
|
|
8
|
+
"VarlaCore": "0x79870b76C01900e53a909b1F77d2CF3f1935c5D8",
|
|
9
|
+
"VarlaPool": "0xf1d4be6c15b6F7Fb66CE2C85368d26a603eb3cC0",
|
|
10
|
+
"OracleUpdaterRouter": "0xd98799d440034CeC1CE41c8495cdeF0dA18951C1",
|
|
11
|
+
"VarlaLiquidator": "0xD570aeFD9C54f816a53786ed1888fE4A03be359A",
|
|
12
|
+
"VarlaMergeLiquidator": "0x71becFD9AC3aeE3F3BD24A8518022147Efc18b4d",
|
|
13
|
+
"VarlaConvertLiquidator": "0x842905cA77B50eCDf2D890516fCD7E9A324B44e9",
|
|
14
|
+
"PolymarketCtfAdapter": "0x3bd6570DB3f6D6965F78399817678950d6eC6e4C",
|
|
15
|
+
"PolymarketNegRiskMergeAdapter": "0x424886B053D1eED5FE98A94988CFC8CA28c7C0A7"
|
|
16
16
|
}
|
|
17
17
|
}
|
package/src/addresses/polygon.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
// Auto-generated from varla-protocol deployments/polygon
|
|
1
|
+
// Auto-generated from varla-protocol deployments/polygon (immutable)
|
|
2
2
|
import type { AddressBook } from "../types";
|
|
3
3
|
|
|
4
4
|
export const polygon: AddressBook = {
|
|
5
|
-
accessManager: "
|
|
6
|
-
oracle: "
|
|
7
|
-
core: "
|
|
8
|
-
pool: "
|
|
9
|
-
oracleUpdaterRouter: "
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
accessManager: "0xEAC5659248A4f4c8440961874FA7994c6B821ad0",
|
|
6
|
+
oracle: "0x6D6d16860c9366a97AbC02402cFe7988F9c20a8d",
|
|
7
|
+
core: "0x79870b76C01900e53a909b1F77d2CF3f1935c5D8",
|
|
8
|
+
pool: "0xf1d4be6c15b6F7Fb66CE2C85368d26a603eb3cC0",
|
|
9
|
+
oracleUpdaterRouter: "0xd98799d440034CeC1CE41c8495cdeF0dA18951C1",
|
|
10
|
+
interestRateStrategy: "0x6eE2F00463632476614a01332aD490c87978fa1d",
|
|
11
|
+
proxyAdmin: "0xf42B3A7E9850DF4D6Ea0a58CF72C531b3B479aAB",
|
|
12
|
+
liquidator: "0xD570aeFD9C54f816a53786ed1888fE4A03be359A",
|
|
13
|
+
mergeLiquidator: "0x71becFD9AC3aeE3F3BD24A8518022147Efc18b4d",
|
|
14
|
+
convertLiquidator: "0x842905cA77B50eCDf2D890516fCD7E9A324B44e9",
|
|
15
|
+
polymarketCtfAdapter: "0x3bd6570DB3f6D6965F78399817678950d6eC6e4C",
|
|
16
|
+
negRiskMergeAdapter: "0x424886B053D1eED5FE98A94988CFC8CA28c7C0A7",
|
|
15
17
|
};
|
|
16
18
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Auto-generated from varla-protocol deployments/polygon (proxy)
|
|
2
|
+
import type { AddressBook } from "../types";
|
|
3
|
+
|
|
4
|
+
export const polygonProxy: AddressBook = {
|
|
5
|
+
accessManager: "0xEAC5659248A4f4c8440961874FA7994c6B821ad0",
|
|
6
|
+
oracle: "0x1021A3B50F824873D96Ef126e4622cFFcD8d59bc",
|
|
7
|
+
core: "0x336A935210b39E01aC296f211274492caF013F77",
|
|
8
|
+
pool: "0x990DA16Fb01186C5Ffc3f185ff07c126C6705d76",
|
|
9
|
+
oracleUpdaterRouter: "0xd98799d440034CeC1CE41c8495cdeF0dA18951C1",
|
|
10
|
+
interestRateStrategy: "0x2C1D739947F1DD4F1E683f9e98F8c7B3d4a31464",
|
|
11
|
+
proxyAdmin: "0xf42B3A7E9850DF4D6Ea0a58CF72C531b3B479aAB",
|
|
12
|
+
liquidator: "0xDb94015Dd6304d86c637b218a867D15F49c3cC9b",
|
|
13
|
+
mergeLiquidator: "0xaCc7f056B0b9FEF713c5F317Bb65Fe660b3e1b2a",
|
|
14
|
+
convertLiquidator: "0x4d175bCCc5400Aca8b2d9E8c6c0aF179607fB935",
|
|
15
|
+
polymarketCtfAdapter: "0x3bd6570DB3f6D6965F78399817678950d6eC6e4C",
|
|
16
|
+
negRiskMergeAdapter: "0x424886B053D1eED5FE98A94988CFC8CA28c7C0A7",
|
|
17
|
+
};
|
|
18
|
+
|
package/src/contracts.ts
CHANGED
|
@@ -66,24 +66,18 @@ export type GetVarlaContractsParams = {
|
|
|
66
66
|
export function getAddressBook(chain: ChainKey, mode?: DeployMode): AddressBook {
|
|
67
67
|
const m = mode ?? "immutable";
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
`No proxy deployment found for chain '${chain}'. ` +
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
const key = m === "proxy" ? `${chain}Proxy` : chain;
|
|
70
|
+
const book = (addresses as Record<string, AddressBook | undefined>)[key];
|
|
71
|
+
if (!book) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
m === "proxy"
|
|
74
|
+
? `No proxy deployment found for chain '${chain}'. ` +
|
|
75
|
+
`Run the deploy with DEPLOY_MODE=proxy and regenerate SDK artifacts.`
|
|
76
|
+
: `No deployment found for chain '${chain}'. ` +
|
|
77
|
+
`Deploy the chain and run \`bun run prepack\` to regenerate SDK artifacts.`,
|
|
78
|
+
);
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
if (chain === "polygon") return addresses.polygon;
|
|
82
|
-
if (chain === "bsc") return addresses.bsc;
|
|
83
|
-
|
|
84
|
-
// TypeScript should make this unreachable, but keep a runtime guard.
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
86
|
-
throw new Error(`Unsupported chain key: ${chain as string}`);
|
|
80
|
+
return book;
|
|
87
81
|
}
|
|
88
82
|
|
|
89
83
|
function mustAddress(book: AddressBook, key: keyof AddressBook): Address {
|