flash-sdk 11.8.6-alpha.0 → 11.8.7

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