@ember-finance/sdk 2.11.0-pre.7 → 2.11.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 +175 -43
- package/dist/src/api/v2/apis/vaults-api.d.ts +0 -42
- package/dist/src/api/v2/apis/vaults-api.js +0 -87
- package/dist/src/api/v2/models/chain.d.ts +0 -6
- package/dist/src/api/v2/models/index.d.ts +0 -3
- package/dist/src/api/v2/models/index.js +0 -3
- package/dist/src/api/v2/models/instant-withdraw-config.d.ts +2 -21
- package/dist/src/api/v2/models/poc-report-protocol.d.ts +0 -13
- package/dist/src/api/v2/models/transparency-row.d.ts +1 -1
- package/dist/src/evm-vaults/interfaces/index.d.ts +5 -0
- package/dist/src/evm-vaults/on-chain-calls/operator.d.ts +16 -0
- package/dist/src/evm-vaults/on-chain-calls/operator.js +20 -0
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.d.ts +21 -0
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.js +39 -0
- package/dist/src/evm-vaults/on-chain-calls/vault-admin.d.ts +16 -0
- package/dist/src/evm-vaults/on-chain-calls/vault-admin.js +20 -0
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.js +3 -1
- package/package.json +1 -6
- package/dist/src/api/v2/models/coin-placement.d.ts +0 -113
- package/dist/src/api/v2/models/coin-placement.js +0 -17
- package/dist/src/api/v2/models/coin-placements-response.d.ts +0 -25
- package/dist/src/api/v2/models/coin-placements-response.js +0 -14
- package/dist/src/api/v2/models/poc-report-protocol-asset.d.ts +0 -60
- package/dist/src/api/v2/models/poc-report-protocol-asset.js +0 -18
- package/dist/src/placements/adapters/alphalend.d.ts +0 -1
- package/dist/src/placements/adapters/alphalend.js +0 -58
- package/dist/src/placements/adapters/bluefin-spot.d.ts +0 -1
- package/dist/src/placements/adapters/bluefin-spot.js +0 -78
- package/dist/src/placements/adapters/current.d.ts +0 -1
- package/dist/src/placements/adapters/current.js +0 -70
- package/dist/src/placements/adapters/evm-protocols.d.ts +0 -1
- package/dist/src/placements/adapters/evm-protocols.js +0 -8
- package/dist/src/placements/adapters/factory.d.ts +0 -15
- package/dist/src/placements/adapters/factory.js +0 -62
- package/dist/src/placements/adapters/index.d.ts +0 -14
- package/dist/src/placements/adapters/index.js +0 -25
- package/dist/src/placements/adapters/navi.d.ts +0 -1
- package/dist/src/placements/adapters/navi.js +0 -53
- package/dist/src/placements/adapters/pendle.d.ts +0 -9
- package/dist/src/placements/adapters/pendle.js +0 -108
- package/dist/src/placements/adapters/royco.d.ts +0 -2
- package/dist/src/placements/adapters/royco.js +0 -49
- package/dist/src/placements/adapters/suilend.d.ts +0 -1
- package/dist/src/placements/adapters/suilend.js +0 -57
- package/dist/src/placements/batch.d.ts +0 -70
- package/dist/src/placements/batch.js +0 -197
- package/dist/src/placements/client.d.ts +0 -17
- package/dist/src/placements/client.js +0 -194
- package/dist/src/placements/evm.d.ts +0 -29
- package/dist/src/placements/evm.js +0 -280
- package/dist/src/placements/index.d.ts +0 -9
- package/dist/src/placements/index.js +0 -9
- package/dist/src/placements/pointers.d.ts +0 -24
- package/dist/src/placements/pointers.js +0 -126
- package/dist/src/placements/registry.d.ts +0 -11
- package/dist/src/placements/registry.js +0 -19
- package/dist/src/placements/sui.d.ts +0 -47
- package/dist/src/placements/sui.js +0 -302
- package/dist/src/placements/types.d.ts +0 -147
- package/dist/src/placements/types.js +0 -1
- package/dist/src/placements/vaults.d.ts +0 -15
- package/dist/src/placements/vaults.js +0 -97
|
@@ -61,6 +61,22 @@ export declare class EVMOperatorCalls extends EVMOnChainCalls {
|
|
|
61
61
|
* @returns EvmOnChainCallResponse
|
|
62
62
|
*/
|
|
63
63
|
processParkingLotDeposits(vaultAddress: string, numRequests: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Process every queued deposit request in a vault's parking lot up to and
|
|
66
|
+
* including `upToSequenceNumber`, forwarding escrowed collateral into the vault.
|
|
67
|
+
* Operator-only.
|
|
68
|
+
*
|
|
69
|
+
* Prefer this over {@link processParkingLotDeposits} when settling through a
|
|
70
|
+
* known request: `numRequests` counts queue SLOTS walked and cancelled slots
|
|
71
|
+
* count towards it, so the count has to be derived from the live head and is
|
|
72
|
+
* easy to get wrong. Reverts if the sequence number is past the queue tail
|
|
73
|
+
* (IndexOutOfBounds) or at/below the head (InvalidRequest) rather than clamping.
|
|
74
|
+
* @param vaultAddress The vault the parking lot serves
|
|
75
|
+
* @param upToSequenceNumber Last request sequence number to settle (inclusive)
|
|
76
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
77
|
+
* @returns EvmOnChainCallResponse
|
|
78
|
+
*/
|
|
79
|
+
processParkingLotDepositsUpTo(vaultAddress: string, upToSequenceNumber: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
64
80
|
/**
|
|
65
81
|
* Set an account's status on a vault's parking-lot deposit allow-list.
|
|
66
82
|
* Operator-gated (EmberDepositParkingLot.setDepositAllowListStatus); emits
|
|
@@ -76,6 +76,26 @@ export class EVMOperatorCalls extends EVMOnChainCalls {
|
|
|
76
76
|
const txCall = this.txBuilder.processParkingLotDeposits(parkingLotAddress, numRequests);
|
|
77
77
|
return this.execCall(txCall, options);
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Process every queued deposit request in a vault's parking lot up to and
|
|
81
|
+
* including `upToSequenceNumber`, forwarding escrowed collateral into the vault.
|
|
82
|
+
* Operator-only.
|
|
83
|
+
*
|
|
84
|
+
* Prefer this over {@link processParkingLotDeposits} when settling through a
|
|
85
|
+
* known request: `numRequests` counts queue SLOTS walked and cancelled slots
|
|
86
|
+
* count towards it, so the count has to be derived from the live head and is
|
|
87
|
+
* easy to get wrong. Reverts if the sequence number is past the queue tail
|
|
88
|
+
* (IndexOutOfBounds) or at/below the head (InvalidRequest) rather than clamping.
|
|
89
|
+
* @param vaultAddress The vault the parking lot serves
|
|
90
|
+
* @param upToSequenceNumber Last request sequence number to settle (inclusive)
|
|
91
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
92
|
+
* @returns EvmOnChainCallResponse
|
|
93
|
+
*/
|
|
94
|
+
async processParkingLotDepositsUpTo(vaultAddress, upToSequenceNumber, options) {
|
|
95
|
+
const parkingLotAddress = this.parser.resolveParkingLotAddress(vaultAddress, options?.parkingLotAddress);
|
|
96
|
+
const txCall = this.txBuilder.processParkingLotDepositsUpTo(parkingLotAddress, upToSequenceNumber);
|
|
97
|
+
return this.execCall(txCall, options);
|
|
98
|
+
}
|
|
79
99
|
/**
|
|
80
100
|
* Set an account's status on a vault's parking-lot deposit allow-list.
|
|
81
101
|
* Operator-gated (EmberDepositParkingLot.setDepositAllowListStatus); emits
|
|
@@ -167,6 +167,18 @@ export declare class EVMTxBuilder {
|
|
|
167
167
|
* @returns Transaction call object
|
|
168
168
|
*/
|
|
169
169
|
processParkingLotDeposits(parkingLotAddress: string, numRequests: NumStr): ITransactionCall;
|
|
170
|
+
/**
|
|
171
|
+
* Processes every queued deposit request up to and including
|
|
172
|
+
* `upToSequenceNumber` (operator-only). Prefer this over
|
|
173
|
+
* {@link processParkingLotDeposits} when settling through a known request:
|
|
174
|
+
* `numRequests` counts queue SLOTS walked and cancelled slots count towards it,
|
|
175
|
+
* so a count has to be derived from the live head and is easy to get wrong.
|
|
176
|
+
* Reverts if the sequence number is past the queue tail or at/below the head.
|
|
177
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
178
|
+
* @param upToSequenceNumber Last request sequence number to settle (inclusive)
|
|
179
|
+
* @returns Transaction call object
|
|
180
|
+
*/
|
|
181
|
+
processParkingLotDepositsUpTo(parkingLotAddress: string, upToSequenceNumber: NumStr): ITransactionCall;
|
|
170
182
|
/**
|
|
171
183
|
* Rotates the operator authorised to process a parking lot's queue
|
|
172
184
|
* (vault-admin only).
|
|
@@ -183,6 +195,15 @@ export declare class EVMTxBuilder {
|
|
|
183
195
|
* @returns Transaction call object
|
|
184
196
|
*/
|
|
185
197
|
setParkingLotDepositsPaused(parkingLotAddress: string, paused: boolean): ITransactionCall;
|
|
198
|
+
/**
|
|
199
|
+
* Pauses or resumes cancellation of pending deposit requests in a parking lot
|
|
200
|
+
* (vault admin or protocol guardian). While paused the queue can still grow and
|
|
201
|
+
* the operator can still process it, but depositors cannot withdraw from it.
|
|
202
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
203
|
+
* @param paused True to block cancellation, false to resume
|
|
204
|
+
* @returns Transaction call object
|
|
205
|
+
*/
|
|
206
|
+
setParkingLotCancellationsPaused(parkingLotAddress: string, paused: boolean): ITransactionCall;
|
|
186
207
|
setParkingLotDepositAllowList(parkingLotAddress: string, account: string, status: boolean): ITransactionCall;
|
|
187
208
|
/**
|
|
188
209
|
* Updates the paused status of a vault operation (called via ProtocolConfig)
|
|
@@ -314,6 +314,27 @@ export class EVMTxBuilder {
|
|
|
314
314
|
chainId: this.getChainId()
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Processes every queued deposit request up to and including
|
|
319
|
+
* `upToSequenceNumber` (operator-only). Prefer this over
|
|
320
|
+
* {@link processParkingLotDeposits} when settling through a known request:
|
|
321
|
+
* `numRequests` counts queue SLOTS walked and cancelled slots count towards it,
|
|
322
|
+
* so a count has to be derived from the live head and is easy to get wrong.
|
|
323
|
+
* Reverts if the sequence number is past the queue tail or at/below the head.
|
|
324
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
325
|
+
* @param upToSequenceNumber Last request sequence number to settle (inclusive)
|
|
326
|
+
* @returns Transaction call object
|
|
327
|
+
*/
|
|
328
|
+
processParkingLotDepositsUpTo(parkingLotAddress, upToSequenceNumber) {
|
|
329
|
+
return {
|
|
330
|
+
to: parkingLotAddress,
|
|
331
|
+
functionName: "processDepositsUpTo",
|
|
332
|
+
args: [BigInt(upToSequenceNumber)],
|
|
333
|
+
abi: EmberDepositParkingLotABI.abi,
|
|
334
|
+
value: 0n,
|
|
335
|
+
chainId: this.getChainId()
|
|
336
|
+
};
|
|
337
|
+
}
|
|
317
338
|
/**
|
|
318
339
|
* Rotates the operator authorised to process a parking lot's queue
|
|
319
340
|
* (vault-admin only).
|
|
@@ -348,6 +369,24 @@ export class EVMTxBuilder {
|
|
|
348
369
|
chainId: this.getChainId()
|
|
349
370
|
};
|
|
350
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Pauses or resumes cancellation of pending deposit requests in a parking lot
|
|
374
|
+
* (vault admin or protocol guardian). While paused the queue can still grow and
|
|
375
|
+
* the operator can still process it, but depositors cannot withdraw from it.
|
|
376
|
+
* @param parkingLotAddress Address of the EmberDepositParkingLot
|
|
377
|
+
* @param paused True to block cancellation, false to resume
|
|
378
|
+
* @returns Transaction call object
|
|
379
|
+
*/
|
|
380
|
+
setParkingLotCancellationsPaused(parkingLotAddress, paused) {
|
|
381
|
+
return {
|
|
382
|
+
to: parkingLotAddress,
|
|
383
|
+
functionName: "setCancellationsPaused",
|
|
384
|
+
args: [paused],
|
|
385
|
+
abi: EmberDepositParkingLotABI.abi,
|
|
386
|
+
value: 0n,
|
|
387
|
+
chainId: this.getChainId()
|
|
388
|
+
};
|
|
389
|
+
}
|
|
351
390
|
setParkingLotDepositAllowList(parkingLotAddress, account, status) {
|
|
352
391
|
return {
|
|
353
392
|
to: parkingLotAddress,
|
|
@@ -72,6 +72,22 @@ export declare class EVMVaultAdminCalls extends EVMOnChainCalls {
|
|
|
72
72
|
* @returns EvmOnChainCallResponse
|
|
73
73
|
*/
|
|
74
74
|
setParkingLotDepositsPaused(vaultAddress: string, paused: boolean, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Pause or resume cancellation of pending deposit requests in a vault's parking
|
|
77
|
+
* lot (EmberDepositParkingLot.setCancellationsPaused); emits
|
|
78
|
+
* CancellationsPausedUpdated. Callable by the vault admin or the protocol
|
|
79
|
+
* guardian.
|
|
80
|
+
*
|
|
81
|
+
* While paused, depositors cannot withdraw from the queue — new deposits still
|
|
82
|
+
* join it and the operator can still process it — so the pending total can grow
|
|
83
|
+
* but not shrink. Note a depositor who parks while it is set cannot cancel until
|
|
84
|
+
* it is cleared.
|
|
85
|
+
* @param vaultAddress The address of the vault
|
|
86
|
+
* @param paused True to block cancellation, false to resume
|
|
87
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
88
|
+
* @returns EvmOnChainCallResponse
|
|
89
|
+
*/
|
|
90
|
+
setParkingLotCancellationsPaused(vaultAddress: string, paused: boolean, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
75
91
|
/**
|
|
76
92
|
* Update the rate manager of a vault
|
|
77
93
|
* @param vaultAddress The address of the vault
|
|
@@ -91,6 +91,26 @@ export class EVMVaultAdminCalls extends EVMOnChainCalls {
|
|
|
91
91
|
const txCall = this.txBuilder.setParkingLotDepositsPaused(parkingLotAddress, paused);
|
|
92
92
|
return this.execCall(txCall, options);
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Pause or resume cancellation of pending deposit requests in a vault's parking
|
|
96
|
+
* lot (EmberDepositParkingLot.setCancellationsPaused); emits
|
|
97
|
+
* CancellationsPausedUpdated. Callable by the vault admin or the protocol
|
|
98
|
+
* guardian.
|
|
99
|
+
*
|
|
100
|
+
* While paused, depositors cannot withdraw from the queue — new deposits still
|
|
101
|
+
* join it and the operator can still process it — so the pending total can grow
|
|
102
|
+
* but not shrink. Note a depositor who parks while it is set cannot cancel until
|
|
103
|
+
* it is cleared.
|
|
104
|
+
* @param vaultAddress The address of the vault
|
|
105
|
+
* @param paused True to block cancellation, false to resume
|
|
106
|
+
* @param options Optional tx execution params (incl. optional parkingLotAddress override)
|
|
107
|
+
* @returns EvmOnChainCallResponse
|
|
108
|
+
*/
|
|
109
|
+
async setParkingLotCancellationsPaused(vaultAddress, paused, options) {
|
|
110
|
+
const parkingLotAddress = this.parser.resolveParkingLotAddress(vaultAddress, options?.parkingLotAddress);
|
|
111
|
+
const txCall = this.txBuilder.setParkingLotCancellationsPaused(parkingLotAddress, paused);
|
|
112
|
+
return this.execCall(txCall, options);
|
|
113
|
+
}
|
|
94
114
|
/**
|
|
95
115
|
* Update the rate manager of a vault
|
|
96
116
|
* @param vaultAddress The address of the vault
|
|
@@ -227,9 +227,10 @@ export class EVMVaultReader {
|
|
|
227
227
|
*/
|
|
228
228
|
async getParkingLotInfo(parkingLotAddress) {
|
|
229
229
|
const parkingLot = this.getParkingLotContract(parkingLotAddress);
|
|
230
|
-
const [operator, depositsPaused, totalPendingAssets, livePendingCount, sequenceNumber, queueStartIndex] = await Promise.all([
|
|
230
|
+
const [operator, depositsPaused, cancellationsPaused, totalPendingAssets, livePendingCount, sequenceNumber, queueStartIndex] = await Promise.all([
|
|
231
231
|
parkingLot.operator(),
|
|
232
232
|
parkingLot.depositsPaused(),
|
|
233
|
+
parkingLot.cancellationsPaused(),
|
|
233
234
|
parkingLot.totalPendingAssets(),
|
|
234
235
|
parkingLot.getLivePendingDepositsCount(),
|
|
235
236
|
parkingLot.sequenceNumber(),
|
|
@@ -239,6 +240,7 @@ export class EVMVaultReader {
|
|
|
239
240
|
address: parkingLotAddress,
|
|
240
241
|
operator,
|
|
241
242
|
depositsPaused,
|
|
243
|
+
cancellationsPaused,
|
|
242
244
|
totalPendingAssets,
|
|
243
245
|
livePendingCount,
|
|
244
246
|
sequenceNumber,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-finance/sdk",
|
|
3
3
|
"description": "Ember Protocol SDK",
|
|
4
|
-
"version": "2.11.0
|
|
4
|
+
"version": "2.11.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -44,11 +44,6 @@
|
|
|
44
44
|
"import": "./dist/src/common/index.js",
|
|
45
45
|
"default": "./dist/src/common/index.js"
|
|
46
46
|
},
|
|
47
|
-
"./placements": {
|
|
48
|
-
"types": "./dist/src/placements/index.d.ts",
|
|
49
|
-
"import": "./dist/src/placements/index.js",
|
|
50
|
-
"default": "./dist/src/placements/index.js"
|
|
51
|
-
},
|
|
52
47
|
"./abis": {
|
|
53
48
|
"types": "./dist/src/abis/index.d.ts",
|
|
54
49
|
"import": "./dist/src/abis/index.js",
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ember Protocol Vaults API
|
|
3
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 2.0.0
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @export
|
|
15
|
-
* @interface CoinPlacement
|
|
16
|
-
*/
|
|
17
|
-
export interface CoinPlacement {
|
|
18
|
-
/**
|
|
19
|
-
* Stable identity for this placement, for a client to key a list on. A protocol can list the same coin at several venues — the same pair at two fee tiers, or the two tranches of one market — so protocol and label together do not identify a row. Survives a re-sync.
|
|
20
|
-
* @type {string}
|
|
21
|
-
* @memberof CoinPlacement
|
|
22
|
-
*/
|
|
23
|
-
id: string;
|
|
24
|
-
/**
|
|
25
|
-
* Adapter id, e.g. \"bluefin-spot\"
|
|
26
|
-
* @type {string}
|
|
27
|
-
* @memberof CoinPlacement
|
|
28
|
-
*/
|
|
29
|
-
protocol: string;
|
|
30
|
-
/**
|
|
31
|
-
* The protocol\'s display name, e.g. \"Current Finance\". Absent when the protocol is not in our catalogue yet — render `protocol` then.
|
|
32
|
-
* @type {string}
|
|
33
|
-
* @memberof CoinPlacement
|
|
34
|
-
*/
|
|
35
|
-
protocolName?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Icon for the protocol. Absent when the protocol is not in our catalogue yet.
|
|
38
|
-
* @type {string}
|
|
39
|
-
* @memberof CoinPlacement
|
|
40
|
-
*/
|
|
41
|
-
protocolLogoUrl?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Chain identifier as catalogued, e.g. \"sui-mainnet\".
|
|
44
|
-
* @type {string}
|
|
45
|
-
* @memberof CoinPlacement
|
|
46
|
-
*/
|
|
47
|
-
chainIdentifier: string;
|
|
48
|
-
/**
|
|
49
|
-
* EVM network id. Absent on chains that have none.
|
|
50
|
-
* @type {number}
|
|
51
|
-
* @memberof CoinPlacement
|
|
52
|
-
*/
|
|
53
|
-
chainId?: number;
|
|
54
|
-
/**
|
|
55
|
-
* A chain RPC endpoint safe to call from a browser, when we publish one. Absent means the client should use its own configured endpoint.
|
|
56
|
-
* @type {string}
|
|
57
|
-
* @memberof CoinPlacement
|
|
58
|
-
*/
|
|
59
|
-
rpcUrl?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Pool, market or vault address. Never a symbol.
|
|
62
|
-
* @type {string}
|
|
63
|
-
* @memberof CoinPlacement
|
|
64
|
-
*/
|
|
65
|
-
venue: string;
|
|
66
|
-
/**
|
|
67
|
-
* The token an account holds to represent its position here, when that is not the venue itself. Absent means the venue.
|
|
68
|
-
* @type {string}
|
|
69
|
-
* @memberof CoinPlacement
|
|
70
|
-
*/
|
|
71
|
-
shareToken?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Deep link to the venue.
|
|
74
|
-
* @type {string}
|
|
75
|
-
* @memberof CoinPlacement
|
|
76
|
-
*/
|
|
77
|
-
url?: string;
|
|
78
|
-
/**
|
|
79
|
-
* The coin in its chain\'s own canonical form, ready to hand to an RPC.
|
|
80
|
-
* @type {string}
|
|
81
|
-
* @memberof CoinPlacement
|
|
82
|
-
*/
|
|
83
|
-
coin: string;
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
* @type {number}
|
|
87
|
-
* @memberof CoinPlacement
|
|
88
|
-
*/
|
|
89
|
-
decimals: number;
|
|
90
|
-
/**
|
|
91
|
-
* Registry rows come from a protocol\'s own catalogue; Manual rows are hand-maintained for protocols that publish none.
|
|
92
|
-
* @type {string}
|
|
93
|
-
* @memberof CoinPlacement
|
|
94
|
-
*/
|
|
95
|
-
source: CoinPlacementSourceEnum;
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @type {string}
|
|
99
|
-
* @memberof CoinPlacement
|
|
100
|
-
*/
|
|
101
|
-
label?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Last time the venue was confirmed to still list the coin.
|
|
104
|
-
* @type {string}
|
|
105
|
-
* @memberof CoinPlacement
|
|
106
|
-
*/
|
|
107
|
-
lastVerifiedAt?: string;
|
|
108
|
-
}
|
|
109
|
-
export declare const CoinPlacementSourceEnum: {
|
|
110
|
-
readonly Registry: "Registry";
|
|
111
|
-
readonly Manual: "Manual";
|
|
112
|
-
};
|
|
113
|
-
export type CoinPlacementSourceEnum = (typeof CoinPlacementSourceEnum)[keyof typeof CoinPlacementSourceEnum];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Ember Protocol Vaults API
|
|
5
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 2.0.0
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
export const CoinPlacementSourceEnum = {
|
|
15
|
-
Registry: "Registry",
|
|
16
|
-
Manual: "Manual"
|
|
17
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ember Protocol Vaults API
|
|
3
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 2.0.0
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
import type { CoinPlacement } from "./coin-placement.js";
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @export
|
|
16
|
-
* @interface CoinPlacementsResponse
|
|
17
|
-
*/
|
|
18
|
-
export interface CoinPlacementsResponse {
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @type {Array<CoinPlacement>}
|
|
22
|
-
* @memberof CoinPlacementsResponse
|
|
23
|
-
*/
|
|
24
|
-
placements: Array<CoinPlacement>;
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Ember Protocol Vaults API
|
|
5
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 2.0.0
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ember Protocol Vaults API
|
|
3
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 2.0.0
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @export
|
|
15
|
-
* @interface PocReportProtocolAsset
|
|
16
|
-
*/
|
|
17
|
-
export interface PocReportProtocolAsset {
|
|
18
|
-
/**
|
|
19
|
-
* The asset symbol (e.g., USDC)
|
|
20
|
-
* @type {string}
|
|
21
|
-
* @memberof PocReportProtocolAsset
|
|
22
|
-
*/
|
|
23
|
-
symbol: string;
|
|
24
|
-
/**
|
|
25
|
-
* The asset contract address or coin type, when known
|
|
26
|
-
* @type {string}
|
|
27
|
-
* @memberof PocReportProtocolAsset
|
|
28
|
-
*/
|
|
29
|
-
address?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Which leg of the position this is. Borrow legs carry a negative value, so the legs sum to the position\'s net value.
|
|
32
|
-
* @type {string}
|
|
33
|
-
* @memberof PocReportProtocolAsset
|
|
34
|
-
*/
|
|
35
|
-
side: PocReportProtocolAssetSideEnum;
|
|
36
|
-
/**
|
|
37
|
-
* The quantity held, in whole units of the asset
|
|
38
|
-
* @type {string}
|
|
39
|
-
* @memberof PocReportProtocolAsset
|
|
40
|
-
*/
|
|
41
|
-
amount: string;
|
|
42
|
-
/**
|
|
43
|
-
* The value in e9 USD, negative for a borrow leg
|
|
44
|
-
* @type {string}
|
|
45
|
-
* @memberof PocReportProtocolAsset
|
|
46
|
-
*/
|
|
47
|
-
valueUsdE9: string;
|
|
48
|
-
/**
|
|
49
|
-
* The asset icon url, when the data provider supplies one
|
|
50
|
-
* @type {string}
|
|
51
|
-
* @memberof PocReportProtocolAsset
|
|
52
|
-
*/
|
|
53
|
-
logoUrl?: string;
|
|
54
|
-
}
|
|
55
|
-
export declare const PocReportProtocolAssetSideEnum: {
|
|
56
|
-
readonly Supply: "supply";
|
|
57
|
-
readonly Reward: "reward";
|
|
58
|
-
readonly Borrow: "borrow";
|
|
59
|
-
};
|
|
60
|
-
export type PocReportProtocolAssetSideEnum = (typeof PocReportProtocolAssetSideEnum)[keyof typeof PocReportProtocolAssetSideEnum];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Ember Protocol Vaults API
|
|
5
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 2.0.0
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
export const PocReportProtocolAssetSideEnum = {
|
|
15
|
-
Supply: "supply",
|
|
16
|
-
Reward: "reward",
|
|
17
|
-
Borrow: "borrow"
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const alphalend: import("../types.js").ProtocolAdapter;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { coinTypesMatch, tableId, toBigInt, typeArguments } from "../sui.js";
|
|
2
|
-
import { createSuiVenueAdapter } from "./factory.js";
|
|
3
|
-
/** AlphaLend scales its xToken exchange rate by 1e18. */
|
|
4
|
-
const RATIO_SCALE = 10n ** 18n;
|
|
5
|
-
function ratioOf(field) {
|
|
6
|
-
return toBigInt(field?.value ?? field);
|
|
7
|
-
}
|
|
8
|
-
export const alphalend = createSuiVenueAdapter({
|
|
9
|
-
id: "alphalend",
|
|
10
|
-
async read(ref, account, reader) {
|
|
11
|
-
// AlphaLend. An account holds a `position::PositionCap` pointing at a position
|
|
12
|
-
// object, whose dynamic fields carry one entry per market it is in.
|
|
13
|
-
//
|
|
14
|
-
// Balances are denominated in xTokens, an interest-bearing share, so they are
|
|
15
|
-
// converted through the market's `xtoken_ratio` to the underlying coin the
|
|
16
|
-
// caller asked about.
|
|
17
|
-
const protocols = await reader.objects([ref.venue]);
|
|
18
|
-
const protocol = protocols[ref.venue];
|
|
19
|
-
if (!protocol) {
|
|
20
|
-
throw new Error(`alphalend: lending protocol ${ref.venue} not found on chain`);
|
|
21
|
-
}
|
|
22
|
-
const capType = ref.shareToken ?? `${protocol.type.split("::")[0]}::position::PositionCap`;
|
|
23
|
-
const caps = await reader.ownedObjects(account, capType);
|
|
24
|
-
if (caps.length === 0)
|
|
25
|
-
return undefined;
|
|
26
|
-
const markets = tableId(protocol.json.markets);
|
|
27
|
-
if (!markets)
|
|
28
|
-
throw new Error(`alphalend: no markets table on ${ref.venue}`);
|
|
29
|
-
// Which market holds our coin, and what an xToken is worth there.
|
|
30
|
-
const entries = await reader.dynamicFields(markets);
|
|
31
|
-
const market = entries.find(entry => coinTypesMatch(entry.value?.coin_type ?? "", ref.coin));
|
|
32
|
-
if (!market)
|
|
33
|
-
return undefined;
|
|
34
|
-
const marketValue = market.value;
|
|
35
|
-
const marketId = String(marketValue.market_id);
|
|
36
|
-
const ratio = ratioOf(marketValue.xtoken_ratio);
|
|
37
|
-
let xTokens = 0n;
|
|
38
|
-
for (const cap of caps) {
|
|
39
|
-
const positionId = cap.json.position_id;
|
|
40
|
-
if (!positionId)
|
|
41
|
-
continue;
|
|
42
|
-
const held = await reader.dynamicFields(positionId);
|
|
43
|
-
for (const entry of held) {
|
|
44
|
-
if (String(entry.name) !== marketId)
|
|
45
|
-
continue;
|
|
46
|
-
// The entry's type argument names the coin, so a position in a
|
|
47
|
-
// different market of the same id cannot be mistaken for this one.
|
|
48
|
-
const [entryCoin] = typeArguments(entry.valueType);
|
|
49
|
-
if (entryCoin && !coinTypesMatch(entryCoin, ref.coin))
|
|
50
|
-
continue;
|
|
51
|
-
xTokens += toBigInt(entry.value?.x_token);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (xTokens === 0n)
|
|
55
|
-
return undefined;
|
|
56
|
-
return (xTokens * ratio) / RATIO_SCALE;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const bluefinSpot: import("../types.js").ProtocolAdapter;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { coinTypesMatch, toBigInt, typeArguments } from "../sui.js";
|
|
2
|
-
import { createSuiVenueAdapter } from "./factory.js";
|
|
3
|
-
/** Sui wraps a signed tick as `{ bits }`, two's complement in a u32. */
|
|
4
|
-
function tickOf(field) {
|
|
5
|
-
const bits = Number(field?.bits ?? 0);
|
|
6
|
-
return bits >= 0x80000000 ? bits - 0x100000000 : bits;
|
|
7
|
-
}
|
|
8
|
-
const Q64 = 2n ** 64n;
|
|
9
|
-
/**
|
|
10
|
-
* √(1.0001^tick) as a Q64 fixed point.
|
|
11
|
-
*
|
|
12
|
-
* Computed in floating point rather than by the usual chain of magic constants.
|
|
13
|
-
* A double carries ~15 significant digits against Q64's ~19, so the result can
|
|
14
|
-
* be off by roughly 1e-16 relative — orders of magnitude below the dust these
|
|
15
|
-
* amounts are displayed to, and far less error-prone than transcribing the
|
|
16
|
-
* bit-manipulation table.
|
|
17
|
-
*/
|
|
18
|
-
function sqrtRatioAtTick(tick) {
|
|
19
|
-
return BigInt(Math.floor(Math.pow(1.0001, tick / 2) * Number(Q64)));
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The token amounts a concentrated-liquidity position is currently worth.
|
|
23
|
-
*
|
|
24
|
-
* A position holds liquidity over a tick range, not amounts, so what it is
|
|
25
|
-
* worth depends on where the pool's price sits relative to that range: entirely
|
|
26
|
-
* in coin A above it, entirely in coin B below it, and split while inside.
|
|
27
|
-
*/
|
|
28
|
-
function positionAmounts(liquidity, sqrtLower, sqrtUpper, sqrtPrice) {
|
|
29
|
-
if (liquidity === 0n || sqrtLower >= sqrtUpper)
|
|
30
|
-
return { amountA: 0n, amountB: 0n };
|
|
31
|
-
const clamped = sqrtPrice < sqrtLower ? sqrtLower : sqrtPrice > sqrtUpper ? sqrtUpper : sqrtPrice;
|
|
32
|
-
// amountA = L * (√upper - √p) / (√p * √upper)
|
|
33
|
-
const amountA = clamped >= sqrtUpper
|
|
34
|
-
? 0n
|
|
35
|
-
: (liquidity * (sqrtUpper - clamped) * Q64) / (clamped * sqrtUpper);
|
|
36
|
-
// amountB = L * (√p - √lower)
|
|
37
|
-
const amountB = clamped <= sqrtLower ? 0n : (liquidity * (clamped - sqrtLower)) / Q64;
|
|
38
|
-
return { amountA, amountB };
|
|
39
|
-
}
|
|
40
|
-
export const bluefinSpot = createSuiVenueAdapter({
|
|
41
|
-
id: "bluefin-spot",
|
|
42
|
-
async read(ref, account, reader) {
|
|
43
|
-
// Bluefin spot AMM. A position is an owned `Position` object naming its pool, so
|
|
44
|
-
// an account's stake in one venue is the sum of the positions it owns there.
|
|
45
|
-
const pools = await reader.objects([ref.venue]);
|
|
46
|
-
const pool = pools[ref.venue];
|
|
47
|
-
if (!pool)
|
|
48
|
-
throw new Error(`bluefin-spot: pool ${ref.venue} not found on chain`);
|
|
49
|
-
// Positions come from the same package as the pool, so derive the type
|
|
50
|
-
// rather than pin a package that moves on every contract upgrade.
|
|
51
|
-
const positionType = ref.shareToken ?? `${pool.type.split("::")[0]}::position::Position`;
|
|
52
|
-
const owned = await reader.ownedObjects(account, positionType);
|
|
53
|
-
const inPool = owned.filter(o => o.json.pool_id === ref.venue);
|
|
54
|
-
if (inPool.length === 0)
|
|
55
|
-
return undefined;
|
|
56
|
-
const [typeA, typeB] = typeArguments(pool.type);
|
|
57
|
-
const wantsA = coinTypesMatch(typeA, ref.coin);
|
|
58
|
-
if (!wantsA && !coinTypesMatch(typeB, ref.coin)) {
|
|
59
|
-
throw new Error(`bluefin-spot: pool ${ref.venue} does not hold ${ref.coin}`);
|
|
60
|
-
}
|
|
61
|
-
// A missing field reads as 0, which clamps every position to the lower
|
|
62
|
-
// tick and returns a plausible but wrong amount. Fail instead.
|
|
63
|
-
const sqrtPrice = toBigInt(pool.json.current_sqrt_price);
|
|
64
|
-
if (sqrtPrice === 0n) {
|
|
65
|
-
throw new Error(`bluefin-spot: pool ${ref.venue} has no current_sqrt_price`);
|
|
66
|
-
}
|
|
67
|
-
let total = 0n;
|
|
68
|
-
for (const position of inPool) {
|
|
69
|
-
const { amountA, amountB } = positionAmounts(toBigInt(position.json.liquidity), sqrtRatioAtTick(tickOf(position.json.lower_tick)), sqrtRatioAtTick(tickOf(position.json.upper_tick)), sqrtPrice);
|
|
70
|
-
total += wantsA ? amountA : amountB;
|
|
71
|
-
}
|
|
72
|
-
// A position wholly outside the current range holds none of this side.
|
|
73
|
-
// Reporting zero would render an empty row rather than no row.
|
|
74
|
-
if (total === 0n)
|
|
75
|
-
return undefined;
|
|
76
|
-
return total;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const current: import("../types.js").ProtocolAdapter;
|