Skip to content

Commit c23a021

Browse files
committed
div zero fix
1 parent 450274c commit c23a021

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shared/post-processors/exchange-rates/price-routing-mainnet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export const translateMainnetSymbol = (symbol: MainnetCurrency): MainnetCurrency
148148
return symbol
149149
}
150150

151-
export const invertRate = (rate: bigint, decimals = 18) => 10n ** BigInt(2 * decimals) / rate
151+
export const invertRate = (rate: bigint, decimals = 18) => (rate > 0n ? 10n ** BigInt(2 * decimals) / rate : 0n)
152152
export const twoWay = <Base extends CurrencySymbol, Quote extends CurrencySymbol>(
153153
base: Base,
154154
quote: Quote,

0 commit comments

Comments
 (0)