@drift-labs/vaults-sdk 0.1.416 → 0.1.418

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.
@@ -142,6 +142,34 @@
142
142
  }
143
143
  ]
144
144
  },
145
+ {
146
+ "name": "updateVaultProtocol",
147
+ "accounts": [
148
+ {
149
+ "name": "vault",
150
+ "isMut": true,
151
+ "isSigner": false
152
+ },
153
+ {
154
+ "name": "protocol",
155
+ "isMut": false,
156
+ "isSigner": true
157
+ },
158
+ {
159
+ "name": "vaultProtocol",
160
+ "isMut": true,
161
+ "isSigner": false
162
+ }
163
+ ],
164
+ "args": [
165
+ {
166
+ "name": "params",
167
+ "type": {
168
+ "defined": "UpdateVaultProtocolParams"
169
+ }
170
+ }
171
+ ]
172
+ },
145
173
  {
146
174
  "name": "updateVault",
147
175
  "accounts": [
@@ -901,6 +929,155 @@
901
929
  }
902
930
  ],
903
931
  "args": []
932
+ },
933
+ {
934
+ "name": "protocolRequestWithdraw",
935
+ "accounts": [
936
+ {
937
+ "name": "vault",
938
+ "isMut": true,
939
+ "isSigner": false
940
+ },
941
+ {
942
+ "name": "vaultProtocol",
943
+ "isMut": true,
944
+ "isSigner": false
945
+ },
946
+ {
947
+ "name": "protocol",
948
+ "isMut": false,
949
+ "isSigner": true
950
+ },
951
+ {
952
+ "name": "driftUserStats",
953
+ "isMut": false,
954
+ "isSigner": false
955
+ },
956
+ {
957
+ "name": "driftUser",
958
+ "isMut": false,
959
+ "isSigner": false
960
+ },
961
+ {
962
+ "name": "driftState",
963
+ "isMut": false,
964
+ "isSigner": false
965
+ }
966
+ ],
967
+ "args": [
968
+ {
969
+ "name": "withdrawAmount",
970
+ "type": "u64"
971
+ },
972
+ {
973
+ "name": "withdrawUnit",
974
+ "type": {
975
+ "defined": "WithdrawUnit"
976
+ }
977
+ }
978
+ ]
979
+ },
980
+ {
981
+ "name": "protocolCancelWithdrawRequest",
982
+ "accounts": [
983
+ {
984
+ "name": "vault",
985
+ "isMut": true,
986
+ "isSigner": false
987
+ },
988
+ {
989
+ "name": "vaultProtocol",
990
+ "isMut": true,
991
+ "isSigner": false
992
+ },
993
+ {
994
+ "name": "protocol",
995
+ "isMut": false,
996
+ "isSigner": true
997
+ },
998
+ {
999
+ "name": "driftUserStats",
1000
+ "isMut": false,
1001
+ "isSigner": false
1002
+ },
1003
+ {
1004
+ "name": "driftUser",
1005
+ "isMut": false,
1006
+ "isSigner": false
1007
+ },
1008
+ {
1009
+ "name": "driftState",
1010
+ "isMut": false,
1011
+ "isSigner": false
1012
+ }
1013
+ ],
1014
+ "args": []
1015
+ },
1016
+ {
1017
+ "name": "protocolWithdraw",
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": "vaultTokenAccount",
1036
+ "isMut": true,
1037
+ "isSigner": false
1038
+ },
1039
+ {
1040
+ "name": "driftUserStats",
1041
+ "isMut": true,
1042
+ "isSigner": false
1043
+ },
1044
+ {
1045
+ "name": "driftUser",
1046
+ "isMut": true,
1047
+ "isSigner": false
1048
+ },
1049
+ {
1050
+ "name": "driftState",
1051
+ "isMut": false,
1052
+ "isSigner": false
1053
+ },
1054
+ {
1055
+ "name": "driftSpotMarketVault",
1056
+ "isMut": true,
1057
+ "isSigner": false
1058
+ },
1059
+ {
1060
+ "name": "driftSigner",
1061
+ "isMut": false,
1062
+ "isSigner": false
1063
+ },
1064
+ {
1065
+ "name": "userTokenAccount",
1066
+ "isMut": true,
1067
+ "isSigner": false
1068
+ },
1069
+ {
1070
+ "name": "driftProgram",
1071
+ "isMut": false,
1072
+ "isSigner": false
1073
+ },
1074
+ {
1075
+ "name": "tokenProgram",
1076
+ "isMut": false,
1077
+ "isSigner": false
1078
+ }
1079
+ ],
1080
+ "args": []
904
1081
  }
905
1082
  ],
906
1083
  "accounts": [
@@ -1008,6 +1185,92 @@
1008
1185
  ]
1009
1186
  }
1010
1187
  },
1188
+ {
1189
+ "name": "VaultProtocol",
1190
+ "type": {
1191
+ "kind": "struct",
1192
+ "fields": [
1193
+ {
1194
+ "name": "protocol",
1195
+ "docs": [
1196
+ "The protocol, company, or entity that services the product using this vault.",
1197
+ "The protocol is not allowed to deposit into the vault but can profit share and collect annual fees just like the manager."
1198
+ ],
1199
+ "type": "publicKey"
1200
+ },
1201
+ {
1202
+ "name": "protocolProfitAndFeeShares",
1203
+ "docs": [
1204
+ "The shares from profit share and annual fee unclaimed by the protocol."
1205
+ ],
1206
+ "type": "u128"
1207
+ },
1208
+ {
1209
+ "name": "protocolFee",
1210
+ "docs": [
1211
+ "The annual fee charged on deposits by the protocol (traditional hedge funds typically charge 2% per year on assets under management).",
1212
+ "Unlike the management fee this can't be negative."
1213
+ ],
1214
+ "type": "u64"
1215
+ },
1216
+ {
1217
+ "name": "protocolTotalWithdraws",
1218
+ "docs": [
1219
+ "Total withdraws for the protocol"
1220
+ ],
1221
+ "type": "u64"
1222
+ },
1223
+ {
1224
+ "name": "protocolTotalFee",
1225
+ "docs": [
1226
+ "Total fee charged by the protocol (annual management fee + profit share).",
1227
+ "Unlike the management fee this can't be negative."
1228
+ ],
1229
+ "type": "u64"
1230
+ },
1231
+ {
1232
+ "name": "protocolTotalProfitShare",
1233
+ "docs": [
1234
+ "Total profit share charged by the protocol"
1235
+ ],
1236
+ "type": "u64"
1237
+ },
1238
+ {
1239
+ "name": "lastProtocolWithdrawRequest",
1240
+ "type": {
1241
+ "defined": "WithdrawRequest"
1242
+ }
1243
+ },
1244
+ {
1245
+ "name": "protocolProfitShare",
1246
+ "docs": [
1247
+ "Percentage the protocol charges on all profits realized by depositors: PERCENTAGE_PRECISION"
1248
+ ],
1249
+ "type": "u32"
1250
+ },
1251
+ {
1252
+ "name": "bump",
1253
+ "type": "u8"
1254
+ },
1255
+ {
1256
+ "name": "version",
1257
+ "type": "u8"
1258
+ },
1259
+ {
1260
+ "name": "padding",
1261
+ "docs": [
1262
+ "[`VaultProtocol`] is 117 bytes with padding to 120 bytes to make it a multiple of 8."
1263
+ ],
1264
+ "type": {
1265
+ "array": [
1266
+ "u8",
1267
+ 2
1268
+ ]
1269
+ }
1270
+ }
1271
+ ]
1272
+ }
1273
+ },
1011
1274
  {
1012
1275
  "name": "Vault",
1013
1276
  "type": {
@@ -1064,7 +1327,7 @@
1064
1327
  "name": "delegate",
1065
1328
  "docs": [
1066
1329
  "The vaults designated delegate for drift user account",
1067
- "Can differ from actual user delegate if vault is in liquidation"
1330
+ "can differ from actual user delegate if vault is in liquidation"
1068
1331
  ],
1069
1332
  "type": "publicKey"
1070
1333
  },
@@ -1078,126 +1341,129 @@
1078
1341
  {
1079
1342
  "name": "userShares",
1080
1343
  "docs": [
1081
- "the sum of all shares held by the users (vault depositors)"
1344
+ "The sum of all shares held by the users (vault depositors)"
1082
1345
  ],
1083
1346
  "type": "u128"
1084
1347
  },
1085
1348
  {
1086
1349
  "name": "totalShares",
1087
1350
  "docs": [
1088
- "the sum of all shares (including vault manager)"
1351
+ "The sum of all shares: deposits from users, manager deposits, manager profit/fee, and protocol profit/fee.",
1352
+ "The manager deposits are total_shares - user_shares - protocol_profit_and_fee_shares."
1089
1353
  ],
1090
1354
  "type": "u128"
1091
1355
  },
1092
1356
  {
1093
1357
  "name": "lastFeeUpdateTs",
1094
1358
  "docs": [
1095
- "last fee update unix timestamp"
1359
+ "Last fee update unix timestamp"
1096
1360
  ],
1097
1361
  "type": "i64"
1098
1362
  },
1099
1363
  {
1100
1364
  "name": "liquidationStartTs",
1101
1365
  "docs": [
1102
- "When the liquidation start"
1366
+ "When the liquidation starts"
1103
1367
  ],
1104
1368
  "type": "i64"
1105
1369
  },
1106
1370
  {
1107
1371
  "name": "redeemPeriod",
1108
1372
  "docs": [
1109
- "the period (in seconds) that a vault depositor must wait after requesting a withdraw to complete withdraw"
1373
+ "The period (in seconds) that a vault depositor must wait after requesting a withdrawal to finalize withdrawal.",
1374
+ "Currently, the maximum is 90 days."
1110
1375
  ],
1111
1376
  "type": "i64"
1112
1377
  },
1113
1378
  {
1114
1379
  "name": "totalWithdrawRequested",
1115
1380
  "docs": [
1116
- "the sum of all outstanding withdraw requests"
1381
+ "The sum of all outstanding withdraw requests"
1117
1382
  ],
1118
1383
  "type": "u64"
1119
1384
  },
1120
1385
  {
1121
1386
  "name": "maxTokens",
1122
1387
  "docs": [
1123
- "max token capacity, once hit/passed vault will reject new deposits (updateable)"
1388
+ "Max token capacity, once hit/passed vault will reject new deposits (updatable)"
1124
1389
  ],
1125
1390
  "type": "u64"
1126
1391
  },
1127
1392
  {
1128
1393
  "name": "managementFee",
1129
1394
  "docs": [
1130
- "manager fee"
1395
+ "The annual fee charged on deposits by the manager.",
1396
+ "Traditional funds typically charge 2% per year on assets under management."
1131
1397
  ],
1132
1398
  "type": "i64"
1133
1399
  },
1134
1400
  {
1135
1401
  "name": "initTs",
1136
1402
  "docs": [
1137
- "timestamp vault initialized"
1403
+ "Timestamp vault initialized"
1138
1404
  ],
1139
1405
  "type": "i64"
1140
1406
  },
1141
1407
  {
1142
1408
  "name": "netDeposits",
1143
1409
  "docs": [
1144
- "the net deposits for the vault"
1410
+ "The net deposits for the vault"
1145
1411
  ],
1146
1412
  "type": "i64"
1147
1413
  },
1148
1414
  {
1149
1415
  "name": "managerNetDeposits",
1150
1416
  "docs": [
1151
- "the net deposits for the vault manager"
1417
+ "The net deposits for the manager"
1152
1418
  ],
1153
1419
  "type": "i64"
1154
1420
  },
1155
1421
  {
1156
1422
  "name": "totalDeposits",
1157
1423
  "docs": [
1158
- "total deposits"
1424
+ "Total deposits"
1159
1425
  ],
1160
1426
  "type": "u64"
1161
1427
  },
1162
1428
  {
1163
1429
  "name": "totalWithdraws",
1164
1430
  "docs": [
1165
- "total withdraws"
1431
+ "Total withdraws"
1166
1432
  ],
1167
1433
  "type": "u64"
1168
1434
  },
1169
1435
  {
1170
1436
  "name": "managerTotalDeposits",
1171
1437
  "docs": [
1172
- "total deposits for the vault manager"
1438
+ "Total deposits for the manager"
1173
1439
  ],
1174
1440
  "type": "u64"
1175
1441
  },
1176
1442
  {
1177
1443
  "name": "managerTotalWithdraws",
1178
1444
  "docs": [
1179
- "total withdraws for the vault manager"
1445
+ "Total withdraws for the manager"
1180
1446
  ],
1181
1447
  "type": "u64"
1182
1448
  },
1183
1449
  {
1184
1450
  "name": "managerTotalFee",
1185
1451
  "docs": [
1186
- "total mgmt fee charged by vault manager"
1452
+ "Total management fee accrued by the manager"
1187
1453
  ],
1188
1454
  "type": "i64"
1189
1455
  },
1190
1456
  {
1191
1457
  "name": "managerTotalProfitShare",
1192
1458
  "docs": [
1193
- "total profit share charged by vault manager"
1459
+ "Total profit share accrued by the manager"
1194
1460
  ],
1195
1461
  "type": "u64"
1196
1462
  },
1197
1463
  {
1198
1464
  "name": "minDepositAmount",
1199
1465
  "docs": [
1200
- "the minimum deposit amount"
1466
+ "The minimum deposit amount"
1201
1467
  ],
1202
1468
  "type": "u64"
1203
1469
  },
@@ -1210,21 +1476,21 @@
1210
1476
  {
1211
1477
  "name": "sharesBase",
1212
1478
  "docs": [
1213
- "the base 10 exponent of the shares (given massive share inflation can occur at near zero vault equity)"
1479
+ "The base 10 exponent of the shares (given massive share inflation can occur at near zero vault equity)"
1214
1480
  ],
1215
1481
  "type": "u32"
1216
1482
  },
1217
1483
  {
1218
1484
  "name": "profitShare",
1219
1485
  "docs": [
1220
- "percentage of gains for vault admin upon depositor's realize/withdraw: PERCENTAGE_PRECISION"
1486
+ "Percentage the manager charges on all profits realized by depositors: PERCENTAGE_PRECISION"
1221
1487
  ],
1222
1488
  "type": "u32"
1223
1489
  },
1224
1490
  {
1225
1491
  "name": "hurdleRate",
1226
1492
  "docs": [
1227
- "vault admin only collect incentive fees during periods when returns are higher than this amount: PERCENTAGE_PRECISION"
1493
+ "Vault manager only collect incentive fees during periods when returns are higher than this amount: PERCENTAGE_PRECISION"
1228
1494
  ],
1229
1495
  "type": "u32"
1230
1496
  },
@@ -1245,16 +1511,24 @@
1245
1511
  {
1246
1512
  "name": "permissioned",
1247
1513
  "docs": [
1248
- "Whether or not anybody can be a depositor"
1514
+ "Whether anybody can be a depositor"
1249
1515
  ],
1250
1516
  "type": "bool"
1251
1517
  },
1518
+ {
1519
+ "name": "vaultProtocol",
1520
+ "docs": [
1521
+ "The optional [`VaultProtocol`] account.",
1522
+ "If this is the default Pubkey (system program id) then it is \"none\"."
1523
+ ],
1524
+ "type": "publicKey"
1525
+ },
1252
1526
  {
1253
1527
  "name": "padding",
1254
1528
  "type": {
1255
1529
  "array": [
1256
1530
  "u64",
1257
- 8
1531
+ 4
1258
1532
  ]
1259
1533
  }
1260
1534
  }
@@ -1308,6 +1582,54 @@
1308
1582
  {
1309
1583
  "name": "permissioned",
1310
1584
  "type": "bool"
1585
+ },
1586
+ {
1587
+ "name": "vaultProtocol",
1588
+ "type": {
1589
+ "option": {
1590
+ "defined": "VaultProtocolParams"
1591
+ }
1592
+ }
1593
+ }
1594
+ ]
1595
+ }
1596
+ },
1597
+ {
1598
+ "name": "VaultProtocolParams",
1599
+ "type": {
1600
+ "kind": "struct",
1601
+ "fields": [
1602
+ {
1603
+ "name": "protocol",
1604
+ "type": "publicKey"
1605
+ },
1606
+ {
1607
+ "name": "protocolFee",
1608
+ "type": "u64"
1609
+ },
1610
+ {
1611
+ "name": "protocolProfitShare",
1612
+ "type": "u32"
1613
+ }
1614
+ ]
1615
+ }
1616
+ },
1617
+ {
1618
+ "name": "UpdateVaultProtocolParams",
1619
+ "type": {
1620
+ "kind": "struct",
1621
+ "fields": [
1622
+ {
1623
+ "name": "protocolFee",
1624
+ "type": {
1625
+ "option": "u64"
1626
+ }
1627
+ },
1628
+ {
1629
+ "name": "protocolProfitShare",
1630
+ "type": {
1631
+ "option": "u32"
1632
+ }
1311
1633
  }
1312
1634
  ]
1313
1635
  }
@@ -1539,6 +1861,108 @@
1539
1861
  "index": false
1540
1862
  }
1541
1863
  ]
1864
+ },
1865
+ {
1866
+ "name": "VaultDepositorV1Record",
1867
+ "fields": [
1868
+ {
1869
+ "name": "ts",
1870
+ "type": "i64",
1871
+ "index": false
1872
+ },
1873
+ {
1874
+ "name": "vault",
1875
+ "type": "publicKey",
1876
+ "index": false
1877
+ },
1878
+ {
1879
+ "name": "depositorAuthority",
1880
+ "type": "publicKey",
1881
+ "index": false
1882
+ },
1883
+ {
1884
+ "name": "action",
1885
+ "type": {
1886
+ "defined": "VaultDepositorAction"
1887
+ },
1888
+ "index": false
1889
+ },
1890
+ {
1891
+ "name": "amount",
1892
+ "type": "u64",
1893
+ "index": false
1894
+ },
1895
+ {
1896
+ "name": "spotMarketIndex",
1897
+ "type": "u16",
1898
+ "index": false
1899
+ },
1900
+ {
1901
+ "name": "vaultSharesBefore",
1902
+ "type": "u128",
1903
+ "index": false
1904
+ },
1905
+ {
1906
+ "name": "vaultSharesAfter",
1907
+ "type": "u128",
1908
+ "index": false
1909
+ },
1910
+ {
1911
+ "name": "vaultEquityBefore",
1912
+ "type": "u64",
1913
+ "index": false
1914
+ },
1915
+ {
1916
+ "name": "userVaultSharesBefore",
1917
+ "type": "u128",
1918
+ "index": false
1919
+ },
1920
+ {
1921
+ "name": "totalVaultSharesBefore",
1922
+ "type": "u128",
1923
+ "index": false
1924
+ },
1925
+ {
1926
+ "name": "userVaultSharesAfter",
1927
+ "type": "u128",
1928
+ "index": false
1929
+ },
1930
+ {
1931
+ "name": "totalVaultSharesAfter",
1932
+ "type": "u128",
1933
+ "index": false
1934
+ },
1935
+ {
1936
+ "name": "protocolProfitShare",
1937
+ "type": "u64",
1938
+ "index": false
1939
+ },
1940
+ {
1941
+ "name": "protocolFee",
1942
+ "type": "i64",
1943
+ "index": false
1944
+ },
1945
+ {
1946
+ "name": "protocolFeeShares",
1947
+ "type": "i64",
1948
+ "index": false
1949
+ },
1950
+ {
1951
+ "name": "managerProfitShare",
1952
+ "type": "u64",
1953
+ "index": false
1954
+ },
1955
+ {
1956
+ "name": "managementFee",
1957
+ "type": "i64",
1958
+ "index": false
1959
+ },
1960
+ {
1961
+ "name": "managementFeeShares",
1962
+ "type": "i64",
1963
+ "index": false
1964
+ }
1965
+ ]
1542
1966
  }
1543
1967
  ],
1544
1968
  "errors": [
@@ -1651,6 +2075,11 @@
1651
2075
  "code": 6021,
1652
2076
  "name": "OngoingLiquidation",
1653
2077
  "msg": "OngoingLiquidation"
2078
+ },
2079
+ {
2080
+ "code": 6022,
2081
+ "name": "VaultProtocolMissing",
2082
+ "msg": "VaultProtocolMissing"
1654
2083
  }
1655
2084
  ],
1656
2085
  "metadata": {