@venusprotocol/liquidity-hub 2.0.0 → 2.1.0-dev.2

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.
@@ -0,0 +1,94 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ pragma solidity 0.8.25;
3
+
4
+ /**
5
+ * @title ICentrifugeAsyncVault
6
+ * @author Venus
7
+ * @notice Minimal ERC-7540 surface: only what `AdapterCentrifuge` calls on a Centrifuge async
8
+ * vault (JTRSY / JAAA). Requests are asynchronous — a request escrows value with
9
+ * Centrifuge, the fund manager fills it cross-chain, and a later claim collects the result.
10
+ * @dev Centrifuge's request id is always `0`, so the `requestId` parameters and return values here
11
+ * carry no information. Per-position state (the pending and claimable buckets) does not live
12
+ * on the vault: read it from `ICentrifugeAsyncRequestManager.investments(vault, controller)`,
13
+ * on the manager this vault reports via `baseManager()`.
14
+ */
15
+ interface ICentrifugeAsyncVault {
16
+ // ─────────────────────────── Requests ───────────────────────────
17
+
18
+ /// @notice Opens a deposit request: pulls `assets` from `owner` into Centrifuge's escrow and
19
+ /// books them under `controller`'s `pendingDepositRequest`. The adapter passes the
20
+ /// YieldGroup as both controller and owner.
21
+ function requestDeposit(uint256 assets, address controller, address owner) external returns (uint256 requestId);
22
+
23
+ /// @notice Opens a redeem request: escrows `shares` from `owner` and books them under
24
+ /// `controller`'s `pendingRedeemRequest`.
25
+ function requestRedeem(uint256 shares, address controller, address owner) external returns (uint256 requestId);
26
+
27
+ // ──────────────────────────── Claims ────────────────────────────
28
+
29
+ /// @notice Claims the shares a filled deposit request issued, up to `maxMint`.
30
+ function mint(uint256 shares, address receiver, address controller) external returns (uint256 assets);
31
+
32
+ /// @notice Claims the assets a filled redeem request reserved, up to `maxWithdraw`.
33
+ function withdraw(uint256 assets, address receiver, address controller) external returns (uint256 shares);
34
+
35
+ // ─────────────────────────── Cancels ────────────────────────────
36
+
37
+ /// @notice Opens a cancel for the controller's pending deposit request. The returned assets
38
+ /// become claimable only once the manager processes the cancel cross-chain.
39
+ function cancelDepositRequest(uint256 requestId, address controller) external;
40
+
41
+ /// @notice Opens a cancel for the controller's pending redeem request.
42
+ function cancelRedeemRequest(uint256 requestId, address controller) external;
43
+
44
+ /// @notice Collects the assets a processed deposit cancel returned
45
+ /// (`claimableCancelDepositRequest`).
46
+ function claimCancelDepositRequest(uint256 requestId, address receiver, address controller)
47
+ external
48
+ returns (uint256 assets);
49
+
50
+ /// @notice Collects the shares a processed redeem cancel returned
51
+ /// (`claimableCancelRedeemRequest`).
52
+ function claimCancelRedeemRequest(uint256 requestId, address receiver, address controller)
53
+ external
54
+ returns (uint256 shares);
55
+
56
+ // ──────────────────────────── Views ─────────────────────────────
57
+
58
+ /// @notice Underlying asset of the vault; must match the Hub asset at registration.
59
+ function asset() external view returns (address);
60
+
61
+ /// @notice The vault's share token (JTRSY / JAAA) — what the group actually holds. `sweep` does
62
+ /// not bar it, because it bars only `asset()` and the vault address itself.
63
+ function share() external view returns (address);
64
+
65
+ /// @notice The vault's `AsyncRequestManager`, where the per-position `AsyncInvestmentState`
66
+ /// lives.
67
+ /// @dev Not the `manager()` alias, which Centrifuge deleted in v3.1.0. Both read the same
68
+ /// storage slot, but only this name exists in every release.
69
+ function baseManager() external view returns (address);
70
+
71
+ /// @notice The vault's own conversion of `shares` to assets at the fund's current NAV.
72
+ /// @dev Not on the valuation path. `AdapterCentrifuge` adds up every share-shaped bucket and
73
+ /// marks the total with one {pricePerShare} read, rather than converting each bucket
74
+ /// through here. That price is already truncated to the asset's decimals, so the adapter's
75
+ /// mark sits at or just below this one: conservative, and intended for a mark nobody can
76
+ /// vouch for. Neither read is bounded here — the YieldGroup's NAV band clamps the adapter's
77
+ /// total afterwards, so it binds whichever one the adapter used. Validity is unchecked
78
+ /// either way — a stale price passes through as-is and an unset one converts everything to
79
+ /// 0, so this never reverts on provenance.
80
+ function convertToAssets(uint256 shares) external view returns (uint256 assets);
81
+
82
+ /// @notice Price of one whole share in the asset's decimals, derived from the same
83
+ /// cross-chain-published prices as {convertToAssets} and equally validity-unchecked:
84
+ /// an unset feed reads 0. The adapter probes this before NAV-valuing share buckets so
85
+ /// a missing feed halts valuation instead of silently zeroing it.
86
+ function pricePerShare() external view returns (uint256 price);
87
+
88
+ /// @notice Claimable assets from filled redeem requests: the vault's permission-checked reading
89
+ /// of `investments().maxWithdraw`, which returns 0 while the controller is frozen. An
90
+ /// expired memberlist does not affect it — claiming a redemption checks only the freeze
91
+ /// flag — so this view and the claim always agree. Liquidity reads this; valuation reads
92
+ /// the raw struct.
93
+ function maxWithdraw(address controller) external view returns (uint256 assets);
94
+ }
@@ -0,0 +1,421 @@
1
+ {
2
+ "address": "0x680cE4422264ecDAd3590cB50FE254D4c153f427",
3
+ "block": 122006956,
4
+ "chainId": 56,
5
+ "contract": "AdapterCentrifuge",
6
+ "abi": [
7
+ {
8
+ "type": "constructor",
9
+ "inputs": [],
10
+ "stateMutability": "nonpayable"
11
+ },
12
+ {
13
+ "type": "function",
14
+ "name": "accrue",
15
+ "inputs": [
16
+ {
17
+ "name": "resource",
18
+ "type": "address",
19
+ "internalType": "address"
20
+ }
21
+ ],
22
+ "outputs": [],
23
+ "stateMutability": "nonpayable"
24
+ },
25
+ {
26
+ "type": "function",
27
+ "name": "asset",
28
+ "inputs": [
29
+ {
30
+ "name": "resource",
31
+ "type": "address",
32
+ "internalType": "address"
33
+ }
34
+ ],
35
+ "outputs": [
36
+ {
37
+ "name": "",
38
+ "type": "address",
39
+ "internalType": "address"
40
+ }
41
+ ],
42
+ "stateMutability": "view"
43
+ },
44
+ {
45
+ "type": "function",
46
+ "name": "cancelDepositRequest",
47
+ "inputs": [
48
+ {
49
+ "name": "resource",
50
+ "type": "address",
51
+ "internalType": "address"
52
+ }
53
+ ],
54
+ "outputs": [],
55
+ "stateMutability": "nonpayable"
56
+ },
57
+ {
58
+ "type": "function",
59
+ "name": "cancelRedeemRequest",
60
+ "inputs": [
61
+ {
62
+ "name": "resource",
63
+ "type": "address",
64
+ "internalType": "address"
65
+ }
66
+ ],
67
+ "outputs": [],
68
+ "stateMutability": "nonpayable"
69
+ },
70
+ {
71
+ "type": "function",
72
+ "name": "claimCancelDeposit",
73
+ "inputs": [
74
+ {
75
+ "name": "resource",
76
+ "type": "address",
77
+ "internalType": "address"
78
+ }
79
+ ],
80
+ "outputs": [
81
+ {
82
+ "name": "assets",
83
+ "type": "uint256",
84
+ "internalType": "uint256"
85
+ }
86
+ ],
87
+ "stateMutability": "nonpayable"
88
+ },
89
+ {
90
+ "type": "function",
91
+ "name": "claimCancelRedeem",
92
+ "inputs": [
93
+ {
94
+ "name": "resource",
95
+ "type": "address",
96
+ "internalType": "address"
97
+ }
98
+ ],
99
+ "outputs": [
100
+ {
101
+ "name": "shares",
102
+ "type": "uint256",
103
+ "internalType": "uint256"
104
+ }
105
+ ],
106
+ "stateMutability": "nonpayable"
107
+ },
108
+ {
109
+ "type": "function",
110
+ "name": "claimDeposit",
111
+ "inputs": [
112
+ {
113
+ "name": "resource",
114
+ "type": "address",
115
+ "internalType": "address"
116
+ }
117
+ ],
118
+ "outputs": [
119
+ {
120
+ "name": "shares",
121
+ "type": "uint256",
122
+ "internalType": "uint256"
123
+ }
124
+ ],
125
+ "stateMutability": "nonpayable"
126
+ },
127
+ {
128
+ "type": "function",
129
+ "name": "claimRedeem",
130
+ "inputs": [
131
+ {
132
+ "name": "resource",
133
+ "type": "address",
134
+ "internalType": "address"
135
+ }
136
+ ],
137
+ "outputs": [
138
+ {
139
+ "name": "assets",
140
+ "type": "uint256",
141
+ "internalType": "uint256"
142
+ }
143
+ ],
144
+ "stateMutability": "nonpayable"
145
+ },
146
+ {
147
+ "type": "function",
148
+ "name": "deposit",
149
+ "inputs": [
150
+ {
151
+ "name": "resource",
152
+ "type": "address",
153
+ "internalType": "address"
154
+ },
155
+ {
156
+ "name": "amount",
157
+ "type": "uint256",
158
+ "internalType": "uint256"
159
+ }
160
+ ],
161
+ "outputs": [
162
+ {
163
+ "name": "",
164
+ "type": "uint256",
165
+ "internalType": "uint256"
166
+ }
167
+ ],
168
+ "stateMutability": "nonpayable"
169
+ },
170
+ {
171
+ "type": "function",
172
+ "name": "depositRoom",
173
+ "inputs": [
174
+ {
175
+ "name": "resource",
176
+ "type": "address",
177
+ "internalType": "address"
178
+ },
179
+ {
180
+ "name": "holder",
181
+ "type": "address",
182
+ "internalType": "address"
183
+ }
184
+ ],
185
+ "outputs": [
186
+ {
187
+ "name": "",
188
+ "type": "uint256",
189
+ "internalType": "uint256"
190
+ }
191
+ ],
192
+ "stateMutability": "view"
193
+ },
194
+ {
195
+ "type": "function",
196
+ "name": "maxDeposit",
197
+ "inputs": [
198
+ {
199
+ "name": "resource",
200
+ "type": "address",
201
+ "internalType": "address"
202
+ }
203
+ ],
204
+ "outputs": [
205
+ {
206
+ "name": "",
207
+ "type": "uint256",
208
+ "internalType": "uint256"
209
+ }
210
+ ],
211
+ "stateMutability": "pure"
212
+ },
213
+ {
214
+ "type": "function",
215
+ "name": "maxWithdraw",
216
+ "inputs": [
217
+ {
218
+ "name": "resource",
219
+ "type": "address",
220
+ "internalType": "address"
221
+ },
222
+ {
223
+ "name": "holder",
224
+ "type": "address",
225
+ "internalType": "address"
226
+ }
227
+ ],
228
+ "outputs": [
229
+ {
230
+ "name": "",
231
+ "type": "uint256",
232
+ "internalType": "uint256"
233
+ }
234
+ ],
235
+ "stateMutability": "view"
236
+ },
237
+ {
238
+ "type": "function",
239
+ "name": "pricePerShare",
240
+ "inputs": [
241
+ {
242
+ "name": "resource",
243
+ "type": "address",
244
+ "internalType": "address"
245
+ }
246
+ ],
247
+ "outputs": [
248
+ {
249
+ "name": "price",
250
+ "type": "uint256",
251
+ "internalType": "uint256"
252
+ }
253
+ ],
254
+ "stateMutability": "view"
255
+ },
256
+ {
257
+ "type": "function",
258
+ "name": "receiptBalance",
259
+ "inputs": [
260
+ {
261
+ "name": "resource",
262
+ "type": "address",
263
+ "internalType": "address"
264
+ },
265
+ {
266
+ "name": "holder",
267
+ "type": "address",
268
+ "internalType": "address"
269
+ }
270
+ ],
271
+ "outputs": [
272
+ {
273
+ "name": "",
274
+ "type": "uint256",
275
+ "internalType": "uint256"
276
+ }
277
+ ],
278
+ "stateMutability": "view"
279
+ },
280
+ {
281
+ "type": "function",
282
+ "name": "requestRedeem",
283
+ "inputs": [
284
+ {
285
+ "name": "resource",
286
+ "type": "address",
287
+ "internalType": "address"
288
+ },
289
+ {
290
+ "name": "shares",
291
+ "type": "uint256",
292
+ "internalType": "uint256"
293
+ }
294
+ ],
295
+ "outputs": [],
296
+ "stateMutability": "nonpayable"
297
+ },
298
+ {
299
+ "type": "function",
300
+ "name": "spotAPYBps",
301
+ "inputs": [
302
+ {
303
+ "name": "resource",
304
+ "type": "address",
305
+ "internalType": "address"
306
+ },
307
+ {
308
+ "name": "",
309
+ "type": "uint256",
310
+ "internalType": "uint256"
311
+ }
312
+ ],
313
+ "outputs": [
314
+ {
315
+ "name": "",
316
+ "type": "uint64",
317
+ "internalType": "uint64"
318
+ }
319
+ ],
320
+ "stateMutability": "view"
321
+ },
322
+ {
323
+ "type": "function",
324
+ "name": "totalAssets",
325
+ "inputs": [
326
+ {
327
+ "name": "resource",
328
+ "type": "address",
329
+ "internalType": "address"
330
+ },
331
+ {
332
+ "name": "holder",
333
+ "type": "address",
334
+ "internalType": "address"
335
+ }
336
+ ],
337
+ "outputs": [
338
+ {
339
+ "name": "value",
340
+ "type": "uint256",
341
+ "internalType": "uint256"
342
+ }
343
+ ],
344
+ "stateMutability": "view"
345
+ },
346
+ {
347
+ "type": "function",
348
+ "name": "validateRegistration",
349
+ "inputs": [
350
+ {
351
+ "name": "resource",
352
+ "type": "address",
353
+ "internalType": "address"
354
+ }
355
+ ],
356
+ "outputs": [],
357
+ "stateMutability": "view"
358
+ },
359
+ {
360
+ "type": "function",
361
+ "name": "withdraw",
362
+ "inputs": [
363
+ {
364
+ "name": "resource",
365
+ "type": "address",
366
+ "internalType": "address"
367
+ },
368
+ {
369
+ "name": "amount",
370
+ "type": "uint256",
371
+ "internalType": "uint256"
372
+ },
373
+ {
374
+ "name": "to",
375
+ "type": "address",
376
+ "internalType": "address"
377
+ }
378
+ ],
379
+ "outputs": [],
380
+ "stateMutability": "nonpayable"
381
+ },
382
+ {
383
+ "type": "error",
384
+ "name": "NoManager",
385
+ "inputs": [
386
+ {
387
+ "name": "resource",
388
+ "type": "address",
389
+ "internalType": "address"
390
+ }
391
+ ]
392
+ },
393
+ {
394
+ "type": "error",
395
+ "name": "NoShareToken",
396
+ "inputs": [
397
+ {
398
+ "name": "resource",
399
+ "type": "address",
400
+ "internalType": "address"
401
+ }
402
+ ]
403
+ },
404
+ {
405
+ "type": "error",
406
+ "name": "NotDelegateCall",
407
+ "inputs": []
408
+ },
409
+ {
410
+ "type": "error",
411
+ "name": "ZeroSharePrice",
412
+ "inputs": [
413
+ {
414
+ "name": "resource",
415
+ "type": "address",
416
+ "internalType": "address"
417
+ }
418
+ ]
419
+ }
420
+ ]
421
+ }
@@ -0,0 +1,110 @@
1
+ {
2
+ "address": "0xAe90Cfb3E2Bc97508F58E7e076Acf38f3bfC820f",
3
+ "block": 122006956,
4
+ "chainId": 56,
5
+ "contract": "UpgradeableBeacon",
6
+ "abi": [
7
+ {
8
+ "type": "constructor",
9
+ "inputs": [
10
+ {
11
+ "name": "implementation_",
12
+ "type": "address",
13
+ "internalType": "address"
14
+ }
15
+ ],
16
+ "stateMutability": "nonpayable"
17
+ },
18
+ {
19
+ "type": "function",
20
+ "name": "implementation",
21
+ "inputs": [],
22
+ "outputs": [
23
+ {
24
+ "name": "",
25
+ "type": "address",
26
+ "internalType": "address"
27
+ }
28
+ ],
29
+ "stateMutability": "view"
30
+ },
31
+ {
32
+ "type": "function",
33
+ "name": "owner",
34
+ "inputs": [],
35
+ "outputs": [
36
+ {
37
+ "name": "",
38
+ "type": "address",
39
+ "internalType": "address"
40
+ }
41
+ ],
42
+ "stateMutability": "view"
43
+ },
44
+ {
45
+ "type": "function",
46
+ "name": "renounceOwnership",
47
+ "inputs": [],
48
+ "outputs": [],
49
+ "stateMutability": "nonpayable"
50
+ },
51
+ {
52
+ "type": "function",
53
+ "name": "transferOwnership",
54
+ "inputs": [
55
+ {
56
+ "name": "newOwner",
57
+ "type": "address",
58
+ "internalType": "address"
59
+ }
60
+ ],
61
+ "outputs": [],
62
+ "stateMutability": "nonpayable"
63
+ },
64
+ {
65
+ "type": "function",
66
+ "name": "upgradeTo",
67
+ "inputs": [
68
+ {
69
+ "name": "newImplementation",
70
+ "type": "address",
71
+ "internalType": "address"
72
+ }
73
+ ],
74
+ "outputs": [],
75
+ "stateMutability": "nonpayable"
76
+ },
77
+ {
78
+ "type": "event",
79
+ "name": "OwnershipTransferred",
80
+ "inputs": [
81
+ {
82
+ "name": "previousOwner",
83
+ "type": "address",
84
+ "indexed": true,
85
+ "internalType": "address"
86
+ },
87
+ {
88
+ "name": "newOwner",
89
+ "type": "address",
90
+ "indexed": true,
91
+ "internalType": "address"
92
+ }
93
+ ],
94
+ "anonymous": false
95
+ },
96
+ {
97
+ "type": "event",
98
+ "name": "Upgraded",
99
+ "inputs": [
100
+ {
101
+ "name": "implementation",
102
+ "type": "address",
103
+ "indexed": true,
104
+ "internalType": "address"
105
+ }
106
+ ],
107
+ "anonymous": false
108
+ }
109
+ ]
110
+ }