├── README.md ├── build └── contracts │ ├── Crowdsale.json │ ├── Hello_mshk_top.json │ ├── IMyAdvancedToken.json │ ├── IOwned.json │ ├── ISmartToken.json │ ├── IToken.json │ ├── Migrations.json │ ├── MyAdvancedToken.json │ ├── Owned.json │ ├── SmartToken.json │ ├── Token.json │ └── Utils.json ├── contracts ├── Crowdsale.sol ├── MyAdvancedToken.sol ├── Owned.sol ├── SmartToken.sol ├── Token.sol ├── Utils.sol ├── helpers │ ├── Hello_mshk_top.sol │ └── Migrations.sol └── interfaces │ ├── IMyAdvancedToken.sol │ ├── IOwned.sol │ ├── ISmartToken.sol │ └── IToken.sol ├── migrations ├── 1_initial_migration.js └── 2_deploy_contracts.js └── truffle.js /README.md: -------------------------------------------------------------------------------- 1 | 2 | # 目录 3 | [toc] 4 | 5 | 智能合约的实例,里面包括简单的代币合约、高级代币合约、众筹合约。 6 | 7 | 如何使用代码的文章教程:[Truffle 4.0、Geth 1.7.2、TestRPC在私有链上搭建智能合约](https://mshk.top/2017/11/truffle-4-0-geth-1-7-2-testrpc/) 8 | -------------------------------------------------------------------------------- /build/contracts/Hello_mshk_top.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Hello_mshk_top", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [ 7 | { 8 | "name": "name", 9 | "type": "string" 10 | } 11 | ], 12 | "name": "print", 13 | "outputs": [ 14 | { 15 | "name": "", 16 | "type": "string" 17 | } 18 | ], 19 | "payable": false, 20 | "stateMutability": "pure", 21 | "type": "function" 22 | }, 23 | { 24 | "constant": true, 25 | "inputs": [], 26 | "name": "say", 27 | "outputs": [ 28 | { 29 | "name": "", 30 | "type": "string" 31 | } 32 | ], 33 | "payable": false, 34 | "stateMutability": "pure", 35 | "type": "function" 36 | } 37 | ], 38 | "bytecode": "0x6060604052341561000f57600080fd5b6102488061001e6000396000f30060606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806311114af114610051578063954ab4b214610127575b600080fd5b341561005c57600080fd5b6100ac600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506101b5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100ec5780820151818401526020810190506100d1565b50505050905090810190601f1680156101195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013257600080fd5b61013a6101c5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017a57808201518184015260208101905061015f565b50505050905090810190601f1680156101a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101bd610208565b819050919050565b6101cd610208565b6040805190810160405280600e81526020017f48656c6c6f206d73686b2e746f70000000000000000000000000000000000000815250905090565b6020604051908101604052806000815250905600a165627a7a723058209c99aa92d9e5789e23c0b22e612618a4bd16d6cf59b835a5cbcb2975b39630820029", 39 | "deployedBytecode": "0x60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806311114af114610051578063954ab4b214610127575b600080fd5b341561005c57600080fd5b6100ac600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506101b5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100ec5780820151818401526020810190506100d1565b50505050905090810190601f1680156101195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013257600080fd5b61013a6101c5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017a57808201518184015260208101905061015f565b50505050905090810190601f1680156101a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101bd610208565b819050919050565b6101cd610208565b6040805190810160405280600e81526020017f48656c6c6f206d73686b2e746f70000000000000000000000000000000000000815250905090565b6020604051908101604052806000815250905600a165627a7a723058209c99aa92d9e5789e23c0b22e612618a4bd16d6cf59b835a5cbcb2975b39630820029", 40 | "sourceMap": "26:191:6:-;;;;;;;;;;;;;;;;;", 41 | "deployedSourceMap": "26:191:6:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;136:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54:78:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;136:79:6;185:6;;:::i;:::-;206:4;199:11;;136:79;;;:::o;54:78::-;90:6;;:::i;:::-;104:23;;;;;;;;;;;;;;;;;;;;54:78;:::o;26:191::-;;;;;;;;;;;;;;;:::o", 42 | "source": "pragma solidity ^0.4.17;\n\ncontract Hello_mshk_top {\n function say() public pure returns (string) {\n return \"Hello mshk.top\";\n }\n\n function print(string name) public pure returns (string) {\n return name;\n }\n}\n", 43 | "sourcePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/helpers/Hello_mshk_top.sol", 44 | "ast": { 45 | "attributes": { 46 | "absolutePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/helpers/Hello_mshk_top.sol", 47 | "exportedSymbols": { 48 | "Hello_mshk_top": [ 49 | 1071 50 | ] 51 | } 52 | }, 53 | "children": [ 54 | { 55 | "attributes": { 56 | "literals": [ 57 | "solidity", 58 | "^", 59 | "0.4", 60 | ".17" 61 | ] 62 | }, 63 | "id": 1052, 64 | "name": "PragmaDirective", 65 | "src": "0:24:6" 66 | }, 67 | { 68 | "attributes": { 69 | "baseContracts": [ 70 | null 71 | ], 72 | "contractDependencies": [ 73 | null 74 | ], 75 | "contractKind": "contract", 76 | "documentation": null, 77 | "fullyImplemented": true, 78 | "linearizedBaseContracts": [ 79 | 1071 80 | ], 81 | "name": "Hello_mshk_top", 82 | "scope": 1072 83 | }, 84 | "children": [ 85 | { 86 | "attributes": { 87 | "constant": true, 88 | "implemented": true, 89 | "isConstructor": false, 90 | "modifiers": [ 91 | null 92 | ], 93 | "name": "say", 94 | "payable": false, 95 | "scope": 1071, 96 | "stateMutability": "pure", 97 | "superFunction": null, 98 | "visibility": "public" 99 | }, 100 | "children": [ 101 | { 102 | "attributes": { 103 | "parameters": [ 104 | null 105 | ] 106 | }, 107 | "children": [], 108 | "id": 1053, 109 | "name": "ParameterList", 110 | "src": "66:2:6" 111 | }, 112 | { 113 | "children": [ 114 | { 115 | "attributes": { 116 | "constant": false, 117 | "name": "", 118 | "scope": 1060, 119 | "stateVariable": false, 120 | "storageLocation": "default", 121 | "type": "string memory", 122 | "value": null, 123 | "visibility": "internal" 124 | }, 125 | "children": [ 126 | { 127 | "attributes": { 128 | "name": "string", 129 | "type": "string storage pointer" 130 | }, 131 | "id": 1054, 132 | "name": "ElementaryTypeName", 133 | "src": "90:6:6" 134 | } 135 | ], 136 | "id": 1055, 137 | "name": "VariableDeclaration", 138 | "src": "90:6:6" 139 | } 140 | ], 141 | "id": 1056, 142 | "name": "ParameterList", 143 | "src": "89:8:6" 144 | }, 145 | { 146 | "children": [ 147 | { 148 | "attributes": { 149 | "functionReturnParameters": 1056 150 | }, 151 | "children": [ 152 | { 153 | "attributes": { 154 | "argumentTypes": null, 155 | "hexvalue": "48656c6c6f206d73686b2e746f70", 156 | "isConstant": false, 157 | "isLValue": false, 158 | "isPure": true, 159 | "lValueRequested": false, 160 | "subdenomination": null, 161 | "token": "string", 162 | "type": "literal_string \"Hello mshk.top\"", 163 | "value": "Hello mshk.top" 164 | }, 165 | "id": 1057, 166 | "name": "Literal", 167 | "src": "111:16:6" 168 | } 169 | ], 170 | "id": 1058, 171 | "name": "Return", 172 | "src": "104:23:6" 173 | } 174 | ], 175 | "id": 1059, 176 | "name": "Block", 177 | "src": "98:34:6" 178 | } 179 | ], 180 | "id": 1060, 181 | "name": "FunctionDefinition", 182 | "src": "54:78:6" 183 | }, 184 | { 185 | "attributes": { 186 | "constant": true, 187 | "implemented": true, 188 | "isConstructor": false, 189 | "modifiers": [ 190 | null 191 | ], 192 | "name": "print", 193 | "payable": false, 194 | "scope": 1071, 195 | "stateMutability": "pure", 196 | "superFunction": null, 197 | "visibility": "public" 198 | }, 199 | "children": [ 200 | { 201 | "children": [ 202 | { 203 | "attributes": { 204 | "constant": false, 205 | "name": "name", 206 | "scope": 1070, 207 | "stateVariable": false, 208 | "storageLocation": "default", 209 | "type": "string memory", 210 | "value": null, 211 | "visibility": "internal" 212 | }, 213 | "children": [ 214 | { 215 | "attributes": { 216 | "name": "string", 217 | "type": "string storage pointer" 218 | }, 219 | "id": 1061, 220 | "name": "ElementaryTypeName", 221 | "src": "151:6:6" 222 | } 223 | ], 224 | "id": 1062, 225 | "name": "VariableDeclaration", 226 | "src": "151:11:6" 227 | } 228 | ], 229 | "id": 1063, 230 | "name": "ParameterList", 231 | "src": "150:13:6" 232 | }, 233 | { 234 | "children": [ 235 | { 236 | "attributes": { 237 | "constant": false, 238 | "name": "", 239 | "scope": 1070, 240 | "stateVariable": false, 241 | "storageLocation": "default", 242 | "type": "string memory", 243 | "value": null, 244 | "visibility": "internal" 245 | }, 246 | "children": [ 247 | { 248 | "attributes": { 249 | "name": "string", 250 | "type": "string storage pointer" 251 | }, 252 | "id": 1064, 253 | "name": "ElementaryTypeName", 254 | "src": "185:6:6" 255 | } 256 | ], 257 | "id": 1065, 258 | "name": "VariableDeclaration", 259 | "src": "185:6:6" 260 | } 261 | ], 262 | "id": 1066, 263 | "name": "ParameterList", 264 | "src": "184:8:6" 265 | }, 266 | { 267 | "children": [ 268 | { 269 | "attributes": { 270 | "functionReturnParameters": 1066 271 | }, 272 | "children": [ 273 | { 274 | "attributes": { 275 | "argumentTypes": null, 276 | "overloadedDeclarations": [ 277 | null 278 | ], 279 | "referencedDeclaration": 1062, 280 | "type": "string memory", 281 | "value": "name" 282 | }, 283 | "id": 1067, 284 | "name": "Identifier", 285 | "src": "206:4:6" 286 | } 287 | ], 288 | "id": 1068, 289 | "name": "Return", 290 | "src": "199:11:6" 291 | } 292 | ], 293 | "id": 1069, 294 | "name": "Block", 295 | "src": "193:22:6" 296 | } 297 | ], 298 | "id": 1070, 299 | "name": "FunctionDefinition", 300 | "src": "136:79:6" 301 | } 302 | ], 303 | "id": 1071, 304 | "name": "ContractDefinition", 305 | "src": "26:191:6" 306 | } 307 | ], 308 | "id": 1072, 309 | "name": "SourceUnit", 310 | "src": "0:218:6" 311 | }, 312 | "compiler": { 313 | "name": "solc", 314 | "version": "0.4.18+commit.9cf6e910.Emscripten.clang" 315 | }, 316 | "networks": { 317 | "1509885692861": { 318 | "events": {}, 319 | "links": {}, 320 | "address": "0x0db0e65659e067fe08b1546aaa2200157fcdd9ad" 321 | } 322 | }, 323 | "schemaVersion": "1.0.1", 324 | "updatedAt": "2017-11-05T13:45:28.092Z" 325 | } -------------------------------------------------------------------------------- /build/contracts/IMyAdvancedToken.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "IMyAdvancedToken", 3 | "abi": [ 4 | { 5 | "constant": false, 6 | "inputs": [ 7 | { 8 | "name": "newSellPrice", 9 | "type": "uint256" 10 | }, 11 | { 12 | "name": "newBuyPrice", 13 | "type": "uint256" 14 | } 15 | ], 16 | "name": "setPrices", 17 | "outputs": [], 18 | "payable": false, 19 | "stateMutability": "nonpayable", 20 | "type": "function" 21 | }, 22 | { 23 | "constant": false, 24 | "inputs": [ 25 | { 26 | "name": "target", 27 | "type": "address" 28 | }, 29 | { 30 | "name": "mintedAmount", 31 | "type": "uint256" 32 | } 33 | ], 34 | "name": "mintToken", 35 | "outputs": [], 36 | "payable": false, 37 | "stateMutability": "nonpayable", 38 | "type": "function" 39 | }, 40 | { 41 | "constant": false, 42 | "inputs": [], 43 | "name": "buy", 44 | "outputs": [], 45 | "payable": true, 46 | "stateMutability": "payable", 47 | "type": "function" 48 | }, 49 | { 50 | "constant": false, 51 | "inputs": [ 52 | { 53 | "name": "amount", 54 | "type": "uint256" 55 | } 56 | ], 57 | "name": "sell", 58 | "outputs": [], 59 | "payable": false, 60 | "stateMutability": "nonpayable", 61 | "type": "function" 62 | }, 63 | { 64 | "constant": false, 65 | "inputs": [ 66 | { 67 | "name": "target", 68 | "type": "address" 69 | }, 70 | { 71 | "name": "freeze", 72 | "type": "bool" 73 | } 74 | ], 75 | "name": "freezeAccount", 76 | "outputs": [], 77 | "payable": false, 78 | "stateMutability": "nonpayable", 79 | "type": "function" 80 | } 81 | ], 82 | "bytecode": "0x", 83 | "deployedBytecode": "0x", 84 | "sourceMap": "", 85 | "deployedSourceMap": "", 86 | "source": "pragma solidity ^0.4.17;\n\n/*\n Standard IMyAdvancedToken interface\n*/\ncontract IMyAdvancedToken {\n\n function _transfer(address _from, address _to, uint256 _value) internal;\n function mintToken(address target, uint256 mintedAmount) public;\n function freezeAccount(address target, bool freeze) public;\n function setPrices(uint256 newSellPrice, uint256 newBuyPrice) public;\n function buy() payable public;\n function sell(uint256 amount) public;\n}\n", 87 | "sourcePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/interfaces/IMyAdvancedToken.sol", 88 | "ast": { 89 | "attributes": { 90 | "absolutePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/interfaces/IMyAdvancedToken.sol", 91 | "exportedSymbols": { 92 | "IMyAdvancedToken": [ 93 | 1169 94 | ] 95 | } 96 | }, 97 | "children": [ 98 | { 99 | "attributes": { 100 | "literals": [ 101 | "solidity", 102 | "^", 103 | "0.4", 104 | ".17" 105 | ] 106 | }, 107 | "id": 1130, 108 | "name": "PragmaDirective", 109 | "src": "0:24:8" 110 | }, 111 | { 112 | "attributes": { 113 | "baseContracts": [ 114 | null 115 | ], 116 | "contractDependencies": [ 117 | null 118 | ], 119 | "contractKind": "contract", 120 | "documentation": null, 121 | "fullyImplemented": false, 122 | "linearizedBaseContracts": [ 123 | 1169 124 | ], 125 | "name": "IMyAdvancedToken", 126 | "scope": 1170 127 | }, 128 | "children": [ 129 | { 130 | "attributes": { 131 | "body": null, 132 | "constant": false, 133 | "implemented": false, 134 | "isConstructor": false, 135 | "modifiers": [ 136 | null 137 | ], 138 | "name": "_transfer", 139 | "payable": false, 140 | "scope": 1169, 141 | "stateMutability": "nonpayable", 142 | "superFunction": null, 143 | "visibility": "internal" 144 | }, 145 | "children": [ 146 | { 147 | "children": [ 148 | { 149 | "attributes": { 150 | "constant": false, 151 | "name": "_from", 152 | "scope": 1139, 153 | "stateVariable": false, 154 | "storageLocation": "default", 155 | "type": "address", 156 | "value": null, 157 | "visibility": "internal" 158 | }, 159 | "children": [ 160 | { 161 | "attributes": { 162 | "name": "address", 163 | "type": "address" 164 | }, 165 | "id": 1131, 166 | "name": "ElementaryTypeName", 167 | "src": "124:7:8" 168 | } 169 | ], 170 | "id": 1132, 171 | "name": "VariableDeclaration", 172 | "src": "124:13:8" 173 | }, 174 | { 175 | "attributes": { 176 | "constant": false, 177 | "name": "_to", 178 | "scope": 1139, 179 | "stateVariable": false, 180 | "storageLocation": "default", 181 | "type": "address", 182 | "value": null, 183 | "visibility": "internal" 184 | }, 185 | "children": [ 186 | { 187 | "attributes": { 188 | "name": "address", 189 | "type": "address" 190 | }, 191 | "id": 1133, 192 | "name": "ElementaryTypeName", 193 | "src": "139:7:8" 194 | } 195 | ], 196 | "id": 1134, 197 | "name": "VariableDeclaration", 198 | "src": "139:11:8" 199 | }, 200 | { 201 | "attributes": { 202 | "constant": false, 203 | "name": "_value", 204 | "scope": 1139, 205 | "stateVariable": false, 206 | "storageLocation": "default", 207 | "type": "uint256", 208 | "value": null, 209 | "visibility": "internal" 210 | }, 211 | "children": [ 212 | { 213 | "attributes": { 214 | "name": "uint256", 215 | "type": "uint256" 216 | }, 217 | "id": 1135, 218 | "name": "ElementaryTypeName", 219 | "src": "152:7:8" 220 | } 221 | ], 222 | "id": 1136, 223 | "name": "VariableDeclaration", 224 | "src": "152:14:8" 225 | } 226 | ], 227 | "id": 1137, 228 | "name": "ParameterList", 229 | "src": "123:44:8" 230 | }, 231 | { 232 | "attributes": { 233 | "parameters": [ 234 | null 235 | ] 236 | }, 237 | "children": [], 238 | "id": 1138, 239 | "name": "ParameterList", 240 | "src": "176:0:8" 241 | } 242 | ], 243 | "id": 1139, 244 | "name": "FunctionDefinition", 245 | "src": "105:72:8" 246 | }, 247 | { 248 | "attributes": { 249 | "body": null, 250 | "constant": false, 251 | "implemented": false, 252 | "isConstructor": false, 253 | "modifiers": [ 254 | null 255 | ], 256 | "name": "mintToken", 257 | "payable": false, 258 | "scope": 1169, 259 | "stateMutability": "nonpayable", 260 | "superFunction": null, 261 | "visibility": "public" 262 | }, 263 | "children": [ 264 | { 265 | "children": [ 266 | { 267 | "attributes": { 268 | "constant": false, 269 | "name": "target", 270 | "scope": 1146, 271 | "stateVariable": false, 272 | "storageLocation": "default", 273 | "type": "address", 274 | "value": null, 275 | "visibility": "internal" 276 | }, 277 | "children": [ 278 | { 279 | "attributes": { 280 | "name": "address", 281 | "type": "address" 282 | }, 283 | "id": 1140, 284 | "name": "ElementaryTypeName", 285 | "src": "201:7:8" 286 | } 287 | ], 288 | "id": 1141, 289 | "name": "VariableDeclaration", 290 | "src": "201:14:8" 291 | }, 292 | { 293 | "attributes": { 294 | "constant": false, 295 | "name": "mintedAmount", 296 | "scope": 1146, 297 | "stateVariable": false, 298 | "storageLocation": "default", 299 | "type": "uint256", 300 | "value": null, 301 | "visibility": "internal" 302 | }, 303 | "children": [ 304 | { 305 | "attributes": { 306 | "name": "uint256", 307 | "type": "uint256" 308 | }, 309 | "id": 1142, 310 | "name": "ElementaryTypeName", 311 | "src": "217:7:8" 312 | } 313 | ], 314 | "id": 1143, 315 | "name": "VariableDeclaration", 316 | "src": "217:20:8" 317 | } 318 | ], 319 | "id": 1144, 320 | "name": "ParameterList", 321 | "src": "200:38:8" 322 | }, 323 | { 324 | "attributes": { 325 | "parameters": [ 326 | null 327 | ] 328 | }, 329 | "children": [], 330 | "id": 1145, 331 | "name": "ParameterList", 332 | "src": "245:0:8" 333 | } 334 | ], 335 | "id": 1146, 336 | "name": "FunctionDefinition", 337 | "src": "182:64:8" 338 | }, 339 | { 340 | "attributes": { 341 | "body": null, 342 | "constant": false, 343 | "implemented": false, 344 | "isConstructor": false, 345 | "modifiers": [ 346 | null 347 | ], 348 | "name": "freezeAccount", 349 | "payable": false, 350 | "scope": 1169, 351 | "stateMutability": "nonpayable", 352 | "superFunction": null, 353 | "visibility": "public" 354 | }, 355 | "children": [ 356 | { 357 | "children": [ 358 | { 359 | "attributes": { 360 | "constant": false, 361 | "name": "target", 362 | "scope": 1153, 363 | "stateVariable": false, 364 | "storageLocation": "default", 365 | "type": "address", 366 | "value": null, 367 | "visibility": "internal" 368 | }, 369 | "children": [ 370 | { 371 | "attributes": { 372 | "name": "address", 373 | "type": "address" 374 | }, 375 | "id": 1147, 376 | "name": "ElementaryTypeName", 377 | "src": "274:7:8" 378 | } 379 | ], 380 | "id": 1148, 381 | "name": "VariableDeclaration", 382 | "src": "274:14:8" 383 | }, 384 | { 385 | "attributes": { 386 | "constant": false, 387 | "name": "freeze", 388 | "scope": 1153, 389 | "stateVariable": false, 390 | "storageLocation": "default", 391 | "type": "bool", 392 | "value": null, 393 | "visibility": "internal" 394 | }, 395 | "children": [ 396 | { 397 | "attributes": { 398 | "name": "bool", 399 | "type": "bool" 400 | }, 401 | "id": 1149, 402 | "name": "ElementaryTypeName", 403 | "src": "290:4:8" 404 | } 405 | ], 406 | "id": 1150, 407 | "name": "VariableDeclaration", 408 | "src": "290:11:8" 409 | } 410 | ], 411 | "id": 1151, 412 | "name": "ParameterList", 413 | "src": "273:29:8" 414 | }, 415 | { 416 | "attributes": { 417 | "parameters": [ 418 | null 419 | ] 420 | }, 421 | "children": [], 422 | "id": 1152, 423 | "name": "ParameterList", 424 | "src": "309:0:8" 425 | } 426 | ], 427 | "id": 1153, 428 | "name": "FunctionDefinition", 429 | "src": "251:59:8" 430 | }, 431 | { 432 | "attributes": { 433 | "body": null, 434 | "constant": false, 435 | "implemented": false, 436 | "isConstructor": false, 437 | "modifiers": [ 438 | null 439 | ], 440 | "name": "setPrices", 441 | "payable": false, 442 | "scope": 1169, 443 | "stateMutability": "nonpayable", 444 | "superFunction": null, 445 | "visibility": "public" 446 | }, 447 | "children": [ 448 | { 449 | "children": [ 450 | { 451 | "attributes": { 452 | "constant": false, 453 | "name": "newSellPrice", 454 | "scope": 1160, 455 | "stateVariable": false, 456 | "storageLocation": "default", 457 | "type": "uint256", 458 | "value": null, 459 | "visibility": "internal" 460 | }, 461 | "children": [ 462 | { 463 | "attributes": { 464 | "name": "uint256", 465 | "type": "uint256" 466 | }, 467 | "id": 1154, 468 | "name": "ElementaryTypeName", 469 | "src": "334:7:8" 470 | } 471 | ], 472 | "id": 1155, 473 | "name": "VariableDeclaration", 474 | "src": "334:20:8" 475 | }, 476 | { 477 | "attributes": { 478 | "constant": false, 479 | "name": "newBuyPrice", 480 | "scope": 1160, 481 | "stateVariable": false, 482 | "storageLocation": "default", 483 | "type": "uint256", 484 | "value": null, 485 | "visibility": "internal" 486 | }, 487 | "children": [ 488 | { 489 | "attributes": { 490 | "name": "uint256", 491 | "type": "uint256" 492 | }, 493 | "id": 1156, 494 | "name": "ElementaryTypeName", 495 | "src": "356:7:8" 496 | } 497 | ], 498 | "id": 1157, 499 | "name": "VariableDeclaration", 500 | "src": "356:19:8" 501 | } 502 | ], 503 | "id": 1158, 504 | "name": "ParameterList", 505 | "src": "333:43:8" 506 | }, 507 | { 508 | "attributes": { 509 | "parameters": [ 510 | null 511 | ] 512 | }, 513 | "children": [], 514 | "id": 1159, 515 | "name": "ParameterList", 516 | "src": "383:0:8" 517 | } 518 | ], 519 | "id": 1160, 520 | "name": "FunctionDefinition", 521 | "src": "315:69:8" 522 | }, 523 | { 524 | "attributes": { 525 | "body": null, 526 | "constant": false, 527 | "implemented": false, 528 | "isConstructor": false, 529 | "modifiers": [ 530 | null 531 | ], 532 | "name": "buy", 533 | "payable": true, 534 | "scope": 1169, 535 | "stateMutability": "payable", 536 | "superFunction": null, 537 | "visibility": "public" 538 | }, 539 | "children": [ 540 | { 541 | "attributes": { 542 | "parameters": [ 543 | null 544 | ] 545 | }, 546 | "children": [], 547 | "id": 1161, 548 | "name": "ParameterList", 549 | "src": "401:2:8" 550 | }, 551 | { 552 | "attributes": { 553 | "parameters": [ 554 | null 555 | ] 556 | }, 557 | "children": [], 558 | "id": 1162, 559 | "name": "ParameterList", 560 | "src": "418:0:8" 561 | } 562 | ], 563 | "id": 1163, 564 | "name": "FunctionDefinition", 565 | "src": "389:30:8" 566 | }, 567 | { 568 | "attributes": { 569 | "body": null, 570 | "constant": false, 571 | "implemented": false, 572 | "isConstructor": false, 573 | "modifiers": [ 574 | null 575 | ], 576 | "name": "sell", 577 | "payable": false, 578 | "scope": 1169, 579 | "stateMutability": "nonpayable", 580 | "superFunction": null, 581 | "visibility": "public" 582 | }, 583 | "children": [ 584 | { 585 | "children": [ 586 | { 587 | "attributes": { 588 | "constant": false, 589 | "name": "amount", 590 | "scope": 1168, 591 | "stateVariable": false, 592 | "storageLocation": "default", 593 | "type": "uint256", 594 | "value": null, 595 | "visibility": "internal" 596 | }, 597 | "children": [ 598 | { 599 | "attributes": { 600 | "name": "uint256", 601 | "type": "uint256" 602 | }, 603 | "id": 1164, 604 | "name": "ElementaryTypeName", 605 | "src": "438:7:8" 606 | } 607 | ], 608 | "id": 1165, 609 | "name": "VariableDeclaration", 610 | "src": "438:14:8" 611 | } 612 | ], 613 | "id": 1166, 614 | "name": "ParameterList", 615 | "src": "437:16:8" 616 | }, 617 | { 618 | "attributes": { 619 | "parameters": [ 620 | null 621 | ] 622 | }, 623 | "children": [], 624 | "id": 1167, 625 | "name": "ParameterList", 626 | "src": "460:0:8" 627 | } 628 | ], 629 | "id": 1168, 630 | "name": "FunctionDefinition", 631 | "src": "424:37:8" 632 | } 633 | ], 634 | "id": 1169, 635 | "name": "ContractDefinition", 636 | "src": "72:391:8" 637 | } 638 | ], 639 | "id": 1170, 640 | "name": "SourceUnit", 641 | "src": "0:464:8" 642 | }, 643 | "compiler": { 644 | "name": "solc", 645 | "version": "0.4.18+commit.9cf6e910.Emscripten.clang" 646 | }, 647 | "networks": {}, 648 | "schemaVersion": "1.0.1", 649 | "updatedAt": "2017-11-05T13:45:27.920Z" 650 | } -------------------------------------------------------------------------------- /build/contracts/IOwned.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "IOwned", 3 | "abi": [ 4 | { 5 | "constant": false, 6 | "inputs": [], 7 | "name": "acceptOwnership", 8 | "outputs": [], 9 | "payable": false, 10 | "stateMutability": "nonpayable", 11 | "type": "function" 12 | }, 13 | { 14 | "constant": true, 15 | "inputs": [], 16 | "name": "owner", 17 | "outputs": [ 18 | { 19 | "name": "", 20 | "type": "address" 21 | } 22 | ], 23 | "payable": false, 24 | "stateMutability": "pure", 25 | "type": "function" 26 | }, 27 | { 28 | "constant": false, 29 | "inputs": [ 30 | { 31 | "name": "_newOwner", 32 | "type": "address" 33 | } 34 | ], 35 | "name": "transferOwnership", 36 | "outputs": [], 37 | "payable": false, 38 | "stateMutability": "nonpayable", 39 | "type": "function" 40 | } 41 | ], 42 | "bytecode": "0x", 43 | "deployedBytecode": "0x", 44 | "sourceMap": "", 45 | "deployedSourceMap": "", 46 | "source": "pragma solidity ^0.4.17;\n\n/*\n Owned contract interface\n*/\ncontract IOwned {\n // this function isn't abstract since the compiler emits automatically generated getter functions as external\n function owner() public pure returns (address) {}\n\n function transferOwnership(address _newOwner) public;\n function acceptOwnership() public;\n}\n", 47 | "sourcePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/interfaces/IOwned.sol", 48 | "ast": { 49 | "attributes": { 50 | "absolutePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/interfaces/IOwned.sol", 51 | "exportedSymbols": { 52 | "IOwned": [ 53 | 1186 54 | ] 55 | } 56 | }, 57 | "children": [ 58 | { 59 | "attributes": { 60 | "literals": [ 61 | "solidity", 62 | "^", 63 | "0.4", 64 | ".17" 65 | ] 66 | }, 67 | "id": 1171, 68 | "name": "PragmaDirective", 69 | "src": "0:24:9" 70 | }, 71 | { 72 | "attributes": { 73 | "baseContracts": [ 74 | null 75 | ], 76 | "contractDependencies": [ 77 | null 78 | ], 79 | "contractKind": "contract", 80 | "documentation": null, 81 | "fullyImplemented": false, 82 | "linearizedBaseContracts": [ 83 | 1186 84 | ], 85 | "name": "IOwned", 86 | "scope": 1187 87 | }, 88 | "children": [ 89 | { 90 | "attributes": { 91 | "constant": true, 92 | "implemented": true, 93 | "isConstructor": false, 94 | "modifiers": [ 95 | null 96 | ], 97 | "name": "owner", 98 | "payable": false, 99 | "scope": 1186, 100 | "stateMutability": "pure", 101 | "superFunction": null, 102 | "visibility": "public" 103 | }, 104 | "children": [ 105 | { 106 | "attributes": { 107 | "parameters": [ 108 | null 109 | ] 110 | }, 111 | "children": [], 112 | "id": 1172, 113 | "name": "ParameterList", 114 | "src": "211:2:9" 115 | }, 116 | { 117 | "children": [ 118 | { 119 | "attributes": { 120 | "constant": false, 121 | "name": "", 122 | "scope": 1177, 123 | "stateVariable": false, 124 | "storageLocation": "default", 125 | "type": "address", 126 | "value": null, 127 | "visibility": "internal" 128 | }, 129 | "children": [ 130 | { 131 | "attributes": { 132 | "name": "address", 133 | "type": "address" 134 | }, 135 | "id": 1173, 136 | "name": "ElementaryTypeName", 137 | "src": "235:7:9" 138 | } 139 | ], 140 | "id": 1174, 141 | "name": "VariableDeclaration", 142 | "src": "235:7:9" 143 | } 144 | ], 145 | "id": 1175, 146 | "name": "ParameterList", 147 | "src": "234:9:9" 148 | }, 149 | { 150 | "attributes": { 151 | "statements": [ 152 | null 153 | ] 154 | }, 155 | "children": [], 156 | "id": 1176, 157 | "name": "Block", 158 | "src": "244:2:9" 159 | } 160 | ], 161 | "id": 1177, 162 | "name": "FunctionDefinition", 163 | "src": "197:49:9" 164 | }, 165 | { 166 | "attributes": { 167 | "body": null, 168 | "constant": false, 169 | "implemented": false, 170 | "isConstructor": false, 171 | "modifiers": [ 172 | null 173 | ], 174 | "name": "transferOwnership", 175 | "payable": false, 176 | "scope": 1186, 177 | "stateMutability": "nonpayable", 178 | "superFunction": null, 179 | "visibility": "public" 180 | }, 181 | "children": [ 182 | { 183 | "children": [ 184 | { 185 | "attributes": { 186 | "constant": false, 187 | "name": "_newOwner", 188 | "scope": 1182, 189 | "stateVariable": false, 190 | "storageLocation": "default", 191 | "type": "address", 192 | "value": null, 193 | "visibility": "internal" 194 | }, 195 | "children": [ 196 | { 197 | "attributes": { 198 | "name": "address", 199 | "type": "address" 200 | }, 201 | "id": 1178, 202 | "name": "ElementaryTypeName", 203 | "src": "279:7:9" 204 | } 205 | ], 206 | "id": 1179, 207 | "name": "VariableDeclaration", 208 | "src": "279:17:9" 209 | } 210 | ], 211 | "id": 1180, 212 | "name": "ParameterList", 213 | "src": "278:19:9" 214 | }, 215 | { 216 | "attributes": { 217 | "parameters": [ 218 | null 219 | ] 220 | }, 221 | "children": [], 222 | "id": 1181, 223 | "name": "ParameterList", 224 | "src": "304:0:9" 225 | } 226 | ], 227 | "id": 1182, 228 | "name": "FunctionDefinition", 229 | "src": "252:53:9" 230 | }, 231 | { 232 | "attributes": { 233 | "body": null, 234 | "constant": false, 235 | "implemented": false, 236 | "isConstructor": false, 237 | "modifiers": [ 238 | null 239 | ], 240 | "name": "acceptOwnership", 241 | "payable": false, 242 | "scope": 1186, 243 | "stateMutability": "nonpayable", 244 | "superFunction": null, 245 | "visibility": "public" 246 | }, 247 | "children": [ 248 | { 249 | "attributes": { 250 | "parameters": [ 251 | null 252 | ] 253 | }, 254 | "children": [], 255 | "id": 1183, 256 | "name": "ParameterList", 257 | "src": "334:2:9" 258 | }, 259 | { 260 | "attributes": { 261 | "parameters": [ 262 | null 263 | ] 264 | }, 265 | "children": [], 266 | "id": 1184, 267 | "name": "ParameterList", 268 | "src": "343:0:9" 269 | } 270 | ], 271 | "id": 1185, 272 | "name": "FunctionDefinition", 273 | "src": "310:34:9" 274 | } 275 | ], 276 | "id": 1186, 277 | "name": "ContractDefinition", 278 | "src": "61:285:9" 279 | } 280 | ], 281 | "id": 1187, 282 | "name": "SourceUnit", 283 | "src": "0:347:9" 284 | }, 285 | "compiler": { 286 | "name": "solc", 287 | "version": "0.4.18+commit.9cf6e910.Emscripten.clang" 288 | }, 289 | "networks": {}, 290 | "schemaVersion": "1.0.1", 291 | "updatedAt": "2017-11-05T13:45:27.920Z" 292 | } -------------------------------------------------------------------------------- /build/contracts/ISmartToken.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "ISmartToken", 3 | "abi": [ 4 | { 5 | "constant": false, 6 | "inputs": [ 7 | { 8 | "name": "_to", 9 | "type": "address" 10 | }, 11 | { 12 | "name": "_value", 13 | "type": "uint256" 14 | } 15 | ], 16 | "name": "issue", 17 | "outputs": [], 18 | "payable": false, 19 | "stateMutability": "nonpayable", 20 | "type": "function" 21 | } 22 | ], 23 | "bytecode": "0x", 24 | "deployedBytecode": "0x", 25 | "sourceMap": "", 26 | "deployedSourceMap": "", 27 | "source": "pragma solidity ^0.4.17;\n\n/*\n Standard ISmartyToken interface\n*/\ncontract ISmartToken {\n\n function issue(address _to, uint256 _value) public;\n}\n", 28 | "sourcePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/interfaces/ISmartToken.sol", 29 | "ast": { 30 | "attributes": { 31 | "absolutePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/interfaces/ISmartToken.sol", 32 | "exportedSymbols": { 33 | "ISmartToken": [ 34 | 1196 35 | ] 36 | } 37 | }, 38 | "children": [ 39 | { 40 | "attributes": { 41 | "literals": [ 42 | "solidity", 43 | "^", 44 | "0.4", 45 | ".17" 46 | ] 47 | }, 48 | "id": 1188, 49 | "name": "PragmaDirective", 50 | "src": "0:24:10" 51 | }, 52 | { 53 | "attributes": { 54 | "baseContracts": [ 55 | null 56 | ], 57 | "contractDependencies": [ 58 | null 59 | ], 60 | "contractKind": "contract", 61 | "documentation": null, 62 | "fullyImplemented": false, 63 | "linearizedBaseContracts": [ 64 | 1196 65 | ], 66 | "name": "ISmartToken", 67 | "scope": 1197 68 | }, 69 | "children": [ 70 | { 71 | "attributes": { 72 | "body": null, 73 | "constant": false, 74 | "implemented": false, 75 | "isConstructor": false, 76 | "modifiers": [ 77 | null 78 | ], 79 | "name": "issue", 80 | "payable": false, 81 | "scope": 1196, 82 | "stateMutability": "nonpayable", 83 | "superFunction": null, 84 | "visibility": "public" 85 | }, 86 | "children": [ 87 | { 88 | "children": [ 89 | { 90 | "attributes": { 91 | "constant": false, 92 | "name": "_to", 93 | "scope": 1195, 94 | "stateVariable": false, 95 | "storageLocation": "default", 96 | "type": "address", 97 | "value": null, 98 | "visibility": "internal" 99 | }, 100 | "children": [ 101 | { 102 | "attributes": { 103 | "name": "address", 104 | "type": "address" 105 | }, 106 | "id": 1189, 107 | "name": "ElementaryTypeName", 108 | "src": "111:7:10" 109 | } 110 | ], 111 | "id": 1190, 112 | "name": "VariableDeclaration", 113 | "src": "111:11:10" 114 | }, 115 | { 116 | "attributes": { 117 | "constant": false, 118 | "name": "_value", 119 | "scope": 1195, 120 | "stateVariable": false, 121 | "storageLocation": "default", 122 | "type": "uint256", 123 | "value": null, 124 | "visibility": "internal" 125 | }, 126 | "children": [ 127 | { 128 | "attributes": { 129 | "name": "uint256", 130 | "type": "uint256" 131 | }, 132 | "id": 1191, 133 | "name": "ElementaryTypeName", 134 | "src": "124:7:10" 135 | } 136 | ], 137 | "id": 1192, 138 | "name": "VariableDeclaration", 139 | "src": "124:14:10" 140 | } 141 | ], 142 | "id": 1193, 143 | "name": "ParameterList", 144 | "src": "110:29:10" 145 | }, 146 | { 147 | "attributes": { 148 | "parameters": [ 149 | null 150 | ] 151 | }, 152 | "children": [], 153 | "id": 1194, 154 | "name": "ParameterList", 155 | "src": "146:0:10" 156 | } 157 | ], 158 | "id": 1195, 159 | "name": "FunctionDefinition", 160 | "src": "96:51:10" 161 | } 162 | ], 163 | "id": 1196, 164 | "name": "ContractDefinition", 165 | "src": "68:81:10" 166 | } 167 | ], 168 | "id": 1197, 169 | "name": "SourceUnit", 170 | "src": "0:150:10" 171 | }, 172 | "compiler": { 173 | "name": "solc", 174 | "version": "0.4.18+commit.9cf6e910.Emscripten.clang" 175 | }, 176 | "networks": {}, 177 | "schemaVersion": "1.0.1", 178 | "updatedAt": "2017-11-05T13:45:27.920Z" 179 | } -------------------------------------------------------------------------------- /build/contracts/IToken.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "IToken", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [], 7 | "name": "name", 8 | "outputs": [ 9 | { 10 | "name": "", 11 | "type": "string" 12 | } 13 | ], 14 | "payable": false, 15 | "stateMutability": "pure", 16 | "type": "function" 17 | }, 18 | { 19 | "constant": false, 20 | "inputs": [ 21 | { 22 | "name": "_spender", 23 | "type": "address" 24 | }, 25 | { 26 | "name": "_value", 27 | "type": "uint256" 28 | } 29 | ], 30 | "name": "approve", 31 | "outputs": [ 32 | { 33 | "name": "success", 34 | "type": "bool" 35 | } 36 | ], 37 | "payable": false, 38 | "stateMutability": "nonpayable", 39 | "type": "function" 40 | }, 41 | { 42 | "constant": true, 43 | "inputs": [], 44 | "name": "totalSupply", 45 | "outputs": [ 46 | { 47 | "name": "", 48 | "type": "uint256" 49 | } 50 | ], 51 | "payable": false, 52 | "stateMutability": "pure", 53 | "type": "function" 54 | }, 55 | { 56 | "constant": false, 57 | "inputs": [ 58 | { 59 | "name": "_from", 60 | "type": "address" 61 | }, 62 | { 63 | "name": "_to", 64 | "type": "address" 65 | }, 66 | { 67 | "name": "_value", 68 | "type": "uint256" 69 | } 70 | ], 71 | "name": "transferFrom", 72 | "outputs": [ 73 | { 74 | "name": "success", 75 | "type": "bool" 76 | } 77 | ], 78 | "payable": false, 79 | "stateMutability": "nonpayable", 80 | "type": "function" 81 | }, 82 | { 83 | "constant": true, 84 | "inputs": [], 85 | "name": "decimals", 86 | "outputs": [ 87 | { 88 | "name": "", 89 | "type": "uint8" 90 | } 91 | ], 92 | "payable": false, 93 | "stateMutability": "pure", 94 | "type": "function" 95 | }, 96 | { 97 | "constant": true, 98 | "inputs": [ 99 | { 100 | "name": "_owner", 101 | "type": "address" 102 | } 103 | ], 104 | "name": "balanceOf", 105 | "outputs": [ 106 | { 107 | "name": "", 108 | "type": "uint256" 109 | } 110 | ], 111 | "payable": false, 112 | "stateMutability": "pure", 113 | "type": "function" 114 | }, 115 | { 116 | "constant": true, 117 | "inputs": [], 118 | "name": "symbol", 119 | "outputs": [ 120 | { 121 | "name": "", 122 | "type": "string" 123 | } 124 | ], 125 | "payable": false, 126 | "stateMutability": "pure", 127 | "type": "function" 128 | }, 129 | { 130 | "constant": false, 131 | "inputs": [ 132 | { 133 | "name": "_to", 134 | "type": "address" 135 | }, 136 | { 137 | "name": "_value", 138 | "type": "uint256" 139 | } 140 | ], 141 | "name": "transfer", 142 | "outputs": [ 143 | { 144 | "name": "success", 145 | "type": "bool" 146 | } 147 | ], 148 | "payable": false, 149 | "stateMutability": "nonpayable", 150 | "type": "function" 151 | }, 152 | { 153 | "constant": true, 154 | "inputs": [ 155 | { 156 | "name": "_owner", 157 | "type": "address" 158 | }, 159 | { 160 | "name": "_spender", 161 | "type": "address" 162 | } 163 | ], 164 | "name": "allowance", 165 | "outputs": [ 166 | { 167 | "name": "", 168 | "type": "uint256" 169 | } 170 | ], 171 | "payable": false, 172 | "stateMutability": "pure", 173 | "type": "function" 174 | } 175 | ], 176 | "bytecode": "0x", 177 | "deployedBytecode": "0x", 178 | "sourceMap": "", 179 | "deployedSourceMap": "", 180 | "source": "pragma solidity ^0.4.17;\n\n/*\n Standard Token interface\n*/\ncontract IToken {\n // these functions aren't abstract since the compiler emits automatically generated getter functions as external\n function name() public pure returns (string) {}\n function symbol() public pure returns (string) {}\n function decimals() public pure returns (uint8) {}\n function totalSupply() public pure returns (uint256) {}\n function balanceOf(address _owner) public pure returns (uint256) { _owner; }\n function allowance(address _owner, address _spender) public pure returns (uint256) { _owner; _spender; }\n\n function _transfer(address _from, address _to, uint256 _value) internal;\n function transfer(address _to, uint256 _value) public returns (bool success);\n function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);\n function approve(address _spender, uint256 _value) public returns (bool success);\n\n}\n", 181 | "sourcePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/interfaces/IToken.sol", 182 | "ast": { 183 | "attributes": { 184 | "absolutePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/interfaces/IToken.sol", 185 | "exportedSymbols": { 186 | "IToken": [ 187 | 1285 188 | ] 189 | } 190 | }, 191 | "children": [ 192 | { 193 | "attributes": { 194 | "literals": [ 195 | "solidity", 196 | "^", 197 | "0.4", 198 | ".17" 199 | ] 200 | }, 201 | "id": 1198, 202 | "name": "PragmaDirective", 203 | "src": "0:24:11" 204 | }, 205 | { 206 | "attributes": { 207 | "baseContracts": [ 208 | null 209 | ], 210 | "contractDependencies": [ 211 | null 212 | ], 213 | "contractKind": "contract", 214 | "documentation": null, 215 | "fullyImplemented": false, 216 | "linearizedBaseContracts": [ 217 | 1285 218 | ], 219 | "name": "IToken", 220 | "scope": 1286 221 | }, 222 | "children": [ 223 | { 224 | "attributes": { 225 | "constant": true, 226 | "implemented": true, 227 | "isConstructor": false, 228 | "modifiers": [ 229 | null 230 | ], 231 | "name": "name", 232 | "payable": false, 233 | "scope": 1285, 234 | "stateMutability": "pure", 235 | "superFunction": null, 236 | "visibility": "public" 237 | }, 238 | "children": [ 239 | { 240 | "attributes": { 241 | "parameters": [ 242 | null 243 | ] 244 | }, 245 | "children": [], 246 | "id": 1199, 247 | "name": "ParameterList", 248 | "src": "213:2:11" 249 | }, 250 | { 251 | "children": [ 252 | { 253 | "attributes": { 254 | "constant": false, 255 | "name": "", 256 | "scope": 1204, 257 | "stateVariable": false, 258 | "storageLocation": "default", 259 | "type": "string memory", 260 | "value": null, 261 | "visibility": "internal" 262 | }, 263 | "children": [ 264 | { 265 | "attributes": { 266 | "name": "string", 267 | "type": "string storage pointer" 268 | }, 269 | "id": 1200, 270 | "name": "ElementaryTypeName", 271 | "src": "237:6:11" 272 | } 273 | ], 274 | "id": 1201, 275 | "name": "VariableDeclaration", 276 | "src": "237:6:11" 277 | } 278 | ], 279 | "id": 1202, 280 | "name": "ParameterList", 281 | "src": "236:8:11" 282 | }, 283 | { 284 | "attributes": { 285 | "statements": [ 286 | null 287 | ] 288 | }, 289 | "children": [], 290 | "id": 1203, 291 | "name": "Block", 292 | "src": "245:2:11" 293 | } 294 | ], 295 | "id": 1204, 296 | "name": "FunctionDefinition", 297 | "src": "200:47:11" 298 | }, 299 | { 300 | "attributes": { 301 | "constant": true, 302 | "implemented": true, 303 | "isConstructor": false, 304 | "modifiers": [ 305 | null 306 | ], 307 | "name": "symbol", 308 | "payable": false, 309 | "scope": 1285, 310 | "stateMutability": "pure", 311 | "superFunction": null, 312 | "visibility": "public" 313 | }, 314 | "children": [ 315 | { 316 | "attributes": { 317 | "parameters": [ 318 | null 319 | ] 320 | }, 321 | "children": [], 322 | "id": 1205, 323 | "name": "ParameterList", 324 | "src": "267:2:11" 325 | }, 326 | { 327 | "children": [ 328 | { 329 | "attributes": { 330 | "constant": false, 331 | "name": "", 332 | "scope": 1210, 333 | "stateVariable": false, 334 | "storageLocation": "default", 335 | "type": "string memory", 336 | "value": null, 337 | "visibility": "internal" 338 | }, 339 | "children": [ 340 | { 341 | "attributes": { 342 | "name": "string", 343 | "type": "string storage pointer" 344 | }, 345 | "id": 1206, 346 | "name": "ElementaryTypeName", 347 | "src": "291:6:11" 348 | } 349 | ], 350 | "id": 1207, 351 | "name": "VariableDeclaration", 352 | "src": "291:6:11" 353 | } 354 | ], 355 | "id": 1208, 356 | "name": "ParameterList", 357 | "src": "290:8:11" 358 | }, 359 | { 360 | "attributes": { 361 | "statements": [ 362 | null 363 | ] 364 | }, 365 | "children": [], 366 | "id": 1209, 367 | "name": "Block", 368 | "src": "299:2:11" 369 | } 370 | ], 371 | "id": 1210, 372 | "name": "FunctionDefinition", 373 | "src": "252:49:11" 374 | }, 375 | { 376 | "attributes": { 377 | "constant": true, 378 | "implemented": true, 379 | "isConstructor": false, 380 | "modifiers": [ 381 | null 382 | ], 383 | "name": "decimals", 384 | "payable": false, 385 | "scope": 1285, 386 | "stateMutability": "pure", 387 | "superFunction": null, 388 | "visibility": "public" 389 | }, 390 | "children": [ 391 | { 392 | "attributes": { 393 | "parameters": [ 394 | null 395 | ] 396 | }, 397 | "children": [], 398 | "id": 1211, 399 | "name": "ParameterList", 400 | "src": "323:2:11" 401 | }, 402 | { 403 | "children": [ 404 | { 405 | "attributes": { 406 | "constant": false, 407 | "name": "", 408 | "scope": 1216, 409 | "stateVariable": false, 410 | "storageLocation": "default", 411 | "type": "uint8", 412 | "value": null, 413 | "visibility": "internal" 414 | }, 415 | "children": [ 416 | { 417 | "attributes": { 418 | "name": "uint8", 419 | "type": "uint8" 420 | }, 421 | "id": 1212, 422 | "name": "ElementaryTypeName", 423 | "src": "347:5:11" 424 | } 425 | ], 426 | "id": 1213, 427 | "name": "VariableDeclaration", 428 | "src": "347:5:11" 429 | } 430 | ], 431 | "id": 1214, 432 | "name": "ParameterList", 433 | "src": "346:7:11" 434 | }, 435 | { 436 | "attributes": { 437 | "statements": [ 438 | null 439 | ] 440 | }, 441 | "children": [], 442 | "id": 1215, 443 | "name": "Block", 444 | "src": "354:2:11" 445 | } 446 | ], 447 | "id": 1216, 448 | "name": "FunctionDefinition", 449 | "src": "306:50:11" 450 | }, 451 | { 452 | "attributes": { 453 | "constant": true, 454 | "implemented": true, 455 | "isConstructor": false, 456 | "modifiers": [ 457 | null 458 | ], 459 | "name": "totalSupply", 460 | "payable": false, 461 | "scope": 1285, 462 | "stateMutability": "pure", 463 | "superFunction": null, 464 | "visibility": "public" 465 | }, 466 | "children": [ 467 | { 468 | "attributes": { 469 | "parameters": [ 470 | null 471 | ] 472 | }, 473 | "children": [], 474 | "id": 1217, 475 | "name": "ParameterList", 476 | "src": "381:2:11" 477 | }, 478 | { 479 | "children": [ 480 | { 481 | "attributes": { 482 | "constant": false, 483 | "name": "", 484 | "scope": 1222, 485 | "stateVariable": false, 486 | "storageLocation": "default", 487 | "type": "uint256", 488 | "value": null, 489 | "visibility": "internal" 490 | }, 491 | "children": [ 492 | { 493 | "attributes": { 494 | "name": "uint256", 495 | "type": "uint256" 496 | }, 497 | "id": 1218, 498 | "name": "ElementaryTypeName", 499 | "src": "405:7:11" 500 | } 501 | ], 502 | "id": 1219, 503 | "name": "VariableDeclaration", 504 | "src": "405:7:11" 505 | } 506 | ], 507 | "id": 1220, 508 | "name": "ParameterList", 509 | "src": "404:9:11" 510 | }, 511 | { 512 | "attributes": { 513 | "statements": [ 514 | null 515 | ] 516 | }, 517 | "children": [], 518 | "id": 1221, 519 | "name": "Block", 520 | "src": "414:2:11" 521 | } 522 | ], 523 | "id": 1222, 524 | "name": "FunctionDefinition", 525 | "src": "361:55:11" 526 | }, 527 | { 528 | "attributes": { 529 | "constant": true, 530 | "implemented": true, 531 | "isConstructor": false, 532 | "modifiers": [ 533 | null 534 | ], 535 | "name": "balanceOf", 536 | "payable": false, 537 | "scope": 1285, 538 | "stateMutability": "pure", 539 | "superFunction": null, 540 | "visibility": "public" 541 | }, 542 | "children": [ 543 | { 544 | "children": [ 545 | { 546 | "attributes": { 547 | "constant": false, 548 | "name": "_owner", 549 | "scope": 1232, 550 | "stateVariable": false, 551 | "storageLocation": "default", 552 | "type": "address", 553 | "value": null, 554 | "visibility": "internal" 555 | }, 556 | "children": [ 557 | { 558 | "attributes": { 559 | "name": "address", 560 | "type": "address" 561 | }, 562 | "id": 1223, 563 | "name": "ElementaryTypeName", 564 | "src": "440:7:11" 565 | } 566 | ], 567 | "id": 1224, 568 | "name": "VariableDeclaration", 569 | "src": "440:14:11" 570 | } 571 | ], 572 | "id": 1225, 573 | "name": "ParameterList", 574 | "src": "439:16:11" 575 | }, 576 | { 577 | "children": [ 578 | { 579 | "attributes": { 580 | "constant": false, 581 | "name": "", 582 | "scope": 1232, 583 | "stateVariable": false, 584 | "storageLocation": "default", 585 | "type": "uint256", 586 | "value": null, 587 | "visibility": "internal" 588 | }, 589 | "children": [ 590 | { 591 | "attributes": { 592 | "name": "uint256", 593 | "type": "uint256" 594 | }, 595 | "id": 1226, 596 | "name": "ElementaryTypeName", 597 | "src": "477:7:11" 598 | } 599 | ], 600 | "id": 1227, 601 | "name": "VariableDeclaration", 602 | "src": "477:7:11" 603 | } 604 | ], 605 | "id": 1228, 606 | "name": "ParameterList", 607 | "src": "476:9:11" 608 | }, 609 | { 610 | "children": [ 611 | { 612 | "children": [ 613 | { 614 | "attributes": { 615 | "argumentTypes": null, 616 | "overloadedDeclarations": [ 617 | null 618 | ], 619 | "referencedDeclaration": 1224, 620 | "type": "address", 621 | "value": "_owner" 622 | }, 623 | "id": 1229, 624 | "name": "Identifier", 625 | "src": "488:6:11" 626 | } 627 | ], 628 | "id": 1230, 629 | "name": "ExpressionStatement", 630 | "src": "488:6:11" 631 | } 632 | ], 633 | "id": 1231, 634 | "name": "Block", 635 | "src": "486:11:11" 636 | } 637 | ], 638 | "id": 1232, 639 | "name": "FunctionDefinition", 640 | "src": "421:76:11" 641 | }, 642 | { 643 | "attributes": { 644 | "constant": true, 645 | "implemented": true, 646 | "isConstructor": false, 647 | "modifiers": [ 648 | null 649 | ], 650 | "name": "allowance", 651 | "payable": false, 652 | "scope": 1285, 653 | "stateMutability": "pure", 654 | "superFunction": null, 655 | "visibility": "public" 656 | }, 657 | "children": [ 658 | { 659 | "children": [ 660 | { 661 | "attributes": { 662 | "constant": false, 663 | "name": "_owner", 664 | "scope": 1246, 665 | "stateVariable": false, 666 | "storageLocation": "default", 667 | "type": "address", 668 | "value": null, 669 | "visibility": "internal" 670 | }, 671 | "children": [ 672 | { 673 | "attributes": { 674 | "name": "address", 675 | "type": "address" 676 | }, 677 | "id": 1233, 678 | "name": "ElementaryTypeName", 679 | "src": "521:7:11" 680 | } 681 | ], 682 | "id": 1234, 683 | "name": "VariableDeclaration", 684 | "src": "521:14:11" 685 | }, 686 | { 687 | "attributes": { 688 | "constant": false, 689 | "name": "_spender", 690 | "scope": 1246, 691 | "stateVariable": false, 692 | "storageLocation": "default", 693 | "type": "address", 694 | "value": null, 695 | "visibility": "internal" 696 | }, 697 | "children": [ 698 | { 699 | "attributes": { 700 | "name": "address", 701 | "type": "address" 702 | }, 703 | "id": 1235, 704 | "name": "ElementaryTypeName", 705 | "src": "537:7:11" 706 | } 707 | ], 708 | "id": 1236, 709 | "name": "VariableDeclaration", 710 | "src": "537:16:11" 711 | } 712 | ], 713 | "id": 1237, 714 | "name": "ParameterList", 715 | "src": "520:34:11" 716 | }, 717 | { 718 | "children": [ 719 | { 720 | "attributes": { 721 | "constant": false, 722 | "name": "", 723 | "scope": 1246, 724 | "stateVariable": false, 725 | "storageLocation": "default", 726 | "type": "uint256", 727 | "value": null, 728 | "visibility": "internal" 729 | }, 730 | "children": [ 731 | { 732 | "attributes": { 733 | "name": "uint256", 734 | "type": "uint256" 735 | }, 736 | "id": 1238, 737 | "name": "ElementaryTypeName", 738 | "src": "576:7:11" 739 | } 740 | ], 741 | "id": 1239, 742 | "name": "VariableDeclaration", 743 | "src": "576:7:11" 744 | } 745 | ], 746 | "id": 1240, 747 | "name": "ParameterList", 748 | "src": "575:9:11" 749 | }, 750 | { 751 | "children": [ 752 | { 753 | "children": [ 754 | { 755 | "attributes": { 756 | "argumentTypes": null, 757 | "overloadedDeclarations": [ 758 | null 759 | ], 760 | "referencedDeclaration": 1234, 761 | "type": "address", 762 | "value": "_owner" 763 | }, 764 | "id": 1241, 765 | "name": "Identifier", 766 | "src": "587:6:11" 767 | } 768 | ], 769 | "id": 1242, 770 | "name": "ExpressionStatement", 771 | "src": "587:6:11" 772 | }, 773 | { 774 | "children": [ 775 | { 776 | "attributes": { 777 | "argumentTypes": null, 778 | "overloadedDeclarations": [ 779 | null 780 | ], 781 | "referencedDeclaration": 1236, 782 | "type": "address", 783 | "value": "_spender" 784 | }, 785 | "id": 1243, 786 | "name": "Identifier", 787 | "src": "595:8:11" 788 | } 789 | ], 790 | "id": 1244, 791 | "name": "ExpressionStatement", 792 | "src": "595:8:11" 793 | } 794 | ], 795 | "id": 1245, 796 | "name": "Block", 797 | "src": "585:21:11" 798 | } 799 | ], 800 | "id": 1246, 801 | "name": "FunctionDefinition", 802 | "src": "502:104:11" 803 | }, 804 | { 805 | "attributes": { 806 | "body": null, 807 | "constant": false, 808 | "implemented": false, 809 | "isConstructor": false, 810 | "modifiers": [ 811 | null 812 | ], 813 | "name": "_transfer", 814 | "payable": false, 815 | "scope": 1285, 816 | "stateMutability": "nonpayable", 817 | "superFunction": 1139, 818 | "visibility": "internal" 819 | }, 820 | "children": [ 821 | { 822 | "children": [ 823 | { 824 | "attributes": { 825 | "constant": false, 826 | "name": "_from", 827 | "scope": 1255, 828 | "stateVariable": false, 829 | "storageLocation": "default", 830 | "type": "address", 831 | "value": null, 832 | "visibility": "internal" 833 | }, 834 | "children": [ 835 | { 836 | "attributes": { 837 | "name": "address", 838 | "type": "address" 839 | }, 840 | "id": 1247, 841 | "name": "ElementaryTypeName", 842 | "src": "631:7:11" 843 | } 844 | ], 845 | "id": 1248, 846 | "name": "VariableDeclaration", 847 | "src": "631:13:11" 848 | }, 849 | { 850 | "attributes": { 851 | "constant": false, 852 | "name": "_to", 853 | "scope": 1255, 854 | "stateVariable": false, 855 | "storageLocation": "default", 856 | "type": "address", 857 | "value": null, 858 | "visibility": "internal" 859 | }, 860 | "children": [ 861 | { 862 | "attributes": { 863 | "name": "address", 864 | "type": "address" 865 | }, 866 | "id": 1249, 867 | "name": "ElementaryTypeName", 868 | "src": "646:7:11" 869 | } 870 | ], 871 | "id": 1250, 872 | "name": "VariableDeclaration", 873 | "src": "646:11:11" 874 | }, 875 | { 876 | "attributes": { 877 | "constant": false, 878 | "name": "_value", 879 | "scope": 1255, 880 | "stateVariable": false, 881 | "storageLocation": "default", 882 | "type": "uint256", 883 | "value": null, 884 | "visibility": "internal" 885 | }, 886 | "children": [ 887 | { 888 | "attributes": { 889 | "name": "uint256", 890 | "type": "uint256" 891 | }, 892 | "id": 1251, 893 | "name": "ElementaryTypeName", 894 | "src": "659:7:11" 895 | } 896 | ], 897 | "id": 1252, 898 | "name": "VariableDeclaration", 899 | "src": "659:14:11" 900 | } 901 | ], 902 | "id": 1253, 903 | "name": "ParameterList", 904 | "src": "630:44:11" 905 | }, 906 | { 907 | "attributes": { 908 | "parameters": [ 909 | null 910 | ] 911 | }, 912 | "children": [], 913 | "id": 1254, 914 | "name": "ParameterList", 915 | "src": "683:0:11" 916 | } 917 | ], 918 | "id": 1255, 919 | "name": "FunctionDefinition", 920 | "src": "612:72:11" 921 | }, 922 | { 923 | "attributes": { 924 | "body": null, 925 | "constant": false, 926 | "implemented": false, 927 | "isConstructor": false, 928 | "modifiers": [ 929 | null 930 | ], 931 | "name": "transfer", 932 | "payable": false, 933 | "scope": 1285, 934 | "stateMutability": "nonpayable", 935 | "superFunction": null, 936 | "visibility": "public" 937 | }, 938 | "children": [ 939 | { 940 | "children": [ 941 | { 942 | "attributes": { 943 | "constant": false, 944 | "name": "_to", 945 | "scope": 1264, 946 | "stateVariable": false, 947 | "storageLocation": "default", 948 | "type": "address", 949 | "value": null, 950 | "visibility": "internal" 951 | }, 952 | "children": [ 953 | { 954 | "attributes": { 955 | "name": "address", 956 | "type": "address" 957 | }, 958 | "id": 1256, 959 | "name": "ElementaryTypeName", 960 | "src": "707:7:11" 961 | } 962 | ], 963 | "id": 1257, 964 | "name": "VariableDeclaration", 965 | "src": "707:11:11" 966 | }, 967 | { 968 | "attributes": { 969 | "constant": false, 970 | "name": "_value", 971 | "scope": 1264, 972 | "stateVariable": false, 973 | "storageLocation": "default", 974 | "type": "uint256", 975 | "value": null, 976 | "visibility": "internal" 977 | }, 978 | "children": [ 979 | { 980 | "attributes": { 981 | "name": "uint256", 982 | "type": "uint256" 983 | }, 984 | "id": 1258, 985 | "name": "ElementaryTypeName", 986 | "src": "720:7:11" 987 | } 988 | ], 989 | "id": 1259, 990 | "name": "VariableDeclaration", 991 | "src": "720:14:11" 992 | } 993 | ], 994 | "id": 1260, 995 | "name": "ParameterList", 996 | "src": "706:29:11" 997 | }, 998 | { 999 | "children": [ 1000 | { 1001 | "attributes": { 1002 | "constant": false, 1003 | "name": "success", 1004 | "scope": 1264, 1005 | "stateVariable": false, 1006 | "storageLocation": "default", 1007 | "type": "bool", 1008 | "value": null, 1009 | "visibility": "internal" 1010 | }, 1011 | "children": [ 1012 | { 1013 | "attributes": { 1014 | "name": "bool", 1015 | "type": "bool" 1016 | }, 1017 | "id": 1261, 1018 | "name": "ElementaryTypeName", 1019 | "src": "752:4:11" 1020 | } 1021 | ], 1022 | "id": 1262, 1023 | "name": "VariableDeclaration", 1024 | "src": "752:12:11" 1025 | } 1026 | ], 1027 | "id": 1263, 1028 | "name": "ParameterList", 1029 | "src": "751:14:11" 1030 | } 1031 | ], 1032 | "id": 1264, 1033 | "name": "FunctionDefinition", 1034 | "src": "689:77:11" 1035 | }, 1036 | { 1037 | "attributes": { 1038 | "body": null, 1039 | "constant": false, 1040 | "implemented": false, 1041 | "isConstructor": false, 1042 | "modifiers": [ 1043 | null 1044 | ], 1045 | "name": "transferFrom", 1046 | "payable": false, 1047 | "scope": 1285, 1048 | "stateMutability": "nonpayable", 1049 | "superFunction": null, 1050 | "visibility": "public" 1051 | }, 1052 | "children": [ 1053 | { 1054 | "children": [ 1055 | { 1056 | "attributes": { 1057 | "constant": false, 1058 | "name": "_from", 1059 | "scope": 1275, 1060 | "stateVariable": false, 1061 | "storageLocation": "default", 1062 | "type": "address", 1063 | "value": null, 1064 | "visibility": "internal" 1065 | }, 1066 | "children": [ 1067 | { 1068 | "attributes": { 1069 | "name": "address", 1070 | "type": "address" 1071 | }, 1072 | "id": 1265, 1073 | "name": "ElementaryTypeName", 1074 | "src": "793:7:11" 1075 | } 1076 | ], 1077 | "id": 1266, 1078 | "name": "VariableDeclaration", 1079 | "src": "793:13:11" 1080 | }, 1081 | { 1082 | "attributes": { 1083 | "constant": false, 1084 | "name": "_to", 1085 | "scope": 1275, 1086 | "stateVariable": false, 1087 | "storageLocation": "default", 1088 | "type": "address", 1089 | "value": null, 1090 | "visibility": "internal" 1091 | }, 1092 | "children": [ 1093 | { 1094 | "attributes": { 1095 | "name": "address", 1096 | "type": "address" 1097 | }, 1098 | "id": 1267, 1099 | "name": "ElementaryTypeName", 1100 | "src": "808:7:11" 1101 | } 1102 | ], 1103 | "id": 1268, 1104 | "name": "VariableDeclaration", 1105 | "src": "808:11:11" 1106 | }, 1107 | { 1108 | "attributes": { 1109 | "constant": false, 1110 | "name": "_value", 1111 | "scope": 1275, 1112 | "stateVariable": false, 1113 | "storageLocation": "default", 1114 | "type": "uint256", 1115 | "value": null, 1116 | "visibility": "internal" 1117 | }, 1118 | "children": [ 1119 | { 1120 | "attributes": { 1121 | "name": "uint256", 1122 | "type": "uint256" 1123 | }, 1124 | "id": 1269, 1125 | "name": "ElementaryTypeName", 1126 | "src": "821:7:11" 1127 | } 1128 | ], 1129 | "id": 1270, 1130 | "name": "VariableDeclaration", 1131 | "src": "821:14:11" 1132 | } 1133 | ], 1134 | "id": 1271, 1135 | "name": "ParameterList", 1136 | "src": "792:44:11" 1137 | }, 1138 | { 1139 | "children": [ 1140 | { 1141 | "attributes": { 1142 | "constant": false, 1143 | "name": "success", 1144 | "scope": 1275, 1145 | "stateVariable": false, 1146 | "storageLocation": "default", 1147 | "type": "bool", 1148 | "value": null, 1149 | "visibility": "internal" 1150 | }, 1151 | "children": [ 1152 | { 1153 | "attributes": { 1154 | "name": "bool", 1155 | "type": "bool" 1156 | }, 1157 | "id": 1272, 1158 | "name": "ElementaryTypeName", 1159 | "src": "853:4:11" 1160 | } 1161 | ], 1162 | "id": 1273, 1163 | "name": "VariableDeclaration", 1164 | "src": "853:12:11" 1165 | } 1166 | ], 1167 | "id": 1274, 1168 | "name": "ParameterList", 1169 | "src": "852:14:11" 1170 | } 1171 | ], 1172 | "id": 1275, 1173 | "name": "FunctionDefinition", 1174 | "src": "771:96:11" 1175 | }, 1176 | { 1177 | "attributes": { 1178 | "body": null, 1179 | "constant": false, 1180 | "implemented": false, 1181 | "isConstructor": false, 1182 | "modifiers": [ 1183 | null 1184 | ], 1185 | "name": "approve", 1186 | "payable": false, 1187 | "scope": 1285, 1188 | "stateMutability": "nonpayable", 1189 | "superFunction": null, 1190 | "visibility": "public" 1191 | }, 1192 | "children": [ 1193 | { 1194 | "children": [ 1195 | { 1196 | "attributes": { 1197 | "constant": false, 1198 | "name": "_spender", 1199 | "scope": 1284, 1200 | "stateVariable": false, 1201 | "storageLocation": "default", 1202 | "type": "address", 1203 | "value": null, 1204 | "visibility": "internal" 1205 | }, 1206 | "children": [ 1207 | { 1208 | "attributes": { 1209 | "name": "address", 1210 | "type": "address" 1211 | }, 1212 | "id": 1276, 1213 | "name": "ElementaryTypeName", 1214 | "src": "889:7:11" 1215 | } 1216 | ], 1217 | "id": 1277, 1218 | "name": "VariableDeclaration", 1219 | "src": "889:16:11" 1220 | }, 1221 | { 1222 | "attributes": { 1223 | "constant": false, 1224 | "name": "_value", 1225 | "scope": 1284, 1226 | "stateVariable": false, 1227 | "storageLocation": "default", 1228 | "type": "uint256", 1229 | "value": null, 1230 | "visibility": "internal" 1231 | }, 1232 | "children": [ 1233 | { 1234 | "attributes": { 1235 | "name": "uint256", 1236 | "type": "uint256" 1237 | }, 1238 | "id": 1278, 1239 | "name": "ElementaryTypeName", 1240 | "src": "907:7:11" 1241 | } 1242 | ], 1243 | "id": 1279, 1244 | "name": "VariableDeclaration", 1245 | "src": "907:14:11" 1246 | } 1247 | ], 1248 | "id": 1280, 1249 | "name": "ParameterList", 1250 | "src": "888:34:11" 1251 | }, 1252 | { 1253 | "children": [ 1254 | { 1255 | "attributes": { 1256 | "constant": false, 1257 | "name": "success", 1258 | "scope": 1284, 1259 | "stateVariable": false, 1260 | "storageLocation": "default", 1261 | "type": "bool", 1262 | "value": null, 1263 | "visibility": "internal" 1264 | }, 1265 | "children": [ 1266 | { 1267 | "attributes": { 1268 | "name": "bool", 1269 | "type": "bool" 1270 | }, 1271 | "id": 1281, 1272 | "name": "ElementaryTypeName", 1273 | "src": "939:4:11" 1274 | } 1275 | ], 1276 | "id": 1282, 1277 | "name": "VariableDeclaration", 1278 | "src": "939:12:11" 1279 | } 1280 | ], 1281 | "id": 1283, 1282 | "name": "ParameterList", 1283 | "src": "938:14:11" 1284 | } 1285 | ], 1286 | "id": 1284, 1287 | "name": "FunctionDefinition", 1288 | "src": "872:81:11" 1289 | } 1290 | ], 1291 | "id": 1285, 1292 | "name": "ContractDefinition", 1293 | "src": "61:895:11" 1294 | } 1295 | ], 1296 | "id": 1286, 1297 | "name": "SourceUnit", 1298 | "src": "0:957:11" 1299 | }, 1300 | "compiler": { 1301 | "name": "solc", 1302 | "version": "0.4.18+commit.9cf6e910.Emscripten.clang" 1303 | }, 1304 | "networks": {}, 1305 | "schemaVersion": "1.0.1", 1306 | "updatedAt": "2017-11-05T13:45:27.920Z" 1307 | } -------------------------------------------------------------------------------- /build/contracts/Migrations.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Migrations", 3 | "abi": [ 4 | { 5 | "constant": false, 6 | "inputs": [ 7 | { 8 | "name": "new_address", 9 | "type": "address" 10 | } 11 | ], 12 | "name": "upgrade", 13 | "outputs": [], 14 | "payable": false, 15 | "stateMutability": "nonpayable", 16 | "type": "function" 17 | }, 18 | { 19 | "constant": true, 20 | "inputs": [], 21 | "name": "last_completed_migration", 22 | "outputs": [ 23 | { 24 | "name": "", 25 | "type": "uint256" 26 | } 27 | ], 28 | "payable": false, 29 | "stateMutability": "view", 30 | "type": "function" 31 | }, 32 | { 33 | "constant": true, 34 | "inputs": [], 35 | "name": "owner", 36 | "outputs": [ 37 | { 38 | "name": "", 39 | "type": "address" 40 | } 41 | ], 42 | "payable": false, 43 | "stateMutability": "view", 44 | "type": "function" 45 | }, 46 | { 47 | "constant": false, 48 | "inputs": [ 49 | { 50 | "name": "completed", 51 | "type": "uint256" 52 | } 53 | ], 54 | "name": "setCompleted", 55 | "outputs": [], 56 | "payable": false, 57 | "stateMutability": "nonpayable", 58 | "type": "function" 59 | }, 60 | { 61 | "inputs": [], 62 | "payable": false, 63 | "stateMutability": "nonpayable", 64 | "type": "constructor" 65 | } 66 | ], 67 | "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a7230582090ff6a8dca3be780a5a636ebc17e6d4640fc8d9b27adab9c034c6c5c1b9c987d0029", 68 | "deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a7230582090ff6a8dca3be780a5a636ebc17e6d4640fc8d9b27adab9c034c6c5c1b9c987d0029", 69 | "sourceMap": "26:488:7:-;;;178:58;;;;;;;;221:10;213:5;;:18;;;;;;;;;;;;;;;;;;26:488;;;;;;", 70 | "deployedSourceMap": "26:488:7:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;50:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;240:103;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;409:19;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;442:11;409:45;;460:8;:21;;;482:24;;460:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;143:26;347:165;;:::o;74:36::-;;;;:::o;50:20::-;;;;;;;;;;;;;:::o;240:103::-;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;329:9;302:24;:36;;;;143:26;240:103;:::o", 71 | "source": "pragma solidity ^0.4.17;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function Migrations() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", 72 | "sourcePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/helpers/Migrations.sol", 73 | "ast": { 74 | "attributes": { 75 | "absolutePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/helpers/Migrations.sol", 76 | "exportedSymbols": { 77 | "Migrations": [ 78 | 1128 79 | ] 80 | } 81 | }, 82 | "children": [ 83 | { 84 | "attributes": { 85 | "literals": [ 86 | "solidity", 87 | "^", 88 | "0.4", 89 | ".17" 90 | ] 91 | }, 92 | "id": 1073, 93 | "name": "PragmaDirective", 94 | "src": "0:24:7" 95 | }, 96 | { 97 | "attributes": { 98 | "baseContracts": [ 99 | null 100 | ], 101 | "contractDependencies": [ 102 | null 103 | ], 104 | "contractKind": "contract", 105 | "documentation": null, 106 | "fullyImplemented": true, 107 | "linearizedBaseContracts": [ 108 | 1128 109 | ], 110 | "name": "Migrations", 111 | "scope": 1129 112 | }, 113 | "children": [ 114 | { 115 | "attributes": { 116 | "constant": false, 117 | "name": "owner", 118 | "scope": 1128, 119 | "stateVariable": true, 120 | "storageLocation": "default", 121 | "type": "address", 122 | "value": null, 123 | "visibility": "public" 124 | }, 125 | "children": [ 126 | { 127 | "attributes": { 128 | "name": "address", 129 | "type": "address" 130 | }, 131 | "id": 1074, 132 | "name": "ElementaryTypeName", 133 | "src": "50:7:7" 134 | } 135 | ], 136 | "id": 1075, 137 | "name": "VariableDeclaration", 138 | "src": "50:20:7" 139 | }, 140 | { 141 | "attributes": { 142 | "constant": false, 143 | "name": "last_completed_migration", 144 | "scope": 1128, 145 | "stateVariable": true, 146 | "storageLocation": "default", 147 | "type": "uint256", 148 | "value": null, 149 | "visibility": "public" 150 | }, 151 | "children": [ 152 | { 153 | "attributes": { 154 | "name": "uint", 155 | "type": "uint256" 156 | }, 157 | "id": 1076, 158 | "name": "ElementaryTypeName", 159 | "src": "74:4:7" 160 | } 161 | ], 162 | "id": 1077, 163 | "name": "VariableDeclaration", 164 | "src": "74:36:7" 165 | }, 166 | { 167 | "attributes": { 168 | "name": "restricted", 169 | "visibility": "internal" 170 | }, 171 | "children": [ 172 | { 173 | "attributes": { 174 | "parameters": [ 175 | null 176 | ] 177 | }, 178 | "children": [], 179 | "id": 1078, 180 | "name": "ParameterList", 181 | "src": "134:2:7" 182 | }, 183 | { 184 | "children": [ 185 | { 186 | "attributes": { 187 | "falseBody": null 188 | }, 189 | "children": [ 190 | { 191 | "attributes": { 192 | "argumentTypes": null, 193 | "commonType": { 194 | "typeIdentifier": "t_address", 195 | "typeString": "address" 196 | }, 197 | "isConstant": false, 198 | "isLValue": false, 199 | "isPure": false, 200 | "lValueRequested": false, 201 | "operator": "==", 202 | "type": "bool" 203 | }, 204 | "children": [ 205 | { 206 | "attributes": { 207 | "argumentTypes": null, 208 | "isConstant": false, 209 | "isLValue": false, 210 | "isPure": false, 211 | "lValueRequested": false, 212 | "member_name": "sender", 213 | "referencedDeclaration": null, 214 | "type": "address" 215 | }, 216 | "children": [ 217 | { 218 | "attributes": { 219 | "argumentTypes": null, 220 | "overloadedDeclarations": [ 221 | null 222 | ], 223 | "referencedDeclaration": 1297, 224 | "type": "msg", 225 | "value": "msg" 226 | }, 227 | "id": 1079, 228 | "name": "Identifier", 229 | "src": "147:3:7" 230 | } 231 | ], 232 | "id": 1080, 233 | "name": "MemberAccess", 234 | "src": "147:10:7" 235 | }, 236 | { 237 | "attributes": { 238 | "argumentTypes": null, 239 | "overloadedDeclarations": [ 240 | null 241 | ], 242 | "referencedDeclaration": 1075, 243 | "type": "address", 244 | "value": "owner" 245 | }, 246 | "id": 1081, 247 | "name": "Identifier", 248 | "src": "161:5:7" 249 | } 250 | ], 251 | "id": 1082, 252 | "name": "BinaryOperation", 253 | "src": "147:19:7" 254 | }, 255 | { 256 | "id": 1083, 257 | "name": "PlaceholderStatement", 258 | "src": "168:1:7" 259 | } 260 | ], 261 | "id": 1084, 262 | "name": "IfStatement", 263 | "src": "143:26:7" 264 | } 265 | ], 266 | "id": 1085, 267 | "name": "Block", 268 | "src": "137:37:7" 269 | } 270 | ], 271 | "id": 1086, 272 | "name": "ModifierDefinition", 273 | "src": "115:59:7" 274 | }, 275 | { 276 | "attributes": { 277 | "constant": false, 278 | "implemented": true, 279 | "isConstructor": true, 280 | "modifiers": [ 281 | null 282 | ], 283 | "name": "Migrations", 284 | "payable": false, 285 | "scope": 1128, 286 | "stateMutability": "nonpayable", 287 | "superFunction": null, 288 | "visibility": "public" 289 | }, 290 | "children": [ 291 | { 292 | "attributes": { 293 | "parameters": [ 294 | null 295 | ] 296 | }, 297 | "children": [], 298 | "id": 1087, 299 | "name": "ParameterList", 300 | "src": "197:2:7" 301 | }, 302 | { 303 | "attributes": { 304 | "parameters": [ 305 | null 306 | ] 307 | }, 308 | "children": [], 309 | "id": 1088, 310 | "name": "ParameterList", 311 | "src": "207:0:7" 312 | }, 313 | { 314 | "children": [ 315 | { 316 | "children": [ 317 | { 318 | "attributes": { 319 | "argumentTypes": null, 320 | "isConstant": false, 321 | "isLValue": false, 322 | "isPure": false, 323 | "lValueRequested": false, 324 | "operator": "=", 325 | "type": "address" 326 | }, 327 | "children": [ 328 | { 329 | "attributes": { 330 | "argumentTypes": null, 331 | "overloadedDeclarations": [ 332 | null 333 | ], 334 | "referencedDeclaration": 1075, 335 | "type": "address", 336 | "value": "owner" 337 | }, 338 | "id": 1089, 339 | "name": "Identifier", 340 | "src": "213:5:7" 341 | }, 342 | { 343 | "attributes": { 344 | "argumentTypes": null, 345 | "isConstant": false, 346 | "isLValue": false, 347 | "isPure": false, 348 | "lValueRequested": false, 349 | "member_name": "sender", 350 | "referencedDeclaration": null, 351 | "type": "address" 352 | }, 353 | "children": [ 354 | { 355 | "attributes": { 356 | "argumentTypes": null, 357 | "overloadedDeclarations": [ 358 | null 359 | ], 360 | "referencedDeclaration": 1297, 361 | "type": "msg", 362 | "value": "msg" 363 | }, 364 | "id": 1090, 365 | "name": "Identifier", 366 | "src": "221:3:7" 367 | } 368 | ], 369 | "id": 1091, 370 | "name": "MemberAccess", 371 | "src": "221:10:7" 372 | } 373 | ], 374 | "id": 1092, 375 | "name": "Assignment", 376 | "src": "213:18:7" 377 | } 378 | ], 379 | "id": 1093, 380 | "name": "ExpressionStatement", 381 | "src": "213:18:7" 382 | } 383 | ], 384 | "id": 1094, 385 | "name": "Block", 386 | "src": "207:29:7" 387 | } 388 | ], 389 | "id": 1095, 390 | "name": "FunctionDefinition", 391 | "src": "178:58:7" 392 | }, 393 | { 394 | "attributes": { 395 | "constant": false, 396 | "implemented": true, 397 | "isConstructor": false, 398 | "name": "setCompleted", 399 | "payable": false, 400 | "scope": 1128, 401 | "stateMutability": "nonpayable", 402 | "superFunction": null, 403 | "visibility": "public" 404 | }, 405 | "children": [ 406 | { 407 | "children": [ 408 | { 409 | "attributes": { 410 | "constant": false, 411 | "name": "completed", 412 | "scope": 1107, 413 | "stateVariable": false, 414 | "storageLocation": "default", 415 | "type": "uint256", 416 | "value": null, 417 | "visibility": "internal" 418 | }, 419 | "children": [ 420 | { 421 | "attributes": { 422 | "name": "uint", 423 | "type": "uint256" 424 | }, 425 | "id": 1096, 426 | "name": "ElementaryTypeName", 427 | "src": "262:4:7" 428 | } 429 | ], 430 | "id": 1097, 431 | "name": "VariableDeclaration", 432 | "src": "262:14:7" 433 | } 434 | ], 435 | "id": 1098, 436 | "name": "ParameterList", 437 | "src": "261:16:7" 438 | }, 439 | { 440 | "attributes": { 441 | "parameters": [ 442 | null 443 | ] 444 | }, 445 | "children": [], 446 | "id": 1101, 447 | "name": "ParameterList", 448 | "src": "296:0:7" 449 | }, 450 | { 451 | "attributes": { 452 | "arguments": [ 453 | null 454 | ] 455 | }, 456 | "children": [ 457 | { 458 | "attributes": { 459 | "argumentTypes": null, 460 | "overloadedDeclarations": [ 461 | null 462 | ], 463 | "referencedDeclaration": 1086, 464 | "type": "modifier ()", 465 | "value": "restricted" 466 | }, 467 | "id": 1099, 468 | "name": "Identifier", 469 | "src": "285:10:7" 470 | } 471 | ], 472 | "id": 1100, 473 | "name": "ModifierInvocation", 474 | "src": "285:10:7" 475 | }, 476 | { 477 | "children": [ 478 | { 479 | "children": [ 480 | { 481 | "attributes": { 482 | "argumentTypes": null, 483 | "isConstant": false, 484 | "isLValue": false, 485 | "isPure": false, 486 | "lValueRequested": false, 487 | "operator": "=", 488 | "type": "uint256" 489 | }, 490 | "children": [ 491 | { 492 | "attributes": { 493 | "argumentTypes": null, 494 | "overloadedDeclarations": [ 495 | null 496 | ], 497 | "referencedDeclaration": 1077, 498 | "type": "uint256", 499 | "value": "last_completed_migration" 500 | }, 501 | "id": 1102, 502 | "name": "Identifier", 503 | "src": "302:24:7" 504 | }, 505 | { 506 | "attributes": { 507 | "argumentTypes": null, 508 | "overloadedDeclarations": [ 509 | null 510 | ], 511 | "referencedDeclaration": 1097, 512 | "type": "uint256", 513 | "value": "completed" 514 | }, 515 | "id": 1103, 516 | "name": "Identifier", 517 | "src": "329:9:7" 518 | } 519 | ], 520 | "id": 1104, 521 | "name": "Assignment", 522 | "src": "302:36:7" 523 | } 524 | ], 525 | "id": 1105, 526 | "name": "ExpressionStatement", 527 | "src": "302:36:7" 528 | } 529 | ], 530 | "id": 1106, 531 | "name": "Block", 532 | "src": "296:47:7" 533 | } 534 | ], 535 | "id": 1107, 536 | "name": "FunctionDefinition", 537 | "src": "240:103:7" 538 | }, 539 | { 540 | "attributes": { 541 | "constant": false, 542 | "implemented": true, 543 | "isConstructor": false, 544 | "name": "upgrade", 545 | "payable": false, 546 | "scope": 1128, 547 | "stateMutability": "nonpayable", 548 | "superFunction": null, 549 | "visibility": "public" 550 | }, 551 | "children": [ 552 | { 553 | "children": [ 554 | { 555 | "attributes": { 556 | "constant": false, 557 | "name": "new_address", 558 | "scope": 1127, 559 | "stateVariable": false, 560 | "storageLocation": "default", 561 | "type": "address", 562 | "value": null, 563 | "visibility": "internal" 564 | }, 565 | "children": [ 566 | { 567 | "attributes": { 568 | "name": "address", 569 | "type": "address" 570 | }, 571 | "id": 1108, 572 | "name": "ElementaryTypeName", 573 | "src": "364:7:7" 574 | } 575 | ], 576 | "id": 1109, 577 | "name": "VariableDeclaration", 578 | "src": "364:19:7" 579 | } 580 | ], 581 | "id": 1110, 582 | "name": "ParameterList", 583 | "src": "363:21:7" 584 | }, 585 | { 586 | "attributes": { 587 | "parameters": [ 588 | null 589 | ] 590 | }, 591 | "children": [], 592 | "id": 1113, 593 | "name": "ParameterList", 594 | "src": "403:0:7" 595 | }, 596 | { 597 | "attributes": { 598 | "arguments": [ 599 | null 600 | ] 601 | }, 602 | "children": [ 603 | { 604 | "attributes": { 605 | "argumentTypes": null, 606 | "overloadedDeclarations": [ 607 | null 608 | ], 609 | "referencedDeclaration": 1086, 610 | "type": "modifier ()", 611 | "value": "restricted" 612 | }, 613 | "id": 1111, 614 | "name": "Identifier", 615 | "src": "392:10:7" 616 | } 617 | ], 618 | "id": 1112, 619 | "name": "ModifierInvocation", 620 | "src": "392:10:7" 621 | }, 622 | { 623 | "children": [ 624 | { 625 | "attributes": { 626 | "assignments": [ 627 | 1115 628 | ] 629 | }, 630 | "children": [ 631 | { 632 | "attributes": { 633 | "constant": false, 634 | "name": "upgraded", 635 | "scope": 1127, 636 | "stateVariable": false, 637 | "storageLocation": "default", 638 | "type": "contract Migrations", 639 | "value": null, 640 | "visibility": "internal" 641 | }, 642 | "children": [ 643 | { 644 | "attributes": { 645 | "contractScope": null, 646 | "name": "Migrations", 647 | "referencedDeclaration": 1128, 648 | "type": "contract Migrations" 649 | }, 650 | "id": 1114, 651 | "name": "UserDefinedTypeName", 652 | "src": "409:10:7" 653 | } 654 | ], 655 | "id": 1115, 656 | "name": "VariableDeclaration", 657 | "src": "409:19:7" 658 | }, 659 | { 660 | "attributes": { 661 | "argumentTypes": null, 662 | "isConstant": false, 663 | "isLValue": false, 664 | "isPure": false, 665 | "isStructConstructorCall": false, 666 | "lValueRequested": false, 667 | "names": [ 668 | null 669 | ], 670 | "type": "contract Migrations", 671 | "type_conversion": true 672 | }, 673 | "children": [ 674 | { 675 | "attributes": { 676 | "argumentTypes": [ 677 | { 678 | "typeIdentifier": "t_address", 679 | "typeString": "address" 680 | } 681 | ], 682 | "overloadedDeclarations": [ 683 | null 684 | ], 685 | "referencedDeclaration": 1128, 686 | "type": "type(contract Migrations)", 687 | "value": "Migrations" 688 | }, 689 | "id": 1116, 690 | "name": "Identifier", 691 | "src": "431:10:7" 692 | }, 693 | { 694 | "attributes": { 695 | "argumentTypes": null, 696 | "overloadedDeclarations": [ 697 | null 698 | ], 699 | "referencedDeclaration": 1109, 700 | "type": "address", 701 | "value": "new_address" 702 | }, 703 | "id": 1117, 704 | "name": "Identifier", 705 | "src": "442:11:7" 706 | } 707 | ], 708 | "id": 1118, 709 | "name": "FunctionCall", 710 | "src": "431:23:7" 711 | } 712 | ], 713 | "id": 1119, 714 | "name": "VariableDeclarationStatement", 715 | "src": "409:45:7" 716 | }, 717 | { 718 | "children": [ 719 | { 720 | "attributes": { 721 | "argumentTypes": null, 722 | "isConstant": false, 723 | "isLValue": false, 724 | "isPure": false, 725 | "isStructConstructorCall": false, 726 | "lValueRequested": false, 727 | "names": [ 728 | null 729 | ], 730 | "type": "tuple()", 731 | "type_conversion": false 732 | }, 733 | "children": [ 734 | { 735 | "attributes": { 736 | "argumentTypes": [ 737 | { 738 | "typeIdentifier": "t_uint256", 739 | "typeString": "uint256" 740 | } 741 | ], 742 | "isConstant": false, 743 | "isLValue": false, 744 | "isPure": false, 745 | "lValueRequested": false, 746 | "member_name": "setCompleted", 747 | "referencedDeclaration": 1107, 748 | "type": "function (uint256) external" 749 | }, 750 | "children": [ 751 | { 752 | "attributes": { 753 | "argumentTypes": null, 754 | "overloadedDeclarations": [ 755 | null 756 | ], 757 | "referencedDeclaration": 1115, 758 | "type": "contract Migrations", 759 | "value": "upgraded" 760 | }, 761 | "id": 1120, 762 | "name": "Identifier", 763 | "src": "460:8:7" 764 | } 765 | ], 766 | "id": 1122, 767 | "name": "MemberAccess", 768 | "src": "460:21:7" 769 | }, 770 | { 771 | "attributes": { 772 | "argumentTypes": null, 773 | "overloadedDeclarations": [ 774 | null 775 | ], 776 | "referencedDeclaration": 1077, 777 | "type": "uint256", 778 | "value": "last_completed_migration" 779 | }, 780 | "id": 1123, 781 | "name": "Identifier", 782 | "src": "482:24:7" 783 | } 784 | ], 785 | "id": 1124, 786 | "name": "FunctionCall", 787 | "src": "460:47:7" 788 | } 789 | ], 790 | "id": 1125, 791 | "name": "ExpressionStatement", 792 | "src": "460:47:7" 793 | } 794 | ], 795 | "id": 1126, 796 | "name": "Block", 797 | "src": "403:109:7" 798 | } 799 | ], 800 | "id": 1127, 801 | "name": "FunctionDefinition", 802 | "src": "347:165:7" 803 | } 804 | ], 805 | "id": 1128, 806 | "name": "ContractDefinition", 807 | "src": "26:488:7" 808 | } 809 | ], 810 | "id": 1129, 811 | "name": "SourceUnit", 812 | "src": "0:515:7" 813 | }, 814 | "compiler": { 815 | "name": "solc", 816 | "version": "0.4.18+commit.9cf6e910.Emscripten.clang" 817 | }, 818 | "networks": {}, 819 | "schemaVersion": "1.0.1", 820 | "updatedAt": "2017-11-05T13:45:28.493Z" 821 | } -------------------------------------------------------------------------------- /build/contracts/Owned.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Owned", 3 | "abi": [ 4 | { 5 | "constant": false, 6 | "inputs": [], 7 | "name": "acceptOwnership", 8 | "outputs": [], 9 | "payable": false, 10 | "stateMutability": "nonpayable", 11 | "type": "function" 12 | }, 13 | { 14 | "constant": true, 15 | "inputs": [], 16 | "name": "owner", 17 | "outputs": [ 18 | { 19 | "name": "", 20 | "type": "address" 21 | } 22 | ], 23 | "payable": false, 24 | "stateMutability": "view", 25 | "type": "function" 26 | }, 27 | { 28 | "constant": true, 29 | "inputs": [], 30 | "name": "newOwner", 31 | "outputs": [ 32 | { 33 | "name": "", 34 | "type": "address" 35 | } 36 | ], 37 | "payable": false, 38 | "stateMutability": "view", 39 | "type": "function" 40 | }, 41 | { 42 | "constant": false, 43 | "inputs": [ 44 | { 45 | "name": "_newOwner", 46 | "type": "address" 47 | } 48 | ], 49 | "name": "transferOwnership", 50 | "outputs": [], 51 | "payable": false, 52 | "stateMutability": "nonpayable", 53 | "type": "function" 54 | }, 55 | { 56 | "inputs": [], 57 | "payable": false, 58 | "stateMutability": "nonpayable", 59 | "type": "constructor" 60 | }, 61 | { 62 | "anonymous": false, 63 | "inputs": [ 64 | { 65 | "indexed": false, 66 | "name": "_prevOwner", 67 | "type": "address" 68 | }, 69 | { 70 | "indexed": false, 71 | "name": "_newOwner", 72 | "type": "address" 73 | } 74 | ], 75 | "name": "OwnerUpdate", 76 | "type": "event" 77 | } 78 | ], 79 | "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506104aa8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806379ba5097146100675780638da5cb5b1461007c578063d4ee1d90146100d1578063f2fde38b14610126575b600080fd5b341561007257600080fd5b61007a61015f565b005b341561008757600080fd5b61008f61033b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100dc57600080fd5b6100e4610360565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561013157600080fd5b61015d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610386565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156101bb57600080fd5b7f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103de57fe5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561043a57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820959d360d892b3fb6bd726643efbdf0d1cd283a957989421deb426118c24af3ec0029", 80 | "deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806379ba5097146100675780638da5cb5b1461007c578063d4ee1d90146100d1578063f2fde38b14610126575b600080fd5b341561007257600080fd5b61007a61015f565b005b341561008757600080fd5b61008f61033b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100dc57600080fd5b6100e4610360565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561013157600080fd5b61015d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610386565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156101bb57600080fd5b7f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103de57fe5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561043a57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820959d360d892b3fb6bd726643efbdf0d1cd283a957989421deb426118c24af3ec0029", 81 | "sourceMap": "95:910:2:-;;;290:59;;;;;;;;332:10;324:5;;:18;;;;;;;;;;;;;;;;;;95:910;;;;;;", 82 | "deployedSourceMap": "95:910:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;833:170;;;;;;;;;;;;;;126:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;152:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;616:137;;;;;;;;;;;;;;;;;;;;;;;;;;;;833:170;899:8;;;;;;;;;;;885:22;;:10;:22;;;877:31;;;;;;;;918:28;930:5;;;;;;;;;;;937:8;;;;;;;;;;;918:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;964:8;;;;;;;;;;;956:5;;:16;;;;;;;;;;;;;;;;;;993:3;982:8;;:14;;;;;;;;;;;;;;;;;;833:170::o;126:20::-;;;;;;;;;;;;;:::o;152:23::-;;;;;;;;;;;;;:::o;616:137::-;474:5;;;;;;;;;;;460:19;;:10;:19;;;453:27;;;;;;710:5;;;;;;;;;;;697:18;;:9;:18;;;;689:27;;;;;;;;737:9;726:8;;:20;;;;;;;;;;;;;;;;;;616:137;:::o", 83 | "source": "pragma solidity ^0.4.17;\nimport './interfaces/IOwned.sol';\n\n/*\n owned 是一个管理者\n*/\ncontract Owned is IOwned {\n address public owner;\n address public newOwner;\n\n event OwnerUpdate(address _prevOwner, address _newOwner);\n\n /**\n * 初始化构造函数\n */\n function Owned() public {\n owner = msg.sender;\n }\n\n /**\n * 判断当前合约调用者是否是管理员\n */\n modifier onlyOwner {\n assert(msg.sender == owner);\n _;\n }\n\n /**\n * 指派一个新的管理员\n * @param _newOwner address 新的管理员帐户地址\n */\n function transferOwnership(address _newOwner) public onlyOwner {\n require(_newOwner != owner);\n newOwner = _newOwner;\n }\n\n /**\n @dev 新的管理员,确认接受做为管理员\n */\n function acceptOwnership() public {\n require(msg.sender == newOwner);\n OwnerUpdate(owner, newOwner);\n owner = newOwner;\n newOwner = 0x0;\n }\n}\n", 84 | "sourcePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/Owned.sol", 85 | "ast": { 86 | "attributes": { 87 | "absolutePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/Owned.sol", 88 | "exportedSymbols": { 89 | "Owned": [ 90 | 550 91 | ] 92 | } 93 | }, 94 | "children": [ 95 | { 96 | "attributes": { 97 | "literals": [ 98 | "solidity", 99 | "^", 100 | "0.4", 101 | ".17" 102 | ] 103 | }, 104 | "id": 474, 105 | "name": "PragmaDirective", 106 | "src": "0:24:2" 107 | }, 108 | { 109 | "attributes": { 110 | "SourceUnit": 1187, 111 | "absolutePath": "/Users/lion/my_project/_eth/test_truffle1/contracts/interfaces/IOwned.sol", 112 | "file": "./interfaces/IOwned.sol", 113 | "scope": 551, 114 | "symbolAliases": [ 115 | null 116 | ], 117 | "unitAlias": "" 118 | }, 119 | "id": 475, 120 | "name": "ImportDirective", 121 | "src": "25:33:2" 122 | }, 123 | { 124 | "attributes": { 125 | "contractDependencies": [ 126 | 1186 127 | ], 128 | "contractKind": "contract", 129 | "documentation": null, 130 | "fullyImplemented": true, 131 | "linearizedBaseContracts": [ 132 | 550, 133 | 1186 134 | ], 135 | "name": "Owned", 136 | "scope": 551 137 | }, 138 | "children": [ 139 | { 140 | "attributes": { 141 | "arguments": [ 142 | null 143 | ] 144 | }, 145 | "children": [ 146 | { 147 | "attributes": { 148 | "contractScope": null, 149 | "name": "IOwned", 150 | "referencedDeclaration": 1186, 151 | "type": "contract IOwned" 152 | }, 153 | "id": 476, 154 | "name": "UserDefinedTypeName", 155 | "src": "113:6:2" 156 | } 157 | ], 158 | "id": 477, 159 | "name": "InheritanceSpecifier", 160 | "src": "113:6:2" 161 | }, 162 | { 163 | "attributes": { 164 | "constant": false, 165 | "name": "owner", 166 | "scope": 550, 167 | "stateVariable": true, 168 | "storageLocation": "default", 169 | "type": "address", 170 | "value": null, 171 | "visibility": "public" 172 | }, 173 | "children": [ 174 | { 175 | "attributes": { 176 | "name": "address", 177 | "type": "address" 178 | }, 179 | "id": 478, 180 | "name": "ElementaryTypeName", 181 | "src": "126:7:2" 182 | } 183 | ], 184 | "id": 479, 185 | "name": "VariableDeclaration", 186 | "src": "126:20:2" 187 | }, 188 | { 189 | "attributes": { 190 | "constant": false, 191 | "name": "newOwner", 192 | "scope": 550, 193 | "stateVariable": true, 194 | "storageLocation": "default", 195 | "type": "address", 196 | "value": null, 197 | "visibility": "public" 198 | }, 199 | "children": [ 200 | { 201 | "attributes": { 202 | "name": "address", 203 | "type": "address" 204 | }, 205 | "id": 480, 206 | "name": "ElementaryTypeName", 207 | "src": "152:7:2" 208 | } 209 | ], 210 | "id": 481, 211 | "name": "VariableDeclaration", 212 | "src": "152:23:2" 213 | }, 214 | { 215 | "attributes": { 216 | "anonymous": false, 217 | "name": "OwnerUpdate" 218 | }, 219 | "children": [ 220 | { 221 | "children": [ 222 | { 223 | "attributes": { 224 | "constant": false, 225 | "indexed": false, 226 | "name": "_prevOwner", 227 | "scope": 487, 228 | "stateVariable": false, 229 | "storageLocation": "default", 230 | "type": "address", 231 | "value": null, 232 | "visibility": "internal" 233 | }, 234 | "children": [ 235 | { 236 | "attributes": { 237 | "name": "address", 238 | "type": "address" 239 | }, 240 | "id": 482, 241 | "name": "ElementaryTypeName", 242 | "src": "200:7:2" 243 | } 244 | ], 245 | "id": 483, 246 | "name": "VariableDeclaration", 247 | "src": "200:18:2" 248 | }, 249 | { 250 | "attributes": { 251 | "constant": false, 252 | "indexed": false, 253 | "name": "_newOwner", 254 | "scope": 487, 255 | "stateVariable": false, 256 | "storageLocation": "default", 257 | "type": "address", 258 | "value": null, 259 | "visibility": "internal" 260 | }, 261 | "children": [ 262 | { 263 | "attributes": { 264 | "name": "address", 265 | "type": "address" 266 | }, 267 | "id": 484, 268 | "name": "ElementaryTypeName", 269 | "src": "220:7:2" 270 | } 271 | ], 272 | "id": 485, 273 | "name": "VariableDeclaration", 274 | "src": "220:17:2" 275 | } 276 | ], 277 | "id": 486, 278 | "name": "ParameterList", 279 | "src": "199:39:2" 280 | } 281 | ], 282 | "id": 487, 283 | "name": "EventDefinition", 284 | "src": "182:57:2" 285 | }, 286 | { 287 | "attributes": { 288 | "constant": false, 289 | "implemented": true, 290 | "isConstructor": true, 291 | "modifiers": [ 292 | null 293 | ], 294 | "name": "Owned", 295 | "payable": false, 296 | "scope": 550, 297 | "stateMutability": "nonpayable", 298 | "superFunction": null, 299 | "visibility": "public" 300 | }, 301 | "children": [ 302 | { 303 | "attributes": { 304 | "parameters": [ 305 | null 306 | ] 307 | }, 308 | "children": [], 309 | "id": 488, 310 | "name": "ParameterList", 311 | "src": "304:2:2" 312 | }, 313 | { 314 | "attributes": { 315 | "parameters": [ 316 | null 317 | ] 318 | }, 319 | "children": [], 320 | "id": 489, 321 | "name": "ParameterList", 322 | "src": "314:0:2" 323 | }, 324 | { 325 | "children": [ 326 | { 327 | "children": [ 328 | { 329 | "attributes": { 330 | "argumentTypes": null, 331 | "isConstant": false, 332 | "isLValue": false, 333 | "isPure": false, 334 | "lValueRequested": false, 335 | "operator": "=", 336 | "type": "address" 337 | }, 338 | "children": [ 339 | { 340 | "attributes": { 341 | "argumentTypes": null, 342 | "overloadedDeclarations": [ 343 | 479 344 | ], 345 | "referencedDeclaration": 479, 346 | "type": "address", 347 | "value": "owner" 348 | }, 349 | "id": 490, 350 | "name": "Identifier", 351 | "src": "324:5:2" 352 | }, 353 | { 354 | "attributes": { 355 | "argumentTypes": null, 356 | "isConstant": false, 357 | "isLValue": false, 358 | "isPure": false, 359 | "lValueRequested": false, 360 | "member_name": "sender", 361 | "referencedDeclaration": null, 362 | "type": "address" 363 | }, 364 | "children": [ 365 | { 366 | "attributes": { 367 | "argumentTypes": null, 368 | "overloadedDeclarations": [ 369 | null 370 | ], 371 | "referencedDeclaration": 1297, 372 | "type": "msg", 373 | "value": "msg" 374 | }, 375 | "id": 491, 376 | "name": "Identifier", 377 | "src": "332:3:2" 378 | } 379 | ], 380 | "id": 492, 381 | "name": "MemberAccess", 382 | "src": "332:10:2" 383 | } 384 | ], 385 | "id": 493, 386 | "name": "Assignment", 387 | "src": "324:18:2" 388 | } 389 | ], 390 | "id": 494, 391 | "name": "ExpressionStatement", 392 | "src": "324:18:2" 393 | } 394 | ], 395 | "id": 495, 396 | "name": "Block", 397 | "src": "314:35:2" 398 | } 399 | ], 400 | "id": 496, 401 | "name": "FunctionDefinition", 402 | "src": "290:59:2" 403 | }, 404 | { 405 | "attributes": { 406 | "name": "onlyOwner", 407 | "visibility": "internal" 408 | }, 409 | "children": [ 410 | { 411 | "attributes": { 412 | "parameters": [ 413 | null 414 | ] 415 | }, 416 | "children": [], 417 | "id": 497, 418 | "name": "ParameterList", 419 | "src": "443:0:2" 420 | }, 421 | { 422 | "children": [ 423 | { 424 | "children": [ 425 | { 426 | "attributes": { 427 | "argumentTypes": null, 428 | "isConstant": false, 429 | "isLValue": false, 430 | "isPure": false, 431 | "isStructConstructorCall": false, 432 | "lValueRequested": false, 433 | "names": [ 434 | null 435 | ], 436 | "type": "tuple()", 437 | "type_conversion": false 438 | }, 439 | "children": [ 440 | { 441 | "attributes": { 442 | "argumentTypes": [ 443 | { 444 | "typeIdentifier": "t_bool", 445 | "typeString": "bool" 446 | } 447 | ], 448 | "overloadedDeclarations": [ 449 | null 450 | ], 451 | "referencedDeclaration": 1288, 452 | "type": "function (bool) pure", 453 | "value": "assert" 454 | }, 455 | "id": 498, 456 | "name": "Identifier", 457 | "src": "453:6:2" 458 | }, 459 | { 460 | "attributes": { 461 | "argumentTypes": null, 462 | "commonType": { 463 | "typeIdentifier": "t_address", 464 | "typeString": "address" 465 | }, 466 | "isConstant": false, 467 | "isLValue": false, 468 | "isPure": false, 469 | "lValueRequested": false, 470 | "operator": "==", 471 | "type": "bool" 472 | }, 473 | "children": [ 474 | { 475 | "attributes": { 476 | "argumentTypes": null, 477 | "isConstant": false, 478 | "isLValue": false, 479 | "isPure": false, 480 | "lValueRequested": false, 481 | "member_name": "sender", 482 | "referencedDeclaration": null, 483 | "type": "address" 484 | }, 485 | "children": [ 486 | { 487 | "attributes": { 488 | "argumentTypes": null, 489 | "overloadedDeclarations": [ 490 | null 491 | ], 492 | "referencedDeclaration": 1297, 493 | "type": "msg", 494 | "value": "msg" 495 | }, 496 | "id": 499, 497 | "name": "Identifier", 498 | "src": "460:3:2" 499 | } 500 | ], 501 | "id": 500, 502 | "name": "MemberAccess", 503 | "src": "460:10:2" 504 | }, 505 | { 506 | "attributes": { 507 | "argumentTypes": null, 508 | "overloadedDeclarations": [ 509 | 479 510 | ], 511 | "referencedDeclaration": 479, 512 | "type": "address", 513 | "value": "owner" 514 | }, 515 | "id": 501, 516 | "name": "Identifier", 517 | "src": "474:5:2" 518 | } 519 | ], 520 | "id": 502, 521 | "name": "BinaryOperation", 522 | "src": "460:19:2" 523 | } 524 | ], 525 | "id": 503, 526 | "name": "FunctionCall", 527 | "src": "453:27:2" 528 | } 529 | ], 530 | "id": 504, 531 | "name": "ExpressionStatement", 532 | "src": "453:27:2" 533 | }, 534 | { 535 | "id": 505, 536 | "name": "PlaceholderStatement", 537 | "src": "490:1:2" 538 | } 539 | ], 540 | "id": 506, 541 | "name": "Block", 542 | "src": "443:55:2" 543 | } 544 | ], 545 | "id": 507, 546 | "name": "ModifierDefinition", 547 | "src": "424:74:2" 548 | }, 549 | { 550 | "attributes": { 551 | "constant": false, 552 | "implemented": true, 553 | "isConstructor": false, 554 | "name": "transferOwnership", 555 | "payable": false, 556 | "scope": 550, 557 | "stateMutability": "nonpayable", 558 | "superFunction": 1182, 559 | "visibility": "public" 560 | }, 561 | "children": [ 562 | { 563 | "children": [ 564 | { 565 | "attributes": { 566 | "constant": false, 567 | "name": "_newOwner", 568 | "scope": 525, 569 | "stateVariable": false, 570 | "storageLocation": "default", 571 | "type": "address", 572 | "value": null, 573 | "visibility": "internal" 574 | }, 575 | "children": [ 576 | { 577 | "attributes": { 578 | "name": "address", 579 | "type": "address" 580 | }, 581 | "id": 508, 582 | "name": "ElementaryTypeName", 583 | "src": "643:7:2" 584 | } 585 | ], 586 | "id": 509, 587 | "name": "VariableDeclaration", 588 | "src": "643:17:2" 589 | } 590 | ], 591 | "id": 510, 592 | "name": "ParameterList", 593 | "src": "642:19:2" 594 | }, 595 | { 596 | "attributes": { 597 | "parameters": [ 598 | null 599 | ] 600 | }, 601 | "children": [], 602 | "id": 513, 603 | "name": "ParameterList", 604 | "src": "679:0:2" 605 | }, 606 | { 607 | "attributes": { 608 | "arguments": [ 609 | null 610 | ] 611 | }, 612 | "children": [ 613 | { 614 | "attributes": { 615 | "argumentTypes": null, 616 | "overloadedDeclarations": [ 617 | null 618 | ], 619 | "referencedDeclaration": 507, 620 | "type": "modifier ()", 621 | "value": "onlyOwner" 622 | }, 623 | "id": 511, 624 | "name": "Identifier", 625 | "src": "669:9:2" 626 | } 627 | ], 628 | "id": 512, 629 | "name": "ModifierInvocation", 630 | "src": "669:9:2" 631 | }, 632 | { 633 | "children": [ 634 | { 635 | "children": [ 636 | { 637 | "attributes": { 638 | "argumentTypes": null, 639 | "isConstant": false, 640 | "isLValue": false, 641 | "isPure": false, 642 | "isStructConstructorCall": false, 643 | "lValueRequested": false, 644 | "names": [ 645 | null 646 | ], 647 | "type": "tuple()", 648 | "type_conversion": false 649 | }, 650 | "children": [ 651 | { 652 | "attributes": { 653 | "argumentTypes": [ 654 | { 655 | "typeIdentifier": "t_bool", 656 | "typeString": "bool" 657 | } 658 | ], 659 | "overloadedDeclarations": [ 660 | null 661 | ], 662 | "referencedDeclaration": 1300, 663 | "type": "function (bool) pure", 664 | "value": "require" 665 | }, 666 | "id": 514, 667 | "name": "Identifier", 668 | "src": "689:7:2" 669 | }, 670 | { 671 | "attributes": { 672 | "argumentTypes": null, 673 | "commonType": { 674 | "typeIdentifier": "t_address", 675 | "typeString": "address" 676 | }, 677 | "isConstant": false, 678 | "isLValue": false, 679 | "isPure": false, 680 | "lValueRequested": false, 681 | "operator": "!=", 682 | "type": "bool" 683 | }, 684 | "children": [ 685 | { 686 | "attributes": { 687 | "argumentTypes": null, 688 | "overloadedDeclarations": [ 689 | null 690 | ], 691 | "referencedDeclaration": 509, 692 | "type": "address", 693 | "value": "_newOwner" 694 | }, 695 | "id": 515, 696 | "name": "Identifier", 697 | "src": "697:9:2" 698 | }, 699 | { 700 | "attributes": { 701 | "argumentTypes": null, 702 | "overloadedDeclarations": [ 703 | 479 704 | ], 705 | "referencedDeclaration": 479, 706 | "type": "address", 707 | "value": "owner" 708 | }, 709 | "id": 516, 710 | "name": "Identifier", 711 | "src": "710:5:2" 712 | } 713 | ], 714 | "id": 517, 715 | "name": "BinaryOperation", 716 | "src": "697:18:2" 717 | } 718 | ], 719 | "id": 518, 720 | "name": "FunctionCall", 721 | "src": "689:27:2" 722 | } 723 | ], 724 | "id": 519, 725 | "name": "ExpressionStatement", 726 | "src": "689:27:2" 727 | }, 728 | { 729 | "children": [ 730 | { 731 | "attributes": { 732 | "argumentTypes": null, 733 | "isConstant": false, 734 | "isLValue": false, 735 | "isPure": false, 736 | "lValueRequested": false, 737 | "operator": "=", 738 | "type": "address" 739 | }, 740 | "children": [ 741 | { 742 | "attributes": { 743 | "argumentTypes": null, 744 | "overloadedDeclarations": [ 745 | null 746 | ], 747 | "referencedDeclaration": 481, 748 | "type": "address", 749 | "value": "newOwner" 750 | }, 751 | "id": 520, 752 | "name": "Identifier", 753 | "src": "726:8:2" 754 | }, 755 | { 756 | "attributes": { 757 | "argumentTypes": null, 758 | "overloadedDeclarations": [ 759 | null 760 | ], 761 | "referencedDeclaration": 509, 762 | "type": "address", 763 | "value": "_newOwner" 764 | }, 765 | "id": 521, 766 | "name": "Identifier", 767 | "src": "737:9:2" 768 | } 769 | ], 770 | "id": 522, 771 | "name": "Assignment", 772 | "src": "726:20:2" 773 | } 774 | ], 775 | "id": 523, 776 | "name": "ExpressionStatement", 777 | "src": "726:20:2" 778 | } 779 | ], 780 | "id": 524, 781 | "name": "Block", 782 | "src": "679:74:2" 783 | } 784 | ], 785 | "id": 525, 786 | "name": "FunctionDefinition", 787 | "src": "616:137:2" 788 | }, 789 | { 790 | "attributes": { 791 | "constant": false, 792 | "implemented": true, 793 | "isConstructor": false, 794 | "modifiers": [ 795 | null 796 | ], 797 | "name": "acceptOwnership", 798 | "payable": false, 799 | "scope": 550, 800 | "stateMutability": "nonpayable", 801 | "superFunction": 1185, 802 | "visibility": "public" 803 | }, 804 | "children": [ 805 | { 806 | "attributes": { 807 | "parameters": [ 808 | null 809 | ] 810 | }, 811 | "children": [], 812 | "id": 526, 813 | "name": "ParameterList", 814 | "src": "857:2:2" 815 | }, 816 | { 817 | "attributes": { 818 | "parameters": [ 819 | null 820 | ] 821 | }, 822 | "children": [], 823 | "id": 527, 824 | "name": "ParameterList", 825 | "src": "867:0:2" 826 | }, 827 | { 828 | "children": [ 829 | { 830 | "children": [ 831 | { 832 | "attributes": { 833 | "argumentTypes": null, 834 | "isConstant": false, 835 | "isLValue": false, 836 | "isPure": false, 837 | "isStructConstructorCall": false, 838 | "lValueRequested": false, 839 | "names": [ 840 | null 841 | ], 842 | "type": "tuple()", 843 | "type_conversion": false 844 | }, 845 | "children": [ 846 | { 847 | "attributes": { 848 | "argumentTypes": [ 849 | { 850 | "typeIdentifier": "t_bool", 851 | "typeString": "bool" 852 | } 853 | ], 854 | "overloadedDeclarations": [ 855 | null 856 | ], 857 | "referencedDeclaration": 1300, 858 | "type": "function (bool) pure", 859 | "value": "require" 860 | }, 861 | "id": 528, 862 | "name": "Identifier", 863 | "src": "877:7:2" 864 | }, 865 | { 866 | "attributes": { 867 | "argumentTypes": null, 868 | "commonType": { 869 | "typeIdentifier": "t_address", 870 | "typeString": "address" 871 | }, 872 | "isConstant": false, 873 | "isLValue": false, 874 | "isPure": false, 875 | "lValueRequested": false, 876 | "operator": "==", 877 | "type": "bool" 878 | }, 879 | "children": [ 880 | { 881 | "attributes": { 882 | "argumentTypes": null, 883 | "isConstant": false, 884 | "isLValue": false, 885 | "isPure": false, 886 | "lValueRequested": false, 887 | "member_name": "sender", 888 | "referencedDeclaration": null, 889 | "type": "address" 890 | }, 891 | "children": [ 892 | { 893 | "attributes": { 894 | "argumentTypes": null, 895 | "overloadedDeclarations": [ 896 | null 897 | ], 898 | "referencedDeclaration": 1297, 899 | "type": "msg", 900 | "value": "msg" 901 | }, 902 | "id": 529, 903 | "name": "Identifier", 904 | "src": "885:3:2" 905 | } 906 | ], 907 | "id": 530, 908 | "name": "MemberAccess", 909 | "src": "885:10:2" 910 | }, 911 | { 912 | "attributes": { 913 | "argumentTypes": null, 914 | "overloadedDeclarations": [ 915 | null 916 | ], 917 | "referencedDeclaration": 481, 918 | "type": "address", 919 | "value": "newOwner" 920 | }, 921 | "id": 531, 922 | "name": "Identifier", 923 | "src": "899:8:2" 924 | } 925 | ], 926 | "id": 532, 927 | "name": "BinaryOperation", 928 | "src": "885:22:2" 929 | } 930 | ], 931 | "id": 533, 932 | "name": "FunctionCall", 933 | "src": "877:31:2" 934 | } 935 | ], 936 | "id": 534, 937 | "name": "ExpressionStatement", 938 | "src": "877:31:2" 939 | }, 940 | { 941 | "children": [ 942 | { 943 | "attributes": { 944 | "argumentTypes": null, 945 | "isConstant": false, 946 | "isLValue": false, 947 | "isPure": false, 948 | "isStructConstructorCall": false, 949 | "lValueRequested": false, 950 | "names": [ 951 | null 952 | ], 953 | "type": "tuple()", 954 | "type_conversion": false 955 | }, 956 | "children": [ 957 | { 958 | "attributes": { 959 | "argumentTypes": [ 960 | { 961 | "typeIdentifier": "t_address", 962 | "typeString": "address" 963 | }, 964 | { 965 | "typeIdentifier": "t_address", 966 | "typeString": "address" 967 | } 968 | ], 969 | "overloadedDeclarations": [ 970 | null 971 | ], 972 | "referencedDeclaration": 487, 973 | "type": "function (address,address)", 974 | "value": "OwnerUpdate" 975 | }, 976 | "id": 535, 977 | "name": "Identifier", 978 | "src": "918:11:2" 979 | }, 980 | { 981 | "attributes": { 982 | "argumentTypes": null, 983 | "overloadedDeclarations": [ 984 | 479 985 | ], 986 | "referencedDeclaration": 479, 987 | "type": "address", 988 | "value": "owner" 989 | }, 990 | "id": 536, 991 | "name": "Identifier", 992 | "src": "930:5:2" 993 | }, 994 | { 995 | "attributes": { 996 | "argumentTypes": null, 997 | "overloadedDeclarations": [ 998 | null 999 | ], 1000 | "referencedDeclaration": 481, 1001 | "type": "address", 1002 | "value": "newOwner" 1003 | }, 1004 | "id": 537, 1005 | "name": "Identifier", 1006 | "src": "937:8:2" 1007 | } 1008 | ], 1009 | "id": 538, 1010 | "name": "FunctionCall", 1011 | "src": "918:28:2" 1012 | } 1013 | ], 1014 | "id": 539, 1015 | "name": "ExpressionStatement", 1016 | "src": "918:28:2" 1017 | }, 1018 | { 1019 | "children": [ 1020 | { 1021 | "attributes": { 1022 | "argumentTypes": null, 1023 | "isConstant": false, 1024 | "isLValue": false, 1025 | "isPure": false, 1026 | "lValueRequested": false, 1027 | "operator": "=", 1028 | "type": "address" 1029 | }, 1030 | "children": [ 1031 | { 1032 | "attributes": { 1033 | "argumentTypes": null, 1034 | "overloadedDeclarations": [ 1035 | 479 1036 | ], 1037 | "referencedDeclaration": 479, 1038 | "type": "address", 1039 | "value": "owner" 1040 | }, 1041 | "id": 540, 1042 | "name": "Identifier", 1043 | "src": "956:5:2" 1044 | }, 1045 | { 1046 | "attributes": { 1047 | "argumentTypes": null, 1048 | "overloadedDeclarations": [ 1049 | null 1050 | ], 1051 | "referencedDeclaration": 481, 1052 | "type": "address", 1053 | "value": "newOwner" 1054 | }, 1055 | "id": 541, 1056 | "name": "Identifier", 1057 | "src": "964:8:2" 1058 | } 1059 | ], 1060 | "id": 542, 1061 | "name": "Assignment", 1062 | "src": "956:16:2" 1063 | } 1064 | ], 1065 | "id": 543, 1066 | "name": "ExpressionStatement", 1067 | "src": "956:16:2" 1068 | }, 1069 | { 1070 | "children": [ 1071 | { 1072 | "attributes": { 1073 | "argumentTypes": null, 1074 | "isConstant": false, 1075 | "isLValue": false, 1076 | "isPure": false, 1077 | "lValueRequested": false, 1078 | "operator": "=", 1079 | "type": "address" 1080 | }, 1081 | "children": [ 1082 | { 1083 | "attributes": { 1084 | "argumentTypes": null, 1085 | "overloadedDeclarations": [ 1086 | null 1087 | ], 1088 | "referencedDeclaration": 481, 1089 | "type": "address", 1090 | "value": "newOwner" 1091 | }, 1092 | "id": 544, 1093 | "name": "Identifier", 1094 | "src": "982:8:2" 1095 | }, 1096 | { 1097 | "attributes": { 1098 | "argumentTypes": null, 1099 | "hexvalue": "307830", 1100 | "isConstant": false, 1101 | "isLValue": false, 1102 | "isPure": true, 1103 | "lValueRequested": false, 1104 | "subdenomination": null, 1105 | "token": "number", 1106 | "type": "int_const 0", 1107 | "value": "0x0" 1108 | }, 1109 | "id": 545, 1110 | "name": "Literal", 1111 | "src": "993:3:2" 1112 | } 1113 | ], 1114 | "id": 546, 1115 | "name": "Assignment", 1116 | "src": "982:14:2" 1117 | } 1118 | ], 1119 | "id": 547, 1120 | "name": "ExpressionStatement", 1121 | "src": "982:14:2" 1122 | } 1123 | ], 1124 | "id": 548, 1125 | "name": "Block", 1126 | "src": "867:136:2" 1127 | } 1128 | ], 1129 | "id": 549, 1130 | "name": "FunctionDefinition", 1131 | "src": "833:170:2" 1132 | } 1133 | ], 1134 | "id": 550, 1135 | "name": "ContractDefinition", 1136 | "src": "95:910:2" 1137 | } 1138 | ], 1139 | "id": 551, 1140 | "name": "SourceUnit", 1141 | "src": "0:1006:2" 1142 | }, 1143 | "compiler": { 1144 | "name": "solc", 1145 | "version": "0.4.18+commit.9cf6e910.Emscripten.clang" 1146 | }, 1147 | "networks": { 1148 | "1509885692861": { 1149 | "events": {}, 1150 | "links": {}, 1151 | "address": "0xf6827b6acea6cb5dbb02cfc9d0ff15800aaae2eb" 1152 | } 1153 | }, 1154 | "schemaVersion": "1.0.1", 1155 | "updatedAt": "2017-11-05T13:45:28.492Z" 1156 | } -------------------------------------------------------------------------------- /contracts/Crowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | 3 | 4 | import './Utils.sol'; 5 | import './interfaces/ISmartToken.sol'; 6 | 7 | 8 | /** 9 | * 众筹合约 10 | */ 11 | contract Crowdsale is Utils { 12 | address public beneficiary = 0x0; //受益人地址,测试时为合约创建者 13 | uint256 public fundingGoal = 100 ether; //众筹目标,单位是ether 14 | uint256 public amountRaised = 0; //已筹集金额数量, 单位是wei 15 | uint256 public deadline; //截止时间 16 | uint256 public price; //代币价格 17 | bool public fundingGoalReached = false; //达成众筹目标 18 | bool public crowdsaleClosed = false; //众筹关闭 19 | 20 | ISmartToken public token; // smart token 21 | 22 | mapping(address => uint256) public balance; //保存众筹地址 23 | 24 | //记录已接收的ether通知 25 | event GoalReached(address _beneficiary, uint _amountRaised); 26 | 27 | //转帐通知 28 | event FundTransfer(address _backer, uint _amount, bool _isContribution); 29 | 30 | /** 31 | * 初始化构造函数 32 | * 33 | * @param _beneficiary 受益人地址 34 | * @param _fundingGoalInEthers 众筹以太币总量 35 | * @param _durationInMinutes 众筹截止,单位是分钟 36 | * @param _token 众筹代币 37 | */ 38 | function Crowdsale( 39 | address _beneficiary, 40 | uint _fundingGoalInEthers, 41 | uint _durationInMinutes, 42 | ISmartToken _token 43 | ) 44 | public 45 | validAddress(_beneficiary) 46 | { 47 | token = _token; 48 | beneficiary = _beneficiary; 49 | fundingGoal = _fundingGoalInEthers * 1 ether; 50 | deadline = now + _durationInMinutes * 1 minutes; 51 | price = 500 finney; //1个以太币可以买 2 个代币 52 | } 53 | 54 | 55 | /** 56 | * 默认函数 57 | * 58 | * 默认函数,可以向合约直接打款 59 | */ 60 | function () payable public { 61 | 62 | //判断是否关闭众筹 63 | require(!crowdsaleClosed); 64 | uint amount = msg.value; 65 | 66 | //捐款人的金额累加 67 | balance[msg.sender] += amount; 68 | 69 | //捐款总额累加 70 | amountRaised += amount; 71 | 72 | //转帐操作,转多少代币给捐款人 73 | token.issue(msg.sender, amount / price); 74 | FundTransfer(msg.sender, amount, true); 75 | } 76 | 77 | /** 78 | * 判断是否已经过了众筹截止限期 79 | */ 80 | modifier afterDeadline() { if (now >= deadline) _; } 81 | 82 | /** 83 | * 检测众筹目标是否已经达到 84 | */ 85 | function checkGoalReached() public afterDeadline { 86 | if (amountRaised >= fundingGoal){ 87 | //达成众筹目标 88 | fundingGoalReached = true; 89 | GoalReached(beneficiary, amountRaised); 90 | } 91 | 92 | //关闭众筹 93 | crowdsaleClosed = true; 94 | } 95 | 96 | 97 | /** 98 | * 收回资金 99 | * 100 | * 检查是否达到了目标或时间限制,如果有,并且达到了资金目标, 101 | * 将全部金额发送给受益人。如果没有达到目标,每个贡献者都可以退出 102 | * 他们贡献的金额 103 | */ 104 | function safeWithdrawal() public afterDeadline { 105 | 106 | //如果没有达成众筹目标 107 | if (!fundingGoalReached) { 108 | //获取合约调用者已捐款余额 109 | uint amount = balance[msg.sender]; 110 | 111 | if (amount > 0) { 112 | //返回合约发起者所有余额 113 | msg.sender.transfer(amount); 114 | FundTransfer(msg.sender, amount, false); 115 | balance[msg.sender] = 0; 116 | } 117 | } 118 | 119 | //如果达成众筹目标,并且合约调用者是受益人 120 | if (fundingGoalReached && beneficiary == msg.sender) { 121 | 122 | //将所有捐款从合约中给受益人 123 | beneficiary.transfer(amountRaised); 124 | 125 | FundTransfer(beneficiary, amount, false); 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /contracts/MyAdvancedToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | import './Token.sol'; 3 | import './Owned.sol'; 4 | import './interfaces/IMyAdvancedToken.sol'; 5 | 6 | /** 7 | * @title 高级版代币 8 | * 增加冻结用户、挖矿、根据指定汇率购买(售出)代币价格的功能 9 | */ 10 | contract MyAdvancedToken is IMyAdvancedToken, Owned, Token { 11 | 12 | //卖出的汇率,一个代币,可以卖出多少个以太币,单位是wei 13 | uint256 public sellPrice; 14 | 15 | //买入的汇率,1个以太币,可以买几个代币 16 | uint256 public buyPrice; 17 | 18 | //是否冻结帐户的列表 19 | mapping (address => bool) public frozenAccount; 20 | 21 | //定义一个事件,当有资产被冻结的时候,通知正在监听事件的客户端 22 | event FrozenFunds(address target, bool frozen); 23 | 24 | 25 | /*初始化合约,并且把初始的所有的令牌都给这合约的创建者 26 | */ 27 | function MyAdvancedToken() 28 | public 29 | Token ('mshk.top Advanced Token', 'MSHK-H', 2) 30 | { 31 | sellPrice = 2; //设置1个单位的代币(单位是wei),能够卖出2个以太币 32 | buyPrice = 4; //设置1个以太币,可以买0.25个代币 33 | } 34 | 35 | 36 | /** 37 | * 私有方法,从指定帐户转出余额 38 | * @param _from address 发送代币的地址 39 | * @param _to address 接受代币的地址 40 | * @param _value uint256 接受代币的数量 41 | */ 42 | function _transfer(address _from, address _to, uint _value) 43 | validAddress(_from) 44 | validAddress(_to) 45 | internal 46 | { 47 | //检查发送者是否拥有足够余额 48 | require (balanceOf[_from] > _value); 49 | 50 | //检查是否溢出 51 | require (balanceOf[_to] + _value > balanceOf[_to]); 52 | 53 | //检查 冻结帐户 54 | require(!frozenAccount[_from]); 55 | require(!frozenAccount[_to]); 56 | 57 | 58 | 59 | //从发送者减掉发送额 60 | balanceOf[_from] = safeSub(balanceOf[_from], _value); 61 | 62 | //给接收者加上相同的量 63 | balanceOf[_to] = safeAdd(balanceOf[_to], _value); 64 | 65 | //通知任何监听该交易的客户端 66 | Transfer(_from, _to, _value); 67 | 68 | } 69 | 70 | /** 71 | * 合约拥有者,可以为指定帐户创造一些代币 72 | * @param target address 帐户地址 73 | * @param mintedAmount uint256 增加的金额(单位是wei) 74 | */ 75 | function mintToken(address target, uint256 mintedAmount) 76 | validAddress(target) 77 | public 78 | onlyOwner 79 | { 80 | 81 | //给指定地址增加代币,同时总量也相加 82 | balanceOf[target] += mintedAmount; 83 | totalSupply += mintedAmount; 84 | 85 | 86 | Transfer(0, this, mintedAmount); 87 | Transfer(this, target, mintedAmount); 88 | } 89 | 90 | /** 91 | * 增加冻结帐户名称 92 | * 93 | * 你可能需要监管功能以便你能控制谁可以/谁不可以使用你创建的代币合约 94 | * 95 | * @param target address 帐户地址 96 | * @param freeze bool 是否冻结 97 | */ 98 | function freezeAccount(address target, bool freeze) 99 | validAddress(target) 100 | public 101 | onlyOwner 102 | { 103 | frozenAccount[target] = freeze; 104 | FrozenFunds(target, freeze); 105 | } 106 | 107 | /** 108 | * 设置买卖价格 109 | * 110 | * 如果你想让ether(或其他代币)为你的代币进行背书,以便可以市场价自动化买卖代币,我们可以这么做。如果要使用浮动的价格,也可以在这里设置 111 | * 112 | * @param newSellPrice 新的卖出价格 113 | * @param newBuyPrice 新的买入价格 114 | */ 115 | function setPrices(uint256 newSellPrice, uint256 newBuyPrice) public onlyOwner { 116 | sellPrice = newSellPrice; 117 | buyPrice = newBuyPrice; 118 | } 119 | 120 | /** 121 | * 使用以太币购买代币 122 | */ 123 | function buy() payable public { 124 | uint amount = msg.value / buyPrice; 125 | 126 | _transfer(this, msg.sender, amount); 127 | } 128 | 129 | /** 130 | * @dev 卖出代币 131 | * @return 要卖出的数量(单位是wei) 132 | */ 133 | function sell(uint256 amount) public { 134 | 135 | //检查合约的余额是否充足 136 | require(this.balance >= amount * sellPrice); 137 | 138 | _transfer(msg.sender, this, amount); 139 | 140 | msg.sender.transfer(amount * sellPrice); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /contracts/Owned.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | import './interfaces/IOwned.sol'; 3 | 4 | /* 5 | owned 是一个管理者 6 | */ 7 | contract Owned is IOwned { 8 | address public owner; 9 | address public newOwner; 10 | 11 | event OwnerUpdate(address _prevOwner, address _newOwner); 12 | 13 | /** 14 | * 初始化构造函数 15 | */ 16 | function Owned() public { 17 | owner = msg.sender; 18 | } 19 | 20 | /** 21 | * 判断当前合约调用者是否是管理员 22 | */ 23 | modifier onlyOwner { 24 | assert(msg.sender == owner); 25 | _; 26 | } 27 | 28 | /** 29 | * 指派一个新的管理员 30 | * @param _newOwner address 新的管理员帐户地址 31 | */ 32 | function transferOwnership(address _newOwner) public onlyOwner { 33 | require(_newOwner != owner); 34 | newOwner = _newOwner; 35 | } 36 | 37 | /** 38 | @dev 新的管理员,确认接受做为管理员 39 | */ 40 | function acceptOwnership() public { 41 | require(msg.sender == newOwner); 42 | OwnerUpdate(owner, newOwner); 43 | owner = newOwner; 44 | newOwner = 0x0; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /contracts/SmartToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | import './Token.sol'; 3 | import './Owned.sol'; 4 | import './interfaces/ISmartToken.sol'; 5 | 6 | contract SmartToken is ISmartToken, Owned, Token { 7 | 8 | string public version = '0.1'; 9 | 10 | // triggered when a smart token is deployed - the _token address is defined for forward compatibility, in case we want to trigger the event from a factory 11 | event NewSmartToken(address _token); 12 | 13 | /* 初始化合约,并且把初始的所有代币都给这合约的创建者 14 | * @param tokenName 代币名称 15 | * @param tokenSymbol 代币符号 16 | * @param decimalsUnits 代币后面的单位,小数点后面多少个0,以太币一样后面是是18个0 17 | */ 18 | function SmartToken(string tokenName, string tokenSymbol, uint8 decimalsUnits) 19 | public 20 | Token (tokenName, tokenSymbol, decimalsUnits) 21 | { 22 | NewSmartToken(address(this)); 23 | } 24 | 25 | 26 | /** 27 | * 增加代币,并将代币发送给捐赠新用户 28 | * @param _to address 接受代币的地址 29 | * @param _amount uint256 接受代币的数量 30 | */ 31 | function issue(address _to, uint256 _amount) 32 | validAddress(_to) 33 | public 34 | { 35 | _amount = _amount * 10 ** uint256(decimals); 36 | totalSupply = totalSupply + _amount; 37 | balanceOf[_to] = safeAdd(balanceOf[_to], _amount); 38 | 39 | //通知任何监听该交易的客户端 40 | Transfer(this, _to, _amount); 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /contracts/Token.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | import './Utils.sol'; 3 | import './interfaces/IToken.sol'; 4 | 5 | contract Token is IToken, Utils { 6 | /* 公共变量 */ 7 | string public standard = 'https://mshk.top'; 8 | string public name = ''; //代币名称 9 | string public symbol = ''; //代币符号比如'$' 10 | uint8 public decimals = 0; //代币单位 11 | uint256 public totalSupply = 0; //代币总量 12 | 13 | /*记录所有余额的映射*/ 14 | mapping (address => uint256) public balanceOf; 15 | mapping (address => mapping (address => uint256)) public allowance; 16 | 17 | /* 在区块链上创建一个事件,用以通知客户端*/ 18 | event Transfer(address indexed from, address indexed to, uint256 value); //转帐通知事件 19 | event Approval(address indexed _owner, address indexed _spender, uint256 _value); //设置允许用户支付最大金额通知 20 | 21 | /* 初始化合约,并且把初始的所有代币都给这合约的创建者 22 | * @param tokenName 代币名称 23 | * @param tokenSymbol 代币符号 24 | * @param decimalsUnits 代币后面的单位,小数点后面多少个0,以太币一样后面是是18个0 25 | */ 26 | function Token(string tokenName, string tokenSymbol, uint8 decimalsUnits) public { 27 | 28 | require(bytes(tokenName).length > 0 && bytes(tokenSymbol).length > 0); // validate input 29 | 30 | name = tokenName; 31 | symbol = tokenSymbol; 32 | decimals = decimalsUnits; 33 | 34 | } 35 | 36 | 37 | /** 38 | * 私有方法从一个帐户发送给另一个帐户代币 39 | * @param _from address 发送代币的地址 40 | * @param _to address 接受代币的地址 41 | * @param _value uint256 接受代币的数量 42 | */ 43 | function _transfer(address _from, address _to, uint256 _value) 44 | internal 45 | validAddress(_from) 46 | validAddress(_to) 47 | { 48 | 49 | 50 | //检查发送者是否拥有足够余额 51 | require(balanceOf[_from] >= _value); 52 | 53 | //检查是否溢出 54 | require(balanceOf[_to] + _value > balanceOf[_to]); 55 | 56 | //保存数据用于后面的判断 57 | uint previousBalances = safeAdd(balanceOf[_from], balanceOf[_to]); 58 | 59 | //从发送者减掉发送额 60 | balanceOf[_from] = safeSub(balanceOf[_from], _value); 61 | 62 | //给接收者加上相同的量 63 | balanceOf[_to] += safeAdd(balanceOf[_to], _value); 64 | 65 | //通知任何监听该交易的客户端 66 | Transfer(_from, _to, _value); 67 | 68 | //判断买、卖双方的数据是否和转换前一致 69 | assert(balanceOf[_from] + balanceOf[_to] == previousBalances); 70 | 71 | } 72 | 73 | /** 74 | * 从主帐户合约调用者发送给别人代币 75 | * @param _to address 接受代币的地址 76 | * @param _value uint256 接受代币的数量 77 | */ 78 | function transfer(address _to, uint256 _value) 79 | public 80 | validAddress(_to) 81 | returns (bool) 82 | { 83 | _transfer(msg.sender, _to, _value); 84 | return true; 85 | } 86 | 87 | /** 88 | * 从某个指定的帐户中,向另一个帐户发送代币 89 | * 90 | * 调用过程,会检查设置的允许最大交易额 91 | * 92 | * @param _from address 发送者地址 93 | * @param _to address 接受者地址 94 | * @param _value uint256 要转移的代币数量 95 | * @return 是否交易成功 96 | */ 97 | function transferFrom(address _from, address _to, uint256 _value) 98 | public 99 | validAddress(_from) 100 | validAddress(_to) 101 | returns (bool) 102 | { 103 | //检查发送者是否拥有足够余额支出的设置 104 | require(_value <= allowance[_from][msg.sender]); // Check allowance 105 | 106 | allowance[_from][msg.sender] -= safeSub(allowance[_from][msg.sender], _value); 107 | 108 | _transfer(_from, _to, _value); 109 | 110 | return true; 111 | } 112 | 113 | /** 114 | * 设置帐户允许支付的最大金额 115 | * 116 | * 一般在智能合约的时候,避免支付过多,造成风险 117 | * 118 | * @param _spender 帐户地址 119 | * @param _value 金额 120 | */ 121 | function approve(address _spender, uint256 _value) 122 | public 123 | validAddress(_spender) 124 | returns (bool success) 125 | { 126 | 127 | require(_value == 0 || allowance[msg.sender][_spender] == 0); 128 | 129 | allowance[msg.sender][_spender] = _value; 130 | Approval(msg.sender, _spender, _value); 131 | return true; 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /contracts/Utils.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | 3 | /* 4 | Utilities & Common Modifiers 5 | */ 6 | contract Utils { 7 | /** 8 | constructor 9 | */ 10 | function Utils() public { 11 | } 12 | 13 | // verifies that an amount is greater than zero 14 | modifier greaterThanZero(uint256 _amount) { 15 | require(_amount > 0); 16 | _; 17 | } 18 | 19 | // validates an address - currently only checks that it isn't null 20 | modifier validAddress(address _address) { 21 | require(_address != 0x0); 22 | _; 23 | } 24 | 25 | // verifies that the address is different than this contract address 26 | modifier notThis(address _address) { 27 | require(_address != address(this)); 28 | _; 29 | } 30 | 31 | // Overflow protected math functions 32 | 33 | /** 34 | @dev returns the sum of _x and _y, asserts if the calculation overflows 35 | 36 | @param _x value 1 37 | @param _y value 2 38 | 39 | @return sum 40 | */ 41 | function safeAdd(uint256 _x, uint256 _y) internal pure returns (uint256) { 42 | uint256 z = _x + _y; 43 | assert(z >= _x); 44 | return z; 45 | } 46 | 47 | /** 48 | @dev returns the difference of _x minus _y, asserts if the subtraction results in a negative number 49 | 50 | @param _x minuend 51 | @param _y subtrahend 52 | 53 | @return difference 54 | */ 55 | function safeSub(uint256 _x, uint256 _y) internal pure returns (uint256) { 56 | assert(_x >= _y); 57 | return _x - _y; 58 | } 59 | 60 | /** 61 | @dev returns the product of multiplying _x by _y, asserts if the calculation overflows 62 | 63 | @param _x factor 1 64 | @param _y factor 2 65 | 66 | @return product 67 | */ 68 | function safeMul(uint256 _x, uint256 _y) internal pure returns (uint256) { 69 | uint256 z = _x * _y; 70 | assert(_x == 0 || z / _x == _y); 71 | return z; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /contracts/helpers/Hello_mshk_top.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | 3 | contract Hello_mshk_top { 4 | 5 | //say hello mshk.top 6 | function say() public pure returns (string) { 7 | return "Hello mshk.top"; 8 | } 9 | 10 | //print name 11 | function print(string name) public pure returns (string) { 12 | return name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /contracts/helpers/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | modifier restricted() { 8 | if (msg.sender == owner) _; 9 | } 10 | 11 | function Migrations() public { 12 | owner = msg.sender; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /contracts/interfaces/IMyAdvancedToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | 3 | /* 4 | Standard IMyAdvancedToken interface 5 | */ 6 | contract IMyAdvancedToken { 7 | 8 | function _transfer(address _from, address _to, uint256 _value) internal; 9 | function mintToken(address target, uint256 mintedAmount) public; 10 | function freezeAccount(address target, bool freeze) public; 11 | function setPrices(uint256 newSellPrice, uint256 newBuyPrice) public; 12 | function buy() payable public; 13 | function sell(uint256 amount) public; 14 | } 15 | -------------------------------------------------------------------------------- /contracts/interfaces/IOwned.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | 3 | /* 4 | Owned contract interface 5 | */ 6 | contract IOwned { 7 | // this function isn't abstract since the compiler emits automatically generated getter functions as external 8 | function owner() public pure returns (address) {} 9 | 10 | function transferOwnership(address _newOwner) public; 11 | function acceptOwnership() public; 12 | } 13 | -------------------------------------------------------------------------------- /contracts/interfaces/ISmartToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | 3 | /* 4 | Standard ISmartyToken interface 5 | */ 6 | contract ISmartToken { 7 | 8 | function issue(address _to, uint256 _value) public; 9 | } 10 | -------------------------------------------------------------------------------- /contracts/interfaces/IToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | 3 | /* 4 | Standard Token interface 5 | */ 6 | contract IToken { 7 | // these functions aren't abstract since the compiler emits automatically generated getter functions as external 8 | function name() public pure returns (string) {} 9 | function symbol() public pure returns (string) {} 10 | function decimals() public pure returns (uint8) {} 11 | function totalSupply() public pure returns (uint256) {} 12 | function balanceOf(address _owner) public pure returns (uint256) { _owner; } 13 | function allowance(address _owner, address _spender) public pure returns (uint256) { _owner; _spender; } 14 | 15 | function _transfer(address _from, address _to, uint256 _value) internal; 16 | function transfer(address _to, uint256 _value) public returns (bool success); 17 | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); 18 | function approve(address _spender, uint256 _value) public returns (bool success); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | var Migrations = artifacts.require("./helpers/Migrations.sol"); 2 | var Hello_mshk_top = artifacts.require("./helpers/Hello_mshk_top.sol"); 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | deployer.deploy(Hello_mshk_top); 6 | }; 7 | -------------------------------------------------------------------------------- /migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | /* global artifacts */ 2 | /* eslint-disable prefer-reflect */ 3 | 4 | const Utils = artifacts.require('./Utils.sol'); 5 | const Owned = artifacts.require('./Owned.sol'); 6 | const Token = artifacts.require('./Token.sol'); 7 | const MyAdvancedToken = artifacts.require('./MyAdvancedToken.sol'); 8 | const SmartToken = artifacts.require('./SmartToken.sol'); 9 | const Crowdsale = artifacts.require('./Crowdsale.sol'); 10 | 11 | module.exports = async (deployer) => { 12 | deployer.deploy(Utils); 13 | deployer.deploy(Owned); 14 | deployer.deploy(Token, 'mshk.top Token', 'MSHK-S', 0); 15 | deployer.deploy(MyAdvancedToken); 16 | await deployer.deploy(SmartToken, 'mshk.top SmartToken', 'MSHK-Smart', 2); 17 | deployer.deploy(Crowdsale, '0x777', 100, 30, SmartToken.address); 18 | }; 19 | -------------------------------------------------------------------------------- /truffle.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // contracts_build_directory: "./output", 3 | networks: { 4 | development: { 5 | host: "localhost", 6 | port: 8545, 7 | network_id: "*" 8 | } 9 | } 10 | }; 11 | --------------------------------------------------------------------------------