@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.
Files changed (56) hide show
  1. package/SDK_IMPROVEMENT_PLAN.md +197 -0
  2. package/arch.md +448 -0
  3. package/dist/__tests__/account.test.d.ts +1 -0
  4. package/dist/__tests__/account.test.js +36 -0
  5. package/dist/__tests__/indexer.test.d.ts +1 -0
  6. package/dist/__tests__/indexer.test.js +230 -0
  7. package/dist/__tests__/lifecycle.test.d.ts +1 -0
  8. package/dist/__tests__/lifecycle.test.js +186 -0
  9. package/dist/__tests__/reads.test.d.ts +1 -0
  10. package/dist/__tests__/reads.test.js +185 -0
  11. package/dist/__tests__/utils.test.d.ts +1 -0
  12. package/dist/__tests__/utils.test.js +185 -0
  13. package/dist/abi/factory.d.ts +308 -0
  14. package/dist/abi/factory.js +399 -0
  15. package/dist/abi/fundedAccount.d.ts +1074 -0
  16. package/dist/abi/fundedAccount.js +1373 -0
  17. package/dist/abi/mainVault.d.ts +1448 -0
  18. package/dist/abi/mainVault.js +1865 -0
  19. package/dist/account.d.ts +55 -0
  20. package/dist/account.js +290 -0
  21. package/dist/constants.d.ts +48 -0
  22. package/dist/constants.js +42 -0
  23. package/dist/factory.d.ts +23 -0
  24. package/dist/factory.js +139 -0
  25. package/dist/index.d.ts +11 -0
  26. package/dist/index.js +14 -0
  27. package/dist/indexer.d.ts +57 -0
  28. package/dist/indexer.js +540 -0
  29. package/dist/sdk.d.ts +22 -0
  30. package/dist/sdk.js +89 -0
  31. package/dist/types.d.ts +384 -0
  32. package/dist/types.js +11 -0
  33. package/dist/utils.d.ts +21 -0
  34. package/dist/utils.js +89 -0
  35. package/dist/vault.d.ts +60 -0
  36. package/dist/vault.js +429 -0
  37. package/package.json +32 -0
  38. package/src/__tests__/account.test.ts +40 -0
  39. package/src/__tests__/indexer.test.ts +255 -0
  40. package/src/__tests__/lifecycle.test.ts +231 -0
  41. package/src/__tests__/reads.test.ts +209 -0
  42. package/src/__tests__/utils.test.ts +245 -0
  43. package/src/abi/factory.ts +399 -0
  44. package/src/abi/fundedAccount.ts +1373 -0
  45. package/src/abi/mainVault.ts +1865 -0
  46. package/src/account.ts +339 -0
  47. package/src/constants.ts +50 -0
  48. package/src/factory.ts +157 -0
  49. package/src/index.ts +16 -0
  50. package/src/indexer.ts +636 -0
  51. package/src/sdk.ts +93 -0
  52. package/src/types.ts +426 -0
  53. package/src/utils.ts +143 -0
  54. package/src/vault.ts +479 -0
  55. package/tsconfig.json +19 -0
  56. package/vitest.config.ts +8 -0
@@ -0,0 +1,384 @@
1
+ import type { Address, WalletClient } from "viem";
2
+ import type { ADDRESSES } from "./constants.js";
3
+ export interface SDKConfig {
4
+ rpcUrl?: string;
5
+ graphqlUrl: string;
6
+ graphqlWsUrl?: string;
7
+ walletClient?: WalletClient;
8
+ fetchFn?: typeof fetch;
9
+ webSocketCtor?: WebSocketConstructor;
10
+ addresses?: Partial<typeof ADDRESSES>;
11
+ }
12
+ export interface WebSocketLike {
13
+ readyState: number;
14
+ send(data: string): void;
15
+ close(): void;
16
+ onopen: ((this: unknown, ...args: unknown[]) => unknown) | null;
17
+ onmessage: ((this: unknown, event: {
18
+ data: unknown;
19
+ }, ...args: unknown[]) => unknown) | null;
20
+ onclose: ((this: unknown, ...args: unknown[]) => unknown) | null;
21
+ onerror: ((this: unknown, ...args: unknown[]) => unknown) | null;
22
+ }
23
+ export interface WebSocketConstructor {
24
+ new (url: string, protocols?: string | string[]): WebSocketLike;
25
+ readonly OPEN: number;
26
+ }
27
+ export declare enum AccountState {
28
+ Uninitialized = 0,
29
+ Initialized = 1,
30
+ Active = 2,
31
+ WithdrawalPending = 3,
32
+ Closing = 4,
33
+ Returning = 5,
34
+ Closed = 6
35
+ }
36
+ export type AccountStateLabel = "UNINITIALIZED" | "INITIALIZED" | "ACTIVE" | "WITHDRAWAL_PENDING" | "CLOSING" | "RETURNING" | "CLOSED";
37
+ export type IndexerAccountStateLabel = "INITIALIZED" | "ACTIVE" | "WITHDRAWAL_PENDING" | "CLOSING" | "RETURNING" | "CLOSED";
38
+ export type BreachType = "TRAILING_DRAWDOWN" | "DAILY_DRAWDOWN" | "LEVERAGE" | "POSITION_LEVERAGE" | "UNAUTHORIZED_ASSET" | "SUBSCRIPTION_EXPIRED";
39
+ export interface VaultStats {
40
+ totalAssets: bigint;
41
+ sharePrice: bigint;
42
+ utilizationBps: bigint;
43
+ availableForAllocation: bigint;
44
+ maxAccountSize: bigint;
45
+ remainingCap: bigint;
46
+ paused: boolean;
47
+ feeMultiplier: number;
48
+ subscriptionFeeMultiplier: number;
49
+ totalShares: bigint;
50
+ totalAllocated: bigint;
51
+ owner: Address;
52
+ pendingOwner: Address;
53
+ relayer: Address;
54
+ protocolFeeReceiver: Address;
55
+ maxCap: bigint;
56
+ hypeForSpot: bigint;
57
+ factory: Address;
58
+ minBuilderShares: bigint;
59
+ builderLeverage: bigint;
60
+ protocolFeeBps: bigint;
61
+ minAccountSize: bigint;
62
+ maxAccountSizeLimit: bigint;
63
+ minDrawdownBps: number;
64
+ maxDrawdownBps: number;
65
+ maxUtilizationBps: bigint;
66
+ maxSingleAccountBps: bigint;
67
+ dailyDdDiscountBps: number;
68
+ }
69
+ export interface LPPosition {
70
+ shares: bigint;
71
+ sharesValue: bigint;
72
+ withdrawableShares: bigint;
73
+ }
74
+ export interface BuilderInfo {
75
+ active: boolean;
76
+ activeFunded: bigint;
77
+ availableFunded: bigint;
78
+ }
79
+ export interface AccountDetails {
80
+ address: Address;
81
+ state: AccountState;
82
+ owner: Address;
83
+ builder: Address;
84
+ accountSize: bigint;
85
+ drawdownBps: number;
86
+ dailyDrawdownEnabled: boolean;
87
+ subscriptionFeeMultiplier: number;
88
+ highWaterMark: bigint;
89
+ dayStartValue: bigint;
90
+ activatedAt: bigint;
91
+ subscriptionPaidUntil: bigint;
92
+ subscriptionCancelled: boolean;
93
+ pendingSubscriptionFee: bigint;
94
+ apiWallet: Address;
95
+ riskEngineWallet: Address;
96
+ builderRiskEngineWallet: Address;
97
+ checkpointIndex: number;
98
+ totalCheckpoints: number;
99
+ profitableDaysCount: number;
100
+ lastCheckpointDay: bigint;
101
+ closingInitiatedAt: number;
102
+ returnInitiatedAt: number;
103
+ pendingWithdrawal: {
104
+ profit: bigint;
105
+ requestedAt: number;
106
+ };
107
+ trailingFloor: bigint;
108
+ dailyFloor: bigint;
109
+ subscriptionFee: bigint;
110
+ isSubscriptionActive: boolean;
111
+ canWithdrawProfit: boolean;
112
+ checkpoints: Array<{
113
+ accountValue: bigint;
114
+ timestamp: number;
115
+ profitable: boolean;
116
+ }>;
117
+ }
118
+ export interface GqlVault {
119
+ id: string;
120
+ address: string;
121
+ totalDeposits: string;
122
+ totalWithdrawals: string;
123
+ totalActivationFees: string;
124
+ cumulativeActivationFeesToVault: string;
125
+ totalAllocated: string;
126
+ totalShares: string;
127
+ cumulativeProfitShares: string;
128
+ cumulativeCancelledProfit: string;
129
+ cumulativeSubscriptionFees: string;
130
+ cumulativeProtocolFeesRouted: string;
131
+ cumulativeHypercoreFees: string;
132
+ cumulativeAccountGains: string;
133
+ cumulativeAccountLosses: string;
134
+ cumulativeRescuedFunds: string;
135
+ totalAccountsActivated: number;
136
+ totalAccountsActive: number;
137
+ totalAccountsClosed: number;
138
+ paused: boolean;
139
+ subscriptionFeeMultiplier: number;
140
+ protocolFeeBps: number;
141
+ protocolFeeReceiver: string | null;
142
+ updatedAt: string;
143
+ }
144
+ export interface GqlLP {
145
+ id: string;
146
+ totalDeposited: string;
147
+ totalWithdrawn: string;
148
+ depositCount: number;
149
+ withdrawCount: number;
150
+ lastActionAt: string;
151
+ }
152
+ export interface GqlBuilder {
153
+ id: string;
154
+ address: string;
155
+ vaultAddress: string;
156
+ active: boolean;
157
+ totalAccountsActivated: number;
158
+ totalAccountsClosed: number;
159
+ activeAccounts: number;
160
+ registeredAt: string;
161
+ deactivatedAt: string | null;
162
+ }
163
+ export interface GqlAccount {
164
+ id: string;
165
+ owner: string;
166
+ builder: {
167
+ id: string;
168
+ address: string;
169
+ vaultAddress: string;
170
+ };
171
+ vaultAddress: string;
172
+ factoryAddress: string;
173
+ state: IndexerAccountStateLabel;
174
+ accountSize: string;
175
+ drawdownBps: number;
176
+ dailyDrawdownEnabled: boolean;
177
+ activationFee: string;
178
+ highWaterMark: string;
179
+ profitableDaysCount: number;
180
+ lastCheckpointDay: string;
181
+ totalCheckpoints: number;
182
+ subscriptionPaidUntil: string;
183
+ subscriptionCancelled: boolean;
184
+ pendingSubscriptionFee: string;
185
+ subscriptionFeeMultiplier: number;
186
+ dayStartValue: string;
187
+ apiWallet: string | null;
188
+ riskEngineWallet: string | null;
189
+ builderRiskEngineWallet: string | null;
190
+ createdAt: string;
191
+ activatedAt: string | null;
192
+ closingInitiatedAt: string | null;
193
+ returnInitiatedAt: string | null;
194
+ closedAt: string | null;
195
+ returnedAmount: string | null;
196
+ breachType: BreachType | null;
197
+ breachValue: string | null;
198
+ breachFloor: string | null;
199
+ closePendingSubFee: string | null;
200
+ closePendingProfit: string | null;
201
+ lastWithdrawalId: string | null;
202
+ updatedAt: string;
203
+ }
204
+ export interface GqlCheckpoint {
205
+ id: string;
206
+ dayNumber: string;
207
+ accountValue: string;
208
+ previousValue: string;
209
+ profitable: boolean;
210
+ profitableDaysCount: number;
211
+ timestamp: string;
212
+ }
213
+ export interface GqlProfitWithdrawal {
214
+ id: string;
215
+ profit: string;
216
+ ownerAmount: string;
217
+ vaultAmount: string;
218
+ protocolAmount: string;
219
+ status: "REQUESTED" | "CLAIMED" | "CANCELLED";
220
+ requestedAt: string;
221
+ claimedAt: string | null;
222
+ cancelledAt: string | null;
223
+ }
224
+ export interface GqlSubscriptionPayment {
225
+ id: string;
226
+ amount: string;
227
+ paidUntil: string;
228
+ timestamp: string;
229
+ }
230
+ export interface GqlDeposit {
231
+ id: string;
232
+ lp: {
233
+ id: string;
234
+ };
235
+ amount: string;
236
+ sharesReceived: string;
237
+ timestamp: string;
238
+ blockNumber?: number;
239
+ txHash: string;
240
+ }
241
+ export interface GqlWithdrawal {
242
+ id: string;
243
+ lp: {
244
+ id: string;
245
+ };
246
+ amount: string;
247
+ sharesBurned: string;
248
+ timestamp: string;
249
+ blockNumber?: number;
250
+ txHash: string;
251
+ }
252
+ export interface GqlAccountEvent {
253
+ id: string;
254
+ eventType: string;
255
+ data: string;
256
+ timestamp: string;
257
+ blockNumber: number;
258
+ txHash: string;
259
+ }
260
+ export interface GqlAllowedPerp {
261
+ id: string;
262
+ vaultAddress: string;
263
+ perpIndex: number;
264
+ allowed: boolean;
265
+ }
266
+ export interface GqlDelegate {
267
+ id: string;
268
+ vaultAddress: string;
269
+ delegateAddress: string;
270
+ builderAddress: string;
271
+ }
272
+ export interface GqlProtocolConfig {
273
+ id: string;
274
+ vaultAddress: string;
275
+ factoryAddress: string;
276
+ updatedAt: string;
277
+ }
278
+ export type GqlConfigContractType = "MainVault" | "FundedAccountFactory";
279
+ export interface GqlMainVaultConfig {
280
+ id: string;
281
+ vaultAddress: string;
282
+ factoryAddress: string;
283
+ owner: string;
284
+ pendingOwner: string;
285
+ relayer: string;
286
+ paused: boolean;
287
+ protocolFeeReceiver: string;
288
+ feeMultiplier: number;
289
+ subscriptionFeeMultiplier: number;
290
+ dailyDdDiscountBps: number;
291
+ minBuilderShares: string;
292
+ builderLeverage: string;
293
+ protocolFeeBps: number;
294
+ minAccountSize: string;
295
+ maxAccountSize: string;
296
+ minDrawdownBps: number;
297
+ maxDrawdownBps: number;
298
+ maxUtilizationBps: number;
299
+ maxSingleAccountBps: number;
300
+ hypeForSpot: string;
301
+ maxCap: string;
302
+ createdAt: string;
303
+ updatedAt: string;
304
+ }
305
+ export interface GqlFactoryConfig {
306
+ id: string;
307
+ factoryAddress: string;
308
+ vaultAddress: string;
309
+ owner: string;
310
+ pendingOwner: string;
311
+ createdAt: string;
312
+ updatedAt: string;
313
+ }
314
+ export interface GqlConfigChange {
315
+ id: string;
316
+ contractAddress: string;
317
+ contractType: GqlConfigContractType;
318
+ field: string;
319
+ oldValue: string;
320
+ newValue: string;
321
+ blockNumber: number;
322
+ timestamp: string;
323
+ txHash: string;
324
+ }
325
+ export interface GqlVaultDayData {
326
+ id: string;
327
+ date: number;
328
+ dayNumber: number;
329
+ evmBalance: string;
330
+ totalAllocated: string;
331
+ totalAssets: string;
332
+ totalShares: string;
333
+ sharePrice: string;
334
+ dailyDeposits: string;
335
+ dailyWithdrawals: string;
336
+ dailyNetLpFlow: string;
337
+ dailyActivationFees: string;
338
+ dailyActivationFeesToVault: string;
339
+ dailyProfitShares: string;
340
+ dailyCancelledProfit: string;
341
+ dailySubscriptionFees: string;
342
+ dailyProtocolFeesRouted: string;
343
+ dailyHypercoreFees: string;
344
+ dailyRescuedFunds: string;
345
+ dailyAccountReturnAmount: string;
346
+ dailyAccountPrincipalReturned: string;
347
+ dailyAccountGains: string;
348
+ dailyAccountLosses: string;
349
+ dailyPerformancePnl: string;
350
+ totalAccountsActivated: number;
351
+ totalAccountsActive: number;
352
+ totalAccountsClosed: number;
353
+ accountsActivatedToday: number;
354
+ accountsClosedToday: number;
355
+ navChange24h: string;
356
+ sharePriceChange24h: string;
357
+ return24hBps: number;
358
+ paused: boolean;
359
+ updatedAt: string;
360
+ }
361
+ export interface GqlLiquidityProviderDayData {
362
+ id: string;
363
+ lp: {
364
+ id: string;
365
+ };
366
+ date: number;
367
+ dayNumber: number;
368
+ shares: string;
369
+ sharesValue: string;
370
+ dailyDeposits: string;
371
+ dailyWithdrawals: string;
372
+ depositCount: number;
373
+ withdrawCount: number;
374
+ }
375
+ export interface Pagination {
376
+ limit?: number;
377
+ offset?: number;
378
+ }
379
+ export interface ConfigChangeFilters extends Pagination {
380
+ contractAddress?: string;
381
+ contractType?: GqlConfigContractType;
382
+ field?: string;
383
+ }
384
+ export type Unsubscribe = () => void;
package/dist/types.js ADDED
@@ -0,0 +1,11 @@
1
+ // ── Enums ───────────────────────────────────────────
2
+ export var AccountState;
3
+ (function (AccountState) {
4
+ AccountState[AccountState["Uninitialized"] = 0] = "Uninitialized";
5
+ AccountState[AccountState["Initialized"] = 1] = "Initialized";
6
+ AccountState[AccountState["Active"] = 2] = "Active";
7
+ AccountState[AccountState["WithdrawalPending"] = 3] = "WithdrawalPending";
8
+ AccountState[AccountState["Closing"] = 4] = "Closing";
9
+ AccountState[AccountState["Returning"] = 5] = "Returning";
10
+ AccountState[AccountState["Closed"] = 6] = "Closed";
11
+ })(AccountState || (AccountState = {}));
@@ -0,0 +1,21 @@
1
+ import { AccountState, type AccountStateLabel } from "./types.js";
2
+ export declare function fromUsdc(amount: bigint): number;
3
+ export declare function toUsdc(amount: number): bigint;
4
+ export declare function from8Dec(value: bigint): number;
5
+ export declare function toUsdc6(value8dec: bigint): bigint;
6
+ export declare function to8Dec(value6dec: bigint): bigint;
7
+ export declare function formatUsd(amount: bigint, dec?: number): string;
8
+ export declare function trailingFloor(hwm: bigint, drawdownBps: number): bigint;
9
+ export declare function dailyFloor(dayStartValue: bigint, drawdownBps: number): bigint;
10
+ export declare function isTrailingBreached(value: bigint, hwm: bigint, bps: number): boolean;
11
+ export declare function isDailyBreached(value: bigint, dsv: bigint, bps: number): boolean;
12
+ export declare function activationFee(accountSize: bigint, drawdownBps: number, dailyDD: boolean, feeMultiplier?: number, dailyDdDiscountBps?: number): bigint;
13
+ export declare function subscriptionFee(accountSize: bigint, subFeeMultiplier: number): bigint;
14
+ export declare function subscriptionFee(accountSize: bigint, _drawdownBps: number, _dailyDD: boolean, subFeeMultiplier: number): bigint;
15
+ export declare function splitProfit(profit: bigint): {
16
+ owner: bigint;
17
+ vault: bigint;
18
+ protocol: bigint;
19
+ };
20
+ export declare function stateToLabel(state: AccountState): AccountStateLabel;
21
+ export declare function labelToState(label: AccountStateLabel): AccountState;
package/dist/utils.js ADDED
@@ -0,0 +1,89 @@
1
+ import { BPS, DAILY_DD_DISCOUNT_BPS, DECIMALS_MULTIPLIER, OWNER_PROFIT_BPS, PROTOCOL_PROFIT_BPS, USDC_DECIMALS, } from "./constants.js";
2
+ import { AccountState } from "./types.js";
3
+ // ── Decimals ────────────────────────────────────────
4
+ export function fromUsdc(amount) {
5
+ return Number(amount) / 10 ** USDC_DECIMALS;
6
+ }
7
+ export function toUsdc(amount) {
8
+ return BigInt(Math.round(amount * 10 ** USDC_DECIMALS));
9
+ }
10
+ export function from8Dec(value) {
11
+ return Number(value) / 1e8;
12
+ }
13
+ export function toUsdc6(value8dec) {
14
+ return value8dec / DECIMALS_MULTIPLIER;
15
+ }
16
+ export function to8Dec(value6dec) {
17
+ return value6dec * DECIMALS_MULTIPLIER;
18
+ }
19
+ export function formatUsd(amount, dec = USDC_DECIMALS) {
20
+ const num = Number(amount) / 10 ** dec;
21
+ return "$" + num.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
22
+ }
23
+ // ── Drawdown ────────────────────────────────────────
24
+ export function trailingFloor(hwm, drawdownBps) {
25
+ return hwm - (hwm * BigInt(drawdownBps)) / BPS;
26
+ }
27
+ export function dailyFloor(dayStartValue, drawdownBps) {
28
+ const dailyBps = BigInt(drawdownBps) / 2n;
29
+ return dayStartValue - (dayStartValue * dailyBps) / BPS;
30
+ }
31
+ export function isTrailingBreached(value, hwm, bps) {
32
+ return value < trailingFloor(hwm, bps);
33
+ }
34
+ export function isDailyBreached(value, dsv, bps) {
35
+ return value < dailyFloor(dsv, bps);
36
+ }
37
+ // ── Fees ────────────────────────────────────────────
38
+ const FEE_DIVISOR = 1000000n;
39
+ const USDC_UNIT = 1000000n;
40
+ function roundUpUsdc(fee) {
41
+ return ((fee + USDC_UNIT - 1n) / USDC_UNIT) * USDC_UNIT;
42
+ }
43
+ function applyDailyDiscount(fee, discountBps) {
44
+ return (fee * (BPS - discountBps)) / BPS;
45
+ }
46
+ export function activationFee(accountSize, drawdownBps, dailyDD, feeMultiplier = 120, dailyDdDiscountBps = Number(DAILY_DD_DISCOUNT_BPS)) {
47
+ let fee = (accountSize * BigInt(drawdownBps) * BigInt(feeMultiplier)) / FEE_DIVISOR;
48
+ if (dailyDD) {
49
+ fee = applyDailyDiscount(fee, BigInt(dailyDdDiscountBps));
50
+ }
51
+ return roundUpUsdc(fee);
52
+ }
53
+ export function subscriptionFee(accountSize, a, _b, c) {
54
+ const subFeeMultiplier = c ?? a;
55
+ const fee = (accountSize * BigInt(subFeeMultiplier)) / BPS;
56
+ return roundUpUsdc(fee);
57
+ }
58
+ // ── Profit split ────────────────────────────────────
59
+ export function splitProfit(profit) {
60
+ const owner = (profit * OWNER_PROFIT_BPS) / BPS;
61
+ const protocol = (profit * PROTOCOL_PROFIT_BPS) / BPS;
62
+ const vault = profit - owner - protocol;
63
+ return { owner, vault, protocol };
64
+ }
65
+ // ── Enum mapping ────────────────────────────────────
66
+ const stateLabels = {
67
+ [AccountState.Uninitialized]: "UNINITIALIZED",
68
+ [AccountState.Initialized]: "INITIALIZED",
69
+ [AccountState.Active]: "ACTIVE",
70
+ [AccountState.WithdrawalPending]: "WITHDRAWAL_PENDING",
71
+ [AccountState.Closing]: "CLOSING",
72
+ [AccountState.Returning]: "RETURNING",
73
+ [AccountState.Closed]: "CLOSED",
74
+ };
75
+ const labelStates = {
76
+ UNINITIALIZED: AccountState.Uninitialized,
77
+ INITIALIZED: AccountState.Initialized,
78
+ ACTIVE: AccountState.Active,
79
+ WITHDRAWAL_PENDING: AccountState.WithdrawalPending,
80
+ CLOSING: AccountState.Closing,
81
+ RETURNING: AccountState.Returning,
82
+ CLOSED: AccountState.Closed,
83
+ };
84
+ export function stateToLabel(state) {
85
+ return stateLabels[state];
86
+ }
87
+ export function labelToState(label) {
88
+ return labelStates[label];
89
+ }
@@ -0,0 +1,60 @@
1
+ import type { Address, Chain, Hash, PublicClient, WalletClient } from "viem";
2
+ import type { BuilderInfo, LPPosition, VaultStats } from "./types.js";
3
+ export declare class VaultModule {
4
+ private publicClient;
5
+ private walletClient;
6
+ private chain;
7
+ private addresses;
8
+ constructor(publicClient: PublicClient, walletClient: WalletClient | undefined, chain: Chain, addresses: {
9
+ vault: Address;
10
+ usdc: Address;
11
+ });
12
+ getStats(): Promise<VaultStats>;
13
+ getLPPosition(account: Address): Promise<LPPosition>;
14
+ getBuilderInfo(builder: Address): Promise<BuilderInfo>;
15
+ getAllowedPerps(): Promise<number[]>;
16
+ isAllowedPerp(index: number): Promise<boolean>;
17
+ calculateFee(size: bigint, bps: number, dailyDD: boolean): Promise<bigint>;
18
+ isPaused(): Promise<boolean>;
19
+ getRemainingCap(): Promise<bigint>;
20
+ isFundedAccount(account: Address): Promise<boolean>;
21
+ getDelegateBuilder(delegate: Address): Promise<Address>;
22
+ private requireWallet;
23
+ private write;
24
+ deposit(amount: bigint): Promise<Hash>;
25
+ withdraw(shares: bigint): Promise<Hash>;
26
+ approveUsdc(amount: bigint): Promise<Hash>;
27
+ registerBuilder(): Promise<Hash>;
28
+ setDelegate(delegate: Address): Promise<Hash>;
29
+ removeDelegate(delegate: Address): Promise<Hash>;
30
+ activateFunded(p: {
31
+ trader: Address;
32
+ accountSize: bigint;
33
+ drawdownBps: number;
34
+ dailyDrawdownEnabled: boolean;
35
+ hypeValue?: bigint;
36
+ }): Promise<Hash>;
37
+ pause(): Promise<Hash>;
38
+ unpause(): Promise<Hash>;
39
+ addAllowedPerp(index: number): Promise<Hash>;
40
+ removeAllowedPerp(index: number): Promise<Hash>;
41
+ setRelayer(addr: Address): Promise<Hash>;
42
+ setFactory(addr: Address): Promise<Hash>;
43
+ setProtocolFeeReceiver(addr: Address): Promise<Hash>;
44
+ transferOwnership(newOwner: Address): Promise<Hash>;
45
+ acceptOwnership(): Promise<Hash>;
46
+ setFeeMultiplier(value: number): Promise<Hash>;
47
+ setSubscriptionFeeMultiplier(value: number): Promise<Hash>;
48
+ setHypeForSpot(value: bigint): Promise<Hash>;
49
+ setMaxCap(value: bigint): Promise<Hash>;
50
+ setMinBuilderShares(value: bigint): Promise<Hash>;
51
+ setBuilderLeverage(value: bigint): Promise<Hash>;
52
+ setProtocolFeeBps(value: bigint): Promise<Hash>;
53
+ setMinAccountSize(value: bigint): Promise<Hash>;
54
+ setMaxAccountSize(value: bigint): Promise<Hash>;
55
+ setMinDrawdownBps(value: number): Promise<Hash>;
56
+ setMaxDrawdownBps(value: number): Promise<Hash>;
57
+ setMaxUtilizationBps(value: bigint): Promise<Hash>;
58
+ setMaxSingleAccountBps(value: bigint): Promise<Hash>;
59
+ setDailyDdDiscountBps(value: number): Promise<Hash>;
60
+ }