From 6bd5755f51d2b316086d6111fa2f3e141c1bd157 Mon Sep 17 00:00:00 2001 From: Brandon Iles Date: Mon, 2 Mar 2026 15:28:51 -0800 Subject: [PATCH] Avoid div by 0 in compute DR --- spot-contracts/contracts/FeePolicy.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spot-contracts/contracts/FeePolicy.sol b/spot-contracts/contracts/FeePolicy.sol index 3bb76149..66485201 100644 --- a/spot-contracts/contracts/FeePolicy.sol +++ b/spot-contracts/contracts/FeePolicy.sol @@ -314,6 +314,7 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { /// @inheritdoc IFeePolicy function computeDeviationRatio(SystemTVL memory s) public view override returns (uint256) { // NOTE: We assume that perp's TVL and vault's TVL values have the same base denomination. - return s.vaultTVL.mulDiv(ONE, s.perpTVL).mulDiv(ONE, targetSystemRatio); + uint256 perpTVL = (s.perpTVL > 0) ? s.perpTVL : 0x1; + return s.vaultTVL.mulDiv(ONE, perpTVL).mulDiv(ONE, targetSystemRatio); } }