Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Created May 20, 2020 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulRBerg/d39a2479e45e61f1afc15e229a86bb07 to your computer and use it in GitHub Desktop.
Save PaulRBerg/d39a2479e45e61f1afc15e229a86bb07 to your computer and use it in GitHub Desktop.
Dummy smart contract used for reproducing a Buidler bug
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.6.8;
contract Counter {
uint256 public count = 0;
event CountedTo(uint256 number);
function countUp() public returns (uint256) {
uint256 newCount = count + 1;
require(newCount > count, "Uint256 overflow");
count = newCount;
emit CountedTo(count);
return count;
}
function countDown() public returns (uint256) {
uint256 newCount = count - 1;
require(newCount < count, "Uint256 underflow");
count = newCount;
emit CountedTo(count);
return count;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment