Skip to content

Commit

Permalink
fix: fix calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekkMA committed Nov 14, 2024
1 parent 6140e3c commit 8c01ec5
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ describeSuite({
const burnPercentage = burnProportion.value().toNumber() / 1e7;

const calcTreasuryIncrease = (feeWithTip: bigint): bigint => {
// In rust code fees.ration(treasury_part, burn_part)
// treasury increase is being calculated this way
const issuanceDecrease = calcIssuanceDecrease(feeWithTip);
return feeWithTip - issuanceDecrease;
};
const calcIssuanceDecrease = (feeWithTip: bigint): bigint => {
const feeWithTipBN = new BN(feeWithTip.toString());
const proportion: BN = t.proportion.value();
const proportion: BN = burnProportion.value();
const val = feeWithTipBN.mul(proportion).div(new BN(1e9));
return BigInt(val.toString());
};
const calcIssuanceDecrease = (feeWithTip: bigint): bigint => {
const treasuryIncrease = calcTreasuryIncrease(feeWithTip);
return feeWithTip - treasuryIncrease;
};

for (const txnType of TransactionTypes) {
it({
Expand Down

0 comments on commit 8c01ec5

Please sign in to comment.