@drift-labs/vaults-sdk 0.1.415 → 0.1.417

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.
@@ -145,6 +145,34 @@ exports.IDL = {
145
145
  },
146
146
  ],
147
147
  },
148
+ {
149
+ name: 'updateVaultProtocol',
150
+ accounts: [
151
+ {
152
+ name: 'vault',
153
+ isMut: true,
154
+ isSigner: false,
155
+ },
156
+ {
157
+ name: 'protocol',
158
+ isMut: false,
159
+ isSigner: true,
160
+ },
161
+ {
162
+ name: 'vaultProtocol',
163
+ isMut: true,
164
+ isSigner: false,
165
+ },
166
+ ],
167
+ args: [
168
+ {
169
+ name: 'params',
170
+ type: {
171
+ defined: 'UpdateVaultProtocolParams',
172
+ },
173
+ },
174
+ ],
175
+ },
148
176
  {
149
177
  name: 'updateVault',
150
178
  accounts: [
@@ -905,6 +933,155 @@ exports.IDL = {
905
933
  ],
906
934
  args: [],
907
935
  },
936
+ {
937
+ name: 'protocolRequestWithdraw',
938
+ accounts: [
939
+ {
940
+ name: 'vault',
941
+ isMut: true,
942
+ isSigner: false,
943
+ },
944
+ {
945
+ name: 'vaultProtocol',
946
+ isMut: true,
947
+ isSigner: false,
948
+ },
949
+ {
950
+ name: 'protocol',
951
+ isMut: false,
952
+ isSigner: true,
953
+ },
954
+ {
955
+ name: 'driftUserStats',
956
+ isMut: false,
957
+ isSigner: false,
958
+ },
959
+ {
960
+ name: 'driftUser',
961
+ isMut: false,
962
+ isSigner: false,
963
+ },
964
+ {
965
+ name: 'driftState',
966
+ isMut: false,
967
+ isSigner: false,
968
+ },
969
+ ],
970
+ args: [
971
+ {
972
+ name: 'withdrawAmount',
973
+ type: 'u64',
974
+ },
975
+ {
976
+ name: 'withdrawUnit',
977
+ type: {
978
+ defined: 'WithdrawUnit',
979
+ },
980
+ },
981
+ ],
982
+ },
983
+ {
984
+ name: 'protocolCancelWithdrawRequest',
985
+ accounts: [
986
+ {
987
+ name: 'vault',
988
+ isMut: true,
989
+ isSigner: false,
990
+ },
991
+ {
992
+ name: 'vaultProtocol',
993
+ isMut: true,
994
+ isSigner: false,
995
+ },
996
+ {
997
+ name: 'protocol',
998
+ isMut: false,
999
+ isSigner: true,
1000
+ },
1001
+ {
1002
+ name: 'driftUserStats',
1003
+ isMut: false,
1004
+ isSigner: false,
1005
+ },
1006
+ {
1007
+ name: 'driftUser',
1008
+ isMut: false,
1009
+ isSigner: false,
1010
+ },
1011
+ {
1012
+ name: 'driftState',
1013
+ isMut: false,
1014
+ isSigner: false,
1015
+ },
1016
+ ],
1017
+ args: [],
1018
+ },
1019
+ {
1020
+ name: 'protocolWithdraw',
1021
+ accounts: [
1022
+ {
1023
+ name: 'vault',
1024
+ isMut: true,
1025
+ isSigner: false,
1026
+ },
1027
+ {
1028
+ name: 'vaultProtocol',
1029
+ isMut: true,
1030
+ isSigner: false,
1031
+ },
1032
+ {
1033
+ name: 'protocol',
1034
+ isMut: false,
1035
+ isSigner: true,
1036
+ },
1037
+ {
1038
+ name: 'vaultTokenAccount',
1039
+ isMut: true,
1040
+ isSigner: false,
1041
+ },
1042
+ {
1043
+ name: 'driftUserStats',
1044
+ isMut: true,
1045
+ isSigner: false,
1046
+ },
1047
+ {
1048
+ name: 'driftUser',
1049
+ isMut: true,
1050
+ isSigner: false,
1051
+ },
1052
+ {
1053
+ name: 'driftState',
1054
+ isMut: false,
1055
+ isSigner: false,
1056
+ },
1057
+ {
1058
+ name: 'driftSpotMarketVault',
1059
+ isMut: true,
1060
+ isSigner: false,
1061
+ },
1062
+ {
1063
+ name: 'driftSigner',
1064
+ isMut: false,
1065
+ isSigner: false,
1066
+ },
1067
+ {
1068
+ name: 'userTokenAccount',
1069
+ isMut: true,
1070
+ isSigner: false,
1071
+ },
1072
+ {
1073
+ name: 'driftProgram',
1074
+ isMut: false,
1075
+ isSigner: false,
1076
+ },
1077
+ {
1078
+ name: 'tokenProgram',
1079
+ isMut: false,
1080
+ isSigner: false,
1081
+ },
1082
+ ],
1083
+ args: [],
1084
+ },
908
1085
  ],
909
1086
  accounts: [
910
1087
  {
@@ -994,6 +1171,85 @@ exports.IDL = {
994
1171
  ],
995
1172
  },
996
1173
  },
1174
+ {
1175
+ name: 'vaultProtocol',
1176
+ type: {
1177
+ kind: 'struct',
1178
+ fields: [
1179
+ {
1180
+ name: 'protocol',
1181
+ docs: [
1182
+ 'The protocol, company, or entity that services the product using this vault.',
1183
+ 'The protocol is not allowed to deposit into the vault but can profit share and collect annual fees just like the manager.',
1184
+ ],
1185
+ type: 'publicKey',
1186
+ },
1187
+ {
1188
+ name: 'protocolProfitAndFeeShares',
1189
+ docs: [
1190
+ 'The shares from profit share and annual fee unclaimed by the protocol.',
1191
+ ],
1192
+ type: 'u128',
1193
+ },
1194
+ {
1195
+ name: 'protocolFee',
1196
+ docs: [
1197
+ 'The annual fee charged on deposits by the protocol (traditional hedge funds typically charge 2% per year on assets under management).',
1198
+ "Unlike the management fee this can't be negative.",
1199
+ ],
1200
+ type: 'u64',
1201
+ },
1202
+ {
1203
+ name: 'protocolTotalWithdraws',
1204
+ docs: ['Total withdraws for the protocol'],
1205
+ type: 'u64',
1206
+ },
1207
+ {
1208
+ name: 'protocolTotalFee',
1209
+ docs: [
1210
+ 'Total fee charged by the protocol (annual management fee + profit share).',
1211
+ "Unlike the management fee this can't be negative.",
1212
+ ],
1213
+ type: 'u64',
1214
+ },
1215
+ {
1216
+ name: 'protocolTotalProfitShare',
1217
+ docs: ['Total profit share charged by the protocol'],
1218
+ type: 'u64',
1219
+ },
1220
+ {
1221
+ name: 'lastProtocolWithdrawRequest',
1222
+ type: {
1223
+ defined: 'WithdrawRequest',
1224
+ },
1225
+ },
1226
+ {
1227
+ name: 'protocolProfitShare',
1228
+ docs: [
1229
+ 'Percentage the protocol charges on all profits realized by depositors: PERCENTAGE_PRECISION',
1230
+ ],
1231
+ type: 'u32',
1232
+ },
1233
+ {
1234
+ name: 'bump',
1235
+ type: 'u8',
1236
+ },
1237
+ {
1238
+ name: 'version',
1239
+ type: 'u8',
1240
+ },
1241
+ {
1242
+ name: 'padding',
1243
+ docs: [
1244
+ '[`VaultProtocol`] is 117 bytes with padding to 120 bytes to make it a multiple of 8.',
1245
+ ],
1246
+ type: {
1247
+ array: ['u8', 2],
1248
+ },
1249
+ },
1250
+ ],
1251
+ },
1252
+ },
997
1253
  {
998
1254
  name: 'vault',
999
1255
  type: {
@@ -1043,7 +1299,7 @@ exports.IDL = {
1043
1299
  name: 'delegate',
1044
1300
  docs: [
1045
1301
  'The vaults designated delegate for drift user account',
1046
- 'Can differ from actual user delegate if vault is in liquidation',
1302
+ 'can differ from actual user delegate if vault is in liquidation',
1047
1303
  ],
1048
1304
  type: 'publicKey',
1049
1305
  },
@@ -1055,97 +1311,104 @@ exports.IDL = {
1055
1311
  {
1056
1312
  name: 'userShares',
1057
1313
  docs: [
1058
- 'the sum of all shares held by the users (vault depositors)',
1314
+ 'The sum of all shares held by the users (vault depositors)',
1059
1315
  ],
1060
1316
  type: 'u128',
1061
1317
  },
1062
1318
  {
1063
1319
  name: 'totalShares',
1064
- docs: ['the sum of all shares (including vault manager)'],
1320
+ docs: [
1321
+ 'The sum of all shares: deposits from users, manager deposits, manager profit/fee, and protocol profit/fee.',
1322
+ 'The manager deposits are total_shares - user_shares - protocol_profit_and_fee_shares.',
1323
+ ],
1065
1324
  type: 'u128',
1066
1325
  },
1067
1326
  {
1068
1327
  name: 'lastFeeUpdateTs',
1069
- docs: ['last fee update unix timestamp'],
1328
+ docs: ['Last fee update unix timestamp'],
1070
1329
  type: 'i64',
1071
1330
  },
1072
1331
  {
1073
1332
  name: 'liquidationStartTs',
1074
- docs: ['When the liquidation start'],
1333
+ docs: ['When the liquidation starts'],
1075
1334
  type: 'i64',
1076
1335
  },
1077
1336
  {
1078
1337
  name: 'redeemPeriod',
1079
1338
  docs: [
1080
- 'the period (in seconds) that a vault depositor must wait after requesting a withdraw to complete withdraw',
1339
+ 'The period (in seconds) that a vault depositor must wait after requesting a withdrawal to finalize withdrawal.',
1340
+ 'Currently, the maximum is 90 days.',
1081
1341
  ],
1082
1342
  type: 'i64',
1083
1343
  },
1084
1344
  {
1085
1345
  name: 'totalWithdrawRequested',
1086
- docs: ['the sum of all outstanding withdraw requests'],
1346
+ docs: ['The sum of all outstanding withdraw requests'],
1087
1347
  type: 'u64',
1088
1348
  },
1089
1349
  {
1090
1350
  name: 'maxTokens',
1091
1351
  docs: [
1092
- 'max token capacity, once hit/passed vault will reject new deposits (updateable)',
1352
+ 'Max token capacity, once hit/passed vault will reject new deposits (updatable)',
1093
1353
  ],
1094
1354
  type: 'u64',
1095
1355
  },
1096
1356
  {
1097
1357
  name: 'managementFee',
1098
- docs: ['manager fee'],
1358
+ docs: [
1359
+ 'The annual fee charged on deposits by the manager.',
1360
+ 'Traditional funds typically charge 2% per year on assets under management.',
1361
+ ],
1099
1362
  type: 'i64',
1100
1363
  },
1101
1364
  {
1102
1365
  name: 'initTs',
1103
- docs: ['timestamp vault initialized'],
1366
+ docs: ['Timestamp vault initialized'],
1104
1367
  type: 'i64',
1105
1368
  },
1106
1369
  {
1107
1370
  name: 'netDeposits',
1108
- docs: ['the net deposits for the vault'],
1371
+ docs: ['The net deposits for the vault'],
1109
1372
  type: 'i64',
1110
1373
  },
1111
1374
  {
1112
1375
  name: 'managerNetDeposits',
1113
- docs: ['the net deposits for the vault manager'],
1376
+ docs: ['The net deposits for the manager'],
1114
1377
  type: 'i64',
1115
1378
  },
1116
1379
  {
1117
1380
  name: 'totalDeposits',
1118
- docs: ['total deposits'],
1381
+ docs: ['Total deposits'],
1119
1382
  type: 'u64',
1120
1383
  },
1121
1384
  {
1122
1385
  name: 'totalWithdraws',
1123
- docs: ['total withdraws'],
1386
+ docs: ['Total withdraws'],
1124
1387
  type: 'u64',
1125
1388
  },
1126
1389
  {
1127
1390
  name: 'managerTotalDeposits',
1128
- docs: ['total deposits for the vault manager'],
1391
+ docs: ['Total deposits for the manager'],
1129
1392
  type: 'u64',
1130
1393
  },
1131
1394
  {
1132
1395
  name: 'managerTotalWithdraws',
1133
- docs: ['total withdraws for the vault manager'],
1396
+ docs: ['Total withdraws for the manager'],
1134
1397
  type: 'u64',
1135
1398
  },
1136
1399
  {
1137
1400
  name: 'managerTotalFee',
1138
- docs: ['total mgmt fee charged by vault manager'],
1401
+ docs: ['Total management fee accrued by the manager'],
1139
1402
  type: 'i64',
1140
1403
  },
1141
1404
  {
1142
1405
  name: 'managerTotalProfitShare',
1143
- docs: ['total profit share charged by vault manager'],
1406
+ docs: ['Total profit share accrued by the manager'],
1144
1407
  type: 'u64',
1145
1408
  },
1146
1409
  {
1147
1410
  name: 'minDepositAmount',
1148
- docs: ['the minimum deposit amount'],
1411
+ docs: ['The minimum deposit amount'],
1149
1412
  type: 'u64',
1150
1413
  },
1151
1414
  {
@@ -1157,21 +1420,21 @@ exports.IDL = {
1157
1420
  {
1158
1421
  name: 'sharesBase',
1159
1422
  docs: [
1160
- 'the base 10 exponent of the shares (given massive share inflation can occur at near zero vault equity)',
1423
+ 'The base 10 exponent of the shares (given massive share inflation can occur at near zero vault equity)',
1161
1424
  ],
1162
1425
  type: 'u32',
1163
1426
  },
1164
1427
  {
1165
1428
  name: 'profitShare',
1166
1429
  docs: [
1167
- "percentage of gains for vault admin upon depositor's realize/withdraw: PERCENTAGE_PRECISION",
1430
+ 'Percentage the manager charges on all profits realized by depositors: PERCENTAGE_PRECISION',
1168
1431
  ],
1169
1432
  type: 'u32',
1170
1433
  },
1171
1434
  {
1172
1435
  name: 'hurdleRate',
1173
1436
  docs: [
1174
- 'vault admin only collect incentive fees during periods when returns are higher than this amount: PERCENTAGE_PRECISION',
1437
+ 'Vault manager only collect incentive fees during periods when returns are higher than this amount: PERCENTAGE_PRECISION',
1175
1438
  ],
1176
1439
  type: 'u32',
1177
1440
  },
@@ -1189,13 +1452,21 @@ exports.IDL = {
1189
1452
  },
1190
1453
  {
1191
1454
  name: 'permissioned',
1192
- docs: ['Whether or not anybody can be a depositor'],
1455
+ docs: ['Whether anybody can be a depositor'],
1193
1456
  type: 'bool',
1194
1457
  },
1458
+ {
1459
+ name: 'vaultProtocol',
1460
+ docs: [
1461
+ 'The optional [`VaultProtocol`] account.',
1462
+ 'If this is the default Pubkey (system program id) then it is "none".',
1463
+ ],
1464
+ type: 'publicKey',
1465
+ },
1195
1466
  {
1196
1467
  name: 'padding',
1197
1468
  type: {
1198
- array: ['u64', 8],
1469
+ array: ['u64', 4],
1199
1470
  },
1200
1471
  },
1201
1472
  ],
@@ -1246,6 +1517,54 @@ exports.IDL = {
1246
1517
  name: 'permissioned',
1247
1518
  type: 'bool',
1248
1519
  },
1520
+ {
1521
+ name: 'vaultProtocol',
1522
+ type: {
1523
+ option: {
1524
+ defined: 'VaultProtocolParams',
1525
+ },
1526
+ },
1527
+ },
1528
+ ],
1529
+ },
1530
+ },
1531
+ {
1532
+ name: 'VaultProtocolParams',
1533
+ type: {
1534
+ kind: 'struct',
1535
+ fields: [
1536
+ {
1537
+ name: 'protocol',
1538
+ type: 'publicKey',
1539
+ },
1540
+ {
1541
+ name: 'protocolFee',
1542
+ type: 'u64',
1543
+ },
1544
+ {
1545
+ name: 'protocolProfitShare',
1546
+ type: 'u32',
1547
+ },
1548
+ ],
1549
+ },
1550
+ },
1551
+ {
1552
+ name: 'UpdateVaultProtocolParams',
1553
+ type: {
1554
+ kind: 'struct',
1555
+ fields: [
1556
+ {
1557
+ name: 'protocolFee',
1558
+ type: {
1559
+ option: 'u64',
1560
+ },
1561
+ },
1562
+ {
1563
+ name: 'protocolProfitShare',
1564
+ type: {
1565
+ option: 'u32',
1566
+ },
1567
+ },
1249
1568
  ],
1250
1569
  },
1251
1570
  },
@@ -1473,6 +1792,108 @@ exports.IDL = {
1473
1792
  },
1474
1793
  ],
1475
1794
  },
1795
+ {
1796
+ name: 'VaultDepositorV1Record',
1797
+ fields: [
1798
+ {
1799
+ name: 'ts',
1800
+ type: 'i64',
1801
+ index: false,
1802
+ },
1803
+ {
1804
+ name: 'vault',
1805
+ type: 'publicKey',
1806
+ index: false,
1807
+ },
1808
+ {
1809
+ name: 'depositorAuthority',
1810
+ type: 'publicKey',
1811
+ index: false,
1812
+ },
1813
+ {
1814
+ name: 'action',
1815
+ type: {
1816
+ defined: 'VaultDepositorAction',
1817
+ },
1818
+ index: false,
1819
+ },
1820
+ {
1821
+ name: 'amount',
1822
+ type: 'u64',
1823
+ index: false,
1824
+ },
1825
+ {
1826
+ name: 'spotMarketIndex',
1827
+ type: 'u16',
1828
+ index: false,
1829
+ },
1830
+ {
1831
+ name: 'vaultSharesBefore',
1832
+ type: 'u128',
1833
+ index: false,
1834
+ },
1835
+ {
1836
+ name: 'vaultSharesAfter',
1837
+ type: 'u128',
1838
+ index: false,
1839
+ },
1840
+ {
1841
+ name: 'vaultEquityBefore',
1842
+ type: 'u64',
1843
+ index: false,
1844
+ },
1845
+ {
1846
+ name: 'userVaultSharesBefore',
1847
+ type: 'u128',
1848
+ index: false,
1849
+ },
1850
+ {
1851
+ name: 'totalVaultSharesBefore',
1852
+ type: 'u128',
1853
+ index: false,
1854
+ },
1855
+ {
1856
+ name: 'userVaultSharesAfter',
1857
+ type: 'u128',
1858
+ index: false,
1859
+ },
1860
+ {
1861
+ name: 'totalVaultSharesAfter',
1862
+ type: 'u128',
1863
+ index: false,
1864
+ },
1865
+ {
1866
+ name: 'protocolProfitShare',
1867
+ type: 'u64',
1868
+ index: false,
1869
+ },
1870
+ {
1871
+ name: 'protocolFee',
1872
+ type: 'i64',
1873
+ index: false,
1874
+ },
1875
+ {
1876
+ name: 'protocolFeeShares',
1877
+ type: 'i64',
1878
+ index: false,
1879
+ },
1880
+ {
1881
+ name: 'managerProfitShare',
1882
+ type: 'u64',
1883
+ index: false,
1884
+ },
1885
+ {
1886
+ name: 'managementFee',
1887
+ type: 'i64',
1888
+ index: false,
1889
+ },
1890
+ {
1891
+ name: 'managementFeeShares',
1892
+ type: 'i64',
1893
+ index: false,
1894
+ },
1895
+ ],
1896
+ },
1476
1897
  ],
1477
1898
  errors: [
1478
1899
  {
@@ -1585,5 +2006,10 @@ exports.IDL = {
1585
2006
  name: 'OngoingLiquidation',
1586
2007
  msg: 'OngoingLiquidation',
1587
2008
  },
2009
+ {
2010
+ code: 6022,
2011
+ name: 'VaultProtocolMissing',
2012
+ msg: 'VaultProtocolMissing',
2013
+ },
1588
2014
  ],
1589
2015
  };