diff --git a/packages/protocol/contracts-0.8/stability/FeeCurrencyAdapter.sol b/packages/protocol/contracts-0.8/stability/FeeCurrencyAdapter.sol index 4238e6670f9..ace1dc45490 100644 --- a/packages/protocol/contracts-0.8/stability/FeeCurrencyAdapter.sol +++ b/packages/protocol/contracts-0.8/stability/FeeCurrencyAdapter.sol @@ -65,6 +65,7 @@ contract FeeCurrencyAdapter is Initializable, CalledByVm, IFeeCurrencyAdapter { */ function debitGasFees(address from, uint256 value) external onlyVm { uint256 valueScaled = downscale(value); + require(valueScaled > 0, "Scaled debit value must be > 0."); debited = valueScaled; adaptedToken.debitGasFees(from, valueScaled); } diff --git a/packages/protocol/test-sol/stability/FeeCurrencyAdapter.t.sol b/packages/protocol/test-sol/stability/FeeCurrencyAdapter.t.sol index e5131b1edc5..87991fb133e 100644 --- a/packages/protocol/test-sol/stability/FeeCurrencyAdapter.t.sol +++ b/packages/protocol/test-sol/stability/FeeCurrencyAdapter.t.sol @@ -180,6 +180,12 @@ contract FeeCurrencyAdapter_DebitGasFees is FeeCurrencyAdapterTest { feeCurrencyAdapter.debitGasFees(address(this), 1000); } + function test_ShouldRevert_WhenScaledDebitValueIs0() public { + vm.expectRevert("Scaled debit value must be > 0."); + vm.prank(address(0)); + feeCurrencyAdapter.debitGasFees(address(this), 1e7); + } + function test_ShouldDebitCorrectAmount_WhenExpectedDigitsOnlyOneBigger() public { debitFuzzyHelper(7, 1e1); }