Skip to content

Commit

Permalink
Merge pull request #61 from computablelabs/safemath
Browse files Browse the repository at this point in the history
Use SafeMath
  • Loading branch information
rbharath committed Jun 26, 2018
2 parents 8d10181 + e71fe51 commit 6eee4ba
Show file tree
Hide file tree
Showing 14 changed files with 25,195 additions and 22,333 deletions.
28 changes: 14 additions & 14 deletions build/contracts/AttributeStore.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@
"type": "function"
}
],
"bytecode": "0x6103bf610030600b82828239805160001a6073146000811461002057610022565bfe5b5030600052607381538281f3007300000000000000000000000000000000000000003014608060405260043610610063576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806350389f5c14610068578063977aa031146100f0575b600080fd5b6100da600480360381019080803590602001909291908035600019169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061017b565b6040518082815260200191505060405180910390f35b8180156100fc57600080fd5b50610179600480360381019080803590602001909291908035600019169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190505050610287565b005b600080838360405160200180836000191660001916815260200182805190602001908083835b6020831015156101c657805182526020820191506020810190506020830392506101a1565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083101515610230578051825260208201915060208101905060208303925061020b565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090508460000160008260001916600019168152602001908152602001600020549150509392505050565b6000838360405160200180836000191660001916815260200182805190602001908083835b6020831015156102d157805182526020820191506020810190506020830392506102ac565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b60208310151561033b5780518252602082019150602081019050602083039250610316565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090508185600001600083600019166000191681526020019081526020016000208190555050505050505600a165627a7a723058204122d2ae8a5f7124771b2c565fe950884c6a6c74ad1fca39d3dcb4f83dbe66b10029",
"deployedBytecode": "0x7300000000000000000000000000000000000000003014608060405260043610610063576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806350389f5c14610068578063977aa031146100f0575b600080fd5b6100da600480360381019080803590602001909291908035600019169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061017b565b6040518082815260200191505060405180910390f35b8180156100fc57600080fd5b50610179600480360381019080803590602001909291908035600019169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190505050610287565b005b600080838360405160200180836000191660001916815260200182805190602001908083835b6020831015156101c657805182526020820191506020810190506020830392506101a1565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083101515610230578051825260208201915060208101905060208303925061020b565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090508460000160008260001916600019168152602001908152602001600020549150509392505050565b6000838360405160200180836000191660001916815260200182805190602001908083835b6020831015156102d157805182526020820191506020810190506020830392506102ac565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b60208310151561033b5780518252602082019150602081019050602083039250610316565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090508185600001600083600019166000191681526020019081526020016000208190555050505050505600a165627a7a723058204122d2ae8a5f7124771b2c565fe950884c6a6c74ad1fca39d3dcb4f83dbe66b10029",
"bytecode": "0x6103bf610030600b82828239805160001a6073146000811461002057610022565bfe5b5030600052607381538281f3007300000000000000000000000000000000000000003014608060405260043610610063576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806350389f5c14610068578063977aa031146100f0575b600080fd5b6100da600480360381019080803590602001909291908035600019169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061017b565b6040518082815260200191505060405180910390f35b8180156100fc57600080fd5b50610179600480360381019080803590602001909291908035600019169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190505050610287565b005b600080838360405160200180836000191660001916815260200182805190602001908083835b6020831015156101c657805182526020820191506020810190506020830392506101a1565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083101515610230578051825260208201915060208101905060208303925061020b565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090508460000160008260001916600019168152602001908152602001600020549150509392505050565b6000838360405160200180836000191660001916815260200182805190602001908083835b6020831015156102d157805182526020820191506020810190506020830392506102ac565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b60208310151561033b5780518252602082019150602081019050602083039250610316565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090508185600001600083600019166000191681526020019081526020016000208190555050505050505600a165627a7a723058203765cf99eae34e1c2e0f4ee06ce5ba3e5c6126ea4a373539f4c7cc9816de21820029",
"deployedBytecode": "0x7300000000000000000000000000000000000000003014608060405260043610610063576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806350389f5c14610068578063977aa031146100f0575b600080fd5b6100da600480360381019080803590602001909291908035600019169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061017b565b6040518082815260200191505060405180910390f35b8180156100fc57600080fd5b50610179600480360381019080803590602001909291908035600019169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190505050610287565b005b600080838360405160200180836000191660001916815260200182805190602001908083835b6020831015156101c657805182526020820191506020810190506020830392506101a1565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083101515610230578051825260208201915060208101905060208303925061020b565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090508460000160008260001916600019168152602001908152602001600020549150509392505050565b6000838360405160200180836000191660001916815260200182805190602001908083835b6020831015156102d157805182526020820191506020810190506020830392506102ac565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b60208310151561033b5780518252602082019150602081019050602083039250610316565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090508185600001600083600019166000191681526020019081526020016000208190555050505050505600a165627a7a723058203765cf99eae34e1c2e0f4ee06ce5ba3e5c6126ea4a373539f4c7cc9816de21820029",
"sourceMap": "26:510:0:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24",
"deployedSourceMap": "26:510:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;110:203;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;317:217;;8:9:-1;5:2;;;30:1;27;20:12;5:2;317:217:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;110:203;207:4;221:11;262:5;269:9;245:34;;;;;;;;;;;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;245:34:0;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;245:34:0;;;235:45;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;235:45:0;;;;;;;;;;;;;;;;221:59;;293:4;:10;;:15;304:3;293:15;;;;;;;;;;;;;;;;;;286:22;;110:203;;;;;;:::o;317:217::-;438:11;479:5;486:9;462:34;;;;;;;;;;;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;462:34:0;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;462:34:0;;;452:45;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;452:45:0;;;;;;;;;;;;;;;;438:59;;521:8;503:4;:10;;:15;514:3;503:15;;;;;;;;;;;;;;;;;:26;;;;317:217;;;;;:::o",
"source": "pragma solidity 0.4.24;\n\n\nlibrary AttributeStore {\n struct Data {\n mapping(bytes32 => uint) store;\n }\n\n function getAttribute(Data storage self, bytes32 _UUID, string _attrName)\n public view returns (uint)\n {\n bytes32 key = keccak256(abi.encodePacked(_UUID, _attrName));\n return self.store[key];\n }\n\n function setAttribute(\n Data storage self,\n bytes32 _UUID,\n string _attrName,\n uint _attrVal) public\n {\n bytes32 key = keccak256(abi.encodePacked(_UUID, _attrName));\n self.store[key] = _attrVal;\n }\n}\n",
"sourcePath": "/home/rob/Github/computable/contracts/AttributeStore.sol",
"sourcePath": "/home/bharath/computable/contracts/AttributeStore.sol",
"ast": {
"absolutePath": "/home/rob/Github/computable/contracts/AttributeStore.sol",
"absolutePath": "/home/bharath/computable/contracts/AttributeStore.sol",
"exportedSymbols": {
"AttributeStore": [
64
Expand Down Expand Up @@ -239,7 +239,7 @@
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3689,
"referencedDeclaration": 4140,
"src": "245:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
Expand Down Expand Up @@ -286,7 +286,7 @@
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3696,
"referencedDeclaration": 4147,
"src": "235:9:0",
"typeDescriptions": {
"typeIdentifier": "t_function_sha3_pure$__$returns$_t_bytes32_$",
Expand Down Expand Up @@ -598,7 +598,7 @@
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3689,
"referencedDeclaration": 4140,
"src": "462:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
Expand Down Expand Up @@ -645,7 +645,7 @@
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3696,
"referencedDeclaration": 4147,
"src": "452:9:0",
"typeDescriptions": {
"typeIdentifier": "t_function_sha3_pure$__$returns$_t_bytes32_$",
Expand Down Expand Up @@ -902,7 +902,7 @@
"src": "0:537:0"
},
"legacyAST": {
"absolutePath": "/home/rob/Github/computable/contracts/AttributeStore.sol",
"absolutePath": "/home/bharath/computable/contracts/AttributeStore.sol",
"exportedSymbols": {
"AttributeStore": [
64
Expand Down Expand Up @@ -1079,7 +1079,7 @@
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3689,
"referencedDeclaration": 4140,
"src": "245:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
Expand Down Expand Up @@ -1126,7 +1126,7 @@
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3696,
"referencedDeclaration": 4147,
"src": "235:9:0",
"typeDescriptions": {
"typeIdentifier": "t_function_sha3_pure$__$returns$_t_bytes32_$",
Expand Down Expand Up @@ -1438,7 +1438,7 @@
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3689,
"referencedDeclaration": 4140,
"src": "462:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
Expand Down Expand Up @@ -1485,7 +1485,7 @@
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3696,
"referencedDeclaration": 4147,
"src": "452:9:0",
"typeDescriptions": {
"typeIdentifier": "t_function_sha3_pure$__$returns$_t_bytes32_$",
Expand Down Expand Up @@ -1747,5 +1747,5 @@
},
"networks": {},
"schemaVersion": "2.0.1",
"updatedAt": "2018-06-21T22:48:42.346Z"
"updatedAt": "2018-06-26T02:58:22.314Z"
}
Loading

0 comments on commit 6eee4ba

Please sign in to comment.