Skip to content

Commit

Permalink
Merge pull request #25 from nexusdev/hotfix
Browse files Browse the repository at this point in the history
safeToAdd fix
  • Loading branch information
nmushegian committed Mar 9, 2016
2 parents 67b7aa7 + b4549a3 commit 37913df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts/util/safety.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
contract DSSafeAddSub {
function safeToAdd(uint a, uint b) internal returns (bool) {
return (a + b > a);
return (a + b >= a);
}
function safeAdd(uint a, uint b) internal returns (uint) {
if (!safeToAdd(a, b)) throw;
Expand Down
10 changes: 10 additions & 0 deletions contracts/util/safety_test.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import 'dapple/test.sol';
import 'util/safety.sol';

contract SafeAddSubTest is Test, DSSafeAddSub {
function setUp() {
}
function testSafeToAddFix() {
assertTrue(safeToAdd(1, 0));
}
}
2 changes: 1 addition & 1 deletion dappfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dappsys
version: 0.1.0
version: 0.1.1
layout:
sol_sources: contracts
build_dir: build
Expand Down

0 comments on commit 37913df

Please sign in to comment.