Skip to content

Commit

Permalink
Feat/resolve protocol fee calc error (#231)
Browse files Browse the repository at this point in the history
* fix: correct feeAmount format
  • Loading branch information
rozanagy authored Jan 21, 2025
1 parent 7992fcf commit 4383e20
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ function calculateProtocolFeeInUSD(
usdPrice: number,
feeBasisPoints: number
): string {
const feeAmount = new Decimal(getFeeAmount(assetAmount, feeBasisPoints));
const result = feeAmount.mul(new Decimal(usdPrice));
try {
const feeAmount = new Decimal(getFeeAmount(assetAmount, feeBasisPoints));
const result = feeAmount.mul(new Decimal(usdPrice));

return result.toNumber().toLocaleString('en-US');
return result.toNumber().toLocaleString('en-US');
} catch (error) {
return '0';
}
}

export function TransactionFormProtocolFeeStack({
Expand Down

0 comments on commit 4383e20

Please sign in to comment.