flash-sdk 11.8.4 → 11.8.5-alpha.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.
@@ -701,7 +701,7 @@ var PerpetualsClient = (function () {
701
701
  currentMarginUsd = positionAccount.collateralUsd.sub(lossUsd);
702
702
  }
703
703
  else {
704
- currentMarginUsd = positionAccount.collateralUsd.add(pnl.profitUsd).sub(lossUsd);
704
+ currentMarginUsd = positionAccount.collateralUsd.add(pnl.finalProfitUsd).sub(lossUsd);
705
705
  }
706
706
  if (currentMarginUsd.gt(constants_1.BN_ZERO)) {
707
707
  return positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(currentMarginUsd);
@@ -1056,7 +1056,7 @@ var PerpetualsClient = (function () {
1056
1056
  var totalFeesUsd = (exitFeeUsd.add(lockAndUnsettledFeeUsd));
1057
1057
  var currentCollateralUsd = positionDelta.collateralUsd;
1058
1058
  var liabilityUsd = newPnl.lossUsd.add(totalFeesUsd);
1059
- var assetsUsd = anchor_1.BN.min(newPnl.profitUsd.add(currentCollateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionDelta.lockedAmount, collateralCustodyAccount.decimals));
1059
+ var assetsUsd = anchor_1.BN.min(newPnl.finalProfitUsd.add(currentCollateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionDelta.lockedAmount, collateralCustodyAccount.decimals));
1060
1060
  if (debugLogs) {
1061
1061
  console.log("assetsUsd.sub(liabilityUsd):", collateralCustodyAccount.decimals, assetsUsd.toString(), liabilityUsd.toString(), assetsUsd.sub(liabilityUsd).toString());
1062
1062
  }
@@ -1193,7 +1193,7 @@ var PerpetualsClient = (function () {
1193
1193
  var exitPriceAndFee = _this.getExitPriceAndFeeSync(positionAccount, marketCorrelation, positionAccount.collateralAmount, positionAccount.sizeAmount, side, targetPrice, targetEmaPrice, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, currentTimestamp);
1194
1194
  var totalFeesUsd = (exitPriceAndFee.exitFeeUsd.add(exitPriceAndFee.borrowFeeUsd));
1195
1195
  var liabilityUsd = newPnl.lossUsd.add(totalFeesUsd);
1196
- var assetsUsd = anchor_1.BN.min(newPnl.profitUsd.add(positionAccount.collateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionAccount.lockedAmount, collateralCustodyAccount.decimals));
1196
+ var assetsUsd = anchor_1.BN.min(newPnl.finalProfitUsd.add(positionAccount.collateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionAccount.lockedAmount, collateralCustodyAccount.decimals));
1197
1197
  var closeAmountUsd, feesAmountUsd;
1198
1198
  if (assetsUsd.gt(liabilityUsd)) {
1199
1199
  closeAmountUsd = assetsUsd.sub(liabilityUsd);
@@ -1609,6 +1609,8 @@ var PerpetualsClient = (function () {
1609
1609
  return {
1610
1610
  profitUsd: constants_1.BN_ZERO,
1611
1611
  lossUsd: constants_1.BN_ZERO,
1612
+ penaltyUsd: constants_1.BN_ZERO,
1613
+ finalProfitUsd: constants_1.BN_ZERO,
1612
1614
  };
1613
1615
  }
1614
1616
  var side = poolConfig.getMarketConfigByPk(positionAccount.market).side;
@@ -1672,16 +1674,34 @@ var PerpetualsClient = (function () {
1672
1674
  if (!priceDiffProfit.exponent.eq(priceDiffLoss.exponent)) {
1673
1675
  throw new Error("exponent mistach");
1674
1676
  }
1677
+ var totalPenaltyBps = positionAccount.oraclePenalty + positionAccount.previousPenalty;
1675
1678
  if (priceDiffProfit.price.gt(constants_1.BN_ZERO)) {
1679
+ var grossProfitUsd = priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals);
1680
+ var penaltyUsd = constants_1.BN_ZERO;
1681
+ var finalProfitUsd = grossProfitUsd;
1682
+ if (totalPenaltyBps > 0 && grossProfitUsd.gt(constants_1.BN_ZERO)) {
1683
+ penaltyUsd = grossProfitUsd.muln(totalPenaltyBps).divn(constants_1.BPS_POWER);
1684
+ if (penaltyUsd.gte(grossProfitUsd)) {
1685
+ penaltyUsd = grossProfitUsd;
1686
+ finalProfitUsd = constants_1.BN_ZERO;
1687
+ }
1688
+ else {
1689
+ finalProfitUsd = grossProfitUsd.sub(penaltyUsd);
1690
+ }
1691
+ }
1676
1692
  return {
1677
- profitUsd: priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
1693
+ profitUsd: grossProfitUsd,
1678
1694
  lossUsd: constants_1.BN_ZERO,
1695
+ penaltyUsd: penaltyUsd,
1696
+ finalProfitUsd: finalProfitUsd,
1679
1697
  };
1680
1698
  }
1681
1699
  else {
1682
1700
  return {
1683
1701
  profitUsd: constants_1.BN_ZERO,
1684
1702
  lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
1703
+ penaltyUsd: constants_1.BN_ZERO,
1704
+ finalProfitUsd: constants_1.BN_ZERO,
1685
1705
  };
1686
1706
  }
1687
1707
  };
@@ -1760,22 +1780,40 @@ var PerpetualsClient = (function () {
1760
1780
  priceDiffLoss = new OraclePrice_1.OraclePrice({ price: exitOraclePrice.price.sub(entryOraclePrice.price), exponent: exitOraclePrice.exponent, confidence: constants_1.BN_ZERO, timestamp: constants_1.BN_ZERO });
1761
1781
  }
1762
1782
  }
1783
+ var totalPenaltyBps = positionAccount.oraclePenalty + positionAccount.previousPenalty;
1763
1784
  if (priceDiffProfit.price.gt(constants_1.BN_ZERO)) {
1785
+ var grossProfitUsd = priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals);
1786
+ var penaltyUsd = constants_1.BN_ZERO;
1787
+ var finalProfitUsd = grossProfitUsd;
1788
+ if (totalPenaltyBps > 0 && grossProfitUsd.gt(constants_1.BN_ZERO)) {
1789
+ penaltyUsd = grossProfitUsd.muln(totalPenaltyBps).divn(constants_1.BPS_POWER);
1790
+ if (penaltyUsd.gte(grossProfitUsd)) {
1791
+ penaltyUsd = grossProfitUsd;
1792
+ finalProfitUsd = constants_1.BN_ZERO;
1793
+ }
1794
+ else {
1795
+ finalProfitUsd = grossProfitUsd.sub(penaltyUsd);
1796
+ }
1797
+ }
1764
1798
  pnl = {
1765
- profitUsd: priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
1799
+ profitUsd: grossProfitUsd,
1766
1800
  lossUsd: constants_1.BN_ZERO,
1801
+ penaltyUsd: penaltyUsd,
1802
+ finalProfitUsd: finalProfitUsd,
1767
1803
  };
1768
1804
  }
1769
1805
  else {
1770
1806
  pnl = {
1771
1807
  profitUsd: constants_1.BN_ZERO,
1772
1808
  lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
1809
+ penaltyUsd: constants_1.BN_ZERO,
1810
+ finalProfitUsd: constants_1.BN_ZERO,
1773
1811
  };
1774
1812
  }
1775
1813
  var liquidationPrice = _this.getLiquidationPriceContractHelper(entryOraclePrice, lockAndUnsettledFeeUsd, side, targetCustodyAccount, positionAccount);
1776
1814
  var unsettledFeesUsd = exitFeeUsd.add(lockAndUnsettledFeeUsd);
1777
1815
  var lossUsd = pnl.lossUsd.add(unsettledFeesUsd);
1778
- var currentMarginUsd = positionAccount.collateralUsd.add(pnl.profitUsd).sub(lossUsd);
1816
+ var currentMarginUsd = positionAccount.collateralUsd.add(pnl.finalProfitUsd).sub(lossUsd);
1779
1817
  var leverage;
1780
1818
  if (currentMarginUsd.gt(constants_1.BN_ZERO)) {
1781
1819
  leverage = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(currentMarginUsd);
@@ -7593,8 +7631,44 @@ var PerpetualsClient = (function () {
7593
7631
  }
7594
7632
  });
7595
7633
  }); };
7634
+ this.setPositionPenalty = function (positionPubkey, oraclePenalty, oracleAuthority) { return __awaiter(_this, void 0, void 0, function () {
7635
+ var instructions, additionalSigners, setPositionPenaltyIx, err_52;
7636
+ return __generator(this, function (_a) {
7637
+ switch (_a.label) {
7638
+ case 0:
7639
+ instructions = [];
7640
+ additionalSigners = [];
7641
+ _a.label = 1;
7642
+ case 1:
7643
+ _a.trys.push([1, 3, , 4]);
7644
+ return [4, this.program.methods
7645
+ .setPositionPenalty({
7646
+ oraclePenalty: oraclePenalty,
7647
+ })
7648
+ .accounts({
7649
+ authority: oracleAuthority,
7650
+ position: positionPubkey,
7651
+ eventAuthority: this.eventAuthority.publicKey,
7652
+ program: this.program.programId,
7653
+ })
7654
+ .instruction()];
7655
+ case 2:
7656
+ setPositionPenaltyIx = _a.sent();
7657
+ instructions.push(setPositionPenaltyIx);
7658
+ return [3, 4];
7659
+ case 3:
7660
+ err_52 = _a.sent();
7661
+ console.log("perpClient setPositionPenalty error:: ", err_52);
7662
+ throw err_52;
7663
+ case 4: return [2, {
7664
+ instructions: __spreadArray([], instructions, true),
7665
+ additionalSigners: additionalSigners
7666
+ }];
7667
+ }
7668
+ });
7669
+ }); };
7596
7670
  this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7597
- var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_52;
7671
+ var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_53;
7598
7672
  return __generator(this, function (_a) {
7599
7673
  switch (_a.label) {
7600
7674
  case 0:
@@ -7632,8 +7706,8 @@ var PerpetualsClient = (function () {
7632
7706
  instructions.push(renameFlp);
7633
7707
  return [3, 4];
7634
7708
  case 3:
7635
- err_52 = _a.sent();
7636
- console.log("perpClient renameFlp error:: ", err_52);
7709
+ err_53 = _a.sent();
7710
+ console.log("perpClient renameFlp error:: ", err_53);
7637
7711
  return [3, 4];
7638
7712
  case 4: return [2, {
7639
7713
  instructions: __spreadArray([], instructions, true),
@@ -7643,7 +7717,7 @@ var PerpetualsClient = (function () {
7643
7717
  });
7644
7718
  }); };
7645
7719
  this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7646
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_53;
7720
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_54;
7647
7721
  return __generator(this, function (_a) {
7648
7722
  switch (_a.label) {
7649
7723
  case 0:
@@ -7681,9 +7755,9 @@ var PerpetualsClient = (function () {
7681
7755
  instructions.push(initStakeInstruction);
7682
7756
  return [3, 4];
7683
7757
  case 3:
7684
- err_53 = _a.sent();
7685
- console.log("perpClient InitStaking error:: ", err_53);
7686
- throw err_53;
7758
+ err_54 = _a.sent();
7759
+ console.log("perpClient InitStaking error:: ", err_54);
7760
+ throw err_54;
7687
7761
  case 4: return [2, {
7688
7762
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7689
7763
  additionalSigners: additionalSigners
@@ -7692,7 +7766,7 @@ var PerpetualsClient = (function () {
7692
7766
  });
7693
7767
  }); };
7694
7768
  this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7695
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_54;
7769
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_55;
7696
7770
  return __generator(this, function (_a) {
7697
7771
  switch (_a.label) {
7698
7772
  case 0:
@@ -7736,9 +7810,9 @@ var PerpetualsClient = (function () {
7736
7810
  instructions.push(initCompoundingInstruction);
7737
7811
  return [3, 4];
7738
7812
  case 3:
7739
- err_54 = _a.sent();
7740
- console.log("perpClient initCompounding error:: ", err_54);
7741
- throw err_54;
7813
+ err_55 = _a.sent();
7814
+ console.log("perpClient initCompounding error:: ", err_55);
7815
+ throw err_55;
7742
7816
  case 4: return [2, {
7743
7817
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7744
7818
  additionalSigners: additionalSigners
@@ -7747,7 +7821,7 @@ var PerpetualsClient = (function () {
7747
7821
  });
7748
7822
  }); };
7749
7823
  this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7750
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_55;
7824
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_56;
7751
7825
  return __generator(this, function (_a) {
7752
7826
  switch (_a.label) {
7753
7827
  case 0:
@@ -7788,9 +7862,9 @@ var PerpetualsClient = (function () {
7788
7862
  instructions.push(initTokenVaultInstruction);
7789
7863
  return [3, 4];
7790
7864
  case 3:
7791
- err_55 = _a.sent();
7792
- console.log("perpClient InitTokenVaultInstruction error:: ", err_55);
7793
- throw err_55;
7865
+ err_56 = _a.sent();
7866
+ console.log("perpClient InitTokenVaultInstruction error:: ", err_56);
7867
+ throw err_56;
7794
7868
  case 4: return [2, {
7795
7869
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7796
7870
  additionalSigners: additionalSigners
@@ -7799,7 +7873,7 @@ var PerpetualsClient = (function () {
7799
7873
  });
7800
7874
  }); };
7801
7875
  this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7802
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_56;
7876
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_57;
7803
7877
  return __generator(this, function (_a) {
7804
7878
  switch (_a.label) {
7805
7879
  case 0:
@@ -7830,9 +7904,9 @@ var PerpetualsClient = (function () {
7830
7904
  instructions.push(setTokenVaultConfigInstruction);
7831
7905
  return [3, 4];
7832
7906
  case 3:
7833
- err_56 = _a.sent();
7834
- console.log("perpClient setTokenVaultConfigInstruction error:: ", err_56);
7835
- throw err_56;
7907
+ err_57 = _a.sent();
7908
+ console.log("perpClient setTokenVaultConfigInstruction error:: ", err_57);
7909
+ throw err_57;
7836
7910
  case 4: return [2, {
7837
7911
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7838
7912
  additionalSigners: additionalSigners
@@ -7841,7 +7915,7 @@ var PerpetualsClient = (function () {
7841
7915
  });
7842
7916
  }); };
7843
7917
  this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7844
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_57;
7918
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_58;
7845
7919
  return __generator(this, function (_a) {
7846
7920
  switch (_a.label) {
7847
7921
  case 0:
@@ -7880,9 +7954,9 @@ var PerpetualsClient = (function () {
7880
7954
  instructions.push(withdrawInstantFeeInstruction);
7881
7955
  return [3, 6];
7882
7956
  case 5:
7883
- err_57 = _a.sent();
7884
- console.log("perpClient withdrawInstantFeeInstruction error:: ", err_57);
7885
- throw err_57;
7957
+ err_58 = _a.sent();
7958
+ console.log("perpClient withdrawInstantFeeInstruction error:: ", err_58);
7959
+ throw err_58;
7886
7960
  case 6: return [2, {
7887
7961
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7888
7962
  additionalSigners: additionalSigners
@@ -7891,7 +7965,7 @@ var PerpetualsClient = (function () {
7891
7965
  });
7892
7966
  }); };
7893
7967
  this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7894
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_58;
7968
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_59;
7895
7969
  return __generator(this, function (_a) {
7896
7970
  switch (_a.label) {
7897
7971
  case 0:
@@ -7930,9 +8004,9 @@ var PerpetualsClient = (function () {
7930
8004
  instructions.push(withdrawUnclaimedTokensInstruction);
7931
8005
  return [3, 6];
7932
8006
  case 5:
7933
- err_58 = _a.sent();
7934
- console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_58);
7935
- throw err_58;
8007
+ err_59 = _a.sent();
8008
+ console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_59);
8009
+ throw err_59;
7936
8010
  case 6: return [2, {
7937
8011
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7938
8012
  additionalSigners: additionalSigners
@@ -7941,7 +8015,7 @@ var PerpetualsClient = (function () {
7941
8015
  });
7942
8016
  }); };
7943
8017
  this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7944
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_59;
8018
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_60;
7945
8019
  return __generator(this, function (_a) {
7946
8020
  switch (_a.label) {
7947
8021
  case 0:
@@ -7978,9 +8052,9 @@ var PerpetualsClient = (function () {
7978
8052
  instructions.push(initRevenueTokenAccountInstruction);
7979
8053
  return [3, 4];
7980
8054
  case 3:
7981
- err_59 = _a.sent();
7982
- console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_59);
7983
- throw err_59;
8055
+ err_60 = _a.sent();
8056
+ console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_60);
8057
+ throw err_60;
7984
8058
  case 4: return [2, {
7985
8059
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7986
8060
  additionalSigners: additionalSigners
@@ -7989,7 +8063,7 @@ var PerpetualsClient = (function () {
7989
8063
  });
7990
8064
  }); };
7991
8065
  this.initRebateVault = function (allowRebatePayout, rebateSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7992
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_60;
8066
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_61;
7993
8067
  return __generator(this, function (_a) {
7994
8068
  switch (_a.label) {
7995
8069
  case 0:
@@ -8024,9 +8098,9 @@ var PerpetualsClient = (function () {
8024
8098
  instructions.push(initRebateVaultInstruction);
8025
8099
  return [3, 4];
8026
8100
  case 3:
8027
- err_60 = _a.sent();
8028
- console.log("perpClient initRebateVaultInstruction error:: ", err_60);
8029
- throw err_60;
8101
+ err_61 = _a.sent();
8102
+ console.log("perpClient initRebateVaultInstruction error:: ", err_61);
8103
+ throw err_61;
8030
8104
  case 4: return [2, {
8031
8105
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8032
8106
  additionalSigners: additionalSigners
@@ -8035,7 +8109,7 @@ var PerpetualsClient = (function () {
8035
8109
  });
8036
8110
  }); };
8037
8111
  this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8038
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_61;
8112
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_62;
8039
8113
  return __generator(this, function (_a) {
8040
8114
  switch (_a.label) {
8041
8115
  case 0:
@@ -8074,9 +8148,9 @@ var PerpetualsClient = (function () {
8074
8148
  instructions.push(distributeTokenRewardInstruction);
8075
8149
  return [3, 4];
8076
8150
  case 3:
8077
- err_61 = _a.sent();
8078
- console.log("perpClient distributeTokenRewardInstruction error:: ", err_61);
8079
- throw err_61;
8151
+ err_62 = _a.sent();
8152
+ console.log("perpClient distributeTokenRewardInstruction error:: ", err_62);
8153
+ throw err_62;
8080
8154
  case 4: return [2, {
8081
8155
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8082
8156
  additionalSigners: additionalSigners
@@ -8085,7 +8159,7 @@ var PerpetualsClient = (function () {
8085
8159
  });
8086
8160
  }); };
8087
8161
  this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
8088
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_62;
8162
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_63;
8089
8163
  return __generator(this, function (_a) {
8090
8164
  switch (_a.label) {
8091
8165
  case 0:
@@ -8113,9 +8187,9 @@ var PerpetualsClient = (function () {
8113
8187
  instructions.push(setTokenStakeLevelInstruction);
8114
8188
  return [3, 4];
8115
8189
  case 3:
8116
- err_62 = _a.sent();
8117
- console.log("perpClient setTokenStakeLevelInstruction error:: ", err_62);
8118
- throw err_62;
8190
+ err_63 = _a.sent();
8191
+ console.log("perpClient setTokenStakeLevelInstruction error:: ", err_63);
8192
+ throw err_63;
8119
8193
  case 4: return [2, {
8120
8194
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8121
8195
  additionalSigners: additionalSigners
@@ -8124,7 +8198,7 @@ var PerpetualsClient = (function () {
8124
8198
  });
8125
8199
  }); };
8126
8200
  this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8127
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_63;
8201
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_64;
8128
8202
  return __generator(this, function (_a) {
8129
8203
  switch (_a.label) {
8130
8204
  case 0:
@@ -8156,9 +8230,9 @@ var PerpetualsClient = (function () {
8156
8230
  instructions.push(setTokenRewardInstruction);
8157
8231
  return [3, 4];
8158
8232
  case 3:
8159
- err_63 = _a.sent();
8160
- console.log("perpClient setTokenRewardInstruction error:: ", err_63);
8161
- throw err_63;
8233
+ err_64 = _a.sent();
8234
+ console.log("perpClient setTokenRewardInstruction error:: ", err_64);
8235
+ throw err_64;
8162
8236
  case 4: return [2, {
8163
8237
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8164
8238
  additionalSigners: additionalSigners
@@ -8167,7 +8241,7 @@ var PerpetualsClient = (function () {
8167
8241
  });
8168
8242
  }); };
8169
8243
  this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
8170
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_64;
8244
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_65;
8171
8245
  return __generator(this, function (_a) {
8172
8246
  switch (_a.label) {
8173
8247
  case 0:
@@ -8196,9 +8270,9 @@ var PerpetualsClient = (function () {
8196
8270
  instructions.push(resizeInternalOracleInstruction);
8197
8271
  return [3, 4];
8198
8272
  case 3:
8199
- err_64 = _a.sent();
8200
- console.log("perpClient resizeInternalOracleInstruction error:: ", err_64);
8201
- throw err_64;
8273
+ err_65 = _a.sent();
8274
+ console.log("perpClient resizeInternalOracleInstruction error:: ", err_65);
8275
+ throw err_65;
8202
8276
  case 4: return [2, {
8203
8277
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8204
8278
  additionalSigners: additionalSigners
@@ -8207,7 +8281,7 @@ var PerpetualsClient = (function () {
8207
8281
  });
8208
8282
  }); };
8209
8283
  this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
8210
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_65;
8284
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_66;
8211
8285
  return __generator(this, function (_a) {
8212
8286
  switch (_a.label) {
8213
8287
  case 0:
@@ -8240,9 +8314,9 @@ var PerpetualsClient = (function () {
8240
8314
  instructions.push(createWhitelistInstruction);
8241
8315
  return [3, 4];
8242
8316
  case 3:
8243
- err_65 = _a.sent();
8244
- console.log("perpClient createWhitelistInstruction error:: ", err_65);
8245
- throw err_65;
8317
+ err_66 = _a.sent();
8318
+ console.log("perpClient createWhitelistInstruction error:: ", err_66);
8319
+ throw err_66;
8246
8320
  case 4: return [2, {
8247
8321
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8248
8322
  additionalSigners: additionalSigners
@@ -8251,7 +8325,7 @@ var PerpetualsClient = (function () {
8251
8325
  });
8252
8326
  }); };
8253
8327
  this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
8254
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_66;
8328
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_67;
8255
8329
  return __generator(this, function (_a) {
8256
8330
  switch (_a.label) {
8257
8331
  case 0:
@@ -8284,9 +8358,9 @@ var PerpetualsClient = (function () {
8284
8358
  instructions.push(setWhitelistConfigInstruction);
8285
8359
  return [3, 4];
8286
8360
  case 3:
8287
- err_66 = _a.sent();
8288
- console.log("perpClient setWhitelistConfigInstruction error:: ", err_66);
8289
- throw err_66;
8361
+ err_67 = _a.sent();
8362
+ console.log("perpClient setWhitelistConfigInstruction error:: ", err_67);
8363
+ throw err_67;
8290
8364
  case 4: return [2, {
8291
8365
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8292
8366
  additionalSigners: additionalSigners
@@ -564,9 +564,9 @@
564
564
  "tokenPrecision": 4,
565
565
  "isStable": false,
566
566
  "isVirtual": true,
567
- "lazerId": 2692,
568
- "pythTicker": "Commodities.WTIH6/USD",
569
- "pythPriceId": "0x0058c6f03fd28b18083d00fcdc3baaed2f11edef8b981f6b74130b85be474b17",
567
+ "lazerId": 2691,
568
+ "pythTicker": "Commodities.WTIG6/USD",
569
+ "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52",
570
570
  "isToken2022": false
571
571
  },
572
572
  {
@@ -681,10 +681,10 @@
681
681
  "isStable": false,
682
682
  "isVirtual": true,
683
683
  "intOracleAddress": "5qLQ3BT7JCf4fUxoAH1xZwHCca9fZuuTWTgTsNxLNcoZ",
684
- "extOracleAddress": "Gf9Cg2NS2xfsxLXixjsfAsQkeH1UxN2WVA7dRzKoacYk",
685
- "lazerId": 2692,
686
- "pythTicker": "Commodities.WTIH6/USD",
687
- "pythPriceId": "0x0058c6f03fd28b18083d00fcdc3baaed2f11edef8b981f6b74130b85be474b17"
684
+ "extOracleAddress": "8nMThr5gWoXaoWHR3gMXrz8ZULukjsBgoW83kuYCDzqG",
685
+ "lazerId": 2691,
686
+ "pythTicker": "Commodities.WTIG6/USD",
687
+ "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52"
688
688
  },
689
689
  {
690
690
  "custodyId": 7,
@@ -2287,7 +2287,7 @@
2287
2287
  "isStable": false,
2288
2288
  "isVirtual": false,
2289
2289
  "intOracleAddress": "GGCsvBtvBQrongLKGsMDTz9E4YeGmomrRDuZXwrTaWrS",
2290
- "extOracleAddress": "AxaxyeDT8JnWERSaTKvFXvPKkEdxnamKSqpWbsSjYg1g",
2290
+ "extOracleAddress": "HJGvGyWrAXdZPG4Q7LNkkKja72FDkJW7ixuyg3u6vZyP",
2291
2291
  "lazerId": 1717,
2292
2292
  "pythTicker": "Equity.US.MSTR/USD",
2293
2293
  "pythPriceId": "0xe1e80251e5f5184f2195008382538e847fafc36f751896889dd3d1b1f6111f09"
@@ -3031,9 +3031,9 @@
3031
3031
  "tokenPrecision": 4,
3032
3032
  "isStable": false,
3033
3033
  "isVirtual": true,
3034
- "lazerId": 2692,
3035
- "pythTicker": "Commodities.WTIH6/USD",
3036
- "pythPriceId": "0x0058c6f03fd28b18083d00fcdc3baaed2f11edef8b981f6b74130b85be474b17",
3034
+ "lazerId": 2691,
3035
+ "pythTicker": "Commodities.WTIG6/USD",
3036
+ "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52",
3037
3037
  "isToken2022": false
3038
3038
  },
3039
3039
  {
@@ -3148,10 +3148,10 @@
3148
3148
  "isStable": false,
3149
3149
  "isVirtual": true,
3150
3150
  "intOracleAddress": "BeqYMCytDcEJrpikXhz8ZLaBb9ACGDVvmp9ekwbgBgma",
3151
- "extOracleAddress": "Gf9Cg2NS2xfsxLXixjsfAsQkeH1UxN2WVA7dRzKoacYk",
3152
- "lazerId": 2692,
3153
- "pythTicker": "Commodities.WTIH6/USD",
3154
- "pythPriceId": "0x0058c6f03fd28b18083d00fcdc3baaed2f11edef8b981f6b74130b85be474b17"
3151
+ "extOracleAddress": "8nMThr5gWoXaoWHR3gMXrz8ZULukjsBgoW83kuYCDzqG",
3152
+ "lazerId": 2691,
3153
+ "pythTicker": "Commodities.WTIG6/USD",
3154
+ "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52"
3155
3155
  },
3156
3156
  {
3157
3157
  "custodyId": 7,
@@ -21,7 +21,8 @@ export declare class PositionAccount implements Position {
21
21
  cumulativeLockFeeSnapshot: BN;
22
22
  degenSizeUsd: BN;
23
23
  referencePrice: ContractOraclePrice;
24
- buffer: number;
24
+ oraclePenalty: number;
25
+ previousPenalty: number;
25
26
  sizeDecimals: number;
26
27
  lockedDecimals: number;
27
28
  collateralDecimals: number;