Created
April 24, 2019 14:36
-
-
Save Eyongkevin/05c3f884bd22948628de80da5282812e to your computer and use it in GitHub Desktop.
This is a solidity library with two functions and a struct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
library count{ | |
struct hold{ | |
uint a; | |
} | |
function subUint(hold storage s, uint b) public returns(uint){ | |
require(s.a >= b); // Make sure it doesn't return a negative value. | |
return s.a - b; | |
} | |
function addUint(uint a , uint b) public pure returns(uint){ | |
uint c = a + b; | |
require(c >= a); // Makre sure the right computation was made | |
return c; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment