safely avoid zero division during execution discount calculation
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
582b22aded
commit
8b6a47d196
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.8.22",
|
"version": "0.8.23",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -105,6 +105,8 @@ const Exodus = ({ chainId, address, config }) => {
|
|||||||
const currentGasPriceCost = currentTwapPrice(currentGasPrice._value).mul(ftsoPrice);
|
const currentGasPriceCost = currentTwapPrice(currentGasPrice._value).mul(ftsoPrice);
|
||||||
const actualGasPerUnitCost = actualGasPerUnit.mul(reservePrice);
|
const actualGasPerUnitCost = actualGasPerUnit.mul(reservePrice);
|
||||||
|
|
||||||
|
if (currentGasPriceCost.eq(zero)) return zero;
|
||||||
|
|
||||||
return currentGasPriceCost
|
return currentGasPriceCost
|
||||||
.sub(actualGasPerUnitCost)
|
.sub(actualGasPerUnitCost)
|
||||||
.mul(oneHundred.add(zero))
|
.mul(oneHundred.add(zero))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user