@elmntl/vaults-v2 1.4.4 → 1.5.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 (39) hide show
  1. package/README.md +40 -0
  2. package/dist/accounts/index.d.ts +2 -0
  3. package/dist/accounts/index.d.ts.map +1 -1
  4. package/dist/accounts/index.js +3 -1
  5. package/dist/accounts/index.js.map +1 -1
  6. package/dist/accounts/poolExt.d.ts +101 -0
  7. package/dist/accounts/poolExt.d.ts.map +1 -0
  8. package/dist/accounts/poolExt.js +211 -0
  9. package/dist/accounts/poolExt.js.map +1 -0
  10. package/dist/accounts/position.d.ts +8 -0
  11. package/dist/accounts/position.d.ts.map +1 -1
  12. package/dist/accounts/position.js +22 -0
  13. package/dist/accounts/position.js.map +1 -1
  14. package/dist/accounts/ticket.d.ts +8 -0
  15. package/dist/accounts/ticket.d.ts.map +1 -1
  16. package/dist/accounts/ticket.js +17 -0
  17. package/dist/accounts/ticket.js.map +1 -1
  18. package/dist/generated/idl/elemental_vault_v2.json +1204 -65
  19. package/dist/index.d.ts +3 -2
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +11 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/programs/elemental.d.ts +32 -1
  24. package/dist/programs/elemental.d.ts.map +1 -1
  25. package/dist/programs/elemental.js +166 -0
  26. package/dist/programs/elemental.js.map +1 -1
  27. package/dist/types.d.ts +53 -0
  28. package/dist/types.d.ts.map +1 -1
  29. package/dist/types.js +29 -4
  30. package/dist/types.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/accounts/index.ts +2 -0
  33. package/src/accounts/poolExt.ts +272 -0
  34. package/src/accounts/position.ts +22 -0
  35. package/src/accounts/ticket.ts +20 -0
  36. package/src/generated/idl/elemental_vault_v2.json +1204 -65
  37. package/src/index.ts +12 -1
  38. package/src/programs/elemental.ts +198 -1
  39. package/src/types.ts +68 -3
@@ -337,6 +337,64 @@
337
337
  }
338
338
  ]
339
339
  },
340
+ {
341
+ "name": "create_ticket_alt",
342
+ "docs": [
343
+ "Create a withdrawal ticket to be paid in the alternate token. Locks the current",
344
+ "NAV (Scope-read from remaining_accounts[0], or posted) and exit fee onto the",
345
+ "ticket; the payout is fixed from this moment. amount=0 is yield-only."
346
+ ],
347
+ "discriminator": [
348
+ 185,
349
+ 1,
350
+ 219,
351
+ 108,
352
+ 233,
353
+ 36,
354
+ 14,
355
+ 212
356
+ ],
357
+ "accounts": [
358
+ {
359
+ "name": "payer",
360
+ "writable": true,
361
+ "signer": true
362
+ },
363
+ {
364
+ "name": "position_owner",
365
+ "accounts": [
366
+ {
367
+ "name": "owner",
368
+ "signer": true
369
+ },
370
+ {
371
+ "name": "position",
372
+ "writable": true
373
+ },
374
+ {
375
+ "name": "pool",
376
+ "writable": true
377
+ }
378
+ ]
379
+ },
380
+ {
381
+ "name": "pool_ext"
382
+ },
383
+ {
384
+ "name": "ticket",
385
+ "writable": true
386
+ },
387
+ {
388
+ "name": "system_program"
389
+ }
390
+ ],
391
+ "args": [
392
+ {
393
+ "name": "amount",
394
+ "type": "u64"
395
+ }
396
+ ]
397
+ },
340
398
  {
341
399
  "name": "deactivate",
342
400
  "docs": [
@@ -459,6 +517,76 @@
459
517
  }
460
518
  ]
461
519
  },
520
+ {
521
+ "name": "deposit_alt",
522
+ "docs": [
523
+ "Deposit the alternate token; credited to the position in vault units at the NAV",
524
+ "(Scope-read from remaining_accounts[0], or posted). `min_credit` is the user's",
525
+ "floor in vault units."
526
+ ],
527
+ "discriminator": [
528
+ 31,
529
+ 117,
530
+ 16,
531
+ 195,
532
+ 206,
533
+ 161,
534
+ 196,
535
+ 176
536
+ ],
537
+ "accounts": [
538
+ {
539
+ "name": "position_owner",
540
+ "accounts": [
541
+ {
542
+ "name": "owner",
543
+ "signer": true
544
+ },
545
+ {
546
+ "name": "position",
547
+ "writable": true
548
+ },
549
+ {
550
+ "name": "pool",
551
+ "writable": true
552
+ }
553
+ ]
554
+ },
555
+ {
556
+ "name": "pool_ext"
557
+ },
558
+ {
559
+ "name": "user_alt_account",
560
+ "docs": [
561
+ "User's alt token account"
562
+ ],
563
+ "writable": true
564
+ },
565
+ {
566
+ "name": "alt_holder",
567
+ "docs": [
568
+ "Pool's alt holder (receives the deposit)"
569
+ ],
570
+ "writable": true
571
+ },
572
+ {
573
+ "name": "alt_mint"
574
+ },
575
+ {
576
+ "name": "token_program"
577
+ }
578
+ ],
579
+ "args": [
580
+ {
581
+ "name": "amount",
582
+ "type": "u64"
583
+ },
584
+ {
585
+ "name": "min_credit",
586
+ "type": "u64"
587
+ }
588
+ ]
589
+ },
462
590
  {
463
591
  "name": "deposit_vault_mint",
464
592
  "docs": [
@@ -523,6 +651,48 @@
523
651
  }
524
652
  ]
525
653
  },
654
+ {
655
+ "name": "flush_alt_to_manager",
656
+ "docs": [
657
+ "Permissionless: move all alt tokens in the holder to the pool's manager_wallet."
658
+ ],
659
+ "discriminator": [
660
+ 93,
661
+ 44,
662
+ 26,
663
+ 173,
664
+ 62,
665
+ 62,
666
+ 74,
667
+ 149
668
+ ],
669
+ "accounts": [
670
+ {
671
+ "name": "pool"
672
+ },
673
+ {
674
+ "name": "ext_authority"
675
+ },
676
+ {
677
+ "name": "pool_ext"
678
+ },
679
+ {
680
+ "name": "alt_holder",
681
+ "writable": true
682
+ },
683
+ {
684
+ "name": "manager_alt_account",
685
+ "writable": true
686
+ },
687
+ {
688
+ "name": "alt_mint"
689
+ },
690
+ {
691
+ "name": "token_program"
692
+ }
693
+ ],
694
+ "args": []
695
+ },
526
696
  {
527
697
  "name": "flush_to_manager",
528
698
  "docs": [
@@ -646,6 +816,104 @@
646
816
  }
647
817
  ]
648
818
  },
819
+ {
820
+ "name": "init_pool_ext",
821
+ "docs": [
822
+ "Admin-only: give a pool a second token at its edges. `alt_is_usdc` = true when",
823
+ "the pool is RWA-denominated and the alt is USDC; false when the pool is",
824
+ "USDC-denominated and the alt is the RWA (in-place adaptation of a live pool).",
825
+ "`nav` is USDC per 1 RWA, 1e9-scaled, for the posted source; `nav_oracle`",
826
+ "Some(scope_prices) + `nav_oracle_index` selects the Scope source (NAV read",
827
+ "on-chain at every conversion; requires `nav_max_age` > 0). `flags`: bit0 alt",
828
+ "deposits, bit1 alt exits. `fee_destination` None = exit fee stays in the faucet."
829
+ ],
830
+ "discriminator": [
831
+ 146,
832
+ 90,
833
+ 228,
834
+ 29,
835
+ 101,
836
+ 206,
837
+ 248,
838
+ 68
839
+ ],
840
+ "accounts": [
841
+ {
842
+ "name": "admin",
843
+ "writable": true,
844
+ "signer": true
845
+ },
846
+ {
847
+ "name": "pool"
848
+ },
849
+ {
850
+ "name": "ext_authority",
851
+ "docs": [
852
+ "Never the pool authority (see `PoolExt::ext_authority_bump`)."
853
+ ]
854
+ },
855
+ {
856
+ "name": "pool_ext",
857
+ "writable": true
858
+ },
859
+ {
860
+ "name": "alt_mint"
861
+ },
862
+ {
863
+ "name": "alt_holder",
864
+ "docs": [
865
+ "Receives alt deposits"
866
+ ]
867
+ },
868
+ {
869
+ "name": "alt_faucet",
870
+ "docs": [
871
+ "Pays alt exits"
872
+ ]
873
+ },
874
+ {
875
+ "name": "system_program"
876
+ }
877
+ ],
878
+ "args": [
879
+ {
880
+ "name": "alt_is_usdc",
881
+ "type": "bool"
882
+ },
883
+ {
884
+ "name": "nav",
885
+ "type": "u64"
886
+ },
887
+ {
888
+ "name": "nav_max_age",
889
+ "type": "u32"
890
+ },
891
+ {
892
+ "name": "exit_fee_bps",
893
+ "type": "u16"
894
+ },
895
+ {
896
+ "name": "fee_destination",
897
+ "type": {
898
+ "option": "pubkey"
899
+ }
900
+ },
901
+ {
902
+ "name": "flags",
903
+ "type": "u8"
904
+ },
905
+ {
906
+ "name": "nav_oracle",
907
+ "type": {
908
+ "option": "pubkey"
909
+ }
910
+ },
911
+ {
912
+ "name": "nav_oracle_index",
913
+ "type": "u16"
914
+ }
915
+ ]
916
+ },
649
917
  {
650
918
  "name": "initialize",
651
919
  "docs": [
@@ -921,62 +1189,174 @@
921
1189
  "args": []
922
1190
  },
923
1191
  {
924
- "name": "transfer_to_faucet",
1192
+ "name": "redeem_ticket_alt",
925
1193
  "docs": [
926
- "Transfer funds from liquidity_holder to liquidity_faucet (admin only)"
1194
+ "Redeem a matured alternate-token ticket: pays the locked net from the alt faucet."
927
1195
  ],
928
1196
  "discriminator": [
929
- 78,
930
- 27,
931
- 32,
932
- 107,
933
- 119,
934
- 121,
935
- 171,
936
- 0
1197
+ 185,
1198
+ 34,
1199
+ 214,
1200
+ 201,
1201
+ 57,
1202
+ 126,
1203
+ 52,
1204
+ 56
937
1205
  ],
938
1206
  "accounts": [
939
1207
  {
940
- "name": "admin",
941
- "docs": [
942
- "Admin must sign"
943
- ],
1208
+ "name": "owner",
1209
+ "writable": true,
944
1210
  "signer": true
945
1211
  },
1212
+ {
1213
+ "name": "ticket",
1214
+ "writable": true
1215
+ },
1216
+ {
1217
+ "name": "position",
1218
+ "writable": true
1219
+ },
946
1220
  {
947
1221
  "name": "pool",
948
- "docs": [
949
- "The pool (must have admin as the signer)"
950
- ]
1222
+ "writable": true
951
1223
  },
952
1224
  {
953
- "name": "pool_authority"
1225
+ "name": "ext_authority"
954
1226
  },
955
1227
  {
956
- "name": "liquidity_holder",
1228
+ "name": "pool_ext"
1229
+ },
1230
+ {
1231
+ "name": "alt_faucet",
957
1232
  "docs": [
958
- "Source: liquidity_holder (where deposits go)"
1233
+ "Alt faucet (pays the exit)"
959
1234
  ],
960
1235
  "writable": true
961
1236
  },
962
1237
  {
963
- "name": "liquidity_faucet",
1238
+ "name": "user_alt_account",
964
1239
  "docs": [
965
- "Destination: liquidity_faucet (where withdrawals come from)"
1240
+ "User's alt account (receives net)"
966
1241
  ],
967
1242
  "writable": true
968
1243
  },
969
1244
  {
970
- "name": "vault_mint",
1245
+ "name": "fee_destination_account",
971
1246
  "docs": [
972
- "The vault mint"
973
- ]
1247
+ "Fee destination's alt account; required only when PoolExt.fee_destination is set and fee > 0"
1248
+ ],
1249
+ "writable": true,
1250
+ "optional": true
974
1251
  },
975
1252
  {
976
- "name": "token_program",
977
- "docs": [
978
- "Token program"
979
- ]
1253
+ "name": "alt_mint"
1254
+ },
1255
+ {
1256
+ "name": "token_program"
1257
+ }
1258
+ ],
1259
+ "args": []
1260
+ },
1261
+ {
1262
+ "name": "set_migration_convert",
1263
+ "docs": [
1264
+ "Admin-only: allow a migration config to accept the target's alt mint as the",
1265
+ "source asset, credited at the target PoolExt NAV (converting migration)."
1266
+ ],
1267
+ "discriminator": [
1268
+ 226,
1269
+ 104,
1270
+ 66,
1271
+ 143,
1272
+ 13,
1273
+ 59,
1274
+ 40,
1275
+ 246
1276
+ ],
1277
+ "accounts": [
1278
+ {
1279
+ "name": "admin",
1280
+ "signer": true
1281
+ },
1282
+ {
1283
+ "name": "pool"
1284
+ },
1285
+ {
1286
+ "name": "migration_config",
1287
+ "writable": true
1288
+ },
1289
+ {
1290
+ "name": "pool_ext",
1291
+ "docs": [
1292
+ "The target pool's ext must exist for a converting path to make sense."
1293
+ ]
1294
+ }
1295
+ ],
1296
+ "args": [
1297
+ {
1298
+ "name": "allow_convert",
1299
+ "type": "bool"
1300
+ }
1301
+ ]
1302
+ },
1303
+ {
1304
+ "name": "transfer_to_faucet",
1305
+ "docs": [
1306
+ "Transfer funds from liquidity_holder to liquidity_faucet (admin only)"
1307
+ ],
1308
+ "discriminator": [
1309
+ 78,
1310
+ 27,
1311
+ 32,
1312
+ 107,
1313
+ 119,
1314
+ 121,
1315
+ 171,
1316
+ 0
1317
+ ],
1318
+ "accounts": [
1319
+ {
1320
+ "name": "admin",
1321
+ "docs": [
1322
+ "Admin must sign"
1323
+ ],
1324
+ "signer": true
1325
+ },
1326
+ {
1327
+ "name": "pool",
1328
+ "docs": [
1329
+ "The pool (must have admin as the signer)"
1330
+ ]
1331
+ },
1332
+ {
1333
+ "name": "pool_authority"
1334
+ },
1335
+ {
1336
+ "name": "liquidity_holder",
1337
+ "docs": [
1338
+ "Source: liquidity_holder (where deposits go)"
1339
+ ],
1340
+ "writable": true
1341
+ },
1342
+ {
1343
+ "name": "liquidity_faucet",
1344
+ "docs": [
1345
+ "Destination: liquidity_faucet (where withdrawals come from)"
1346
+ ],
1347
+ "writable": true
1348
+ },
1349
+ {
1350
+ "name": "vault_mint",
1351
+ "docs": [
1352
+ "The vault mint"
1353
+ ]
1354
+ },
1355
+ {
1356
+ "name": "token_program",
1357
+ "docs": [
1358
+ "Token program"
1359
+ ]
980
1360
  }
981
1361
  ],
982
1362
  "args": [
@@ -1082,6 +1462,45 @@
1082
1462
  ],
1083
1463
  "args": []
1084
1464
  },
1465
+ {
1466
+ "name": "update_pool_ext",
1467
+ "docs": [
1468
+ "Admin may change any field; the pool's manager_wallet may post `nav` only."
1469
+ ],
1470
+ "discriminator": [
1471
+ 237,
1472
+ 82,
1473
+ 191,
1474
+ 95,
1475
+ 40,
1476
+ 0,
1477
+ 157,
1478
+ 27
1479
+ ],
1480
+ "accounts": [
1481
+ {
1482
+ "name": "signer",
1483
+ "signer": true
1484
+ },
1485
+ {
1486
+ "name": "pool"
1487
+ },
1488
+ {
1489
+ "name": "pool_ext",
1490
+ "writable": true
1491
+ }
1492
+ ],
1493
+ "args": [
1494
+ {
1495
+ "name": "params",
1496
+ "type": {
1497
+ "defined": {
1498
+ "name": "UpdatePoolExtParams"
1499
+ }
1500
+ }
1501
+ }
1502
+ ]
1503
+ },
1085
1504
  {
1086
1505
  "name": "withdraw",
1087
1506
  "docs": [
@@ -1175,6 +1594,19 @@
1175
1594
  188
1176
1595
  ]
1177
1596
  },
1597
+ {
1598
+ "name": "PoolExt",
1599
+ "discriminator": [
1600
+ 136,
1601
+ 76,
1602
+ 222,
1603
+ 248,
1604
+ 241,
1605
+ 143,
1606
+ 24,
1607
+ 212
1608
+ ]
1609
+ },
1178
1610
  {
1179
1611
  "name": "Position",
1180
1612
  "discriminator": [
@@ -1229,6 +1661,45 @@
1229
1661
  11
1230
1662
  ]
1231
1663
  },
1664
+ {
1665
+ "name": "AltDepositedEvent",
1666
+ "discriminator": [
1667
+ 114,
1668
+ 255,
1669
+ 228,
1670
+ 119,
1671
+ 69,
1672
+ 196,
1673
+ 49,
1674
+ 167
1675
+ ]
1676
+ },
1677
+ {
1678
+ "name": "AltRedeemedEvent",
1679
+ "discriminator": [
1680
+ 98,
1681
+ 103,
1682
+ 146,
1683
+ 48,
1684
+ 83,
1685
+ 110,
1686
+ 165,
1687
+ 245
1688
+ ]
1689
+ },
1690
+ {
1691
+ "name": "AltTicketCreatedEvent",
1692
+ "discriminator": [
1693
+ 136,
1694
+ 58,
1695
+ 150,
1696
+ 115,
1697
+ 156,
1698
+ 216,
1699
+ 19,
1700
+ 208
1701
+ ]
1702
+ },
1232
1703
  {
1233
1704
  "name": "ConfigUpdatedEvent",
1234
1705
  "discriminator": [
@@ -1307,6 +1778,45 @@
1307
1778
  204
1308
1779
  ]
1309
1780
  },
1781
+ {
1782
+ "name": "MigrationConvertSetEvent",
1783
+ "discriminator": [
1784
+ 81,
1785
+ 101,
1786
+ 127,
1787
+ 123,
1788
+ 227,
1789
+ 96,
1790
+ 9,
1791
+ 180
1792
+ ]
1793
+ },
1794
+ {
1795
+ "name": "PoolExtInitializedEvent",
1796
+ "discriminator": [
1797
+ 22,
1798
+ 115,
1799
+ 57,
1800
+ 194,
1801
+ 37,
1802
+ 128,
1803
+ 218,
1804
+ 252
1805
+ ]
1806
+ },
1807
+ {
1808
+ "name": "PoolExtUpdatedEvent",
1809
+ "discriminator": [
1810
+ 21,
1811
+ 162,
1812
+ 161,
1813
+ 234,
1814
+ 48,
1815
+ 74,
1816
+ 139,
1817
+ 158
1818
+ ]
1819
+ },
1310
1820
  {
1311
1821
  "name": "PoolUpdatedEvent",
1312
1822
  "discriminator": [
@@ -1485,23 +1995,98 @@
1485
1995
  },
1486
1996
  {
1487
1997
  "code": 6027,
1998
+ "name": "PartialDeactivateWouldLeaveDust",
1999
+ "msg": "Partial deactivate would leave a sub-min remainder — do a full withdrawal instead"
2000
+ },
2001
+ {
2002
+ "code": 6028,
1488
2003
  "name": "InvalidMigrationAuthority",
1489
2004
  "msg": "Signer is not the configured migration authority"
1490
2005
  },
1491
2006
  {
1492
- "code": 6028,
2007
+ "code": 6029,
1493
2008
  "name": "MigrationAssetMismatch",
1494
2009
  "msg": "Source mint does not match the target pool's vault mint"
1495
2010
  },
1496
2011
  {
1497
- "code": 6029,
2012
+ "code": 6030,
1498
2013
  "name": "MigrationCapExceeded",
1499
2014
  "msg": "Cumulative migration cap exceeded"
1500
2015
  },
1501
2016
  {
1502
- "code": 6030,
2017
+ "code": 6031,
1503
2018
  "name": "InvalidMigrationAmount",
1504
2019
  "msg": "Migration amount must be greater than zero"
2020
+ },
2021
+ {
2022
+ "code": 6032,
2023
+ "name": "InvalidNav",
2024
+ "msg": "Posted NAV is zero"
2025
+ },
2026
+ {
2027
+ "code": 6033,
2028
+ "name": "PoolExtNavStale",
2029
+ "msg": "Posted NAV is older than nav_max_age"
2030
+ },
2031
+ {
2032
+ "code": 6034,
2033
+ "name": "AltDepositsDisabled",
2034
+ "msg": "Alternate-token deposits are disabled on this pool"
2035
+ },
2036
+ {
2037
+ "code": 6035,
2038
+ "name": "AltExitsDisabled",
2039
+ "msg": "Alternate-token exits are disabled on this pool"
2040
+ },
2041
+ {
2042
+ "code": 6036,
2043
+ "name": "InvalidPayoutMint",
2044
+ "msg": "Ticket was not created for this payout token"
2045
+ },
2046
+ {
2047
+ "code": 6037,
2048
+ "name": "ExitFeeTooHigh",
2049
+ "msg": "Exit fee exceeds the hard cap"
2050
+ },
2051
+ {
2052
+ "code": 6038,
2053
+ "name": "PoolExtRequired",
2054
+ "msg": "PoolExt account required for this conversion"
2055
+ },
2056
+ {
2057
+ "code": 6039,
2058
+ "name": "PoolExtUnauthorized",
2059
+ "msg": "Signer may not change this PoolExt field"
2060
+ },
2061
+ {
2062
+ "code": 6040,
2063
+ "name": "CreditBelowMinimum",
2064
+ "msg": "Converted credit is below min_credit"
2065
+ },
2066
+ {
2067
+ "code": 6041,
2068
+ "name": "FeeDestinationRequired",
2069
+ "msg": "Fee destination token account required"
2070
+ },
2071
+ {
2072
+ "code": 6042,
2073
+ "name": "SelfMigration",
2074
+ "msg": "A pool cannot migrate into itself"
2075
+ },
2076
+ {
2077
+ "code": 6043,
2078
+ "name": "NavOracleRequired",
2079
+ "msg": "NAV oracle account required for this pool's conversion source"
2080
+ },
2081
+ {
2082
+ "code": 6044,
2083
+ "name": "InvalidNavOracle",
2084
+ "msg": "NAV oracle account is not the pinned one or has an unexpected layout"
2085
+ },
2086
+ {
2087
+ "code": 6045,
2088
+ "name": "NavMaxAgeRequired",
2089
+ "msg": "A Scope-sourced pool needs a non-zero nav_max_age"
1505
2090
  }
1506
2091
  ],
1507
2092
  "types": [
@@ -1588,7 +2173,7 @@
1588
2173
  }
1589
2174
  },
1590
2175
  {
1591
- "name": "ConfigUpdatedEvent",
2176
+ "name": "AltDepositedEvent",
1592
2177
  "type": {
1593
2178
  "kind": "struct",
1594
2179
  "fields": [
@@ -1597,46 +2182,182 @@
1597
2182
  "type": "pubkey"
1598
2183
  },
1599
2184
  {
1600
- "name": "reward_annual_rate",
1601
- "type": {
1602
- "option": "u64"
1603
- }
1604
- },
1605
- {
1606
- "name": "max_supply",
1607
- "type": {
1608
- "option": "u64"
1609
- }
2185
+ "name": "position",
2186
+ "type": "pubkey"
1610
2187
  },
1611
2188
  {
1612
- "name": "max_deposit_amount",
1613
- "type": {
1614
- "option": "u64"
1615
- }
2189
+ "name": "owner",
2190
+ "type": "pubkey"
1616
2191
  },
1617
2192
  {
1618
- "name": "min_deposit_amount",
1619
- "type": {
1620
- "option": "u64"
1621
- }
2193
+ "name": "alt_mint",
2194
+ "type": "pubkey"
1622
2195
  },
1623
2196
  {
1624
- "name": "min_deposit_amount_alt",
1625
- "type": {
1626
- "option": "u64"
1627
- }
2197
+ "name": "alt_in",
2198
+ "type": "u64"
1628
2199
  },
1629
2200
  {
1630
- "name": "epoch_start_time",
1631
- "type": {
1632
- "option": "u32"
1633
- }
2201
+ "name": "vault_credited",
2202
+ "type": "u64"
1634
2203
  },
1635
2204
  {
1636
- "name": "manager_wallet",
1637
- "type": {
1638
- "option": "pubkey"
1639
- }
2205
+ "name": "nav",
2206
+ "type": "u64"
2207
+ }
2208
+ ]
2209
+ }
2210
+ },
2211
+ {
2212
+ "name": "AltRedeemedEvent",
2213
+ "type": {
2214
+ "kind": "struct",
2215
+ "fields": [
2216
+ {
2217
+ "name": "pool",
2218
+ "type": "pubkey"
2219
+ },
2220
+ {
2221
+ "name": "ticket",
2222
+ "type": "pubkey"
2223
+ },
2224
+ {
2225
+ "name": "owner",
2226
+ "type": "pubkey"
2227
+ },
2228
+ {
2229
+ "name": "alt_mint",
2230
+ "type": "pubkey"
2231
+ },
2232
+ {
2233
+ "name": "vault_total",
2234
+ "type": "u64"
2235
+ },
2236
+ {
2237
+ "name": "nav_locked",
2238
+ "type": "u64"
2239
+ },
2240
+ {
2241
+ "name": "fee_bps_locked",
2242
+ "type": "u16"
2243
+ },
2244
+ {
2245
+ "name": "gross_alt",
2246
+ "type": "u64"
2247
+ },
2248
+ {
2249
+ "name": "fee_alt",
2250
+ "type": "u64"
2251
+ },
2252
+ {
2253
+ "name": "net_alt",
2254
+ "type": "u64"
2255
+ },
2256
+ {
2257
+ "name": "fee_destination",
2258
+ "type": "pubkey"
2259
+ }
2260
+ ]
2261
+ }
2262
+ },
2263
+ {
2264
+ "name": "AltTicketCreatedEvent",
2265
+ "type": {
2266
+ "kind": "struct",
2267
+ "fields": [
2268
+ {
2269
+ "name": "pool",
2270
+ "type": "pubkey"
2271
+ },
2272
+ {
2273
+ "name": "ticket",
2274
+ "type": "pubkey"
2275
+ },
2276
+ {
2277
+ "name": "owner",
2278
+ "type": "pubkey"
2279
+ },
2280
+ {
2281
+ "name": "alt_mint",
2282
+ "type": "pubkey"
2283
+ },
2284
+ {
2285
+ "name": "vault_total",
2286
+ "type": "u64"
2287
+ },
2288
+ {
2289
+ "name": "nav_locked",
2290
+ "type": "u64"
2291
+ },
2292
+ {
2293
+ "name": "fee_bps_locked",
2294
+ "type": "u16"
2295
+ },
2296
+ {
2297
+ "name": "gross_alt",
2298
+ "type": "u64"
2299
+ },
2300
+ {
2301
+ "name": "fee_alt",
2302
+ "type": "u64"
2303
+ },
2304
+ {
2305
+ "name": "net_alt",
2306
+ "type": "u64"
2307
+ }
2308
+ ]
2309
+ }
2310
+ },
2311
+ {
2312
+ "name": "ConfigUpdatedEvent",
2313
+ "type": {
2314
+ "kind": "struct",
2315
+ "fields": [
2316
+ {
2317
+ "name": "pool",
2318
+ "type": "pubkey"
2319
+ },
2320
+ {
2321
+ "name": "reward_annual_rate",
2322
+ "type": {
2323
+ "option": "u64"
2324
+ }
2325
+ },
2326
+ {
2327
+ "name": "max_supply",
2328
+ "type": {
2329
+ "option": "u64"
2330
+ }
2331
+ },
2332
+ {
2333
+ "name": "max_deposit_amount",
2334
+ "type": {
2335
+ "option": "u64"
2336
+ }
2337
+ },
2338
+ {
2339
+ "name": "min_deposit_amount",
2340
+ "type": {
2341
+ "option": "u64"
2342
+ }
2343
+ },
2344
+ {
2345
+ "name": "min_deposit_amount_alt",
2346
+ "type": {
2347
+ "option": "u64"
2348
+ }
2349
+ },
2350
+ {
2351
+ "name": "epoch_start_time",
2352
+ "type": {
2353
+ "option": "u32"
2354
+ }
2355
+ },
2356
+ {
2357
+ "name": "manager_wallet",
2358
+ "type": {
2359
+ "option": "pubkey"
2360
+ }
1640
2361
  }
1641
2362
  ]
1642
2363
  }
@@ -1720,6 +2441,9 @@
1720
2441
  },
1721
2442
  {
1722
2443
  "name": "amount",
2444
+ "docs": [
2445
+ "Amount in source_mint units as sent by the source pool"
2446
+ ],
1723
2447
  "type": "u64"
1724
2448
  },
1725
2449
  {
@@ -1729,6 +2453,20 @@
1729
2453
  {
1730
2454
  "name": "remaining_cap",
1731
2455
  "type": "u64"
2456
+ },
2457
+ {
2458
+ "name": "credited",
2459
+ "docs": [
2460
+ "Amount credited to the position in vault_mint units (== amount when same asset)"
2461
+ ],
2462
+ "type": "u64"
2463
+ },
2464
+ {
2465
+ "name": "nav",
2466
+ "docs": [
2467
+ "NAV used for a converting migration; 0 for same-asset"
2468
+ ],
2469
+ "type": "u64"
1732
2470
  }
1733
2471
  ]
1734
2472
  }
@@ -1783,6 +2521,15 @@
1783
2521
  ],
1784
2522
  "type": "u8"
1785
2523
  },
2524
+ {
2525
+ "name": "allow_convert",
2526
+ "docs": [
2527
+ "1 = `migrate_in` may accept the target's USDC mint as `source_mint` and credit",
2528
+ "it at the target `PoolExt` NAV. 0 (default, and for configs created before this",
2529
+ "field) keeps the strict same-mint rule. Set by `set_migration_convert`."
2530
+ ],
2531
+ "type": "u8"
2532
+ },
1786
2533
  {
1787
2534
  "name": "_reserved",
1788
2535
  "docs": [
@@ -1791,7 +2538,7 @@
1791
2538
  "type": {
1792
2539
  "array": [
1793
2540
  "u8",
1794
- 32
2541
+ 31
1795
2542
  ]
1796
2543
  }
1797
2544
  }
@@ -1834,6 +2581,26 @@
1834
2581
  ]
1835
2582
  }
1836
2583
  },
2584
+ {
2585
+ "name": "MigrationConvertSetEvent",
2586
+ "type": {
2587
+ "kind": "struct",
2588
+ "fields": [
2589
+ {
2590
+ "name": "pool",
2591
+ "type": "pubkey"
2592
+ },
2593
+ {
2594
+ "name": "authority",
2595
+ "type": "pubkey"
2596
+ },
2597
+ {
2598
+ "name": "allow_convert",
2599
+ "type": "bool"
2600
+ }
2601
+ ]
2602
+ }
2603
+ },
1837
2604
  {
1838
2605
  "name": "Pool",
1839
2606
  "docs": [
@@ -2042,6 +2809,268 @@
2042
2809
  ]
2043
2810
  }
2044
2811
  },
2812
+ {
2813
+ "name": "PoolExt",
2814
+ "docs": [
2815
+ "Per-pool sidecar that gives a vault a second token at its edges.",
2816
+ "",
2817
+ "The pool's ledger (positions, tickets, queues, caps, `reward_per_token`) stays",
2818
+ "in `vault_mint` units. This account names the ALTERNATE token (`alt_mint`),",
2819
+ "where it lands and is paid from, the NAV source, the exit fee, and the",
2820
+ "switches. It works in both directions:",
2821
+ "",
2822
+ "- vault = RWA, alt = USDC (`alt_is_usdc = 1`): USDC deposits credit RWA, RWA",
2823
+ "tickets can pay USDC.",
2824
+ "- vault = USDC, alt = RWA (`alt_is_usdc = 0`): RWA deposits credit USDC, USDC",
2825
+ "tickets can pay RWA. This is how an existing USDC-denominated pool adapts",
2826
+ "in place.",
2827
+ "",
2828
+ "NAV convention is the same either way: USDC per ONE whole RWA token,",
2829
+ "1e9-scaled (1.05 USDC per RWA == 1_050_000_000). Decimals are folded in by",
2830
+ "the conversion helpers using `Pool::per_token_amount` (10^vault_decimals)",
2831
+ "and `alt_decimals`. It is a separate PDA because live pools were client-sized",
2832
+ "at `Pool::LEN` and cannot grow."
2833
+ ],
2834
+ "type": {
2835
+ "kind": "struct",
2836
+ "fields": [
2837
+ {
2838
+ "name": "pool",
2839
+ "docs": [
2840
+ "The pool this ext belongs to (also in the PDA seeds)"
2841
+ ],
2842
+ "type": "pubkey"
2843
+ },
2844
+ {
2845
+ "name": "alt_mint",
2846
+ "docs": [
2847
+ "The alternate token (USDC on an RWA pool; the RWA on a USDC pool)"
2848
+ ],
2849
+ "type": "pubkey"
2850
+ },
2851
+ {
2852
+ "name": "alt_holder",
2853
+ "docs": [
2854
+ "Token account receiving alt deposits; owned by pool_authority"
2855
+ ],
2856
+ "type": "pubkey"
2857
+ },
2858
+ {
2859
+ "name": "alt_faucet",
2860
+ "docs": [
2861
+ "Token account paying alt exits; owned by pool_authority"
2862
+ ],
2863
+ "type": "pubkey"
2864
+ },
2865
+ {
2866
+ "name": "fee_destination",
2867
+ "docs": [
2868
+ "Wallet whose alt-mint token account receives exit fees. `Pubkey::default()` = fee stays in the faucet."
2869
+ ],
2870
+ "type": "pubkey"
2871
+ },
2872
+ {
2873
+ "name": "nav",
2874
+ "docs": [
2875
+ "Posted NAV: USDC per 1 RWA token, 1e9-scaled (used when conversion_source == CUSTODIAL)"
2876
+ ],
2877
+ "type": "u64"
2878
+ },
2879
+ {
2880
+ "name": "nav_updated_at",
2881
+ "docs": [
2882
+ "Unix time the NAV was last posted"
2883
+ ],
2884
+ "type": "i64"
2885
+ },
2886
+ {
2887
+ "name": "nav_max_age",
2888
+ "docs": [
2889
+ "Max age in seconds before conversions reject; 0 = no staleness check"
2890
+ ],
2891
+ "type": "u32"
2892
+ },
2893
+ {
2894
+ "name": "exit_fee_bps",
2895
+ "docs": [
2896
+ "Fee on alt exits, basis points, applied on the conversion"
2897
+ ],
2898
+ "type": "u16"
2899
+ },
2900
+ {
2901
+ "name": "alt_decimals",
2902
+ "docs": [
2903
+ "Decimals of `alt_mint`, recorded at init so no mint account is needed to convert"
2904
+ ],
2905
+ "type": "u8"
2906
+ },
2907
+ {
2908
+ "name": "flags",
2909
+ "docs": [
2910
+ "Bit flags, see `PoolExt::FLAG_*`"
2911
+ ],
2912
+ "type": "u8"
2913
+ },
2914
+ {
2915
+ "name": "conversion_source",
2916
+ "docs": [
2917
+ "Where the NAV comes from: 0 = posted here, 1 = read from Scope at every conversion."
2918
+ ],
2919
+ "type": "u8"
2920
+ },
2921
+ {
2922
+ "name": "bump",
2923
+ "docs": [
2924
+ "PDA bump"
2925
+ ],
2926
+ "type": "u8"
2927
+ },
2928
+ {
2929
+ "name": "nav_oracle",
2930
+ "docs": [
2931
+ "Scope `OraclePrices` account the NAV is read from when",
2932
+ "`conversion_source == CONVERSION_SCOPE`; pinned at init/update by the admin."
2933
+ ],
2934
+ "type": "pubkey"
2935
+ },
2936
+ {
2937
+ "name": "nav_oracle_index",
2938
+ "docs": [
2939
+ "Index of the token's `DatedPrice` entry inside that account"
2940
+ ],
2941
+ "type": "u16"
2942
+ },
2943
+ {
2944
+ "name": "alt_is_usdc",
2945
+ "docs": [
2946
+ "1 = the alt is USDC and the vault is the RWA; 0 = the vault is USDC and the alt is the RWA."
2947
+ ],
2948
+ "type": "u8"
2949
+ },
2950
+ {
2951
+ "name": "ext_authority_bump",
2952
+ "docs": [
2953
+ "Bump of the ext authority PDA `[\"ext_authority\", pool]` that owns `alt_holder` and `alt_faucet`.",
2954
+ "",
2955
+ "Deliberately NOT the pool authority: the OnRe adapter signs as the pool",
2956
+ "authority and hands OnRe a caller-chosen USDC source, so any USDC account",
2957
+ "the pool authority owns could be spent by anyone calling `deposit`."
2958
+ ],
2959
+ "type": "u8"
2960
+ },
2961
+ {
2962
+ "name": "_reserved",
2963
+ "docs": [
2964
+ "Reserved for future use"
2965
+ ],
2966
+ "type": {
2967
+ "array": [
2968
+ "u8",
2969
+ 28
2970
+ ]
2971
+ }
2972
+ }
2973
+ ]
2974
+ }
2975
+ },
2976
+ {
2977
+ "name": "PoolExtInitializedEvent",
2978
+ "type": {
2979
+ "kind": "struct",
2980
+ "fields": [
2981
+ {
2982
+ "name": "pool",
2983
+ "type": "pubkey"
2984
+ },
2985
+ {
2986
+ "name": "pool_ext",
2987
+ "type": "pubkey"
2988
+ },
2989
+ {
2990
+ "name": "alt_mint",
2991
+ "type": "pubkey"
2992
+ },
2993
+ {
2994
+ "name": "alt_holder",
2995
+ "type": "pubkey"
2996
+ },
2997
+ {
2998
+ "name": "alt_faucet",
2999
+ "type": "pubkey"
3000
+ },
3001
+ {
3002
+ "name": "alt_is_usdc",
3003
+ "type": "bool"
3004
+ },
3005
+ {
3006
+ "name": "conversion_source",
3007
+ "type": "u8"
3008
+ },
3009
+ {
3010
+ "name": "nav",
3011
+ "type": "u64"
3012
+ },
3013
+ {
3014
+ "name": "exit_fee_bps",
3015
+ "type": "u16"
3016
+ },
3017
+ {
3018
+ "name": "flags",
3019
+ "type": "u8"
3020
+ }
3021
+ ]
3022
+ }
3023
+ },
3024
+ {
3025
+ "name": "PoolExtUpdatedEvent",
3026
+ "type": {
3027
+ "kind": "struct",
3028
+ "fields": [
3029
+ {
3030
+ "name": "pool",
3031
+ "type": "pubkey"
3032
+ },
3033
+ {
3034
+ "name": "signer",
3035
+ "type": "pubkey"
3036
+ },
3037
+ {
3038
+ "name": "nav",
3039
+ "type": {
3040
+ "option": "u64"
3041
+ }
3042
+ },
3043
+ {
3044
+ "name": "nav_max_age",
3045
+ "type": {
3046
+ "option": "u32"
3047
+ }
3048
+ },
3049
+ {
3050
+ "name": "exit_fee_bps",
3051
+ "type": {
3052
+ "option": "u16"
3053
+ }
3054
+ },
3055
+ {
3056
+ "name": "fee_destination",
3057
+ "type": {
3058
+ "option": "pubkey"
3059
+ }
3060
+ },
3061
+ {
3062
+ "name": "flags",
3063
+ "type": {
3064
+ "option": "u8"
3065
+ }
3066
+ },
3067
+ {
3068
+ "name": "nav_updated_at",
3069
+ "type": "i64"
3070
+ }
3071
+ ]
3072
+ }
3073
+ },
2045
3074
  {
2046
3075
  "name": "PoolUpdatedData",
2047
3076
  "type": {
@@ -2175,12 +3204,40 @@
2175
3204
  ],
2176
3205
  "type": "u16"
2177
3206
  },
3207
+ {
3208
+ "name": "alt_deposited",
3209
+ "docs": [
3210
+ "Alt tokens deposited through `deposit_alt` or a converting `migrate_in` (alt units)"
3211
+ ],
3212
+ "type": "u64"
3213
+ },
3214
+ {
3215
+ "name": "vault_deposited",
3216
+ "docs": [
3217
+ "vault_mint deposited through `deposit`, `deposit_vault_mint` or a same-asset `migrate_in`"
3218
+ ],
3219
+ "type": "u64"
3220
+ },
3221
+ {
3222
+ "name": "alt_withdrawn",
3223
+ "docs": [
3224
+ "Alt tokens paid out through `redeem_ticket_alt`, net of fee (alt units)"
3225
+ ],
3226
+ "type": "u64"
3227
+ },
3228
+ {
3229
+ "name": "vault_withdrawn",
3230
+ "docs": [
3231
+ "vault_mint paid out through `redeem_ticket` / `withdraw`"
3232
+ ],
3233
+ "type": "u64"
3234
+ },
2178
3235
  {
2179
3236
  "name": "_reserved",
2180
3237
  "type": {
2181
3238
  "array": [
2182
3239
  "u8",
2183
- 64
3240
+ 32
2184
3241
  ]
2185
3242
  }
2186
3243
  }
@@ -2362,6 +3419,66 @@
2362
3419
  ]
2363
3420
  }
2364
3421
  },
3422
+ {
3423
+ "name": "UpdatePoolExtParams",
3424
+ "type": {
3425
+ "kind": "struct",
3426
+ "fields": [
3427
+ {
3428
+ "name": "nav",
3429
+ "type": {
3430
+ "option": "u64"
3431
+ }
3432
+ },
3433
+ {
3434
+ "name": "nav_max_age",
3435
+ "type": {
3436
+ "option": "u32"
3437
+ }
3438
+ },
3439
+ {
3440
+ "name": "exit_fee_bps",
3441
+ "type": {
3442
+ "option": "u16"
3443
+ }
3444
+ },
3445
+ {
3446
+ "name": "fee_destination",
3447
+ "docs": [
3448
+ "`Some(Pubkey::default())` clears the destination (fee stays in the faucet)"
3449
+ ],
3450
+ "type": {
3451
+ "option": "pubkey"
3452
+ }
3453
+ },
3454
+ {
3455
+ "name": "flags",
3456
+ "type": {
3457
+ "option": "u8"
3458
+ }
3459
+ },
3460
+ {
3461
+ "name": "nav_oracle",
3462
+ "docs": [
3463
+ "Admin only. `Some(Pubkey::default())` switches back to the posted NAV (custodial);",
3464
+ "any other key switches to Scope and pins that OraclePrices account."
3465
+ ],
3466
+ "type": {
3467
+ "option": "pubkey"
3468
+ }
3469
+ },
3470
+ {
3471
+ "name": "nav_oracle_index",
3472
+ "docs": [
3473
+ "Admin only."
3474
+ ],
3475
+ "type": {
3476
+ "option": "u16"
3477
+ }
3478
+ }
3479
+ ]
3480
+ }
3481
+ },
2365
3482
  {
2366
3483
  "name": "WithdrawalTicket",
2367
3484
  "type": {
@@ -2409,6 +3526,28 @@
2409
3526
  "Bump seed for PDA"
2410
3527
  ],
2411
3528
  "type": "u8"
3529
+ },
3530
+ {
3531
+ "name": "payout_mint",
3532
+ "docs": [
3533
+ "Payout declared at creation: 0 = vault_mint (default, legacy tickets read 0),",
3534
+ "1 = the pool's alt token via `redeem_ticket_alt`, with the two locked fields below."
3535
+ ],
3536
+ "type": "u8"
3537
+ },
3538
+ {
3539
+ "name": "nav_locked",
3540
+ "docs": [
3541
+ "NAV (USDC per RWA, 1e9) resolved when an alt ticket was created"
3542
+ ],
3543
+ "type": "u64"
3544
+ },
3545
+ {
3546
+ "name": "fee_bps_locked",
3547
+ "docs": [
3548
+ "Exit fee bps copied from PoolExt when an alt ticket was created"
3549
+ ],
3550
+ "type": "u16"
2412
3551
  }
2413
3552
  ]
2414
3553
  }