@kehtus/proportion-sdk 0.1.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/SDK_IMPROVEMENT_PLAN.md +197 -0
- package/arch.md +448 -0
- package/dist/__tests__/account.test.d.ts +1 -0
- package/dist/__tests__/account.test.js +36 -0
- package/dist/__tests__/indexer.test.d.ts +1 -0
- package/dist/__tests__/indexer.test.js +230 -0
- package/dist/__tests__/lifecycle.test.d.ts +1 -0
- package/dist/__tests__/lifecycle.test.js +186 -0
- package/dist/__tests__/reads.test.d.ts +1 -0
- package/dist/__tests__/reads.test.js +185 -0
- package/dist/__tests__/utils.test.d.ts +1 -0
- package/dist/__tests__/utils.test.js +185 -0
- package/dist/abi/factory.d.ts +308 -0
- package/dist/abi/factory.js +399 -0
- package/dist/abi/fundedAccount.d.ts +1074 -0
- package/dist/abi/fundedAccount.js +1373 -0
- package/dist/abi/mainVault.d.ts +1448 -0
- package/dist/abi/mainVault.js +1865 -0
- package/dist/account.d.ts +55 -0
- package/dist/account.js +290 -0
- package/dist/constants.d.ts +48 -0
- package/dist/constants.js +42 -0
- package/dist/factory.d.ts +23 -0
- package/dist/factory.js +139 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +14 -0
- package/dist/indexer.d.ts +57 -0
- package/dist/indexer.js +540 -0
- package/dist/sdk.d.ts +22 -0
- package/dist/sdk.js +89 -0
- package/dist/types.d.ts +384 -0
- package/dist/types.js +11 -0
- package/dist/utils.d.ts +21 -0
- package/dist/utils.js +89 -0
- package/dist/vault.d.ts +60 -0
- package/dist/vault.js +429 -0
- package/package.json +32 -0
- package/src/__tests__/account.test.ts +40 -0
- package/src/__tests__/indexer.test.ts +255 -0
- package/src/__tests__/lifecycle.test.ts +231 -0
- package/src/__tests__/reads.test.ts +209 -0
- package/src/__tests__/utils.test.ts +245 -0
- package/src/abi/factory.ts +399 -0
- package/src/abi/fundedAccount.ts +1373 -0
- package/src/abi/mainVault.ts +1865 -0
- package/src/account.ts +339 -0
- package/src/constants.ts +50 -0
- package/src/factory.ts +157 -0
- package/src/index.ts +16 -0
- package/src/indexer.ts +636 -0
- package/src/sdk.ts +93 -0
- package/src/types.ts +426 -0
- package/src/utils.ts +143 -0
- package/src/vault.ts +479 -0
- package/tsconfig.json +19 -0
- package/vitest.config.ts +8 -0
package/src/vault.ts
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import type { Address, Chain, Hash, PublicClient, WalletClient } from "viem";
|
|
2
|
+
import { mainVaultAbi } from "./abi/mainVault.js";
|
|
3
|
+
import type { BuilderInfo, LPPosition, VaultStats } from "./types.js";
|
|
4
|
+
|
|
5
|
+
const erc20Abi = [
|
|
6
|
+
{
|
|
7
|
+
type: "function",
|
|
8
|
+
name: "approve",
|
|
9
|
+
inputs: [
|
|
10
|
+
{ name: "spender", type: "address" },
|
|
11
|
+
{ name: "amount", type: "uint256" },
|
|
12
|
+
],
|
|
13
|
+
outputs: [{ name: "", type: "bool" }],
|
|
14
|
+
stateMutability: "nonpayable",
|
|
15
|
+
},
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
export class VaultModule {
|
|
19
|
+
constructor(
|
|
20
|
+
private publicClient: PublicClient,
|
|
21
|
+
private walletClient: WalletClient | undefined,
|
|
22
|
+
private chain: Chain,
|
|
23
|
+
private addresses: { vault: Address; usdc: Address },
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
// ── READS ───────────────────────────────────────────
|
|
27
|
+
|
|
28
|
+
async getStats(): Promise<VaultStats> {
|
|
29
|
+
const contract = { address: this.addresses.vault, abi: mainVaultAbi } as const;
|
|
30
|
+
const results = await this.publicClient.multicall({
|
|
31
|
+
contracts: [
|
|
32
|
+
{ ...contract, functionName: "totalAssets" },
|
|
33
|
+
{ ...contract, functionName: "sharePrice" },
|
|
34
|
+
{ ...contract, functionName: "getUtilizationBps" },
|
|
35
|
+
{ ...contract, functionName: "getAvailableForAllocation" },
|
|
36
|
+
{ ...contract, functionName: "getMaxAccountSize" },
|
|
37
|
+
{ ...contract, functionName: "getRemainingCap" },
|
|
38
|
+
{ ...contract, functionName: "paused" },
|
|
39
|
+
{ ...contract, functionName: "feeMultiplier" },
|
|
40
|
+
{ ...contract, functionName: "subscriptionFeeMultiplier" },
|
|
41
|
+
{ ...contract, functionName: "totalShares" },
|
|
42
|
+
{ ...contract, functionName: "totalAllocated" },
|
|
43
|
+
{ ...contract, functionName: "owner" },
|
|
44
|
+
{ ...contract, functionName: "pendingOwner" },
|
|
45
|
+
{ ...contract, functionName: "relayer" },
|
|
46
|
+
{ ...contract, functionName: "protocolFeeReceiver" },
|
|
47
|
+
{ ...contract, functionName: "maxCap" },
|
|
48
|
+
{ ...contract, functionName: "hypeForSpot" },
|
|
49
|
+
{ ...contract, functionName: "factory" },
|
|
50
|
+
{ ...contract, functionName: "MIN_BUILDER_SHARES" },
|
|
51
|
+
{ ...contract, functionName: "BUILDER_LEVERAGE" },
|
|
52
|
+
{ ...contract, functionName: "PROTOCOL_FEE_BPS" },
|
|
53
|
+
{ ...contract, functionName: "MIN_ACCOUNT_SIZE" },
|
|
54
|
+
{ ...contract, functionName: "MAX_ACCOUNT_SIZE" },
|
|
55
|
+
{ ...contract, functionName: "MIN_DRAWDOWN_BPS" },
|
|
56
|
+
{ ...contract, functionName: "MAX_DRAWDOWN_BPS" },
|
|
57
|
+
{ ...contract, functionName: "MAX_UTILIZATION_BPS" },
|
|
58
|
+
{ ...contract, functionName: "MAX_SINGLE_ACCOUNT_BPS" },
|
|
59
|
+
{ ...contract, functionName: "DAILY_DD_DISCOUNT_BPS" },
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
totalAssets: results[0].result!,
|
|
64
|
+
sharePrice: results[1].result!,
|
|
65
|
+
utilizationBps: results[2].result!,
|
|
66
|
+
availableForAllocation: results[3].result!,
|
|
67
|
+
maxAccountSize: results[4].result!,
|
|
68
|
+
remainingCap: results[5].result!,
|
|
69
|
+
paused: results[6].result!,
|
|
70
|
+
feeMultiplier: results[7].result!,
|
|
71
|
+
subscriptionFeeMultiplier: results[8].result!,
|
|
72
|
+
totalShares: results[9].result!,
|
|
73
|
+
totalAllocated: results[10].result!,
|
|
74
|
+
owner: results[11].result!,
|
|
75
|
+
pendingOwner: results[12].result!,
|
|
76
|
+
relayer: results[13].result!,
|
|
77
|
+
protocolFeeReceiver: results[14].result!,
|
|
78
|
+
maxCap: results[15].result!,
|
|
79
|
+
hypeForSpot: results[16].result!,
|
|
80
|
+
factory: results[17].result!,
|
|
81
|
+
minBuilderShares: results[18].result!,
|
|
82
|
+
builderLeverage: results[19].result!,
|
|
83
|
+
protocolFeeBps: results[20].result!,
|
|
84
|
+
minAccountSize: results[21].result!,
|
|
85
|
+
maxAccountSizeLimit: results[22].result!,
|
|
86
|
+
minDrawdownBps: results[23].result!,
|
|
87
|
+
maxDrawdownBps: results[24].result!,
|
|
88
|
+
maxUtilizationBps: results[25].result!,
|
|
89
|
+
maxSingleAccountBps: results[26].result!,
|
|
90
|
+
dailyDdDiscountBps: results[27].result!,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async getLPPosition(account: Address): Promise<LPPosition> {
|
|
95
|
+
const contract = { address: this.addresses.vault, abi: mainVaultAbi } as const;
|
|
96
|
+
const results = await this.publicClient.multicall({
|
|
97
|
+
contracts: [
|
|
98
|
+
{ ...contract, functionName: "shares", args: [account] },
|
|
99
|
+
{ ...contract, functionName: "sharesValue", args: [account] },
|
|
100
|
+
{ ...contract, functionName: "withdrawableShares", args: [account] },
|
|
101
|
+
],
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
shares: results[0].result!,
|
|
105
|
+
sharesValue: results[1].result!,
|
|
106
|
+
withdrawableShares: results[2].result!,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async getBuilderInfo(builder: Address): Promise<BuilderInfo> {
|
|
111
|
+
const contract = { address: this.addresses.vault, abi: mainVaultAbi } as const;
|
|
112
|
+
const results = await this.publicClient.multicall({
|
|
113
|
+
contracts: [
|
|
114
|
+
{ ...contract, functionName: "builders", args: [builder] },
|
|
115
|
+
{ ...contract, functionName: "builderAvailableFunded", args: [builder] },
|
|
116
|
+
],
|
|
117
|
+
});
|
|
118
|
+
const [active, activeFunded] = results[0].result!;
|
|
119
|
+
return {
|
|
120
|
+
active,
|
|
121
|
+
activeFunded,
|
|
122
|
+
availableFunded: results[1].result!,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async getAllowedPerps(): Promise<number[]> {
|
|
127
|
+
const result = await this.publicClient.readContract({
|
|
128
|
+
address: this.addresses.vault,
|
|
129
|
+
abi: mainVaultAbi,
|
|
130
|
+
functionName: "getAllowedPerps",
|
|
131
|
+
});
|
|
132
|
+
return result.map(Number);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async isAllowedPerp(index: number): Promise<boolean> {
|
|
136
|
+
return this.publicClient.readContract({
|
|
137
|
+
address: this.addresses.vault,
|
|
138
|
+
abi: mainVaultAbi,
|
|
139
|
+
functionName: "isAllowedPerp",
|
|
140
|
+
args: [index],
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async calculateFee(size: bigint, bps: number, dailyDD: boolean): Promise<bigint> {
|
|
145
|
+
return this.publicClient.readContract({
|
|
146
|
+
address: this.addresses.vault,
|
|
147
|
+
abi: mainVaultAbi,
|
|
148
|
+
functionName: "calculateActivationFee",
|
|
149
|
+
args: [size, bps, dailyDD],
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async isPaused(): Promise<boolean> {
|
|
154
|
+
return this.publicClient.readContract({
|
|
155
|
+
address: this.addresses.vault,
|
|
156
|
+
abi: mainVaultAbi,
|
|
157
|
+
functionName: "paused",
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async getRemainingCap(): Promise<bigint> {
|
|
162
|
+
return this.publicClient.readContract({
|
|
163
|
+
address: this.addresses.vault,
|
|
164
|
+
abi: mainVaultAbi,
|
|
165
|
+
functionName: "getRemainingCap",
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async isFundedAccount(account: Address): Promise<boolean> {
|
|
170
|
+
return this.publicClient.readContract({
|
|
171
|
+
address: this.addresses.vault,
|
|
172
|
+
abi: mainVaultAbi,
|
|
173
|
+
functionName: "isFundedAccount",
|
|
174
|
+
args: [account],
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
async getDelegateBuilder(delegate: Address): Promise<Address> {
|
|
179
|
+
return this.publicClient.readContract({
|
|
180
|
+
address: this.addresses.vault,
|
|
181
|
+
abi: mainVaultAbi,
|
|
182
|
+
functionName: "delegateBuilder",
|
|
183
|
+
args: [delegate],
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ── WRITES ──────────────────────────────────────────
|
|
188
|
+
|
|
189
|
+
private requireWallet(): WalletClient {
|
|
190
|
+
if (!this.walletClient) throw new Error("WalletClient required for write operations");
|
|
191
|
+
return this.walletClient;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
195
|
+
private async write(params: Record<string, unknown>): Promise<Hash> {
|
|
196
|
+
const wallet = this.requireWallet();
|
|
197
|
+
return wallet.writeContract({ chain: this.chain, ...params } as any);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
async deposit(amount: bigint): Promise<Hash> {
|
|
201
|
+
return this.write({
|
|
202
|
+
address: this.addresses.vault,
|
|
203
|
+
abi: mainVaultAbi,
|
|
204
|
+
functionName: "deposit",
|
|
205
|
+
args: [amount],
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async withdraw(shares: bigint): Promise<Hash> {
|
|
210
|
+
return this.write({
|
|
211
|
+
address: this.addresses.vault,
|
|
212
|
+
abi: mainVaultAbi,
|
|
213
|
+
functionName: "withdraw",
|
|
214
|
+
args: [shares],
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
async approveUsdc(amount: bigint): Promise<Hash> {
|
|
219
|
+
return this.write({
|
|
220
|
+
address: this.addresses.usdc,
|
|
221
|
+
abi: erc20Abi,
|
|
222
|
+
functionName: "approve",
|
|
223
|
+
args: [this.addresses.vault, amount],
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
async registerBuilder(): Promise<Hash> {
|
|
228
|
+
return this.write({
|
|
229
|
+
address: this.addresses.vault,
|
|
230
|
+
abi: mainVaultAbi,
|
|
231
|
+
functionName: "registerBuilder",
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async setDelegate(delegate: Address): Promise<Hash> {
|
|
236
|
+
return this.write({
|
|
237
|
+
address: this.addresses.vault,
|
|
238
|
+
abi: mainVaultAbi,
|
|
239
|
+
functionName: "setDelegate",
|
|
240
|
+
args: [delegate],
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async removeDelegate(delegate: Address): Promise<Hash> {
|
|
245
|
+
return this.write({
|
|
246
|
+
address: this.addresses.vault,
|
|
247
|
+
abi: mainVaultAbi,
|
|
248
|
+
functionName: "removeDelegate",
|
|
249
|
+
args: [delegate],
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
async activateFunded(p: {
|
|
254
|
+
trader: Address;
|
|
255
|
+
accountSize: bigint;
|
|
256
|
+
drawdownBps: number;
|
|
257
|
+
dailyDrawdownEnabled: boolean;
|
|
258
|
+
hypeValue?: bigint;
|
|
259
|
+
}): Promise<Hash> {
|
|
260
|
+
const hypeValue = p.hypeValue ?? await this.publicClient.readContract({
|
|
261
|
+
address: this.addresses.vault,
|
|
262
|
+
abi: mainVaultAbi,
|
|
263
|
+
functionName: "hypeForSpot",
|
|
264
|
+
});
|
|
265
|
+
return this.write({
|
|
266
|
+
address: this.addresses.vault,
|
|
267
|
+
abi: mainVaultAbi,
|
|
268
|
+
functionName: "activateFunded",
|
|
269
|
+
args: [p.trader, p.accountSize, p.drawdownBps, p.dailyDrawdownEnabled],
|
|
270
|
+
value: hypeValue,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// ── ADMIN ───────────────────────────────────────────
|
|
275
|
+
|
|
276
|
+
async pause(): Promise<Hash> {
|
|
277
|
+
return this.write({
|
|
278
|
+
address: this.addresses.vault,
|
|
279
|
+
abi: mainVaultAbi,
|
|
280
|
+
functionName: "pause",
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
async unpause(): Promise<Hash> {
|
|
285
|
+
return this.write({
|
|
286
|
+
address: this.addresses.vault,
|
|
287
|
+
abi: mainVaultAbi,
|
|
288
|
+
functionName: "unpause",
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
async addAllowedPerp(index: number): Promise<Hash> {
|
|
293
|
+
return this.write({
|
|
294
|
+
address: this.addresses.vault,
|
|
295
|
+
abi: mainVaultAbi,
|
|
296
|
+
functionName: "addAllowedPerp",
|
|
297
|
+
args: [index],
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
async removeAllowedPerp(index: number): Promise<Hash> {
|
|
302
|
+
return this.write({
|
|
303
|
+
address: this.addresses.vault,
|
|
304
|
+
abi: mainVaultAbi,
|
|
305
|
+
functionName: "removeAllowedPerp",
|
|
306
|
+
args: [index],
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
async setRelayer(addr: Address): Promise<Hash> {
|
|
311
|
+
return this.write({
|
|
312
|
+
address: this.addresses.vault,
|
|
313
|
+
abi: mainVaultAbi,
|
|
314
|
+
functionName: "setRelayer",
|
|
315
|
+
args: [addr],
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
async setFactory(addr: Address): Promise<Hash> {
|
|
320
|
+
return this.write({
|
|
321
|
+
address: this.addresses.vault,
|
|
322
|
+
abi: mainVaultAbi,
|
|
323
|
+
functionName: "setFactory",
|
|
324
|
+
args: [addr],
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
async setProtocolFeeReceiver(addr: Address): Promise<Hash> {
|
|
329
|
+
return this.write({
|
|
330
|
+
address: this.addresses.vault,
|
|
331
|
+
abi: mainVaultAbi,
|
|
332
|
+
functionName: "setProtocolFeeReceiver",
|
|
333
|
+
args: [addr],
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
async transferOwnership(newOwner: Address): Promise<Hash> {
|
|
338
|
+
return this.write({
|
|
339
|
+
address: this.addresses.vault,
|
|
340
|
+
abi: mainVaultAbi,
|
|
341
|
+
functionName: "transferOwnership",
|
|
342
|
+
args: [newOwner],
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
async acceptOwnership(): Promise<Hash> {
|
|
347
|
+
return this.write({
|
|
348
|
+
address: this.addresses.vault,
|
|
349
|
+
abi: mainVaultAbi,
|
|
350
|
+
functionName: "acceptOwnership",
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
async setFeeMultiplier(value: number): Promise<Hash> {
|
|
355
|
+
return this.write({
|
|
356
|
+
address: this.addresses.vault,
|
|
357
|
+
abi: mainVaultAbi,
|
|
358
|
+
functionName: "setFeeMultiplier",
|
|
359
|
+
args: [value],
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
async setSubscriptionFeeMultiplier(value: number): Promise<Hash> {
|
|
364
|
+
return this.write({
|
|
365
|
+
address: this.addresses.vault,
|
|
366
|
+
abi: mainVaultAbi,
|
|
367
|
+
functionName: "setSubscriptionFeeMultiplier",
|
|
368
|
+
args: [value],
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
async setHypeForSpot(value: bigint): Promise<Hash> {
|
|
373
|
+
return this.write({
|
|
374
|
+
address: this.addresses.vault,
|
|
375
|
+
abi: mainVaultAbi,
|
|
376
|
+
functionName: "setHypeForSpot",
|
|
377
|
+
args: [value],
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
async setMaxCap(value: bigint): Promise<Hash> {
|
|
382
|
+
return this.write({
|
|
383
|
+
address: this.addresses.vault,
|
|
384
|
+
abi: mainVaultAbi,
|
|
385
|
+
functionName: "setMaxCap",
|
|
386
|
+
args: [value],
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
async setMinBuilderShares(value: bigint): Promise<Hash> {
|
|
391
|
+
return this.write({
|
|
392
|
+
address: this.addresses.vault,
|
|
393
|
+
abi: mainVaultAbi,
|
|
394
|
+
functionName: "setMinBuilderShares",
|
|
395
|
+
args: [value],
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
async setBuilderLeverage(value: bigint): Promise<Hash> {
|
|
400
|
+
return this.write({
|
|
401
|
+
address: this.addresses.vault,
|
|
402
|
+
abi: mainVaultAbi,
|
|
403
|
+
functionName: "setBuilderLeverage",
|
|
404
|
+
args: [value],
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
async setProtocolFeeBps(value: bigint): Promise<Hash> {
|
|
409
|
+
return this.write({
|
|
410
|
+
address: this.addresses.vault,
|
|
411
|
+
abi: mainVaultAbi,
|
|
412
|
+
functionName: "setProtocolFeeBps",
|
|
413
|
+
args: [value],
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
async setMinAccountSize(value: bigint): Promise<Hash> {
|
|
418
|
+
return this.write({
|
|
419
|
+
address: this.addresses.vault,
|
|
420
|
+
abi: mainVaultAbi,
|
|
421
|
+
functionName: "setMinAccountSize",
|
|
422
|
+
args: [value],
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
async setMaxAccountSize(value: bigint): Promise<Hash> {
|
|
427
|
+
return this.write({
|
|
428
|
+
address: this.addresses.vault,
|
|
429
|
+
abi: mainVaultAbi,
|
|
430
|
+
functionName: "setMaxAccountSize",
|
|
431
|
+
args: [value],
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
async setMinDrawdownBps(value: number): Promise<Hash> {
|
|
436
|
+
return this.write({
|
|
437
|
+
address: this.addresses.vault,
|
|
438
|
+
abi: mainVaultAbi,
|
|
439
|
+
functionName: "setMinDrawdownBps",
|
|
440
|
+
args: [value],
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
async setMaxDrawdownBps(value: number): Promise<Hash> {
|
|
445
|
+
return this.write({
|
|
446
|
+
address: this.addresses.vault,
|
|
447
|
+
abi: mainVaultAbi,
|
|
448
|
+
functionName: "setMaxDrawdownBps",
|
|
449
|
+
args: [value],
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
async setMaxUtilizationBps(value: bigint): Promise<Hash> {
|
|
454
|
+
return this.write({
|
|
455
|
+
address: this.addresses.vault,
|
|
456
|
+
abi: mainVaultAbi,
|
|
457
|
+
functionName: "setMaxUtilizationBps",
|
|
458
|
+
args: [value],
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
async setMaxSingleAccountBps(value: bigint): Promise<Hash> {
|
|
463
|
+
return this.write({
|
|
464
|
+
address: this.addresses.vault,
|
|
465
|
+
abi: mainVaultAbi,
|
|
466
|
+
functionName: "setMaxSingleAccountBps",
|
|
467
|
+
args: [value],
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
async setDailyDdDiscountBps(value: number): Promise<Hash> {
|
|
472
|
+
return this.write({
|
|
473
|
+
address: this.addresses.vault,
|
|
474
|
+
abi: mainVaultAbi,
|
|
475
|
+
functionName: "setDailyDdDiscountBps",
|
|
476
|
+
args: [value],
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"rootDir": "src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"types": ["node"]
|
|
16
|
+
},
|
|
17
|
+
"include": ["src"],
|
|
18
|
+
"exclude": ["node_modules", "dist"]
|
|
19
|
+
}
|