@drift-labs/vaults-sdk 0.1.461 → 0.1.463

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.
@@ -80,6 +80,89 @@ export type DriftVaults = {
80
80
  }
81
81
  ];
82
82
  },
83
+ {
84
+ name: 'initializeVaultWithProtocol';
85
+ accounts: [
86
+ {
87
+ name: 'vault';
88
+ isMut: true;
89
+ isSigner: false;
90
+ },
91
+ {
92
+ name: 'vaultProtocol';
93
+ isMut: true;
94
+ isSigner: false;
95
+ },
96
+ {
97
+ name: 'tokenAccount';
98
+ isMut: true;
99
+ isSigner: false;
100
+ },
101
+ {
102
+ name: 'driftUserStats';
103
+ isMut: true;
104
+ isSigner: false;
105
+ },
106
+ {
107
+ name: 'driftUser';
108
+ isMut: true;
109
+ isSigner: false;
110
+ },
111
+ {
112
+ name: 'driftState';
113
+ isMut: true;
114
+ isSigner: false;
115
+ },
116
+ {
117
+ name: 'driftSpotMarket';
118
+ isMut: false;
119
+ isSigner: false;
120
+ },
121
+ {
122
+ name: 'driftSpotMarketMint';
123
+ isMut: false;
124
+ isSigner: false;
125
+ },
126
+ {
127
+ name: 'manager';
128
+ isMut: false;
129
+ isSigner: true;
130
+ },
131
+ {
132
+ name: 'payer';
133
+ isMut: true;
134
+ isSigner: true;
135
+ },
136
+ {
137
+ name: 'rent';
138
+ isMut: false;
139
+ isSigner: false;
140
+ },
141
+ {
142
+ name: 'systemProgram';
143
+ isMut: false;
144
+ isSigner: false;
145
+ },
146
+ {
147
+ name: 'driftProgram';
148
+ isMut: false;
149
+ isSigner: false;
150
+ },
151
+ {
152
+ name: 'tokenProgram';
153
+ isMut: false;
154
+ isSigner: false;
155
+ }
156
+ ];
157
+ args: [
158
+ {
159
+ name: 'params';
160
+ type: {
161
+ defined: 'VaultWithProtocolParams';
162
+ };
163
+ }
164
+ ];
165
+ },
83
166
  {
84
167
  name: 'updateDelegate';
85
168
  accounts: [
@@ -142,6 +225,34 @@ export type DriftVaults = {
142
225
  }
143
226
  ];
144
227
  },
228
+ {
229
+ name: 'updateVaultProtocol';
230
+ accounts: [
231
+ {
232
+ name: 'vault';
233
+ isMut: true;
234
+ isSigner: false;
235
+ },
236
+ {
237
+ name: 'protocol';
238
+ isMut: false;
239
+ isSigner: true;
240
+ },
241
+ {
242
+ name: 'vaultProtocol';
243
+ isMut: true;
244
+ isSigner: false;
245
+ }
246
+ ];
247
+ args: [
248
+ {
249
+ name: 'params';
250
+ type: {
251
+ defined: 'UpdateVaultProtocolParams';
252
+ };
253
+ }
254
+ ];
255
+ },
145
256
  {
146
257
  name: 'updateVault';
147
258
  accounts: [
@@ -901,6 +1012,155 @@ export type DriftVaults = {
901
1012
  }
902
1013
  ];
903
1014
  args: [];
1015
+ },
1016
+ {
1017
+ name: 'protocolRequestWithdraw';
1018
+ accounts: [
1019
+ {
1020
+ name: 'vault';
1021
+ isMut: true;
1022
+ isSigner: false;
1023
+ },
1024
+ {
1025
+ name: 'vaultProtocol';
1026
+ isMut: true;
1027
+ isSigner: false;
1028
+ },
1029
+ {
1030
+ name: 'protocol';
1031
+ isMut: false;
1032
+ isSigner: true;
1033
+ },
1034
+ {
1035
+ name: 'driftUserStats';
1036
+ isMut: false;
1037
+ isSigner: false;
1038
+ },
1039
+ {
1040
+ name: 'driftUser';
1041
+ isMut: false;
1042
+ isSigner: false;
1043
+ },
1044
+ {
1045
+ name: 'driftState';
1046
+ isMut: false;
1047
+ isSigner: false;
1048
+ }
1049
+ ];
1050
+ args: [
1051
+ {
1052
+ name: 'withdrawAmount';
1053
+ type: 'u64';
1054
+ },
1055
+ {
1056
+ name: 'withdrawUnit';
1057
+ type: {
1058
+ defined: 'WithdrawUnit';
1059
+ };
1060
+ }
1061
+ ];
1062
+ },
1063
+ {
1064
+ name: 'protocolCancelWithdrawRequest';
1065
+ accounts: [
1066
+ {
1067
+ name: 'vault';
1068
+ isMut: true;
1069
+ isSigner: false;
1070
+ },
1071
+ {
1072
+ name: 'vaultProtocol';
1073
+ isMut: true;
1074
+ isSigner: false;
1075
+ },
1076
+ {
1077
+ name: 'protocol';
1078
+ isMut: false;
1079
+ isSigner: true;
1080
+ },
1081
+ {
1082
+ name: 'driftUserStats';
1083
+ isMut: false;
1084
+ isSigner: false;
1085
+ },
1086
+ {
1087
+ name: 'driftUser';
1088
+ isMut: false;
1089
+ isSigner: false;
1090
+ },
1091
+ {
1092
+ name: 'driftState';
1093
+ isMut: false;
1094
+ isSigner: false;
1095
+ }
1096
+ ];
1097
+ args: [];
1098
+ },
1099
+ {
1100
+ name: 'protocolWithdraw';
1101
+ accounts: [
1102
+ {
1103
+ name: 'vault';
1104
+ isMut: true;
1105
+ isSigner: false;
1106
+ },
1107
+ {
1108
+ name: 'vaultProtocol';
1109
+ isMut: true;
1110
+ isSigner: false;
1111
+ },
1112
+ {
1113
+ name: 'protocol';
1114
+ isMut: false;
1115
+ isSigner: true;
1116
+ },
1117
+ {
1118
+ name: 'vaultTokenAccount';
1119
+ isMut: true;
1120
+ isSigner: false;
1121
+ },
1122
+ {
1123
+ name: 'driftUserStats';
1124
+ isMut: true;
1125
+ isSigner: false;
1126
+ },
1127
+ {
1128
+ name: 'driftUser';
1129
+ isMut: true;
1130
+ isSigner: false;
1131
+ },
1132
+ {
1133
+ name: 'driftState';
1134
+ isMut: false;
1135
+ isSigner: false;
1136
+ },
1137
+ {
1138
+ name: 'driftSpotMarketVault';
1139
+ isMut: true;
1140
+ isSigner: false;
1141
+ },
1142
+ {
1143
+ name: 'driftSigner';
1144
+ isMut: false;
1145
+ isSigner: false;
1146
+ },
1147
+ {
1148
+ name: 'userTokenAccount';
1149
+ isMut: true;
1150
+ isSigner: false;
1151
+ },
1152
+ {
1153
+ name: 'driftProgram';
1154
+ isMut: false;
1155
+ isSigner: false;
1156
+ },
1157
+ {
1158
+ name: 'tokenProgram';
1159
+ isMut: false;
1160
+ isSigner: false;
1161
+ }
1162
+ ];
1163
+ args: [];
904
1164
  }
905
1165
  ];
906
1166
  accounts: [
@@ -991,6 +1251,82 @@ export type DriftVaults = {
991
1251
  ];
992
1252
  };
993
1253
  },
1254
+ {
1255
+ name: 'vaultProtocol';
1256
+ type: {
1257
+ kind: 'struct';
1258
+ fields: [
1259
+ {
1260
+ name: 'protocol';
1261
+ docs: [
1262
+ 'The protocol, company, or entity that services the product using this vault.',
1263
+ 'The protocol is not allowed to deposit into the vault but can profit share and collect annual fees just like the manager.'
1264
+ ];
1265
+ type: 'publicKey';
1266
+ },
1267
+ {
1268
+ name: 'protocolProfitAndFeeShares';
1269
+ docs: [
1270
+ 'The shares from profit share and annual fee unclaimed by the protocol.'
1271
+ ];
1272
+ type: 'u128';
1273
+ },
1274
+ {
1275
+ name: 'protocolFee';
1276
+ docs: [
1277
+ 'The annual fee charged on deposits by the protocol (traditional hedge funds typically charge 2% per year on assets under management).',
1278
+ "Unlike the management fee this can't be negative."
1279
+ ];
1280
+ type: 'u64';
1281
+ },
1282
+ {
1283
+ name: 'protocolTotalWithdraws';
1284
+ docs: ['Total withdraws for the protocol'];
1285
+ type: 'u64';
1286
+ },
1287
+ {
1288
+ name: 'protocolTotalFee';
1289
+ docs: [
1290
+ 'Total fee charged by the protocol (annual management fee + profit share).',
1291
+ "Unlike the management fee this can't be negative."
1292
+ ];
1293
+ type: 'u64';
1294
+ },
1295
+ {
1296
+ name: 'protocolTotalProfitShare';
1297
+ docs: ['Total profit share charged by the protocol'];
1298
+ type: 'u64';
1299
+ },
1300
+ {
1301
+ name: 'lastProtocolWithdrawRequest';
1302
+ type: {
1303
+ defined: 'WithdrawRequest';
1304
+ };
1305
+ },
1306
+ {
1307
+ name: 'protocolProfitShare';
1308
+ docs: [
1309
+ 'Percentage the protocol charges on all profits realized by depositors: PERCENTAGE_PRECISION'
1310
+ ];
1311
+ type: 'u32';
1312
+ },
1313
+ {
1314
+ name: 'bump';
1315
+ type: 'u8';
1316
+ },
1317
+ {
1318
+ name: 'version';
1319
+ type: 'u8';
1320
+ },
1321
+ {
1322
+ name: 'padding';
1323
+ type: {
1324
+ array: ['u8', 2];
1325
+ };
1326
+ }
1327
+ ];
1328
+ };
1329
+ },
994
1330
  {
995
1331
  name: 'vault';
996
1332
  type: {
@@ -1040,7 +1376,7 @@ export type DriftVaults = {
1040
1376
  name: 'delegate';
1041
1377
  docs: [
1042
1378
  'The vaults designated delegate for drift user account',
1043
- 'Can differ from actual user delegate if vault is in liquidation'
1379
+ 'can differ from actual user delegate if vault is in liquidation'
1044
1380
  ];
1045
1381
  type: 'publicKey';
1046
1382
  },
@@ -1052,97 +1388,104 @@ export type DriftVaults = {
1052
1388
  {
1053
1389
  name: 'userShares';
1054
1390
  docs: [
1055
- 'the sum of all shares held by the users (vault depositors)'
1391
+ 'The sum of all shares held by the users (vault depositors)'
1056
1392
  ];
1057
1393
  type: 'u128';
1058
1394
  },
1059
1395
  {
1060
1396
  name: 'totalShares';
1061
- docs: ['the sum of all shares (including vault manager)'];
1397
+ docs: [
1398
+ 'The sum of all shares: deposits from users, manager deposits, manager profit/fee, and protocol profit/fee.',
1399
+ 'The manager deposits are total_shares - user_shares - protocol_profit_and_fee_shares.'
1400
+ ];
1062
1401
  type: 'u128';
1063
1402
  },
1064
1403
  {
1065
1404
  name: 'lastFeeUpdateTs';
1066
- docs: ['last fee update unix timestamp'];
1405
+ docs: ['Last fee update unix timestamp'];
1067
1406
  type: 'i64';
1068
1407
  },
1069
1408
  {
1070
1409
  name: 'liquidationStartTs';
1071
- docs: ['When the liquidation start'];
1410
+ docs: ['When the liquidation starts'];
1072
1411
  type: 'i64';
1073
1412
  },
1074
1413
  {
1075
1414
  name: 'redeemPeriod';
1076
1415
  docs: [
1077
- 'the period (in seconds) that a vault depositor must wait after requesting a withdraw to complete withdraw'
1416
+ 'The period (in seconds) that a vault depositor must wait after requesting a withdrawal to finalize withdrawal.',
1417
+ 'Currently, the maximum is 90 days.'
1078
1418
  ];
1079
1419
  type: 'i64';
1080
1420
  },
1081
1421
  {
1082
1422
  name: 'totalWithdrawRequested';
1083
- docs: ['the sum of all outstanding withdraw requests'];
1423
+ docs: ['The sum of all outstanding withdraw requests'];
1084
1424
  type: 'u64';
1085
1425
  },
1086
1426
  {
1087
1427
  name: 'maxTokens';
1088
1428
  docs: [
1089
- 'max token capacity, once hit/passed vault will reject new deposits (updateable)'
1429
+ 'Max token capacity, once hit/passed vault will reject new deposits (updatable)'
1090
1430
  ];
1091
1431
  type: 'u64';
1092
1432
  },
1093
1433
  {
1094
1434
  name: 'managementFee';
1095
- docs: ['manager fee'];
1435
+ docs: [
1436
+ 'The annual fee charged on deposits by the manager.',
1437
+ 'Traditional funds typically charge 2% per year on assets under management.'
1438
+ ];
1096
1439
  type: 'i64';
1097
1440
  },
1098
1441
  {
1099
1442
  name: 'initTs';
1100
- docs: ['timestamp vault initialized'];
1443
+ docs: ['Timestamp vault initialized'];
1101
1444
  type: 'i64';
1102
1445
  },
1103
1446
  {
1104
1447
  name: 'netDeposits';
1105
- docs: ['the net deposits for the vault'];
1448
+ docs: ['The net deposits for the vault'];
1106
1449
  type: 'i64';
1107
1450
  },
1108
1451
  {
1109
1452
  name: 'managerNetDeposits';
1110
- docs: ['the net deposits for the vault manager'];
1453
+ docs: ['The net deposits for the manager'];
1111
1454
  type: 'i64';
1112
1455
  },
1113
1456
  {
1114
1457
  name: 'totalDeposits';
1115
- docs: ['total deposits'];
1458
+ docs: ['Total deposits'];
1116
1459
  type: 'u64';
1117
1460
  },
1118
1461
  {
1119
1462
  name: 'totalWithdraws';
1120
- docs: ['total withdraws'];
1463
+ docs: ['Total withdraws'];
1121
1464
  type: 'u64';
1122
1465
  },
1123
1466
  {
1124
1467
  name: 'managerTotalDeposits';
1125
- docs: ['total deposits for the vault manager'];
1468
+ docs: ['Total deposits for the manager'];
1126
1469
  type: 'u64';
1127
1470
  },
1128
1471
  {
1129
1472
  name: 'managerTotalWithdraws';
1130
- docs: ['total withdraws for the vault manager'];
1473
+ docs: ['Total withdraws for the manager'];
1131
1474
  type: 'u64';
1132
1475
  },
1133
1476
  {
1134
1477
  name: 'managerTotalFee';
1135
- docs: ['total mgmt fee charged by vault manager'];
1478
+ docs: ['Total management fee accrued by the manager'];
1136
1479
  type: 'i64';
1137
1480
  },
1138
1481
  {
1139
1482
  name: 'managerTotalProfitShare';
1140
- docs: ['total profit share charged by vault manager'];
1483
+ docs: ['Total profit share accrued by the manager'];
1141
1484
  type: 'u64';
1142
1485
  },
1143
1486
  {
1144
1487
  name: 'minDepositAmount';
1145
- docs: ['the minimum deposit amount'];
1488
+ docs: ['The minimum deposit amount'];
1146
1489
  type: 'u64';
1147
1490
  },
1148
1491
  {
@@ -1154,21 +1497,21 @@ export type DriftVaults = {
1154
1497
  {
1155
1498
  name: 'sharesBase';
1156
1499
  docs: [
1157
- 'the base 10 exponent of the shares (given massive share inflation can occur at near zero vault equity)'
1500
+ 'The base 10 exponent of the shares (given massive share inflation can occur at near zero vault equity)'
1158
1501
  ];
1159
1502
  type: 'u32';
1160
1503
  },
1161
1504
  {
1162
1505
  name: 'profitShare';
1163
1506
  docs: [
1164
- "percentage of gains for vault admin upon depositor's realize/withdraw: PERCENTAGE_PRECISION"
1507
+ 'Percentage the manager charges on all profits realized by depositors: PERCENTAGE_PRECISION'
1165
1508
  ];
1166
1509
  type: 'u32';
1167
1510
  },
1168
1511
  {
1169
1512
  name: 'hurdleRate';
1170
1513
  docs: [
1171
- 'vault admin only collect incentive fees during periods when returns are higher than this amount: PERCENTAGE_PRECISION'
1514
+ 'Vault manager only collect incentive fees during periods when returns are higher than this amount: PERCENTAGE_PRECISION'
1172
1515
  ];
1173
1516
  type: 'u32';
1174
1517
  },
@@ -1186,13 +1529,24 @@ export type DriftVaults = {
1186
1529
  },
1187
1530
  {
1188
1531
  name: 'permissioned';
1189
- docs: ['Whether or not anybody can be a depositor'];
1532
+ docs: ['Whether anybody can be a depositor'];
1190
1533
  type: 'bool';
1191
1534
  },
1535
+ {
1536
+ name: 'vaultProtocol';
1537
+ docs: ['The optional [`VaultProtocol`] account.'];
1538
+ type: 'bool';
1539
+ },
1540
+ {
1541
+ name: 'padding1';
1542
+ type: {
1543
+ array: ['u8', 7];
1544
+ };
1545
+ },
1192
1546
  {
1193
1547
  name: 'padding';
1194
1548
  type: {
1195
- array: ['u64', 8];
1549
+ array: ['u64', 7];
1196
1550
  };
1197
1551
  }
1198
1552
  ];
@@ -1200,6 +1554,78 @@ export type DriftVaults = {
1200
1554
  }
1201
1555
  ];
1202
1556
  types: [
1557
+ {
1558
+ name: 'VaultWithProtocolParams';
1559
+ type: {
1560
+ kind: 'struct';
1561
+ fields: [
1562
+ {
1563
+ name: 'name';
1564
+ type: {
1565
+ array: ['u8', 32];
1566
+ };
1567
+ },
1568
+ {
1569
+ name: 'redeemPeriod';
1570
+ type: 'i64';
1571
+ },
1572
+ {
1573
+ name: 'maxTokens';
1574
+ type: 'u64';
1575
+ },
1576
+ {
1577
+ name: 'managementFee';
1578
+ type: 'i64';
1579
+ },
1580
+ {
1581
+ name: 'minDepositAmount';
1582
+ type: 'u64';
1583
+ },
1584
+ {
1585
+ name: 'profitShare';
1586
+ type: 'u32';
1587
+ },
1588
+ {
1589
+ name: 'hurdleRate';
1590
+ type: 'u32';
1591
+ },
1592
+ {
1593
+ name: 'spotMarketIndex';
1594
+ type: 'u16';
1595
+ },
1596
+ {
1597
+ name: 'permissioned';
1598
+ type: 'bool';
1599
+ },
1600
+ {
1601
+ name: 'vaultProtocol';
1602
+ type: {
1603
+ defined: 'VaultProtocolParams';
1604
+ };
1605
+ }
1606
+ ];
1607
+ };
1608
+ },
1609
+ {
1610
+ name: 'VaultProtocolParams';
1611
+ type: {
1612
+ kind: 'struct';
1613
+ fields: [
1614
+ {
1615
+ name: 'protocol';
1616
+ type: 'publicKey';
1617
+ },
1618
+ {
1619
+ name: 'protocolFee';
1620
+ type: 'u64';
1621
+ },
1622
+ {
1623
+ name: 'protocolProfitShare';
1624
+ type: 'u32';
1625
+ }
1626
+ ];
1627
+ };
1628
+ },
1203
1629
  {
1204
1630
  name: 'VaultParams';
1205
1631
  type: {
@@ -1246,6 +1672,26 @@ export type DriftVaults = {
1246
1672
  ];
1247
1673
  };
1248
1674
  },
1675
+ {
1676
+ name: 'UpdateVaultProtocolParams';
1677
+ type: {
1678
+ kind: 'struct';
1679
+ fields: [
1680
+ {
1681
+ name: 'protocolFee';
1682
+ type: {
1683
+ option: 'u64';
1684
+ };
1685
+ },
1686
+ {
1687
+ name: 'protocolProfitShare';
1688
+ type: {
1689
+ option: 'u32';
1690
+ };
1691
+ }
1692
+ ];
1693
+ };
1694
+ },
1249
1695
  {
1250
1696
  name: 'UpdateVaultParams';
1251
1697
  type: {
@@ -1469,6 +1915,118 @@ export type DriftVaults = {
1469
1915
  index: false;
1470
1916
  }
1471
1917
  ];
1918
+ },
1919
+ {
1920
+ name: 'VaultDepositorV1Record';
1921
+ fields: [
1922
+ {
1923
+ name: 'ts';
1924
+ type: 'i64';
1925
+ index: false;
1926
+ },
1927
+ {
1928
+ name: 'vault';
1929
+ type: 'publicKey';
1930
+ index: false;
1931
+ },
1932
+ {
1933
+ name: 'depositorAuthority';
1934
+ type: 'publicKey';
1935
+ index: false;
1936
+ },
1937
+ {
1938
+ name: 'action';
1939
+ type: {
1940
+ defined: 'VaultDepositorAction';
1941
+ };
1942
+ index: false;
1943
+ },
1944
+ {
1945
+ name: 'amount';
1946
+ type: 'u64';
1947
+ index: false;
1948
+ },
1949
+ {
1950
+ name: 'spotMarketIndex';
1951
+ type: 'u16';
1952
+ index: false;
1953
+ },
1954
+ {
1955
+ name: 'vaultSharesBefore';
1956
+ type: 'u128';
1957
+ index: false;
1958
+ },
1959
+ {
1960
+ name: 'vaultSharesAfter';
1961
+ type: 'u128';
1962
+ index: false;
1963
+ },
1964
+ {
1965
+ name: 'vaultEquityBefore';
1966
+ type: 'u64';
1967
+ index: false;
1968
+ },
1969
+ {
1970
+ name: 'userVaultSharesBefore';
1971
+ type: 'u128';
1972
+ index: false;
1973
+ },
1974
+ {
1975
+ name: 'totalVaultSharesBefore';
1976
+ type: 'u128';
1977
+ index: false;
1978
+ },
1979
+ {
1980
+ name: 'userVaultSharesAfter';
1981
+ type: 'u128';
1982
+ index: false;
1983
+ },
1984
+ {
1985
+ name: 'totalVaultSharesAfter';
1986
+ type: 'u128';
1987
+ index: false;
1988
+ },
1989
+ {
1990
+ name: 'protocolSharesBefore';
1991
+ type: 'u128';
1992
+ index: false;
1993
+ },
1994
+ {
1995
+ name: 'protocolSharesAfter';
1996
+ type: 'u128';
1997
+ index: false;
1998
+ },
1999
+ {
2000
+ name: 'protocolProfitShare';
2001
+ type: 'u64';
2002
+ index: false;
2003
+ },
2004
+ {
2005
+ name: 'protocolFee';
2006
+ type: 'i64';
2007
+ index: false;
2008
+ },
2009
+ {
2010
+ name: 'protocolFeeShares';
2011
+ type: 'i64';
2012
+ index: false;
2013
+ },
2014
+ {
2015
+ name: 'managerProfitShare';
2016
+ type: 'u64';
2017
+ index: false;
2018
+ },
2019
+ {
2020
+ name: 'managementFee';
2021
+ type: 'i64';
2022
+ index: false;
2023
+ },
2024
+ {
2025
+ name: 'managementFeeShares';
2026
+ type: 'i64';
2027
+ index: false;
2028
+ }
2029
+ ];
1472
2030
  }
1473
2031
  ];
1474
2032
  errors: [
@@ -1581,6 +2139,11 @@ export type DriftVaults = {
1581
2139
  code: 6021;
1582
2140
  name: 'OngoingLiquidation';
1583
2141
  msg: 'OngoingLiquidation';
2142
+ },
2143
+ {
2144
+ code: 6022;
2145
+ name: 'VaultProtocolMissing';
2146
+ msg: 'VaultProtocolMissing';
1584
2147
  }
1585
2148
  ];
1586
2149
  };