Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Addresses.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.0;
pragma solidity >=0.4.25 <0.6.0;

/**
* Addresses Library
Expand All @@ -17,7 +17,7 @@ library Addresses {
* @param _base The address on the network to check if it is a contract
* @return bool Returns true if it is a valid contract
*/
function isContract(address _base) returns (bool _r) {
function isContract(address _base) public returns (bool _r) {
assembly {
_r := gt(extcodesize(_base), 0)
}
Expand Down
14 changes: 7 additions & 7 deletions lib/Integers.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.0;
pragma solidity >=0.4.25 <0.6.0;

/**
* Integers Library
Expand All @@ -18,14 +18,14 @@ library Integers {
* @param _value The ASCII string to be converted to an unsigned integer
* @return uint The unsigned value of the ASCII string
*/
function parseInt(string _value)
function parseInt(string memory _value)
public
returns (uint _ret) {
bytes memory _bytesValue = bytes(_value);
uint j = 1;
for(uint i = _bytesValue.length-1; i >= 0 && i < _bytesValue.length; i--) {
assert(_bytesValue[i] >= 48 && _bytesValue[i] <= 57);
_ret += (uint(_bytesValue[i]) - 48)*j;
assert(uint8(_bytesValue[i]) >= 48 && uint8(_bytesValue[i]) <= 57);
_ret += (uint(uint8(_bytesValue[i])) - 48)*j;
j*=10;
}
}
Expand All @@ -40,11 +40,11 @@ library Integers {
*/
function toString(uint _base)
internal
returns (string) {
returns (string memory) {
bytes memory _tmp = new bytes(32);
uint i;
for(i = 0;_base > 0;i++) {
_tmp[i] = byte((_base % 10) + 48);
_tmp[i] = byte(uint8((_base % 10) + 48));
_base /= 10;
}
bytes memory _real = new bytes(i--);
Expand Down Expand Up @@ -82,7 +82,7 @@ library Integers {
*/
function toBytes(uint _base)
internal
returns (bytes _ret) {
returns (bytes memory _ret) {
assembly {
let m_alloc := add(msize(),0x1)
_ret := mload(m_alloc)
Expand Down
41 changes: 23 additions & 18 deletions lib/Strings.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.0;
pragma solidity >=0.4.25 <0.6.0;

/**
* Strings Library
Expand All @@ -24,10 +24,10 @@ library Strings {
* @param _value The value to be the concatenated suffix
* @return string The resulting string from combinging the base and value
*/
function concat(string _base, string _value)
function concat(string memory _base, string memory _value)
internal
pure
returns (string) {
returns (string memory) {
bytes memory _baseBytes = bytes(_base);
bytes memory _valueBytes = bytes(_value);

Expand Down Expand Up @@ -64,7 +64,7 @@ library Strings {
* @return int The position of the needle starting from 0 and returning -1
* in the case of no matches found
*/
function indexOf(string _base, string _value)
function indexOf(string memory _base, string memory _value)
internal
pure
returns (int) {
Expand All @@ -87,7 +87,7 @@ library Strings {
* @return int The position of the needle starting from 0 and returning -1
* in the case of no matches found
*/
function _indexOf(string _base, string _value, uint _offset)
function _indexOf(string memory _base, string memory _value, uint _offset)
internal
pure
returns (int) {
Expand All @@ -114,7 +114,7 @@ library Strings {
* otherwise this is the string to be measured
* @return uint The length of the passed string
*/
function length(string _base)
function length(string memory _base)
internal
pure
returns (uint) {
Expand All @@ -133,10 +133,10 @@ library Strings {
* @param _length The length of the sub string to be extracted from the base
* @return string The extracted sub string
*/
function substring(string _base, int _length)
function substring(string memory _base, int _length)
internal
pure
returns (string) {
returns (string memory) {
return _substring(_base, _length, 0);
}

Expand All @@ -153,10 +153,10 @@ library Strings {
* @param _offset The starting point to extract the sub string from
* @return string The extracted sub string
*/
function _substring(string _base, int _length, int _offset)
function _substring(string memory _base, int _length, int _offset)
internal
pure
returns (string) {
returns (string memory) {
bytes memory _baseBytes = bytes(_base);

assert(uint(_offset+_length) <= _baseBytes.length);
Expand Down Expand Up @@ -186,9 +186,14 @@ library Strings {
* @return string[] An array of values split based off the delimiter, but
* do not container the delimiter.
*/
function split(string _base, string _value)
function split(string memory _base, string memory _value, string[] storage splitArr)
internal
returns (string[] storage splitArr) {
returns (string[] storage) {

while (splitArr.length > 0) {
splitArr.pop();
}

bytes memory _baseBytes = bytes(_base);
uint _offset = 0;

Expand Down Expand Up @@ -223,7 +228,7 @@ library Strings {
* @param _value The string the base is being compared to
* @return bool Simply notates if the two string have an equivalent
*/
function compareTo(string _base, string _value)
function compareTo(string memory _base, string memory _value)
internal
pure
returns (bool) {
Expand Down Expand Up @@ -256,7 +261,7 @@ library Strings {
* @return bool Simply notates if the two string have an equivalent value
* discarding case
*/
function compareToIgnoreCase(string _base, string _value)
function compareToIgnoreCase(string memory _base, string memory _value)
internal
pure
returns (bool) {
Expand Down Expand Up @@ -287,10 +292,10 @@ library Strings {
* otherwise this is the string base to convert to upper case
* @return string
*/
function upper(string _base)
function upper(string memory _base)
internal
pure
returns (string) {
returns (string memory) {
bytes memory _baseBytes = bytes(_base);
for (uint i = 0; i < _baseBytes.length; i++) {
_baseBytes[i] = _upper(_baseBytes[i]);
Expand All @@ -308,10 +313,10 @@ library Strings {
* otherwise this is the string base to convert to lower case
* @return string
*/
function lower(string _base)
function lower(string memory _base)
internal
pure
returns (string) {
returns (string memory) {
bytes memory _baseBytes = bytes(_base);
for (uint i = 0; i < _baseBytes.length; i++) {
_baseBytes[i] = _lower(_baseBytes[i]);
Expand Down