hedge-web3 0.1.41 → 0.1.44

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 (43) hide show
  1. package/declarations/Constants.d.ts +1 -1
  2. package/declarations/idl/vault.d.ts +154 -8
  3. package/declarations/index.d.ts +1 -1
  4. package/declarations/instructions/liquidateVault.d.ts +1 -1
  5. package/declarations/instructions/updateVaultType.d.ts +15 -0
  6. package/declarations/state/VaultAccount.d.ts +8 -6
  7. package/declarations/state/VaultType.d.ts +24 -0
  8. package/declarations/utils/Sender.d.ts +2 -0
  9. package/declarations/utils/sendAndConfirmWithDebug.d.ts +2 -0
  10. package/lib/Constants.js +1 -1
  11. package/lib/idl/vault.js +154 -8
  12. package/lib/index.js +1 -1
  13. package/lib/instructions/createStakingPool.js +1 -0
  14. package/lib/instructions/depositVault.js +7 -7
  15. package/lib/instructions/liquidateVault.js +5 -7
  16. package/lib/instructions/loanVault.js +7 -6
  17. package/lib/instructions/redeemVault.js +4 -5
  18. package/lib/instructions/refreshOraclePrice.js +2 -2
  19. package/lib/instructions/repayVault.js +4 -5
  20. package/lib/instructions/updateVaultType.js +47 -0
  21. package/lib/instructions/withdrawVault.js +4 -5
  22. package/lib/state/VaultAccount.js +9 -8
  23. package/lib/state/VaultType.js +32 -0
  24. package/lib/utils/Errors.js +1 -0
  25. package/lib/utils/Sender.js +32 -0
  26. package/lib/utils/getLinkedListAccounts.js +15 -15
  27. package/lib/utils/sendAndConfirmWithDebug.js +35 -0
  28. package/package.json +2 -2
  29. package/src/Constants.ts +1 -1
  30. package/src/idl/vault.ts +308 -16
  31. package/src/index.ts +1 -1
  32. package/src/instructions/createStakingPool.ts +1 -0
  33. package/src/instructions/depositVault.ts +8 -8
  34. package/src/instructions/liquidateVault.ts +5 -7
  35. package/src/instructions/loanVault.ts +11 -8
  36. package/src/instructions/redeemVault.ts +4 -5
  37. package/src/instructions/refreshOraclePrice.ts +2 -2
  38. package/src/instructions/repayVault.ts +4 -5
  39. package/src/instructions/{setVaultTypeStatus.ts → updateVaultType.ts} +39 -8
  40. package/src/instructions/withdrawVault.ts +4 -5
  41. package/src/state/VaultAccount.ts +14 -10
  42. package/src/utils/Errors.ts +1 -0
  43. package/src/utils/getLinkedListAccounts.ts +16 -16
@@ -1,5 +1,5 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
- export declare const HEDGE_PROGRAM_ID = "HDG4FDos8fyrB79qMCe98gaFjNEy5kpxGNjMc5V8M6TJ";
2
+ export declare const HEDGE_PROGRAM_ID = "zooJaircVAoQ4e7EXRDocnsbB7UPYQ6J7bKyZEMh784";
3
3
  export declare const HEDGE_PROGRAM_PUBLICKEY: PublicKey;
4
4
  export declare const CHAINLINK_SOL_USD_ID = "FmAmfoyPXiA8Vhhe6MZTr3U6rZfEZ1ctEHay1ysqCqcf";
5
5
  export declare const CHAINLINK_SOL_USD_PUBLICKEY: PublicKey;
@@ -1560,7 +1560,7 @@ export declare type Vault = {
1560
1560
  ];
1561
1561
  },
1562
1562
  {
1563
- "name": "setVaultTypeStatus";
1563
+ "name": "updateVaultType";
1564
1564
  "accounts": [
1565
1565
  {
1566
1566
  "name": "payer";
@@ -1576,12 +1576,77 @@ export declare type Vault = {
1576
1576
  "name": "vaultType";
1577
1577
  "isMut": true;
1578
1578
  "isSigner": false;
1579
+ },
1580
+ {
1581
+ "name": "oracleInfoAccount";
1582
+ "isMut": true;
1583
+ "isSigner": false;
1579
1584
  }
1580
1585
  ];
1581
1586
  "args": [
1582
1587
  {
1583
- "name": "deprecated";
1588
+ "name": "config";
1589
+ "type": {
1590
+ "defined": "VaultTypeConfig";
1591
+ };
1592
+ }
1593
+ ];
1594
+ },
1595
+ {
1596
+ "name": "fixVaultRedeemPointer";
1597
+ "accounts": [
1598
+ {
1599
+ "name": "payer";
1600
+ "isMut": true;
1601
+ "isSigner": true;
1602
+ },
1603
+ {
1604
+ "name": "vaultSystemState";
1605
+ "isMut": true;
1606
+ "isSigner": false;
1607
+ },
1608
+ {
1609
+ "name": "vaultAccount";
1610
+ "isMut": true;
1611
+ "isSigner": false;
1612
+ }
1613
+ ];
1614
+ "args": [];
1615
+ },
1616
+ {
1617
+ "name": "adminSetRedeemPointer";
1618
+ "accounts": [
1619
+ {
1620
+ "name": "payer";
1621
+ "isMut": true;
1622
+ "isSigner": true;
1623
+ },
1624
+ {
1625
+ "name": "vaultSystemState";
1626
+ "isMut": true;
1627
+ "isSigner": false;
1628
+ },
1629
+ {
1630
+ "name": "vaultAccount";
1631
+ "isMut": true;
1632
+ "isSigner": false;
1633
+ },
1634
+ {
1635
+ "name": "vaultTypeAccount";
1636
+ "isMut": true;
1637
+ "isSigner": false;
1638
+ }
1639
+ ];
1640
+ "args": [
1641
+ {
1642
+ "name": "settingHead";
1584
1643
  "type": "bool";
1644
+ },
1645
+ {
1646
+ "name": "pointerToSet";
1647
+ "type": {
1648
+ "option": "publicKey";
1649
+ };
1585
1650
  }
1586
1651
  ];
1587
1652
  }
@@ -1779,7 +1844,7 @@ export declare type Vault = {
1779
1844
  "kind": "struct";
1780
1845
  "fields": [
1781
1846
  {
1782
- "name": "collateralType";
1847
+ "name": "vaultTypeName";
1783
1848
  "type": "string";
1784
1849
  },
1785
1850
  {
@@ -1793,6 +1858,10 @@ export declare type Vault = {
1793
1858
  {
1794
1859
  "name": "oracleSwitchboard";
1795
1860
  "type": "publicKey";
1861
+ },
1862
+ {
1863
+ "name": "vaultType";
1864
+ "type": "publicKey";
1796
1865
  }
1797
1866
  ];
1798
1867
  };
@@ -1903,7 +1972,7 @@ export declare type Vault = {
1903
1972
  "type": {
1904
1973
  "array": [
1905
1974
  "u8",
1906
- 12
1975
+ 16
1907
1976
  ];
1908
1977
  };
1909
1978
  },
@@ -2037,7 +2106,7 @@ export declare type Vault = {
2037
2106
  "kind": "struct";
2038
2107
  "fields": [
2039
2108
  {
2040
- "name": "collateralType";
2109
+ "name": "vaultTypeName";
2041
2110
  "type": "string";
2042
2111
  },
2043
2112
  {
@@ -2121,6 +2190,14 @@ export declare type Vault = {
2121
2190
  {
2122
2191
  "name": "deprecated";
2123
2192
  "type": "bool";
2193
+ },
2194
+ {
2195
+ "name": "totalFeesAccumulatedUsh";
2196
+ "type": "u128";
2197
+ },
2198
+ {
2199
+ "name": "totalFeesAccumulatedCollateral";
2200
+ "type": "u128";
2124
2201
  }
2125
2202
  ];
2126
2203
  };
@@ -2147,7 +2224,7 @@ export declare type Vault = {
2147
2224
  "type": "u64";
2148
2225
  },
2149
2226
  {
2150
- "name": "collateralType";
2227
+ "name": "vaultTypeName";
2151
2228
  "type": "string";
2152
2229
  },
2153
2230
  {
@@ -2195,6 +2272,10 @@ export declare type Vault = {
2195
2272
  "type": {
2196
2273
  "option": "publicKey";
2197
2274
  };
2275
+ },
2276
+ {
2277
+ "name": "vaultType";
2278
+ "type": "publicKey";
2198
2279
  }
2199
2280
  ];
2200
2281
  };
@@ -2243,6 +2324,56 @@ export declare type Vault = {
2243
2324
  ];
2244
2325
  };
2245
2326
  },
2327
+ {
2328
+ "name": "VaultTypeConfig";
2329
+ "type": {
2330
+ "kind": "struct";
2331
+ "fields": [
2332
+ {
2333
+ "name": "maxDebtExtended";
2334
+ "type": {
2335
+ "option": "u64";
2336
+ };
2337
+ },
2338
+ {
2339
+ "name": "minDebtPerVault";
2340
+ "type": {
2341
+ "option": "u64";
2342
+ };
2343
+ },
2344
+ {
2345
+ "name": "loanInitFee";
2346
+ "type": {
2347
+ "option": "u64";
2348
+ };
2349
+ },
2350
+ {
2351
+ "name": "oracleChainlink";
2352
+ "type": {
2353
+ "option": "publicKey";
2354
+ };
2355
+ },
2356
+ {
2357
+ "name": "oraclePyth";
2358
+ "type": {
2359
+ "option": "publicKey";
2360
+ };
2361
+ },
2362
+ {
2363
+ "name": "oracleSwitchboard";
2364
+ "type": {
2365
+ "option": "publicKey";
2366
+ };
2367
+ },
2368
+ {
2369
+ "name": "deprecated";
2370
+ "type": {
2371
+ "option": "bool";
2372
+ };
2373
+ }
2374
+ ];
2375
+ };
2376
+ },
2246
2377
  {
2247
2378
  "name": "PositionState";
2248
2379
  "type": {
@@ -2558,13 +2689,28 @@ export declare type Vault = {
2558
2689
  },
2559
2690
  {
2560
2691
  "code": 6020;
2561
- "name": "RedeemingNonHighestCollateralRatioVault";
2562
- "msg": "Can only redeem highest collateral ratio vault in system.";
2692
+ "name": "NotRedeemingLowestCollateralRatioVault";
2693
+ "msg": "Can only redeem lowest collateral ratio vault in system.";
2563
2694
  },
2564
2695
  {
2565
2696
  "code": 6021;
2566
2697
  "name": "VaultTypeDeprecated";
2567
2698
  "msg": "Vaults of this collateral type are deprecated. No new vaults can be created and no new debt will be issued for this collateral type.";
2699
+ },
2700
+ {
2701
+ "code": 6022;
2702
+ "name": "UpdateLinkedListFailed";
2703
+ "msg": "There was an error updating the list of vaults. Please make sure the transaction is fresh.";
2704
+ },
2705
+ {
2706
+ "code": 6023;
2707
+ "name": "InvalidSaltLength";
2708
+ "msg": "Salt for new vaults must be of length 8";
2709
+ },
2710
+ {
2711
+ "code": 6024;
2712
+ "name": "UpdateVaultTypeBadMaxDebtExtended";
2713
+ "msg": "New Max debt extended value is less than the current debt!";
2568
2714
  }
2569
2715
  ];
2570
2716
  };
@@ -16,7 +16,7 @@ export * from './instructions/refreshOraclePrice';
16
16
  export * from './instructions/initHedgeFoundation';
17
17
  export * from './instructions/initHedgeFoundationTokens';
18
18
  export * from './instructions/setHalted';
19
- export * from './instructions/setVaultTypeStatus';
19
+ export * from './instructions/updateVaultType';
20
20
  export * from './HedgeDecimal';
21
21
  export * from './Constants';
22
22
  export * from './state/VaultAccount';
@@ -2,4 +2,4 @@ import { Program, Provider } from '@project-serum/anchor';
2
2
  import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
3
3
  import { Vault } from 'idl/vault';
4
4
  export declare function liquidateVault(program: Program<Vault>, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, overrideTime?: number): Promise<PublicKey>;
5
- export declare function liquidateVaultInstruction(program: Program<Vault>, payerPublicKey: PublicKey, payerAssociatedTokenAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, poolState: PublicKey, poolEra: PublicKey, poolAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, newEraPublicKey: PublicKey, feePool: PublicKey, feePoolAssociatedTokenAccount: PublicKey, hedgeStakingPoolAssociatedUshTokenAccount: PublicKey, collateralMint: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, collateralType: string, overrideTime?: number): Promise<TransactionInstruction>;
5
+ export declare function liquidateVaultInstruction(program: Program<Vault>, payerPublicKey: PublicKey, payerAssociatedTokenAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, poolState: PublicKey, poolEra: PublicKey, poolAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, newEraPublicKey: PublicKey, feePool: PublicKey, feePoolAssociatedTokenAccount: PublicKey, hedgeStakingPoolAssociatedUshTokenAccount: PublicKey, collateralMint: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, vaultTypeAccount: PublicKey, overrideTime?: number): Promise<TransactionInstruction>;
@@ -0,0 +1,15 @@
1
+ /// <reference types="bn.js" />
2
+ import { BN, Program, Provider } from '@project-serum/anchor';
3
+ import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
4
+ import { Vault } from 'idl/vault';
5
+ export interface VaultTypeConfig {
6
+ maxDebtExtended?: BN;
7
+ minDebtPerVault?: BN;
8
+ loanInitFee?: BN;
9
+ oracleChainlink?: PublicKey;
10
+ oraclePyth?: PublicKey;
11
+ oracleSwitchboard?: PublicKey;
12
+ deprecated?: boolean;
13
+ }
14
+ export declare function updateVaultType(program: Program<Vault>, provider: Provider, payer: Signer, vaultTypeAccount: PublicKey, oracleInfoAccount: PublicKey, config: VaultTypeConfig): Promise<PublicKey>;
15
+ export declare function updateVaultTypeStatusInstruction(program: Program<Vault>, vaultSystemStatePublicKey: PublicKey, payerPublicKey: PublicKey, vaultTypeAccount: PublicKey, oracleInfoAccount: PublicKey, vaultTypeConfig: VaultTypeConfig): Promise<TransactionInstruction>;
@@ -17,16 +17,18 @@ export declare class VaultAccount {
17
17
  denormalizedDebt: number;
18
18
  /** The ordered number of when this vault was created. */
19
19
  vaultNumber: number;
20
- /** Debt redistribution snapshop */
20
+ /** Debt redistribution snapshot */
21
21
  debtProductSnapshotBytes: Decimal;
22
- /** Collateral redistribution snapshop' */
22
+ /** Collateral redistribution snapshot' */
23
23
  collateralAccumulatorSnapshotBytes: Decimal;
24
- /** The vault type eg 'SOL-150' */
25
- collateralType: string;
26
- /** Current State of the vautl ("Open", "Closed", "Liquidated") */
24
+ /** The vault type eg '2-SOL-150-0' */
25
+ vaultTypeName: string;
26
+ /** Current State of the vault ("Open", "Closed", "Liquidated") */
27
27
  vaultStatus: string;
28
28
  /** The public key of the next vault to redeem. */
29
29
  nextVaultToRedeem: PublicKey;
30
+ /** The public key of the vault type. */
31
+ vaultType: PublicKey;
30
32
  constructor(vault: any, publicKey: PublicKey);
31
33
  /**
32
34
  * Check if some `PublicKey` is the owner
@@ -57,7 +59,7 @@ export declare class VaultAccount {
57
59
  addDeposit(depositAmount: number): void;
58
60
  redeem(): void;
59
61
  liquidate(): void;
60
- updateDebtAndCollateral(vaultTypeAccuntData: any): void;
62
+ updateDebtAndCollateral(vaultTypeAccountData: any): void;
61
63
  toString(highlight: PublicKey): string;
62
64
  /**
63
65
  * Creates a VaultAccount from a slice of data
@@ -0,0 +1,24 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import Decimal from 'decimal.js';
3
+ export default class VaultType {
4
+ publicKey?: PublicKey;
5
+ name: string;
6
+ collateralMint: PublicKey;
7
+ collateralIndex: number;
8
+ recentPrice: Decimal;
9
+ priceLastUpdatedTimestamp: Decimal;
10
+ collateralHeld: Decimal;
11
+ denormalizedDebtExtended: Decimal;
12
+ debtRedistributionProduct: Decimal;
13
+ collateralRedistributionAccumulator: Decimal;
14
+ minCollateralRatio: Decimal;
15
+ loanInitFee: Decimal;
16
+ minDebtPerVault: Decimal;
17
+ maxDebtExtended: Decimal;
18
+ canBeRedeemed: boolean;
19
+ cumulativeRate: Decimal;
20
+ cumulativeRateLastUpdated: Decimal;
21
+ interestRatePerSecond: Decimal;
22
+ firstVaultToRedeem: PublicKey;
23
+ constructor(config: any, publicKey?: PublicKey);
24
+ }
@@ -0,0 +1,2 @@
1
+ import { Connection, Signer, Transaction, TransactionSignature } from '@solana/web3.js';
2
+ export declare function sendAndConfirmWithDebug(connection: Connection, transaction: Transaction, signers: Signer[]): Promise<TransactionSignature | void>;
@@ -0,0 +1,2 @@
1
+ import { Connection, Signer, Transaction, TransactionSignature } from '@solana/web3.js';
2
+ export default function sendAndConfirmWithDebug(connection: Connection, transaction: Transaction, signers: Signer[]): Promise<TransactionSignature | void>;
package/lib/Constants.js CHANGED
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.findAssociatedTokenAddress = exports.findVaultAddress = exports.getVaultTypeOracleAccountPublicKey = exports.getVaultTypeAccountPublicKey = exports.getPoolPublicKeyForMint = exports.getHedgeMintPublicKey = exports.getVaultSystemStatePublicKey = exports.getUshMintPublicKey = exports.getLiquidationPoolUshAccountPublicKey = exports.getLiquidationPoolStatePublicKey = exports.CHAINLINK_SOL_USD_PUBLICKEY = exports.CHAINLINK_SOL_USD_ID = exports.HEDGE_PROGRAM_PUBLICKEY = exports.HEDGE_PROGRAM_ID = void 0;
13
13
  const spl_token_1 = require("@solana/spl-token");
14
14
  const web3_js_1 = require("@solana/web3.js");
15
- exports.HEDGE_PROGRAM_ID = 'HDG4FDos8fyrB79qMCe98gaFjNEy5kpxGNjMc5V8M6TJ';
15
+ exports.HEDGE_PROGRAM_ID = 'zooJaircVAoQ4e7EXRDocnsbB7UPYQ6J7bKyZEMh784';
16
16
  exports.HEDGE_PROGRAM_PUBLICKEY = new web3_js_1.PublicKey(exports.HEDGE_PROGRAM_ID);
17
17
  exports.CHAINLINK_SOL_USD_ID = 'FmAmfoyPXiA8Vhhe6MZTr3U6rZfEZ1ctEHay1ysqCqcf';
18
18
  exports.CHAINLINK_SOL_USD_PUBLICKEY = new web3_js_1.PublicKey(exports.CHAINLINK_SOL_USD_ID);
package/lib/idl/vault.js CHANGED
@@ -1563,7 +1563,7 @@ exports.IDL = {
1563
1563
  ]
1564
1564
  },
1565
1565
  {
1566
- "name": "setVaultTypeStatus",
1566
+ "name": "updateVaultType",
1567
1567
  "accounts": [
1568
1568
  {
1569
1569
  "name": "payer",
@@ -1579,12 +1579,77 @@ exports.IDL = {
1579
1579
  "name": "vaultType",
1580
1580
  "isMut": true,
1581
1581
  "isSigner": false
1582
+ },
1583
+ {
1584
+ "name": "oracleInfoAccount",
1585
+ "isMut": true,
1586
+ "isSigner": false
1587
+ }
1588
+ ],
1589
+ "args": [
1590
+ {
1591
+ "name": "config",
1592
+ "type": {
1593
+ "defined": "VaultTypeConfig"
1594
+ }
1595
+ }
1596
+ ]
1597
+ },
1598
+ {
1599
+ "name": "fixVaultRedeemPointer",
1600
+ "accounts": [
1601
+ {
1602
+ "name": "payer",
1603
+ "isMut": true,
1604
+ "isSigner": true
1605
+ },
1606
+ {
1607
+ "name": "vaultSystemState",
1608
+ "isMut": true,
1609
+ "isSigner": false
1610
+ },
1611
+ {
1612
+ "name": "vaultAccount",
1613
+ "isMut": true,
1614
+ "isSigner": false
1615
+ }
1616
+ ],
1617
+ "args": []
1618
+ },
1619
+ {
1620
+ "name": "adminSetRedeemPointer",
1621
+ "accounts": [
1622
+ {
1623
+ "name": "payer",
1624
+ "isMut": true,
1625
+ "isSigner": true
1626
+ },
1627
+ {
1628
+ "name": "vaultSystemState",
1629
+ "isMut": true,
1630
+ "isSigner": false
1631
+ },
1632
+ {
1633
+ "name": "vaultAccount",
1634
+ "isMut": true,
1635
+ "isSigner": false
1636
+ },
1637
+ {
1638
+ "name": "vaultTypeAccount",
1639
+ "isMut": true,
1640
+ "isSigner": false
1582
1641
  }
1583
1642
  ],
1584
1643
  "args": [
1585
1644
  {
1586
- "name": "deprecated",
1645
+ "name": "settingHead",
1587
1646
  "type": "bool"
1647
+ },
1648
+ {
1649
+ "name": "pointerToSet",
1650
+ "type": {
1651
+ "option": "publicKey"
1652
+ }
1588
1653
  }
1589
1654
  ]
1590
1655
  }
@@ -1782,7 +1847,7 @@ exports.IDL = {
1782
1847
  "kind": "struct",
1783
1848
  "fields": [
1784
1849
  {
1785
- "name": "collateralType",
1850
+ "name": "vaultTypeName",
1786
1851
  "type": "string"
1787
1852
  },
1788
1853
  {
@@ -1796,6 +1861,10 @@ exports.IDL = {
1796
1861
  {
1797
1862
  "name": "oracleSwitchboard",
1798
1863
  "type": "publicKey"
1864
+ },
1865
+ {
1866
+ "name": "vaultType",
1867
+ "type": "publicKey"
1799
1868
  }
1800
1869
  ]
1801
1870
  }
@@ -1906,7 +1975,7 @@ exports.IDL = {
1906
1975
  "type": {
1907
1976
  "array": [
1908
1977
  "u8",
1909
- 12
1978
+ 16
1910
1979
  ]
1911
1980
  }
1912
1981
  },
@@ -2040,7 +2109,7 @@ exports.IDL = {
2040
2109
  "kind": "struct",
2041
2110
  "fields": [
2042
2111
  {
2043
- "name": "collateralType",
2112
+ "name": "vaultTypeName",
2044
2113
  "type": "string"
2045
2114
  },
2046
2115
  {
@@ -2124,6 +2193,14 @@ exports.IDL = {
2124
2193
  {
2125
2194
  "name": "deprecated",
2126
2195
  "type": "bool"
2196
+ },
2197
+ {
2198
+ "name": "totalFeesAccumulatedUsh",
2199
+ "type": "u128"
2200
+ },
2201
+ {
2202
+ "name": "totalFeesAccumulatedCollateral",
2203
+ "type": "u128"
2127
2204
  }
2128
2205
  ]
2129
2206
  }
@@ -2150,7 +2227,7 @@ exports.IDL = {
2150
2227
  "type": "u64"
2151
2228
  },
2152
2229
  {
2153
- "name": "collateralType",
2230
+ "name": "vaultTypeName",
2154
2231
  "type": "string"
2155
2232
  },
2156
2233
  {
@@ -2198,6 +2275,10 @@ exports.IDL = {
2198
2275
  "type": {
2199
2276
  "option": "publicKey"
2200
2277
  }
2278
+ },
2279
+ {
2280
+ "name": "vaultType",
2281
+ "type": "publicKey"
2201
2282
  }
2202
2283
  ]
2203
2284
  }
@@ -2246,6 +2327,56 @@ exports.IDL = {
2246
2327
  ]
2247
2328
  }
2248
2329
  },
2330
+ {
2331
+ "name": "VaultTypeConfig",
2332
+ "type": {
2333
+ "kind": "struct",
2334
+ "fields": [
2335
+ {
2336
+ "name": "maxDebtExtended",
2337
+ "type": {
2338
+ "option": "u64"
2339
+ }
2340
+ },
2341
+ {
2342
+ "name": "minDebtPerVault",
2343
+ "type": {
2344
+ "option": "u64"
2345
+ }
2346
+ },
2347
+ {
2348
+ "name": "loanInitFee",
2349
+ "type": {
2350
+ "option": "u64"
2351
+ }
2352
+ },
2353
+ {
2354
+ "name": "oracleChainlink",
2355
+ "type": {
2356
+ "option": "publicKey"
2357
+ }
2358
+ },
2359
+ {
2360
+ "name": "oraclePyth",
2361
+ "type": {
2362
+ "option": "publicKey"
2363
+ }
2364
+ },
2365
+ {
2366
+ "name": "oracleSwitchboard",
2367
+ "type": {
2368
+ "option": "publicKey"
2369
+ }
2370
+ },
2371
+ {
2372
+ "name": "deprecated",
2373
+ "type": {
2374
+ "option": "bool"
2375
+ }
2376
+ }
2377
+ ]
2378
+ }
2379
+ },
2249
2380
  {
2250
2381
  "name": "PositionState",
2251
2382
  "type": {
@@ -2561,13 +2692,28 @@ exports.IDL = {
2561
2692
  },
2562
2693
  {
2563
2694
  "code": 6020,
2564
- "name": "RedeemingNonHighestCollateralRatioVault",
2565
- "msg": "Can only redeem highest collateral ratio vault in system."
2695
+ "name": "NotRedeemingLowestCollateralRatioVault",
2696
+ "msg": "Can only redeem lowest collateral ratio vault in system."
2566
2697
  },
2567
2698
  {
2568
2699
  "code": 6021,
2569
2700
  "name": "VaultTypeDeprecated",
2570
2701
  "msg": "Vaults of this collateral type are deprecated. No new vaults can be created and no new debt will be issued for this collateral type."
2702
+ },
2703
+ {
2704
+ "code": 6022,
2705
+ "name": "UpdateLinkedListFailed",
2706
+ "msg": "There was an error updating the list of vaults. Please make sure the transaction is fresh."
2707
+ },
2708
+ {
2709
+ "code": 6023,
2710
+ "name": "InvalidSaltLength",
2711
+ "msg": "Salt for new vaults must be of length 8"
2712
+ },
2713
+ {
2714
+ "code": 6024,
2715
+ "name": "UpdateVaultTypeBadMaxDebtExtended",
2716
+ "msg": "New Max debt extended value is less than the current debt!"
2571
2717
  }
2572
2718
  ]
2573
2719
  };
package/lib/index.js CHANGED
@@ -28,7 +28,7 @@ __exportStar(require("./instructions/refreshOraclePrice"), exports);
28
28
  __exportStar(require("./instructions/initHedgeFoundation"), exports);
29
29
  __exportStar(require("./instructions/initHedgeFoundationTokens"), exports);
30
30
  __exportStar(require("./instructions/setHalted"), exports);
31
- __exportStar(require("./instructions/setVaultTypeStatus"), exports);
31
+ __exportStar(require("./instructions/updateVaultType"), exports);
32
32
  __exportStar(require("./HedgeDecimal"), exports);
33
33
  __exportStar(require("./Constants"), exports);
34
34
  __exportStar(require("./state/VaultAccount"), exports);
@@ -26,6 +26,7 @@ function createStakingPool(program, provider, payer, mintPublicKey, hedgeTokensT
26
26
  exports.createStakingPool = createStakingPool;
27
27
  function createStakingPoolInstruction(program, payerPublicKey, mintPublicKey, hedgeTokensToBeMinted, overrideStartTime) {
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
+ console.log("new createStakingPoolInstruction");
29
30
  const vaultSystemStatePublicKey = yield (0, Constants_1.getVaultSystemStatePublicKey)();
30
31
  const ushMintPublickey = yield (0, Constants_1.getUshMintPublicKey)();
31
32
  const [poolPublickey, poolBump] = yield (0, Constants_1.getPoolPublicKeyForMint)(mintPublicKey);