safely avoid zero division during execution discount calculation

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-11-16 21:28:17 +03:00
parent 582b22aded
commit 8b6a47d196
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
2 changed files with 3 additions and 1 deletions

View File

@ -1,7 +1,7 @@
{
"name": "ghost-dao-interface",
"private": true,
"version": "0.8.22",
"version": "0.8.23",
"type": "module",
"scripts": {
"dev": "vite",

View File

@ -105,6 +105,8 @@ const Exodus = ({ chainId, address, config }) => {
const currentGasPriceCost = currentTwapPrice(currentGasPrice._value).mul(ftsoPrice);
const actualGasPerUnitCost = actualGasPerUnit.mul(reservePrice);
if (currentGasPriceCost.eq(zero)) return zero;
return currentGasPriceCost
.sub(actualGasPerUnitCost)
.mul(oneHundred.add(zero))