Skip to content

Commit 7cb13c8

Browse files
fix(contracts): allow decrement to zero and add missing increment argument (#512)
Co-authored-by: Clément Danjou <[email protected]>
1 parent 9f69c4a commit 7cb13c8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/examples/fhe-counter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ contract Counter {
3535
3636
/// @notice Decrements the counter by a specific value
3737
function decrement(uint32 value) external {
38-
require(_count > value, "Counter: cannot decrement below zero");
38+
require(_count >= value, "Counter: cannot decrement below zero");
3939
_count -= value;
4040
}
4141
}
@@ -95,7 +95,7 @@ describe("Counter", function () {
9595

9696
it("decrement the counter by 1", async function () {
9797
// First increment, count becomes 1
98-
let tx = await counterContract.connect(signers.alice).increment();
98+
let tx = await counterContract.connect(signers.alice).increment(1);
9999
await tx.wait();
100100
// Then decrement, count goes back to 0
101101
tx = await counterContract.connect(signers.alice).decrement(1);

0 commit comments

Comments
 (0)