Skip to content

Commit

Permalink
fix(): use SafeMath in Storage for key add
Browse files Browse the repository at this point in the history
  • Loading branch information
cckelly committed Jul 12, 2018
1 parent 83c04b4 commit 0cb75fc
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
4 changes: 2 additions & 2 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module.exports = {
kTreeFile: 'tree',
kSignaturesFile: 'signatures',
kStagingFile: './staged.json',
kStorageAddress: '0x4679b5245525c26bf0199021e84f5fa79fecc5bc',
kPriceAddress: '0x9fd09dd609430da75bbbaf301b5a8a15442caac6',
kStorageAddress: '0x82d50ad3c1091866e258fd0f1a7cc9674609d254',
kPriceAddress: '0xdda6327139485221633a1fcd65f4ac932e60a2e1',

kFileMappings: {
kContentTree: {
Expand Down
6 changes: 5 additions & 1 deletion contracts/Storage.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
pragma solidity ^0.4.24;

import 'openzeppelin-solidity/contracts/math/SafeMath.sol';

contract Storage {

using SafeMath for uint256;

address public owner;

// 0 - content/tree file
Expand Down Expand Up @@ -52,7 +56,7 @@ contract Storage {
if (largest_key == 0) {
return 0;
} else {
return largest_key + buffer_mappings[identity][file].buffers[largest_key].length;
return largest_key.add(buffer_mappings[identity][file].buffers[largest_key].length);
}
}

Expand Down
27 changes: 23 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"mirror-folder": "^3.0.0",
"mkdirp": "^0.5.1",
"multidrive": "^5.2.0",
"openzeppelin-solidity": "1.10.0",
"pify": "^3.0.0",
"pretty-bytes": "^4.0.2",
"progress": "^2.0.0",
Expand All @@ -72,5 +73,9 @@
"eslint": "^4.19.1",
"eslint-config-ara": "github:arablocks/eslint-config-ara",
"eslint-plugin-import": "^2.12.0"
},
"directories": {
"lib": "lib",
"test": "test"
}
}

0 comments on commit 0cb75fc

Please sign in to comment.