@ember-finance/sdk 2.1.2 → 2.2.0-rc.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/src/abis/EmberDepositParkingLot.json +899 -0
- package/dist/src/abis/EmberProtocolConfig.json +20 -2
- package/dist/src/abis/EmberVault.json +143 -2
- package/dist/src/api/v2/apis/accounts-api.d.ts +110 -0
- package/dist/src/api/v2/apis/accounts-api.js +207 -0
- package/dist/src/api/v2/apis/vaults-api.d.ts +34 -0
- package/dist/src/api/v2/apis/vaults-api.js +70 -0
- package/dist/src/api/v2/models/account-parking-lot-claimable.d.ts +36 -0
- package/dist/src/api/v2/models/account-parking-lot-claimable.js +14 -0
- package/dist/src/api/v2/models/account-pending-deposit.d.ts +111 -0
- package/dist/src/api/v2/models/account-pending-deposit.js +19 -0
- package/dist/src/api/v2/models/chain-vault-details.d.ts +6 -0
- package/dist/src/api/v2/models/evm-contracts.d.ts +25 -0
- package/dist/src/api/v2/models/evm-deposit-parking-lot.d.ts +66 -0
- package/dist/src/api/v2/models/evm-deposit-parking-lot.js +14 -0
- package/dist/src/api/v2/models/evm-timelock.d.ts +60 -0
- package/dist/src/api/v2/models/evm-timelock.js +14 -0
- package/dist/src/api/v2/models/evm-vault-validator.d.ts +60 -0
- package/dist/src/api/v2/models/evm-vault-validator.js +14 -0
- package/dist/src/api/v2/models/evm-vault.d.ts +6 -0
- package/dist/src/api/v2/models/index.d.ts +6 -0
- package/dist/src/api/v2/models/index.js +6 -0
- package/dist/src/api/v2/models/vault-detail.d.ts +6 -0
- package/dist/src/api/v2/models/vault-parking-lot-info.d.ts +60 -0
- package/dist/src/api/v2/models/vault-parking-lot-info.js +14 -0
- package/dist/src/evm-vaults/interfaces/index.d.ts +35 -0
- package/dist/src/evm-vaults/on-chain-calls/admin.d.ts +14 -0
- package/dist/src/evm-vaults/on-chain-calls/admin.js +17 -0
- package/dist/src/evm-vaults/on-chain-calls/operator.d.ts +9 -0
- package/dist/src/evm-vaults/on-chain-calls/operator.js +13 -0
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.d.ts +75 -0
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.js +148 -0
- package/dist/src/evm-vaults/on-chain-calls/user.d.ts +14 -0
- package/dist/src/evm-vaults/on-chain-calls/user.js +30 -0
- package/dist/src/evm-vaults/on-chain-calls/vault-admin.d.ts +28 -0
- package/dist/src/evm-vaults/on-chain-calls/vault-admin.js +42 -0
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.d.ts +25 -1
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.js +53 -0
- package/dist/src/evm-vaults/utils/deployment-parser.d.ts +16 -0
- package/dist/src/evm-vaults/utils/deployment-parser.js +27 -0
- package/package.json +1 -1
|
@@ -109,6 +109,23 @@ export class EVMAdminCalls extends EVMOnChainCalls {
|
|
|
109
109
|
const txCall = this.txBuilder.pauseNonAdminOperations(pause);
|
|
110
110
|
return this.execCall(txCall, options);
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Guardian fast-path equivalent of {@link pauseNonAdminOperations}: pause /
|
|
114
|
+
* unpause non-admin protocol operations without going through the timelock.
|
|
115
|
+
*
|
|
116
|
+
* The owner-gated `pauseNonAdminOperations` reverts with
|
|
117
|
+
* `OwnableUnauthorizedAccount` once `ProtocolConfig` ownership has been
|
|
118
|
+
* transferred to the admin timelock, so any caller signing with the
|
|
119
|
+
* guardian key must use this variant instead.
|
|
120
|
+
*
|
|
121
|
+
* @param pause Whether to pause non-admin operations
|
|
122
|
+
* @param options Optional tx execution params
|
|
123
|
+
* @returns EvmOnChainCallResponse
|
|
124
|
+
*/
|
|
125
|
+
async guardianPauseNonAdminOperations(pause, options) {
|
|
126
|
+
const txCall = this.txBuilder.guardianPauseNonAdminOperations(pause);
|
|
127
|
+
return this.execCall(txCall, options);
|
|
128
|
+
}
|
|
112
129
|
/**
|
|
113
130
|
* Update the max rate interval of the protocol
|
|
114
131
|
* @param maxRateInterval The new max rate interval
|
|
@@ -52,6 +52,15 @@ export declare class EVMOperatorCalls extends EVMOnChainCalls {
|
|
|
52
52
|
* @returns EvmOnChainCallResponse
|
|
53
53
|
*/
|
|
54
54
|
processWithdrawalRequests(vaultAddress: string, maxRequestCount: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Process queued async (parked) deposits, forwarding escrowed collateral
|
|
57
|
+
* into the vault and minting shares to each request's receiver. Operator-only.
|
|
58
|
+
* @param vaultAddress The vault the parking lot serves
|
|
59
|
+
* @param numRequests Max number of FIFO requests to process this call
|
|
60
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
61
|
+
* @returns EvmOnChainCallResponse
|
|
62
|
+
*/
|
|
63
|
+
processParkingLotDeposits(vaultAddress: string, numRequests: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
55
64
|
/**
|
|
56
65
|
* Collect accrued platform fees from a vault
|
|
57
66
|
* @param vaultAddress The address of the vault
|
|
@@ -63,6 +63,19 @@ export class EVMOperatorCalls extends EVMOnChainCalls {
|
|
|
63
63
|
const txCall = this.txBuilder.processWithdrawalRequests(vaultAddress, maxRequestCount, options?.isETHVault);
|
|
64
64
|
return this.execCall(txCall, options);
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Process queued async (parked) deposits, forwarding escrowed collateral
|
|
68
|
+
* into the vault and minting shares to each request's receiver. Operator-only.
|
|
69
|
+
* @param vaultAddress The vault the parking lot serves
|
|
70
|
+
* @param numRequests Max number of FIFO requests to process this call
|
|
71
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
72
|
+
* @returns EvmOnChainCallResponse
|
|
73
|
+
*/
|
|
74
|
+
async processParkingLotDeposits(vaultAddress, numRequests, options) {
|
|
75
|
+
const parkingLotAddress = this.parser.resolveParkingLotAddress(vaultAddress, options?.parkingLotAddress);
|
|
76
|
+
const txCall = this.txBuilder.processParkingLotDeposits(parkingLotAddress, numRequests);
|
|
77
|
+
return this.execCall(txCall, options);
|
|
78
|
+
}
|
|
66
79
|
// ============================================
|
|
67
80
|
// Fee Collection
|
|
68
81
|
// ============================================
|
|
@@ -60,6 +60,23 @@ export declare class EVMTxBuilder {
|
|
|
60
60
|
* @returns Transaction call object
|
|
61
61
|
*/
|
|
62
62
|
pauseNonAdminOperations(pause: boolean): ITransactionCall;
|
|
63
|
+
/**
|
|
64
|
+
* Guardian fast-path equivalent of {@link pauseNonAdminOperations}.
|
|
65
|
+
*
|
|
66
|
+
* The contract exposes two pause toggles:
|
|
67
|
+
* - `pauseNonAdminOperations` — `onlyOwner` (slow path; behind the timelock
|
|
68
|
+
* once ownership of `ProtocolConfig` has been
|
|
69
|
+
* transferred)
|
|
70
|
+
* - `guardianPauseNonAdminOperations` — `onlyGuardian` (instant, no timelock)
|
|
71
|
+
*
|
|
72
|
+
* Use this variant when signing with the guardian key. Calling the owner-path setter from a
|
|
73
|
+
* guardian signer will revert with `OwnableUnauthorizedAccount` on any chain whose
|
|
74
|
+
* `ProtocolConfig` ownership has moved to the timelock.
|
|
75
|
+
*
|
|
76
|
+
* @param pause True to pause, false to unpause
|
|
77
|
+
* @returns Transaction call object
|
|
78
|
+
*/
|
|
79
|
+
guardianPauseNonAdminOperations(pause: boolean): ITransactionCall;
|
|
63
80
|
/**
|
|
64
81
|
* Updates the platform fee recipient address
|
|
65
82
|
* @param recipient New recipient address
|
|
@@ -133,6 +150,39 @@ export declare class EVMTxBuilder {
|
|
|
133
150
|
* @returns Transaction call object
|
|
134
151
|
*/
|
|
135
152
|
updateVaultAdmin(vaultAddress: string, newAdmin: string): ITransactionCall;
|
|
153
|
+
/**
|
|
154
|
+
* Binds (or clears) a vault's deposit parking lot, enabling async-deposit
|
|
155
|
+
* gating. Routed through the protocol config; caller must be the vault admin.
|
|
156
|
+
* Pass the zero address to unbind and restore permissionless deposits.
|
|
157
|
+
* @param vaultAddress The vault to bind the parking lot to
|
|
158
|
+
* @param parkingLotAddress The parking lot address (or zero address to clear)
|
|
159
|
+
* @returns Transaction call object
|
|
160
|
+
*/
|
|
161
|
+
setVaultParkingLot(vaultAddress: string, parkingLotAddress: string): ITransactionCall;
|
|
162
|
+
/**
|
|
163
|
+
* Processes up to `numRequests` queued deposit requests in a parking lot,
|
|
164
|
+
* forwarding escrowed collateral into the vault (operator-only).
|
|
165
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
166
|
+
* @param numRequests Max number of FIFO requests to process this call
|
|
167
|
+
* @returns Transaction call object
|
|
168
|
+
*/
|
|
169
|
+
processParkingLotDeposits(parkingLotAddress: string, numRequests: NumStr): ITransactionCall;
|
|
170
|
+
/**
|
|
171
|
+
* Rotates the operator authorised to process a parking lot's queue
|
|
172
|
+
* (vault-admin only).
|
|
173
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
174
|
+
* @param newOperator The new operator address
|
|
175
|
+
* @returns Transaction call object
|
|
176
|
+
*/
|
|
177
|
+
setParkingLotOperator(parkingLotAddress: string, newOperator: string): ITransactionCall;
|
|
178
|
+
/**
|
|
179
|
+
* Pauses or resumes new deposit requests into a parking lot (vault admin or
|
|
180
|
+
* protocol guardian). Processing and cancellation remain available while paused.
|
|
181
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
182
|
+
* @param paused True to pause new deposits, false to resume
|
|
183
|
+
* @returns Transaction call object
|
|
184
|
+
*/
|
|
185
|
+
setParkingLotDepositsPaused(parkingLotAddress: string, paused: boolean): ITransactionCall;
|
|
136
186
|
/**
|
|
137
187
|
* Updates the paused status of a vault operation (called via ProtocolConfig)
|
|
138
188
|
* @param vaultAddress Address of the vault
|
|
@@ -248,6 +298,31 @@ export declare class EVMTxBuilder {
|
|
|
248
298
|
* @returns Transaction call object
|
|
249
299
|
*/
|
|
250
300
|
deposit(vaultAddress: string, assets: NumStr, receiver: string, isETHVault?: boolean): ITransactionCall;
|
|
301
|
+
/**
|
|
302
|
+
* Deposits assets into a vault's deposit parking lot (async deposit). The
|
|
303
|
+
* collateral is escrowed and queued; the operator later forwards it into the
|
|
304
|
+
* vault, minting shares to `receiver`. The caller must have approved the
|
|
305
|
+
* collateral to the parking lot address.
|
|
306
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
307
|
+
* @param assets Amount of assets to park
|
|
308
|
+
* @param receiver Address that will receive the minted shares when processed
|
|
309
|
+
* @returns Transaction call object
|
|
310
|
+
*/
|
|
311
|
+
depositToParkingLot(parkingLotAddress: string, assets: NumStr, receiver: string): ITransactionCall;
|
|
312
|
+
/**
|
|
313
|
+
* Cancels a pending parked deposit request, refunding the escrowed collateral.
|
|
314
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
315
|
+
* @param sequenceNumber FIFO sequence number of the request to cancel
|
|
316
|
+
* @returns Transaction call object
|
|
317
|
+
*/
|
|
318
|
+
cancelParkingLotDeposit(parkingLotAddress: string, sequenceNumber: NumStr): ITransactionCall;
|
|
319
|
+
/**
|
|
320
|
+
* Withdraws the caller's accrued claimable balance (undeliverable refunds)
|
|
321
|
+
* from the parking lot.
|
|
322
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
323
|
+
* @returns Transaction call object
|
|
324
|
+
*/
|
|
325
|
+
claimParkingLotRefund(parkingLotAddress: string): ITransactionCall;
|
|
251
326
|
/**
|
|
252
327
|
* Deposits assets to a vault using EIP-2612 permit (no separate approval needed)
|
|
253
328
|
* @param vaultAddress Address of the vault
|
|
@@ -4,6 +4,7 @@ import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json"
|
|
|
4
4
|
import EmberProtocolConfigABI from "../../abis/EmberProtocolConfig.json" with { type: "json" };
|
|
5
5
|
import ERC20TokenABI from "../../abis/ERC20Token.json" with { type: "json" };
|
|
6
6
|
import EmberVaultOFTAdapterABI from "../../abis/EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
|
|
7
|
+
import EmberDepositParkingLotABI from "../../abis/EmberDepositParkingLot.json" with { type: "json" };
|
|
7
8
|
/**
|
|
8
9
|
* EVM Transaction Builder for Ember Protocol (ERC-4626 Compatible)
|
|
9
10
|
*
|
|
@@ -82,6 +83,32 @@ export class EVMTxBuilder {
|
|
|
82
83
|
chainId: this.getChainId()
|
|
83
84
|
};
|
|
84
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Guardian fast-path equivalent of {@link pauseNonAdminOperations}.
|
|
88
|
+
*
|
|
89
|
+
* The contract exposes two pause toggles:
|
|
90
|
+
* - `pauseNonAdminOperations` — `onlyOwner` (slow path; behind the timelock
|
|
91
|
+
* once ownership of `ProtocolConfig` has been
|
|
92
|
+
* transferred)
|
|
93
|
+
* - `guardianPauseNonAdminOperations` — `onlyGuardian` (instant, no timelock)
|
|
94
|
+
*
|
|
95
|
+
* Use this variant when signing with the guardian key. Calling the owner-path setter from a
|
|
96
|
+
* guardian signer will revert with `OwnableUnauthorizedAccount` on any chain whose
|
|
97
|
+
* `ProtocolConfig` ownership has moved to the timelock.
|
|
98
|
+
*
|
|
99
|
+
* @param pause True to pause, false to unpause
|
|
100
|
+
* @returns Transaction call object
|
|
101
|
+
*/
|
|
102
|
+
guardianPauseNonAdminOperations(pause) {
|
|
103
|
+
return {
|
|
104
|
+
to: this.parser.getProtocolConfigAddress(),
|
|
105
|
+
functionName: "guardianPauseNonAdminOperations",
|
|
106
|
+
args: [pause],
|
|
107
|
+
abi: EmberProtocolConfigABI.abi,
|
|
108
|
+
value: 0n,
|
|
109
|
+
chainId: this.getChainId()
|
|
110
|
+
};
|
|
111
|
+
}
|
|
85
112
|
/**
|
|
86
113
|
* Updates the platform fee recipient address
|
|
87
114
|
* @param recipient New recipient address
|
|
@@ -250,6 +277,75 @@ export class EVMTxBuilder {
|
|
|
250
277
|
chainId: this.getChainId()
|
|
251
278
|
};
|
|
252
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* Binds (or clears) a vault's deposit parking lot, enabling async-deposit
|
|
282
|
+
* gating. Routed through the protocol config; caller must be the vault admin.
|
|
283
|
+
* Pass the zero address to unbind and restore permissionless deposits.
|
|
284
|
+
* @param vaultAddress The vault to bind the parking lot to
|
|
285
|
+
* @param parkingLotAddress The parking lot address (or zero address to clear)
|
|
286
|
+
* @returns Transaction call object
|
|
287
|
+
*/
|
|
288
|
+
setVaultParkingLot(vaultAddress, parkingLotAddress) {
|
|
289
|
+
return {
|
|
290
|
+
to: this.parser.getProtocolConfigAddress(),
|
|
291
|
+
functionName: "setVaultParkingLot",
|
|
292
|
+
args: [vaultAddress, parkingLotAddress],
|
|
293
|
+
abi: EmberProtocolConfigABI.abi,
|
|
294
|
+
value: 0n,
|
|
295
|
+
chainId: this.getChainId()
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Processes up to `numRequests` queued deposit requests in a parking lot,
|
|
300
|
+
* forwarding escrowed collateral into the vault (operator-only).
|
|
301
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
302
|
+
* @param numRequests Max number of FIFO requests to process this call
|
|
303
|
+
* @returns Transaction call object
|
|
304
|
+
*/
|
|
305
|
+
processParkingLotDeposits(parkingLotAddress, numRequests) {
|
|
306
|
+
return {
|
|
307
|
+
to: parkingLotAddress,
|
|
308
|
+
functionName: "processDeposits",
|
|
309
|
+
args: [BigInt(numRequests)],
|
|
310
|
+
abi: EmberDepositParkingLotABI.abi,
|
|
311
|
+
value: 0n,
|
|
312
|
+
chainId: this.getChainId()
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Rotates the operator authorised to process a parking lot's queue
|
|
317
|
+
* (vault-admin only).
|
|
318
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
319
|
+
* @param newOperator The new operator address
|
|
320
|
+
* @returns Transaction call object
|
|
321
|
+
*/
|
|
322
|
+
setParkingLotOperator(parkingLotAddress, newOperator) {
|
|
323
|
+
return {
|
|
324
|
+
to: parkingLotAddress,
|
|
325
|
+
functionName: "setOperator",
|
|
326
|
+
args: [newOperator],
|
|
327
|
+
abi: EmberDepositParkingLotABI.abi,
|
|
328
|
+
value: 0n,
|
|
329
|
+
chainId: this.getChainId()
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Pauses or resumes new deposit requests into a parking lot (vault admin or
|
|
334
|
+
* protocol guardian). Processing and cancellation remain available while paused.
|
|
335
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
336
|
+
* @param paused True to pause new deposits, false to resume
|
|
337
|
+
* @returns Transaction call object
|
|
338
|
+
*/
|
|
339
|
+
setParkingLotDepositsPaused(parkingLotAddress, paused) {
|
|
340
|
+
return {
|
|
341
|
+
to: parkingLotAddress,
|
|
342
|
+
functionName: "setDepositsPaused",
|
|
343
|
+
args: [paused],
|
|
344
|
+
abi: EmberDepositParkingLotABI.abi,
|
|
345
|
+
value: 0n,
|
|
346
|
+
chainId: this.getChainId()
|
|
347
|
+
};
|
|
348
|
+
}
|
|
253
349
|
/**
|
|
254
350
|
* Updates the paused status of a vault operation (called via ProtocolConfig)
|
|
255
351
|
* @param vaultAddress Address of the vault
|
|
@@ -507,6 +603,58 @@ export class EVMTxBuilder {
|
|
|
507
603
|
chainId: this.getChainId()
|
|
508
604
|
};
|
|
509
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* Deposits assets into a vault's deposit parking lot (async deposit). The
|
|
608
|
+
* collateral is escrowed and queued; the operator later forwards it into the
|
|
609
|
+
* vault, minting shares to `receiver`. The caller must have approved the
|
|
610
|
+
* collateral to the parking lot address.
|
|
611
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
612
|
+
* @param assets Amount of assets to park
|
|
613
|
+
* @param receiver Address that will receive the minted shares when processed
|
|
614
|
+
* @returns Transaction call object
|
|
615
|
+
*/
|
|
616
|
+
depositToParkingLot(parkingLotAddress, assets, receiver) {
|
|
617
|
+
return {
|
|
618
|
+
to: parkingLotAddress,
|
|
619
|
+
functionName: "deposit",
|
|
620
|
+
args: [BigInt(assets), receiver],
|
|
621
|
+
abi: EmberDepositParkingLotABI.abi,
|
|
622
|
+
value: 0n,
|
|
623
|
+
chainId: this.getChainId()
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Cancels a pending parked deposit request, refunding the escrowed collateral.
|
|
628
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
629
|
+
* @param sequenceNumber FIFO sequence number of the request to cancel
|
|
630
|
+
* @returns Transaction call object
|
|
631
|
+
*/
|
|
632
|
+
cancelParkingLotDeposit(parkingLotAddress, sequenceNumber) {
|
|
633
|
+
return {
|
|
634
|
+
to: parkingLotAddress,
|
|
635
|
+
functionName: "cancelDeposit",
|
|
636
|
+
args: [BigInt(sequenceNumber)],
|
|
637
|
+
abi: EmberDepositParkingLotABI.abi,
|
|
638
|
+
value: 0n,
|
|
639
|
+
chainId: this.getChainId()
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Withdraws the caller's accrued claimable balance (undeliverable refunds)
|
|
644
|
+
* from the parking lot.
|
|
645
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
646
|
+
* @returns Transaction call object
|
|
647
|
+
*/
|
|
648
|
+
claimParkingLotRefund(parkingLotAddress) {
|
|
649
|
+
return {
|
|
650
|
+
to: parkingLotAddress,
|
|
651
|
+
functionName: "claim",
|
|
652
|
+
args: [],
|
|
653
|
+
abi: EmberDepositParkingLotABI.abi,
|
|
654
|
+
value: 0n,
|
|
655
|
+
chainId: this.getChainId()
|
|
656
|
+
};
|
|
657
|
+
}
|
|
510
658
|
/**
|
|
511
659
|
* Deposits assets to a vault using EIP-2612 permit (no separate approval needed)
|
|
512
660
|
* @param vaultAddress Address of the vault
|
|
@@ -63,6 +63,20 @@ export declare class EVMUserCalls extends EVMOnChainCalls {
|
|
|
63
63
|
* @returns EvmOnChainCallResponse
|
|
64
64
|
*/
|
|
65
65
|
deposit(vaultAddress: string, assets: NumStr, options?: IUserCallOptions): Promise<EvmOnChainCallResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* Cancels a pending async (parked) deposit, refunding the escrowed collateral.
|
|
68
|
+
* @param vaultAddress The vault the parking lot serves
|
|
69
|
+
* @param sequenceNumber FIFO sequence number of the request to cancel
|
|
70
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
71
|
+
*/
|
|
72
|
+
cancelParkingLotDeposit(vaultAddress: string, sequenceNumber: NumStr, options?: IUserCallOptions): Promise<EvmOnChainCallResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Withdraws the caller's accrued claimable balance (undeliverable refunds)
|
|
75
|
+
* from the vault's parking lot.
|
|
76
|
+
* @param vaultAddress The vault the parking lot serves
|
|
77
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
78
|
+
*/
|
|
79
|
+
claimParkingLotRefund(vaultAddress: string, options?: IUserCallOptions): Promise<EvmOnChainCallResponse>;
|
|
66
80
|
/**
|
|
67
81
|
* Deposit assets into a vault using EIP-2612 permit (no separate approval needed)
|
|
68
82
|
*
|
|
@@ -69,9 +69,39 @@ export class EVMUserCalls extends EVMOnChainCalls {
|
|
|
69
69
|
*/
|
|
70
70
|
async deposit(vaultAddress, assets, options) {
|
|
71
71
|
const receiver = options?.receiver ?? (await this.getWalletAddress());
|
|
72
|
+
// Async deposit: route through the vault's deposit parking lot. Funds are
|
|
73
|
+
// escrowed + queued and forwarded into the vault later by the operator.
|
|
74
|
+
// The collateral must be approved to the parking lot (not the vault).
|
|
75
|
+
if (options?.depositToParkingLot) {
|
|
76
|
+
const parkingLotAddress = this.parser.resolveParkingLotAddress(vaultAddress, options.parkingLotAddress);
|
|
77
|
+
const txCall = this.txBuilder.depositToParkingLot(parkingLotAddress, assets, receiver);
|
|
78
|
+
return this.execCall(txCall, options);
|
|
79
|
+
}
|
|
72
80
|
const txCall = this.txBuilder.deposit(vaultAddress, assets, receiver, options?.isETHVault);
|
|
73
81
|
return this.execCall(txCall, options);
|
|
74
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Cancels a pending async (parked) deposit, refunding the escrowed collateral.
|
|
85
|
+
* @param vaultAddress The vault the parking lot serves
|
|
86
|
+
* @param sequenceNumber FIFO sequence number of the request to cancel
|
|
87
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
88
|
+
*/
|
|
89
|
+
async cancelParkingLotDeposit(vaultAddress, sequenceNumber, options) {
|
|
90
|
+
const parkingLotAddress = this.parser.resolveParkingLotAddress(vaultAddress, options?.parkingLotAddress);
|
|
91
|
+
const txCall = this.txBuilder.cancelParkingLotDeposit(parkingLotAddress, sequenceNumber);
|
|
92
|
+
return this.execCall(txCall, options);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Withdraws the caller's accrued claimable balance (undeliverable refunds)
|
|
96
|
+
* from the vault's parking lot.
|
|
97
|
+
* @param vaultAddress The vault the parking lot serves
|
|
98
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
99
|
+
*/
|
|
100
|
+
async claimParkingLotRefund(vaultAddress, options) {
|
|
101
|
+
const parkingLotAddress = this.parser.resolveParkingLotAddress(vaultAddress, options?.parkingLotAddress);
|
|
102
|
+
const txCall = this.txBuilder.claimParkingLotRefund(parkingLotAddress);
|
|
103
|
+
return this.execCall(txCall, options);
|
|
104
|
+
}
|
|
75
105
|
/**
|
|
76
106
|
* Deposit assets into a vault using EIP-2612 permit (no separate approval needed)
|
|
77
107
|
*
|
|
@@ -44,6 +44,34 @@ export declare class EVMVaultAdminCalls extends EVMOnChainCalls {
|
|
|
44
44
|
* @returns EvmOnChainCallResponse
|
|
45
45
|
*/
|
|
46
46
|
updateVaultOperator(vaultAddress: string, newOperator: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Bind (or clear) a vault's deposit parking lot, enabling async-deposit
|
|
49
|
+
* gating. Pass the zero address to unbind and restore permissionless deposits.
|
|
50
|
+
* Routed through the protocol config; caller must be the vault admin.
|
|
51
|
+
* @param vaultAddress The vault to bind
|
|
52
|
+
* @param parkingLotAddress The parking lot address (or zero address to clear)
|
|
53
|
+
* @param options Optional tx execution params
|
|
54
|
+
* @returns EvmOnChainCallResponse
|
|
55
|
+
*/
|
|
56
|
+
setVaultParkingLot(vaultAddress: string, parkingLotAddress: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Rotate the operator authorised to process the vault's parking lot queue
|
|
59
|
+
* (vault-admin only).
|
|
60
|
+
* @param vaultAddress The vault the parking lot serves
|
|
61
|
+
* @param newOperator The new operator address
|
|
62
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
63
|
+
* @returns EvmOnChainCallResponse
|
|
64
|
+
*/
|
|
65
|
+
setParkingLotOperator(vaultAddress: string, newOperator: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* Pause or resume new deposit requests into the vault's parking lot (vault
|
|
68
|
+
* admin or protocol guardian). Processing and cancellation stay available.
|
|
69
|
+
* @param vaultAddress The vault the parking lot serves
|
|
70
|
+
* @param paused True to pause new deposits, false to resume
|
|
71
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
72
|
+
* @returns EvmOnChainCallResponse
|
|
73
|
+
*/
|
|
74
|
+
setParkingLotDepositsPaused(vaultAddress: string, paused: boolean, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
47
75
|
/**
|
|
48
76
|
* Update the rate manager of a vault
|
|
49
77
|
* @param vaultAddress The address of the vault
|
|
@@ -49,6 +49,48 @@ export class EVMVaultAdminCalls extends EVMOnChainCalls {
|
|
|
49
49
|
const txCall = this.txBuilder.updateVaultOperator(vaultAddress, newOperator);
|
|
50
50
|
return this.execCall(txCall, options);
|
|
51
51
|
}
|
|
52
|
+
// ============================================
|
|
53
|
+
// Async Deposits (parking lot)
|
|
54
|
+
// ============================================
|
|
55
|
+
/**
|
|
56
|
+
* Bind (or clear) a vault's deposit parking lot, enabling async-deposit
|
|
57
|
+
* gating. Pass the zero address to unbind and restore permissionless deposits.
|
|
58
|
+
* Routed through the protocol config; caller must be the vault admin.
|
|
59
|
+
* @param vaultAddress The vault to bind
|
|
60
|
+
* @param parkingLotAddress The parking lot address (or zero address to clear)
|
|
61
|
+
* @param options Optional tx execution params
|
|
62
|
+
* @returns EvmOnChainCallResponse
|
|
63
|
+
*/
|
|
64
|
+
async setVaultParkingLot(vaultAddress, parkingLotAddress, options) {
|
|
65
|
+
const txCall = this.txBuilder.setVaultParkingLot(vaultAddress, parkingLotAddress);
|
|
66
|
+
return this.execCall(txCall, options);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Rotate the operator authorised to process the vault's parking lot queue
|
|
70
|
+
* (vault-admin only).
|
|
71
|
+
* @param vaultAddress The vault the parking lot serves
|
|
72
|
+
* @param newOperator The new operator address
|
|
73
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
74
|
+
* @returns EvmOnChainCallResponse
|
|
75
|
+
*/
|
|
76
|
+
async setParkingLotOperator(vaultAddress, newOperator, options) {
|
|
77
|
+
const parkingLotAddress = this.parser.resolveParkingLotAddress(vaultAddress, options?.parkingLotAddress);
|
|
78
|
+
const txCall = this.txBuilder.setParkingLotOperator(parkingLotAddress, newOperator);
|
|
79
|
+
return this.execCall(txCall, options);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Pause or resume new deposit requests into the vault's parking lot (vault
|
|
83
|
+
* admin or protocol guardian). Processing and cancellation stay available.
|
|
84
|
+
* @param vaultAddress The vault the parking lot serves
|
|
85
|
+
* @param paused True to pause new deposits, false to resume
|
|
86
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
87
|
+
* @returns EvmOnChainCallResponse
|
|
88
|
+
*/
|
|
89
|
+
async setParkingLotDepositsPaused(vaultAddress, paused, options) {
|
|
90
|
+
const parkingLotAddress = this.parser.resolveParkingLotAddress(vaultAddress, options?.parkingLotAddress);
|
|
91
|
+
const txCall = this.txBuilder.setParkingLotDepositsPaused(parkingLotAddress, paused);
|
|
92
|
+
return this.execCall(txCall, options);
|
|
93
|
+
}
|
|
52
94
|
/**
|
|
53
95
|
* Update the rate manager of a vault
|
|
54
96
|
* @param vaultAddress The address of the vault
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Provider } from "ethers";
|
|
2
2
|
import { EVMDeploymentParser } from "../utils/deployment-parser.js";
|
|
3
|
-
import { EvmProtocolInfo, IOFTSendParam, IOFTFeeQuote, IOFTVaultSupportedChain } from "../interfaces/index.js";
|
|
3
|
+
import { EvmProtocolInfo, IOFTSendParam, IOFTFeeQuote, IOFTVaultSupportedChain, IParkingLotInfo } from "../interfaces/index.js";
|
|
4
4
|
import { NumStr } from "../../common/types.js";
|
|
5
5
|
import { Chain, VaultsApi } from "../../api/v2/index.js";
|
|
6
6
|
/**
|
|
@@ -237,6 +237,30 @@ export declare class EVMVaultReader {
|
|
|
237
237
|
* @returns Asset address
|
|
238
238
|
*/
|
|
239
239
|
getAsset(vaultAddress: string, isETHVault?: boolean): Promise<string>;
|
|
240
|
+
/**
|
|
241
|
+
* Creates an ethers Contract instance for a deposit parking lot
|
|
242
|
+
*/
|
|
243
|
+
private getParkingLotContract;
|
|
244
|
+
/**
|
|
245
|
+
* Gets the vault's bound deposit parking lot address (zero address if async
|
|
246
|
+
* deposits are not enabled for the vault).
|
|
247
|
+
* @param vaultAddress The vault address
|
|
248
|
+
* @param isETHVault If true, uses EmberETHVault ABI
|
|
249
|
+
*/
|
|
250
|
+
getParkingLot(vaultAddress: string, isETHVault?: boolean): Promise<string>;
|
|
251
|
+
/**
|
|
252
|
+
* Reads the on-chain state of a deposit parking lot (operator, pause flag,
|
|
253
|
+
* pending totals, queue cursors).
|
|
254
|
+
* @param parkingLotAddress The parking lot address
|
|
255
|
+
*/
|
|
256
|
+
getParkingLotInfo(parkingLotAddress: string): Promise<IParkingLotInfo>;
|
|
257
|
+
/**
|
|
258
|
+
* Gets an account's accrued claimable balance (undeliverable refunds) in a
|
|
259
|
+
* parking lot.
|
|
260
|
+
* @param parkingLotAddress The parking lot address
|
|
261
|
+
* @param account The account to query
|
|
262
|
+
*/
|
|
263
|
+
getParkingLotClaimable(parkingLotAddress: string, account: string): Promise<bigint>;
|
|
240
264
|
/**
|
|
241
265
|
* Gets total assets under management
|
|
242
266
|
* @param vaultAddress The vault address
|
|
@@ -5,6 +5,7 @@ import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json"
|
|
|
5
5
|
import EmberProtocolConfigABI from "../../abis/EmberProtocolConfig.json" with { type: "json" };
|
|
6
6
|
import ERC20TokenABI from "../../abis/ERC20Token.json" with { type: "json" };
|
|
7
7
|
import EmberVaultOFTAdapterABI from "../../abis/EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
|
|
8
|
+
import EmberDepositParkingLotABI from "../../abis/EmberDepositParkingLot.json" with { type: "json" };
|
|
8
9
|
import { Configuration, VaultsApi } from "../../api/v2/index.js";
|
|
9
10
|
import { environmentConfig } from "../../common/constants.js";
|
|
10
11
|
/**
|
|
@@ -202,6 +203,58 @@ export class EVMVaultReader {
|
|
|
202
203
|
const vault = this.getVaultContract(vaultAddress, isETHVault);
|
|
203
204
|
return vault.asset();
|
|
204
205
|
}
|
|
206
|
+
// ========== Async Deposits (parking lot) ==========
|
|
207
|
+
/**
|
|
208
|
+
* Creates an ethers Contract instance for a deposit parking lot
|
|
209
|
+
*/
|
|
210
|
+
getParkingLotContract(parkingLotAddress) {
|
|
211
|
+
return new Contract(parkingLotAddress, EmberDepositParkingLotABI.abi, this.provider);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Gets the vault's bound deposit parking lot address (zero address if async
|
|
215
|
+
* deposits are not enabled for the vault).
|
|
216
|
+
* @param vaultAddress The vault address
|
|
217
|
+
* @param isETHVault If true, uses EmberETHVault ABI
|
|
218
|
+
*/
|
|
219
|
+
async getParkingLot(vaultAddress, isETHVault) {
|
|
220
|
+
const vault = this.getVaultContract(vaultAddress, isETHVault);
|
|
221
|
+
return vault.parkingLot();
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Reads the on-chain state of a deposit parking lot (operator, pause flag,
|
|
225
|
+
* pending totals, queue cursors).
|
|
226
|
+
* @param parkingLotAddress The parking lot address
|
|
227
|
+
*/
|
|
228
|
+
async getParkingLotInfo(parkingLotAddress) {
|
|
229
|
+
const parkingLot = this.getParkingLotContract(parkingLotAddress);
|
|
230
|
+
const [operator, depositsPaused, totalPendingAssets, livePendingCount, sequenceNumber, queueStartIndex] = await Promise.all([
|
|
231
|
+
parkingLot.operator(),
|
|
232
|
+
parkingLot.depositsPaused(),
|
|
233
|
+
parkingLot.totalPendingAssets(),
|
|
234
|
+
parkingLot.getLivePendingDepositsCount(),
|
|
235
|
+
parkingLot.sequenceNumber(),
|
|
236
|
+
parkingLot.queueStartIndex()
|
|
237
|
+
]);
|
|
238
|
+
return {
|
|
239
|
+
address: parkingLotAddress,
|
|
240
|
+
operator,
|
|
241
|
+
depositsPaused,
|
|
242
|
+
totalPendingAssets,
|
|
243
|
+
livePendingCount,
|
|
244
|
+
sequenceNumber,
|
|
245
|
+
queueStartIndex
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Gets an account's accrued claimable balance (undeliverable refunds) in a
|
|
250
|
+
* parking lot.
|
|
251
|
+
* @param parkingLotAddress The parking lot address
|
|
252
|
+
* @param account The account to query
|
|
253
|
+
*/
|
|
254
|
+
async getParkingLotClaimable(parkingLotAddress, account) {
|
|
255
|
+
const parkingLot = this.getParkingLotContract(parkingLotAddress);
|
|
256
|
+
return parkingLot.claimable(account);
|
|
257
|
+
}
|
|
205
258
|
/**
|
|
206
259
|
* Gets total assets under management
|
|
207
260
|
* @param vaultAddress The vault address
|
|
@@ -95,6 +95,22 @@ export declare class EVMDeploymentParser {
|
|
|
95
95
|
* Gets all receipt token symbols
|
|
96
96
|
*/
|
|
97
97
|
getReceiptTokenSymbols(): string[];
|
|
98
|
+
/**
|
|
99
|
+
* Finds the deposit parking lot address serving a given vault, from
|
|
100
|
+
* deployment info (async deposits). Returns undefined if the vault has no
|
|
101
|
+
* parking lot configured.
|
|
102
|
+
* @param vaultAddress The vault's proxy address
|
|
103
|
+
*/
|
|
104
|
+
getParkingLotAddressByVaultAddress(vaultAddress: string): string | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Resolves the deposit parking lot address for a vault from deployment info:
|
|
107
|
+
* returns the caller override if given, otherwise looks it up in
|
|
108
|
+
* `contracts.depositParkingLots`.
|
|
109
|
+
* @param vaultAddress The vault whose parking lot to resolve
|
|
110
|
+
* @param override Optional explicit parking lot address (skips the lookup)
|
|
111
|
+
* @throws if no override is given and the deployment has no parking lot for the vault
|
|
112
|
+
*/
|
|
113
|
+
resolveParkingLotAddress(vaultAddress: string, override?: string): string;
|
|
98
114
|
/**
|
|
99
115
|
* Finds the OFT adapter entry for a given vault address.
|
|
100
116
|
* @param vaultAddress The vault address (receipt token address in EVM deployment data)
|
|
@@ -157,6 +157,33 @@ export class EVMDeploymentParser {
|
|
|
157
157
|
getReceiptTokenSymbols() {
|
|
158
158
|
return Object.keys(this.deployment.contracts?.receiptTokens ?? {});
|
|
159
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Finds the deposit parking lot address serving a given vault, from
|
|
162
|
+
* deployment info (async deposits). Returns undefined if the vault has no
|
|
163
|
+
* parking lot configured.
|
|
164
|
+
* @param vaultAddress The vault's proxy address
|
|
165
|
+
*/
|
|
166
|
+
getParkingLotAddressByVaultAddress(vaultAddress) {
|
|
167
|
+
const entry = Object.values(this.deployment.contracts?.depositParkingLots ?? {}).find(parkingLot => parkingLot.vault?.toLowerCase() === vaultAddress.toLowerCase());
|
|
168
|
+
return entry?.proxyAddress;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Resolves the deposit parking lot address for a vault from deployment info:
|
|
172
|
+
* returns the caller override if given, otherwise looks it up in
|
|
173
|
+
* `contracts.depositParkingLots`.
|
|
174
|
+
* @param vaultAddress The vault whose parking lot to resolve
|
|
175
|
+
* @param override Optional explicit parking lot address (skips the lookup)
|
|
176
|
+
* @throws if no override is given and the deployment has no parking lot for the vault
|
|
177
|
+
*/
|
|
178
|
+
resolveParkingLotAddress(vaultAddress, override) {
|
|
179
|
+
if (override)
|
|
180
|
+
return override;
|
|
181
|
+
const parkingLot = this.getParkingLotAddressByVaultAddress(vaultAddress);
|
|
182
|
+
if (!parkingLot) {
|
|
183
|
+
throw new Error(`No parking lot configured for vault ${vaultAddress} in deployment info (async deposits not enabled, or the protocol info is stale — pass options.parkingLotAddress to override).`);
|
|
184
|
+
}
|
|
185
|
+
return parkingLot;
|
|
186
|
+
}
|
|
160
187
|
/**
|
|
161
188
|
* Finds the OFT adapter entry for a given vault address.
|
|
162
189
|
* @param vaultAddress The vault address (receipt token address in EVM deployment data)
|