diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..690e3fc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +copy contracts.bat \ No newline at end of file diff --git a/build/contracts/Customers.json b/build/contracts/Customers.json index 1148472..4651ea8 100644 --- a/build/contracts/Customers.json +++ b/build/contracts/Customers.json @@ -21,12 +21,46 @@ "type": "function", "signature": "0xc0abda2a" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "buyer", + "type": "address" + }, + { + "indexed": false, + "name": "tokenId", + "type": "uint256" + } + ], + "name": "BoughtToken", + "type": "event", + "signature": "0x75424253909c2f4460f8a59099700e980f5b484608c4fdd79f600f5162ac88a5" + }, { "constant": false, "inputs": [ { "name": "couponId", "type": "uint256" + }, + { + "name": "tokenPetName_", + "type": "string" + }, + { + "name": "tokenPetAge_", + "type": "uint256" + }, + { + "name": "tokenPetBreed_", + "type": "string" + }, + { + "name": "tokenPetLocation_", + "type": "string" } ], "name": "claim", @@ -36,10 +70,10 @@ "type": "uint256" } ], - "payable": false, - "stateMutability": "nonpayable", + "payable": true, + "stateMutability": "payable", "type": "function", - "signature": "0x379607f5" + "signature": "0xd1420886" }, { "constant": true, @@ -55,22 +89,78 @@ "stateMutability": "view", "type": "function", "signature": "0xf1ba7127" + }, + { + "constant": true, + "inputs": [ + { + "name": "_couponId", + "type": "uint256" + } + ], + "name": "getToken", + "outputs": [ + { + "name": "tokenID_", + "type": "uint256" + }, + { + "name": "tokenPetName_", + "type": "string" + }, + { + "name": "tokenPetAge_", + "type": "uint256" + }, + { + "name": "tokenPetBreed_", + "type": "string" + }, + { + "name": "tokenPetLocation_", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function", + "signature": "0xe4b50cb8" + }, + { + "constant": true, + "inputs": [ + { + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getOwner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function", + "signature": "0xc41a360a" } ], - "bytecode": "0x608060405234801561001057600080fd5b506102f4806100206000396000f3fe608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063379607f51461005c578063c0abda2a146100ab578063f1ba712714610126575b600080fd5b34801561006857600080fd5b506100956004803603602081101561007f57600080fd5b8101908080359060200190929190505050610179565b6040518082815260200191505060405180910390f35b3480156100b757600080fd5b506100e4600480360360208110156100ce57600080fd5b81019080803590602001909291905050506101ee565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561013257600080fd5b5061013b610223565b6040518082601060200280838360005b8381101561016657808201518184015260208101905061014b565b5050505090500191505060405180910390f35b600080821015801561018c5750600f8211155b151561019757600080fd5b336000836010811015156101a757fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550819050919050565b6000816010811015156101fd57fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61022b6102a4565b600060108060200260405190810160405280929190826010801561029a576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610250575b5050505050905090565b6102006040519081016040528060109060208202803883398082019150509050509056fea165627a7a72305820e12bd15a549abb43cc074767a798135008ad21ad9e9cd6c16626b34d79a277f60029", - "deployedBytecode": "0x608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063379607f51461005c578063c0abda2a146100ab578063f1ba712714610126575b600080fd5b34801561006857600080fd5b506100956004803603602081101561007f57600080fd5b8101908080359060200190929190505050610179565b6040518082815260200191505060405180910390f35b3480156100b757600080fd5b506100e4600480360360208110156100ce57600080fd5b81019080803590602001909291905050506101ee565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561013257600080fd5b5061013b610223565b6040518082601060200280838360005b8381101561016657808201518184015260208101905061014b565b5050505090500191505060405180910390f35b600080821015801561018c5750600f8211155b151561019757600080fd5b336000836010811015156101a757fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550819050919050565b6000816010811015156101fd57fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61022b6102a4565b600060108060200260405190810160405280929190826010801561029a576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610250575b5050505050905090565b6102006040519081016040528060109060208202803883398082019150509050509056fea165627a7a72305820e12bd15a549abb43cc074767a798135008ad21ad9e9cd6c16626b34d79a277f60029", - "sourceMap": "25:402:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:402:0;;;;;;;", - "deployedSourceMap": "25:402:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111:178;;8:9:-1;5:2;;;30:1;27;20:12;5:2;111:178:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;111:178:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;51:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;51:28:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;51:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;326:98;;8:9:-1;5:2;;;30:1;27;20:12;5:2;326:98:0;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;326:98:0;;;;;;;;;;;;;;;;111:178;157:4;193:1;181:8;:13;;:31;;;;;210:2;198:8;:14;;181:31;173:40;;;;;;;;246:10;224:9;234:8;224:19;;;;;;;;;;;:32;;;;;;;;;;;;;;;;;;274:8;267:15;;111:178;;;:::o;51:28::-;;;;;;;;;;;;;;;;;;;;;;;;;:::o;326:98::-;371:18;;:::i;:::-;408:9;401:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;326:98;:::o;25:402::-;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;25:402:0;;;;:::o", - "source": "pragma solidity ^0.5.0;\n\ncontract Customers {\n\n address[16] public customers;\n\n // Claiming a coupon\n function claim(uint couponId) public returns (uint) {\n require(couponId >= 0 && couponId <= 15);\n\n customers[couponId] = msg.sender;\n\n return couponId;\n }\n\n // Retrieving the adopters\n function getCustomers() public view returns (address[16] memory) {\n return customers;\n }\n\n}", - "sourcePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Customers.sol", + "bytecode": "0x6080604052660aa87bee53800060105534801561001b57600080fd5b50610ae88061002b6000396000f3fe60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c0abda2a14610072578063c41a360a146100af578063d1420886146100ec578063e4b50cb81461011c578063f1ba71271461015d575b600080fd5b34801561007e57600080fd5b506100996004803603610094919081019061071e565b610188565b6040516100a691906108b5565b60405180910390f35b3480156100bb57600080fd5b506100d660048036036100d1919081019061071e565b6101bd565b6040516100e391906108b5565b60405180910390f35b61010660048036036101019190810190610747565b6101f6565b604051610113919061090c565b60405180910390f35b34801561012857600080fd5b50610143600480360361013e919081019061071e565b610335565b604051610154959493929190610927565b60405180910390f35b34801561016957600080fd5b5061017261056a565b60405161017f91906108d0565b60405180910390f35b60008160108110151561019757fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080826010811015156101cd57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008086101580156102095750600f8611155b151561024a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906108ec565b60405180910390fd5b3360008760108110151561025a57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550846011600088815260200190815260200160002090805190602001906102c09291906105eb565b50836012600088815260200190815260200160002081905550826013600088815260200190815260200160002090805190602001906103009291906105eb565b50816014600088815260200190815260200160002090805190602001906103289291906105eb565b5085905095945050505050565b600060606000606080859450601160008781526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103e85780601f106103bd576101008083540402835291602001916103e8565b820191906000526020600020905b8154815290600101906020018083116103cb57829003601f168201915b5050505050935060126000878152602001908152602001600020549250601360008781526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ac5780601f10610481576101008083540402835291602001916104ac565b820191906000526020600020905b81548152906001019060200180831161048f57829003601f168201915b50505050509150601460008781526020019081526020016000208054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561055a5780601f1061052f5761010080835404028352916020019161055a565b820191906000526020600020905b81548152906001019060200180831161053d57829003601f168201915b5050505050905091939590929450565b61057261066b565b60006010806020026040519081016040528092919082601080156105e1576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610597575b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061062c57805160ff191683800117855561065a565b8280016001018555821561065a579182015b8281111561065957825182559160200191906001019061063e565b5b509050610667919061068f565b5090565b61020060405190810160405280601090602082028038833980820191505090505090565b6106b191905b808211156106ad576000816000905550600101610695565b5090565b90565b600082601f83011215156106c757600080fd5b81356106da6106d5826109bc565b61098f565b915080825260208301602083018583830111156106f657600080fd5b610701838284610a5b565b50505092915050565b60006107168235610a51565b905092915050565b60006020828403121561073057600080fd5b600061073e8482850161070a565b91505092915050565b600080600080600060a0868803121561075f57600080fd5b600061076d8882890161070a565b955050602086013567ffffffffffffffff81111561078a57600080fd5b610796888289016106b4565b94505060406107a78882890161070a565b935050606086013567ffffffffffffffff8111156107c457600080fd5b6107d0888289016106b4565b925050608086013567ffffffffffffffff8111156107ed57600080fd5b6107f9888289016106b4565b9150509295509295909350565b61080f81610a15565b82525050565b61081e816109f2565b610827826109e8565b60005b828110156108595761083d858351610806565b61084682610a08565b915060208501945060018101905061082a565b5050505050565b600061086b826109fd565b80845261087f816020860160208601610a6a565b61088881610a9d565b602085010191505092915050565b6000808252602082019050919050565b6108af81610a47565b82525050565b60006020820190506108ca6000830184610806565b92915050565b6000610200820190506108e66000830184610815565b92915050565b6000602082019050818103600083015261090581610896565b9050919050565b600060208201905061092160008301846108a6565b92915050565b600060a08201905061093c60008301886108a6565b818103602083015261094e8187610860565b905061095d60408301866108a6565b818103606083015261096f8185610860565b905081810360808301526109838184610860565b90509695505050505050565b6000604051905081810181811067ffffffffffffffff821117156109b257600080fd5b8060405250919050565b600067ffffffffffffffff8211156109d357600080fd5b601f19601f8301169050602081019050919050565b6000819050919050565b600060109050919050565b600081519050919050565b6000602082019050919050565b6000610a2082610a27565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610a88578082015181840152602081019050610a6d565b83811115610a97576000848401525b50505050565b6000601f19601f830116905091905056fea265627a7a7230582020209641176c5c8e63e53cf692cd1c7308b3222f65209647c37cea1e55093e096c6578706572696d656e74616cf50037", + "deployedBytecode": "0x60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c0abda2a14610072578063c41a360a146100af578063d1420886146100ec578063e4b50cb81461011c578063f1ba71271461015d575b600080fd5b34801561007e57600080fd5b506100996004803603610094919081019061071e565b610188565b6040516100a691906108b5565b60405180910390f35b3480156100bb57600080fd5b506100d660048036036100d1919081019061071e565b6101bd565b6040516100e391906108b5565b60405180910390f35b61010660048036036101019190810190610747565b6101f6565b604051610113919061090c565b60405180910390f35b34801561012857600080fd5b50610143600480360361013e919081019061071e565b610335565b604051610154959493929190610927565b60405180910390f35b34801561016957600080fd5b5061017261056a565b60405161017f91906108d0565b60405180910390f35b60008160108110151561019757fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080826010811015156101cd57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008086101580156102095750600f8611155b151561024a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906108ec565b60405180910390fd5b3360008760108110151561025a57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550846011600088815260200190815260200160002090805190602001906102c09291906105eb565b50836012600088815260200190815260200160002081905550826013600088815260200190815260200160002090805190602001906103009291906105eb565b50816014600088815260200190815260200160002090805190602001906103289291906105eb565b5085905095945050505050565b600060606000606080859450601160008781526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103e85780601f106103bd576101008083540402835291602001916103e8565b820191906000526020600020905b8154815290600101906020018083116103cb57829003601f168201915b5050505050935060126000878152602001908152602001600020549250601360008781526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ac5780601f10610481576101008083540402835291602001916104ac565b820191906000526020600020905b81548152906001019060200180831161048f57829003601f168201915b50505050509150601460008781526020019081526020016000208054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561055a5780601f1061052f5761010080835404028352916020019161055a565b820191906000526020600020905b81548152906001019060200180831161053d57829003601f168201915b5050505050905091939590929450565b61057261066b565b60006010806020026040519081016040528092919082601080156105e1576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610597575b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061062c57805160ff191683800117855561065a565b8280016001018555821561065a579182015b8281111561065957825182559160200191906001019061063e565b5b509050610667919061068f565b5090565b61020060405190810160405280601090602082028038833980820191505090505090565b6106b191905b808211156106ad576000816000905550600101610695565b5090565b90565b600082601f83011215156106c757600080fd5b81356106da6106d5826109bc565b61098f565b915080825260208301602083018583830111156106f657600080fd5b610701838284610a5b565b50505092915050565b60006107168235610a51565b905092915050565b60006020828403121561073057600080fd5b600061073e8482850161070a565b91505092915050565b600080600080600060a0868803121561075f57600080fd5b600061076d8882890161070a565b955050602086013567ffffffffffffffff81111561078a57600080fd5b610796888289016106b4565b94505060406107a78882890161070a565b935050606086013567ffffffffffffffff8111156107c457600080fd5b6107d0888289016106b4565b925050608086013567ffffffffffffffff8111156107ed57600080fd5b6107f9888289016106b4565b9150509295509295909350565b61080f81610a15565b82525050565b61081e816109f2565b610827826109e8565b60005b828110156108595761083d858351610806565b61084682610a08565b915060208501945060018101905061082a565b5050505050565b600061086b826109fd565b80845261087f816020860160208601610a6a565b61088881610a9d565b602085010191505092915050565b6000808252602082019050919050565b6108af81610a47565b82525050565b60006020820190506108ca6000830184610806565b92915050565b6000610200820190506108e66000830184610815565b92915050565b6000602082019050818103600083015261090581610896565b9050919050565b600060208201905061092160008301846108a6565b92915050565b600060a08201905061093c60008301886108a6565b818103602083015261094e8187610860565b905061095d60408301866108a6565b818103606083015261096f8185610860565b905081810360808301526109838184610860565b90509695505050505050565b6000604051905081810181811067ffffffffffffffff821117156109b257600080fd5b8060405250919050565b600067ffffffffffffffff8211156109d357600080fd5b601f19601f8301169050602081019050919050565b6000819050919050565b600060109050919050565b600081519050919050565b6000602082019050919050565b6000610a2082610a27565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610a88578082015181840152602081019050610a6d565b83811115610a97576000848401525b50505050565b6000601f19601f830116905091905056fea265627a7a7230582020209641176c5c8e63e53cf692cd1c7308b3222f65209647c37cea1e55093e096c6578706572696d656e74616cf50037", + "sourceMap": "62:2362:0:-;;;371:16;350:37;;62:2362;8:9:-1;5:2;;;30:1;27;20:12;5:2;62:2362:0;;;;;;;", + "deployedSourceMap": "62:2362:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;253:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;253:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2314:104;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2314:104:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;659:772;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1726:576;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1726:576:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1483:100;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1483:100:0;;;;;;;;;;;;;;;;;;;;253:28;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2314:104::-;2366:7;2392:9;2402:7;2392:18;;;;;;;;;;;;;;;;;;;;2385:25;;2314:104;;;:::o;659:772::-;886:4;923:1;911:8;:13;;:31;;;;;940:2;928:8;:14;;911:31;903:44;;;;;;;;;;;;;;;;;;;;;;;;1181:10;1159:9;1169:8;1159:19;;;;;;;;;;;:32;;;;;;;;;;;;;;;;;;1227:13;1202:12;:22;1215:8;1202:22;;;;;;;;;;;:38;;;;;;;;;;;;:::i;:::-;;1275:12;1251:11;:21;1263:8;1251:21;;;;;;;;;;;:36;;;;1324:14;1298:13;:23;1312:8;1298:23;;;;;;;;;;;:40;;;;;;;;;;;;:::i;:::-;;1378:17;1349:16;:26;1366:8;1349:26;;;;;;;;;;;:46;;;;;;;;;;;;:::i;:::-;;1415:8;1408:15;;659:772;;;;;;;:::o;1726:576::-;1825:13;1849:27;1887:17;1915:28;1954:31;2075:9;2064:20;;2111:12;:23;2124:9;2111:23;;;;;;;;;;;2095:39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2160:11;:22;2172:9;2160:22;;;;;;;;;;;;2145:37;;2210:13;:24;2224:9;2210:24;;;;;;;;;;;2193:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2265:16;:27;2282:9;2265:27;;;;;;;;;;;2245:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1726:576;;;;;;;:::o;1483:100::-;1528:18;;:::i;:::-;1566:9;1559:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1483:100;:::o;62:2362::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;62:2362:0;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;6:442:-1:-;;108:3;101:4;93:6;89:17;85:27;78:35;75:2;;;126:1;123;116:12;75:2;163:6;150:20;185:65;200:49;242:6;200:49;;;185:65;;;176:74;;270:6;263:5;256:21;306:4;298:6;294:17;339:4;332:5;328:16;374:3;365:6;360:3;356:16;353:25;350:2;;;391:1;388;381:12;350:2;401:41;435:6;430:3;425;401:41;;;68:380;;;;;;;;456:118;;523:46;561:6;548:20;523:46;;;514:55;;508:66;;;;;581:241;;685:2;673:9;664:7;660:23;656:32;653:2;;;701:1;698;691:12;653:2;736:1;753:53;798:7;789:6;778:9;774:22;753:53;;;743:63;;715:97;647:175;;;;;829:1061;;;;;;1031:3;1019:9;1010:7;1006:23;1002:33;999:2;;;1048:1;1045;1038:12;999:2;1083:1;1100:53;1145:7;1136:6;1125:9;1121:22;1100:53;;;1090:63;;1062:97;1218:2;1207:9;1203:18;1190:32;1242:18;1234:6;1231:30;1228:2;;;1274:1;1271;1264:12;1228:2;1294:63;1349:7;1340:6;1329:9;1325:22;1294:63;;;1284:73;;1169:194;1394:2;1412:53;1457:7;1448:6;1437:9;1433:22;1412:53;;;1402:63;;1373:98;1530:2;1519:9;1515:18;1502:32;1554:18;1546:6;1543:30;1540:2;;;1586:1;1583;1576:12;1540:2;1606:63;1661:7;1652:6;1641:9;1637:22;1606:63;;;1596:73;;1481:194;1734:3;1723:9;1719:19;1706:33;1759:18;1751:6;1748:30;1745:2;;;1791:1;1788;1781:12;1745:2;1811:63;1866:7;1857:6;1846:9;1842:22;1811:63;;;1801:73;;1685:195;993:897;;;;;;;;;1897:110;1970:31;1995:5;1970:31;;;1965:3;1958:44;1952:55;;;2049:526;2174:53;2221:5;2174:53;;;2273:55;2322:5;2273:55;;;2349:1;2334:229;2359:6;2356:1;2353:13;2334:229;;;2399:53;2448:3;2439:6;2433:13;2399:53;;;2469:59;2521:6;2469:59;;;2459:69;;2551:4;2546:3;2542:14;2535:21;;2381:1;2378;2374:9;2369:14;;2334:229;;;2338:14;2153:422;;;;;2583:300;;2685:39;2718:5;2685:39;;;2741:6;2736:3;2729:19;2753:63;2809:6;2802:4;2797:3;2793:14;2786:4;2779:5;2775:16;2753:63;;;2848:29;2870:6;2848:29;;;2841:4;2836:3;2832:14;2828:50;2821:57;;2665:218;;;;;;2891:194;;3046:1;3041:3;3034:14;3076:2;3071:3;3067:12;3060:19;;3027:58;;;;3093:110;3166:31;3191:5;3166:31;;;3161:3;3154:44;3148:55;;;3210:193;;3318:2;3307:9;3303:18;3295:26;;3332:61;3390:1;3379:9;3375:17;3366:6;3332:61;;;3289:114;;;;;3410:290;;3566:3;3555:9;3551:19;3543:27;;3581:109;3687:1;3676:9;3672:17;3663:6;3581:109;;;3537:163;;;;;3707:387;;3888:2;3877:9;3873:18;3865:26;;3938:9;3932:4;3928:20;3924:1;3913:9;3909:17;3902:47;3963:121;4079:4;3963:121;;;3955:129;;3859:235;;;;4101:193;;4209:2;4198:9;4194:18;4186:26;;4223:61;4281:1;4270:9;4266:17;4257:6;4223:61;;;4180:114;;;;;4301:863;;4581:3;4570:9;4566:19;4558:27;;4596:61;4654:1;4643:9;4639:17;4630:6;4596:61;;;4705:9;4699:4;4695:20;4690:2;4679:9;4675:18;4668:48;4730:68;4793:4;4784:6;4730:68;;;4722:76;;4809:62;4867:2;4856:9;4852:18;4843:6;4809:62;;;4919:9;4913:4;4909:20;4904:2;4893:9;4889:18;4882:48;4944:68;5007:4;4998:6;4944:68;;;4936:76;;5061:9;5055:4;5051:20;5045:3;5034:9;5030:19;5023:49;5086:68;5149:4;5140:6;5086:68;;;5078:76;;4552:612;;;;;;;;;5171:256;;5233:2;5227:9;5217:19;;5271:4;5263:6;5259:17;5370:6;5358:10;5355:22;5334:18;5322:10;5319:34;5316:62;5313:2;;;5391:1;5388;5381:12;5313:2;5411:10;5407:2;5400:22;5211:216;;;;;5434:259;;5578:18;5570:6;5567:30;5564:2;;;5610:1;5607;5600:12;5564:2;5654:4;5650:9;5643:4;5635:6;5631:17;5627:33;5619:41;;5683:4;5677;5673:15;5665:23;;5501:192;;;;5702:109;;5798:6;5787:17;;5779:32;;;;5820:98;;5909:4;5899:14;;5893:25;;;;5925:92;;6006:5;6000:12;5990:22;;5984:33;;;;6025:121;;6135:4;6127:6;6123:17;6112:28;;6105:41;;;;6154:105;;6223:31;6248:5;6223:31;;;6212:42;;6206:53;;;;6266:128;;6346:42;6339:5;6335:54;6324:65;;6318:76;;;;6401:79;;6470:5;6459:16;;6453:27;;;;6487:79;;6556:5;6545:16;;6539:27;;;;6574:145;6655:6;6650:3;6645;6632:30;6711:1;6702:6;6697:3;6693:16;6686:27;6625:94;;;;6728:268;6793:1;6800:101;6814:6;6811:1;6808:13;6800:101;;;6890:1;6885:3;6881:11;6875:18;6871:1;6866:3;6862:11;6855:39;6836:2;6833:1;6829:10;6824:15;;6800:101;;;6916:6;6913:1;6910:13;6907:2;;;6981:1;6972:6;6967:3;6963:16;6956:27;6907:2;6777:219;;;;;7004:97;;7092:2;7088:7;7083:2;7076:5;7072:14;7068:28;7058:38;;7052:49;;;", + "source": "pragma solidity ^0.5.0;\r\npragma experimental ABIEncoderV2;\r\n\r\ncontract Customers {\r\n\r\n\r\n /*** EVENTS ***/\r\n /// The event emitted (useable by web3) when a token is purchased\r\n event BoughtToken(address indexed buyer, uint256 tokenId);\r\n\r\n\r\n address[16] public customers;\r\n\r\n /// Price set by contract owner for each token in Wei.\r\n uint256 tokenPrice = 3000000000000000;\r\n\r\n\r\n /// The Name of the Pet\r\n mapping(uint256 => string) tokenPetName;\r\n\r\n mapping(uint256 => uint) tokenPetAge;\r\n \r\n mapping(uint256 => string) tokenPetBreed;\r\n \r\n mapping(uint256 => string) tokenPetLocation;\r\n\r\n\r\n\r\n // Claiming a coupon\r\n function claim(\r\n uint couponId, \r\n string memory tokenPetName_,\r\n uint tokenPetAge_,\r\n string memory tokenPetBreed_,\r\n string memory tokenPetLocation_ \r\n \r\n ) public payable returns (uint) {\r\n require(couponId >= 0 && couponId <= 15, \"\");\r\n\r\n //Buy adjusting the function to payable then you can require a certain amount of ETH must be spent\r\n //require(msg.value >= tokenPrice, \"Amount of Ether sent too small\");\r\n \r\n\r\n customers[couponId] = msg.sender;\r\n tokenPetName[couponId] = tokenPetName_;\r\n tokenPetAge[couponId] = tokenPetAge_;\r\n tokenPetBreed[couponId] = tokenPetBreed_;\r\n tokenPetLocation[couponId] = tokenPetLocation_;\r\n\r\n return couponId;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n // Retrieving the adopters\r\n function getCustomers() public view returns (address[16] memory) {\r\n return customers;\r\n }\r\n\r\n\r\n // @notice Returns all the relevant information about a specific token\r\n // @param _couponId The ID of the token of interest\r\n function getToken(uint256 _couponId)\r\n external\r\n view\r\n returns (\t\t\r\n uint tokenID_,\r\n string memory tokenPetName_,\r\n uint tokenPetAge_,\r\n string memory tokenPetBreed_,\r\n string memory tokenPetLocation_\r\n\r\n ) {\r\n // TODO: Add Token Score to the details returned\r\n tokenID_ = _couponId;\r\n tokenPetName_ = tokenPetName[_couponId];\r\n tokenPetAge_ = tokenPetAge[_couponId];\r\n tokenPetBreed_ = tokenPetBreed[_couponId];\r\n tokenPetLocation_ = tokenPetLocation[_couponId];\r\n\r\n }\r\n\r\n\r\n\r\n function getOwner(uint tokenId) public view returns(address){\r\n return customers[tokenId];\r\n } \r\n\r\n}", + "sourcePath": "C:/Users/Michael/Documents/GitHub/lesson-06/contracts/Customers.sol", "ast": { - "absolutePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Customers.sol", + "absolutePath": "/C/Users/Michael/Documents/GitHub/lesson-06/contracts/Customers.sol", "exportedSymbols": { "Customers": [ - 43 + 158 ] }, - "id": 44, + "id": 159, "nodeType": "SourceUnit", "nodes": [ { @@ -84,26 +174,105 @@ "nodeType": "PragmaDirective", "src": "0:23:0" }, + { + "id": 2, + "literals": [ + "experimental", + "ABIEncoderV2" + ], + "nodeType": "PragmaDirective", + "src": "25:33:0" + }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 43, + "id": 158, "linearizedBaseContracts": [ - 43 + 158 ], "name": "Customers", "nodeType": "ContractDefinition", "nodes": [ + { + "anonymous": false, + "documentation": "The event emitted (useable by web3) when a token is purchased", + "id": 8, + "name": "BoughtToken", + "nodeType": "EventDefinition", + "parameters": { + "id": 7, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4, + "indexed": true, + "name": "buyer", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "203:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "203:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 6, + "indexed": false, + "name": "tokenId", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "226:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "226:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "202:40:0" + }, + "src": "185:58:0" + }, { "constant": false, - "id": 5, + "id": 12, "name": "customers", "nodeType": "VariableDeclaration", - "scope": 43, - "src": "51:28:0", + "scope": 158, + "src": "253:28:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -112,28 +281,28 @@ }, "typeName": { "baseType": { - "id": 2, + "id": 9, "name": "address", "nodeType": "ElementaryTypeName", - "src": "51:7:0", + "src": "253:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 4, + "id": 11, "length": { "argumentTypes": null, "hexValue": "3136", - "id": 3, + "id": 10, "isConstant": false, "isLValue": false, "isPure": false, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "59:2:0", + "src": "261:2:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": null, @@ -142,7 +311,7 @@ "value": "16" }, "nodeType": "ArrayTypeName", - "src": "51:11:0", + "src": "253:11:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$16_storage_ptr", "typeString": "address[16]" @@ -151,11 +320,234 @@ "value": null, "visibility": "public" }, + { + "constant": false, + "id": 15, + "name": "tokenPrice", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "350:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 13, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "350:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "33303030303030303030303030303030", + "id": 14, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "371:16:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3000000000000000_by_1", + "typeString": "int_const 3000000000000000" + }, + "value": "3000000000000000" + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 19, + "name": "tokenPetName", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "427:39:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 18, + "keyType": { + "id": 16, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "435:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "427:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 17, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "446:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 23, + "name": "tokenPetAge", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "475:36:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + }, + "typeName": { + "id": 22, + "keyType": { + "id": 20, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "483:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "475:24:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + }, + "valueType": { + "id": 21, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "494:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 27, + "name": "tokenPetBreed", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "524:40:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 26, + "keyType": { + "id": 24, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "532:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "524:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 25, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "543:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 31, + "name": "tokenPetLocation", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "577:43:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 30, + "keyType": { + "id": 28, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "585:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "577:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 29, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "596:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, { "body": { - "id": 31, + "id": 90, "nodeType": "Block", - "src": "163:126:0", + "src": "892:539:0", "statements": [ { "expression": { @@ -167,7 +559,7 @@ "typeIdentifier": "t_bool", "typeString": "bool" }, - "id": 19, + "id": 53, "isConstant": false, "isLValue": false, "isPure": false, @@ -178,19 +570,19 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 15, + "id": 49, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, - "id": 13, + "id": 47, "name": "couponId", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "181:8:0", + "referencedDeclaration": 33, + "src": "911:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -201,14 +593,14 @@ "rightExpression": { "argumentTypes": null, "hexValue": "30", - "id": 14, + "id": 48, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "193:1:0", + "src": "923:1:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", @@ -216,7 +608,7 @@ }, "value": "0" }, - "src": "181:13:0", + "src": "911:13:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -230,19 +622,19 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 18, + "id": 52, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, - "id": 16, + "id": 50, "name": "couponId", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "198:8:0", + "referencedDeclaration": 33, + "src": "928:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -253,14 +645,14 @@ "rightExpression": { "argumentTypes": null, "hexValue": "3135", - "id": 17, + "id": 51, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "210:2:0", + "src": "940:2:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_15_by_1", @@ -268,17 +660,35 @@ }, "value": "15" }, - "src": "198:14:0", + "src": "928:14:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "src": "181:31:0", + "src": "911:31:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } + }, + { + "argumentTypes": null, + "hexValue": "", + "id": 54, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "944:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" } ], "expression": { @@ -286,23 +696,27 @@ { "typeIdentifier": "t_bool", "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" } ], - "id": 12, + "id": 46, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ - 118, - 119 + 233, + 234 ], - "referencedDeclaration": 118, - "src": "173:7:0", + "referencedDeclaration": 234, + "src": "903:7:0", "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" } }, - "id": 20, + "id": 55, "isConstant": false, "isLValue": false, "isPure": false, @@ -310,20 +724,20 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "173:40:0", + "src": "903:44:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 21, + "id": 56, "nodeType": "ExpressionStatement", - "src": "173:40:0" + "src": "903:44:0" }, { "expression": { "argumentTypes": null, - "id": 27, + "id": 62, "isConstant": false, "isLValue": false, "isPure": false, @@ -332,26 +746,26 @@ "argumentTypes": null, "baseExpression": { "argumentTypes": null, - "id": 22, + "id": 57, "name": "customers", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "224:9:0", + "referencedDeclaration": 12, + "src": "1159:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$16_storage", "typeString": "address[16] storage ref" } }, - "id": 24, + "id": 59, "indexExpression": { "argumentTypes": null, - "id": 23, + "id": 58, "name": "couponId", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "234:8:0", + "referencedDeclaration": 33, + "src": "1169:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -362,7 +776,7 @@ "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", - "src": "224:19:0", + "src": "1159:19:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -374,18 +788,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 25, + "id": 60, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "246:3:0", + "referencedDeclaration": 230, + "src": "1181:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 26, + "id": 61, "isConstant": false, "isLValue": false, "isPure": false, @@ -393,61 +807,405 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "246:10:0", + "src": "1181:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, - "src": "224:32:0", + "src": "1159:32:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 28, + "id": 63, "nodeType": "ExpressionStatement", - "src": "224:32:0" + "src": "1159:32:0" }, { "expression": { "argumentTypes": null, - "id": 29, - "name": "couponId", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "274:8:0", + "id": 68, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 64, + "name": "tokenPetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 19, + "src": "1202:12:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 66, + "indexExpression": { + "argumentTypes": null, + "id": 65, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1215:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1202:22:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 67, + "name": "tokenPetName_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 35, + "src": "1227:13:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1202:38:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" } }, - "functionReturnParameters": 11, - "id": 30, - "nodeType": "Return", - "src": "267:15:0" + "id": 69, + "nodeType": "ExpressionStatement", + "src": "1202:38:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 70, + "name": "tokenPetAge", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23, + "src": "1251:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + } + }, + "id": 72, + "indexExpression": { + "argumentTypes": null, + "id": 71, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1263:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1251:21:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 73, + "name": "tokenPetAge_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 37, + "src": "1275:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1251:36:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 75, + "nodeType": "ExpressionStatement", + "src": "1251:36:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 80, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 76, + "name": "tokenPetBreed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1298:13:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 78, + "indexExpression": { + "argumentTypes": null, + "id": 77, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1312:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1298:23:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 79, + "name": "tokenPetBreed_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 39, + "src": "1324:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1298:40:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 81, + "nodeType": "ExpressionStatement", + "src": "1298:40:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 86, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 82, + "name": "tokenPetLocation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "1349:16:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 84, + "indexExpression": { + "argumentTypes": null, + "id": 83, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1366:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1349:26:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 85, + "name": "tokenPetLocation_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "1378:17:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1349:46:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 87, + "nodeType": "ExpressionStatement", + "src": "1349:46:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 88, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1415:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 45, + "id": 89, + "nodeType": "Return", + "src": "1408:15:0" } ] }, "documentation": null, - "id": 32, + "id": 91, "implemented": true, "kind": "function", "modifiers": [], "name": "claim", "nodeType": "FunctionDefinition", "parameters": { - "id": 8, + "id": 42, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 7, + "id": 33, "name": "couponId", "nodeType": "VariableDeclaration", - "scope": 32, - "src": "126:13:0", + "scope": 91, + "src": "684:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 32, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "684:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 35, + "name": "tokenPetName_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "709:27:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 34, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "709:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 37, + "name": "tokenPetAge_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "747:17:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -455,10 +1213,10 @@ "typeString": "uint256" }, "typeName": { - "id": 6, + "id": 36, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "126:4:0", + "src": "747:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -466,21 +1224,73 @@ }, "value": null, "visibility": "internal" + }, + { + "constant": false, + "id": 39, + "name": "tokenPetBreed_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "775:28:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 38, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "775:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 41, + "name": "tokenPetLocation_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "814:31:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 40, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "814:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" } ], - "src": "125:15:0" + "src": "673:188:0" }, "returnParameters": { - "id": 11, + "id": 45, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 10, + "id": 44, "name": "", "nodeType": "VariableDeclaration", - "scope": 32, - "src": "157:4:0", + "scope": 91, + "src": "886:4:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -488,10 +1298,10 @@ "typeString": "uint256" }, "typeName": { - "id": 9, + "id": 43, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "157:4:0", + "src": "886:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -501,65 +1311,65 @@ "visibility": "internal" } ], - "src": "156:6:0" + "src": "885:6:0" }, - "scope": 43, - "src": "111:178:0", - "stateMutability": "nonpayable", + "scope": 158, + "src": "659:772:0", + "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 41, + "id": 100, "nodeType": "Block", - "src": "391:33:0", + "src": "1548:35:0", "statements": [ { "expression": { "argumentTypes": null, - "id": 39, + "id": 98, "name": "customers", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "408:9:0", + "referencedDeclaration": 12, + "src": "1566:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$16_storage", "typeString": "address[16] storage ref" } }, - "functionReturnParameters": 38, - "id": 40, + "functionReturnParameters": 97, + "id": 99, "nodeType": "Return", - "src": "401:16:0" + "src": "1559:16:0" } ] }, "documentation": null, - "id": 42, + "id": 101, "implemented": true, "kind": "function", "modifiers": [], "name": "getCustomers", "nodeType": "FunctionDefinition", "parameters": { - "id": 33, + "id": 92, "nodeType": "ParameterList", "parameters": [], - "src": "347:2:0" + "src": "1504:2:0" }, "returnParameters": { - "id": 38, + "id": 97, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 37, + "id": 96, "name": "", "nodeType": "VariableDeclaration", - "scope": 42, - "src": "371:18:0", + "scope": 101, + "src": "1528:18:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { @@ -568,28 +1378,28 @@ }, "typeName": { "baseType": { - "id": 34, + "id": 93, "name": "address", "nodeType": "ElementaryTypeName", - "src": "371:7:0", + "src": "1528:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 36, + "id": 95, "length": { "argumentTypes": null, "hexValue": "3136", - "id": 35, + "id": 94, "isConstant": false, "isLValue": false, "isPure": false, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "379:2:0", + "src": "1536:2:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": null, @@ -598,7 +1408,7 @@ "value": "16" }, "nodeType": "ArrayTypeName", - "src": "371:11:0", + "src": "1528:11:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$16_storage_ptr", "typeString": "address[16]" @@ -608,310 +1418,2202 @@ "visibility": "internal" } ], - "src": "370:20:0" + "src": "1527:20:0" }, - "scope": 43, - "src": "326:98:0", + "scope": 158, + "src": "1483:100:0", "stateMutability": "view", "superFunction": null, "visibility": "public" - } - ], - "scope": 44, - "src": "25:402:0" - } - ], - "src": "0:427:0" - }, - "legacyAST": { - "absolutePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Customers.sol", - "exportedSymbols": { - "Customers": [ - 43 - ] - }, - "id": 44, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 1, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:0" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 43, + }, + { + "body": { + "id": 144, + "nodeType": "Block", + "src": "1995:307:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 116, + "name": "tokenID_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 106, + "src": "2064:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 117, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2075:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2064:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 119, + "nodeType": "ExpressionStatement", + "src": "2064:20:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 120, + "name": "tokenPetName_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 108, + "src": "2095:13:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 121, + "name": "tokenPetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 19, + "src": "2111:12:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 123, + "indexExpression": { + "argumentTypes": null, + "id": 122, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2124:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2111:23:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "src": "2095:39:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 125, + "nodeType": "ExpressionStatement", + "src": "2095:39:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 130, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 126, + "name": "tokenPetAge_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 110, + "src": "2145:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 127, + "name": "tokenPetAge", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23, + "src": "2160:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + } + }, + "id": 129, + "indexExpression": { + "argumentTypes": null, + "id": 128, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2172:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2160:22:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2145:37:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 131, + "nodeType": "ExpressionStatement", + "src": "2145:37:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 132, + "name": "tokenPetBreed_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 112, + "src": "2193:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 133, + "name": "tokenPetBreed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "2210:13:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 135, + "indexExpression": { + "argumentTypes": null, + "id": 134, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2224:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2210:24:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "src": "2193:41:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 137, + "nodeType": "ExpressionStatement", + "src": "2193:41:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 138, + "name": "tokenPetLocation_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 114, + "src": "2245:17:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 139, + "name": "tokenPetLocation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "2265:16:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 141, + "indexExpression": { + "argumentTypes": null, + "id": 140, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2282:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2265:27:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "src": "2245:47:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 143, + "nodeType": "ExpressionStatement", + "src": "2245:47:0" + } + ] + }, + "documentation": null, + "id": 145, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getToken", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 104, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 103, + "name": "_couponId", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1744:17:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 102, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1744:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1743:19:0" + }, + "returnParameters": { + "id": 115, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 106, + "name": "tokenID_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1825:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 105, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1825:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 108, + "name": "tokenPetName_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1849:27:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 107, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1849:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 110, + "name": "tokenPetAge_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1887:17:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 109, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1887:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 112, + "name": "tokenPetBreed_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1915:28:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 111, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1915:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 114, + "name": "tokenPetLocation_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1954:31:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 113, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1954:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1812:182:0" + }, + "scope": 158, + "src": "1726:576:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "external" + }, + { + "body": { + "id": 156, + "nodeType": "Block", + "src": "2374:44:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 152, + "name": "customers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "2392:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16] storage ref" + } + }, + "id": 154, + "indexExpression": { + "argumentTypes": null, + "id": 153, + "name": "tokenId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 147, + "src": "2402:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2392:18:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 151, + "id": 155, + "nodeType": "Return", + "src": "2385:25:0" + } + ] + }, + "documentation": null, + "id": 157, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getOwner", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 148, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 147, + "name": "tokenId", + "nodeType": "VariableDeclaration", + "scope": 157, + "src": "2332:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 146, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2332:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2331:14:0" + }, + "returnParameters": { + "id": 151, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 150, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 157, + "src": "2366:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 149, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2366:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2365:9:0" + }, + "scope": 158, + "src": "2314:104:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 159, + "src": "62:2362:0" + } + ], + "src": "0:2424:0" + }, + "legacyAST": { + "absolutePath": "/C/Users/Michael/Documents/GitHub/lesson-06/contracts/Customers.sol", + "exportedSymbols": { + "Customers": [ + 158 + ] + }, + "id": 159, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.5", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:23:0" + }, + { + "id": 2, + "literals": [ + "experimental", + "ABIEncoderV2" + ], + "nodeType": "PragmaDirective", + "src": "25:33:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 158, "linearizedBaseContracts": [ - 43 + 158 ], "name": "Customers", "nodeType": "ContractDefinition", "nodes": [ { - "constant": false, - "id": 5, - "name": "customers", - "nodeType": "VariableDeclaration", - "scope": 43, - "src": "51:28:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage", - "typeString": "address[16]" + "anonymous": false, + "documentation": "The event emitted (useable by web3) when a token is purchased", + "id": 8, + "name": "BoughtToken", + "nodeType": "EventDefinition", + "parameters": { + "id": 7, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4, + "indexed": true, + "name": "buyer", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "203:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "203:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 6, + "indexed": false, + "name": "tokenId", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "226:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "226:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "202:40:0" + }, + "src": "185:58:0" + }, + { + "constant": false, + "id": 12, + "name": "customers", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "253:28:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16]" + }, + "typeName": { + "baseType": { + "id": 9, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "253:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 11, + "length": { + "argumentTypes": null, + "hexValue": "3136", + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "261:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": null, + "typeString": null + }, + "value": "16" + }, + "nodeType": "ArrayTypeName", + "src": "253:11:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage_ptr", + "typeString": "address[16]" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 15, + "name": "tokenPrice", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "350:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 13, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "350:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "33303030303030303030303030303030", + "id": 14, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "371:16:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3000000000000000_by_1", + "typeString": "int_const 3000000000000000" + }, + "value": "3000000000000000" + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 19, + "name": "tokenPetName", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "427:39:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 18, + "keyType": { + "id": 16, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "435:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "427:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 17, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "446:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 23, + "name": "tokenPetAge", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "475:36:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + }, + "typeName": { + "id": 22, + "keyType": { + "id": 20, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "483:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "475:24:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + }, + "valueType": { + "id": 21, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "494:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 27, + "name": "tokenPetBreed", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "524:40:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 26, + "keyType": { + "id": 24, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "532:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "524:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 25, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "543:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 31, + "name": "tokenPetLocation", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "577:43:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 30, + "keyType": { + "id": 28, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "585:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "577:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 29, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "596:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "body": { + "id": 90, + "nodeType": "Block", + "src": "892:539:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 53, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 49, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 47, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "911:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 48, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "923:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "911:13:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 50, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "928:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3135", + "id": 51, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "940:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "15" + }, + "src": "928:14:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "911:31:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "", + "id": 54, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "944:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + } + ], + "id": 46, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 233, + 234 + ], + "referencedDeclaration": 234, + "src": "903:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 55, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "903:44:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 56, + "nodeType": "ExpressionStatement", + "src": "903:44:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 62, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 57, + "name": "customers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "1159:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16] storage ref" + } + }, + "id": 59, + "indexExpression": { + "argumentTypes": null, + "id": 58, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1169:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1159:19:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 60, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 230, + "src": "1181:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1181:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "1159:32:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 63, + "nodeType": "ExpressionStatement", + "src": "1159:32:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 68, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 64, + "name": "tokenPetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 19, + "src": "1202:12:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 66, + "indexExpression": { + "argumentTypes": null, + "id": 65, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1215:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1202:22:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 67, + "name": "tokenPetName_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 35, + "src": "1227:13:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1202:38:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 69, + "nodeType": "ExpressionStatement", + "src": "1202:38:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 70, + "name": "tokenPetAge", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23, + "src": "1251:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + } + }, + "id": 72, + "indexExpression": { + "argumentTypes": null, + "id": 71, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1263:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1251:21:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 73, + "name": "tokenPetAge_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 37, + "src": "1275:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1251:36:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 75, + "nodeType": "ExpressionStatement", + "src": "1251:36:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 80, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 76, + "name": "tokenPetBreed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1298:13:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 78, + "indexExpression": { + "argumentTypes": null, + "id": 77, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1312:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1298:23:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 79, + "name": "tokenPetBreed_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 39, + "src": "1324:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1298:40:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 81, + "nodeType": "ExpressionStatement", + "src": "1298:40:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 86, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 82, + "name": "tokenPetLocation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "1349:16:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 84, + "indexExpression": { + "argumentTypes": null, + "id": 83, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1366:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1349:26:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 85, + "name": "tokenPetLocation_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "1378:17:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1349:46:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 87, + "nodeType": "ExpressionStatement", + "src": "1349:46:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 88, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1415:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 45, + "id": 89, + "nodeType": "Return", + "src": "1408:15:0" + } + ] + }, + "documentation": null, + "id": 91, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "claim", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 42, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 33, + "name": "couponId", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "684:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 32, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "684:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 35, + "name": "tokenPetName_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "709:27:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 34, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "709:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 37, + "name": "tokenPetAge_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "747:17:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 36, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "747:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 39, + "name": "tokenPetBreed_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "775:28:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 38, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "775:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 41, + "name": "tokenPetLocation_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "814:31:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 40, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "814:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "673:188:0" + }, + "returnParameters": { + "id": 45, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 44, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "886:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 43, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "886:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "885:6:0" + }, + "scope": 158, + "src": "659:772:0", + "stateMutability": "payable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 100, + "nodeType": "Block", + "src": "1548:35:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 98, + "name": "customers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "1566:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16] storage ref" + } + }, + "functionReturnParameters": 97, + "id": 99, + "nodeType": "Return", + "src": "1559:16:0" + } + ] }, - "typeName": { - "baseType": { - "id": 2, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "51:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "documentation": null, + "id": 101, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getCustomers", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 92, + "nodeType": "ParameterList", + "parameters": [], + "src": "1504:2:0" + }, + "returnParameters": { + "id": 97, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 96, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 101, + "src": "1528:18:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_memory_ptr", + "typeString": "address[16]" + }, + "typeName": { + "baseType": { + "id": 93, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1528:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 95, + "length": { + "argumentTypes": null, + "hexValue": "3136", + "id": 94, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1536:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": null, + "typeString": null + }, + "value": "16" + }, + "nodeType": "ArrayTypeName", + "src": "1528:11:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage_ptr", + "typeString": "address[16]" + } + }, + "value": null, + "visibility": "internal" } - }, - "id": 4, - "length": { - "argumentTypes": null, - "hexValue": "3136", - "id": 3, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "59:2:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": null, - "typeString": null - }, - "value": "16" - }, - "nodeType": "ArrayTypeName", - "src": "51:11:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage_ptr", - "typeString": "address[16]" - } + ], + "src": "1527:20:0" }, - "value": null, + "scope": 158, + "src": "1483:100:0", + "stateMutability": "view", + "superFunction": null, "visibility": "public" }, { "body": { - "id": 31, + "id": 144, "nodeType": "Block", - "src": "163:126:0", + "src": "1995:307:0", "statements": [ { "expression": { "argumentTypes": null, - "arguments": [ - { + "id": 118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 116, + "name": "tokenID_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 106, + "src": "2064:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 117, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2075:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2064:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 119, + "nodeType": "ExpressionStatement", + "src": "2064:20:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 120, + "name": "tokenPetName_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 108, + "src": "2095:13:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "id": 19, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 15, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 13, - "name": "couponId", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "181:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">=", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 14, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "193:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "181:13:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "BinaryOperation", - "operator": "&&", - "rightExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 18, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 16, - "name": "couponId", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "198:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "hexValue": "3135", - "id": 17, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "210:2:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_15_by_1", - "typeString": "int_const 15" - }, - "value": "15" - }, - "src": "198:14:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "src": "181:31:0", + "id": 121, + "name": "tokenPetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 19, + "src": "2111:12:0", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 123, + "indexExpression": { + "argumentTypes": null, + "id": 122, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2124:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2111:23:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" + }, + "src": "2095:39:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 125, + "nodeType": "ExpressionStatement", + "src": "2095:39:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 130, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 126, + "name": "tokenPetAge_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 110, + "src": "2145:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 127, + "name": "tokenPetAge", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23, + "src": "2160:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" } - ], - "id": 12, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 118, - 119 - ], - "referencedDeclaration": 118, - "src": "173:7:0", + }, + "id": 129, + "indexExpression": { + "argumentTypes": null, + "id": 128, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2172:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2160:22:0", "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 20, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "173:40:0", + "src": "2145:37:0", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 21, + "id": 131, "nodeType": "ExpressionStatement", - "src": "173:40:0" + "src": "2145:37:0" }, { "expression": { "argumentTypes": null, - "id": 27, + "id": 136, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { + "argumentTypes": null, + "id": 132, + "name": "tokenPetBreed_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 112, + "src": "2193:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, - "id": 22, - "name": "customers", + "id": 133, + "name": "tokenPetBreed", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "224:9:0", + "referencedDeclaration": 27, + "src": "2210:13:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage", - "typeString": "address[16] storage ref" + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" } }, - "id": 24, + "id": 135, "indexExpression": { "argumentTypes": null, - "id": 23, - "name": "couponId", + "id": 134, + "name": "_couponId", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "234:8:0", + "referencedDeclaration": 103, + "src": "2224:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -920,94 +3622,117 @@ "isConstant": false, "isLValue": true, "isPure": false, - "lValueRequested": true, + "lValueRequested": false, "nodeType": "IndexAccess", - "src": "224:19:0", + "src": "2210:24:0", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "src": "2193:41:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 137, + "nodeType": "ExpressionStatement", + "src": "2193:41:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 138, + "name": "tokenPetLocation_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 114, + "src": "2245:17:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, - "expression": { + "baseExpression": { "argumentTypes": null, - "id": 25, - "name": "msg", + "id": 139, + "name": "tokenPetLocation", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "246:3:0", + "referencedDeclaration": 31, + "src": "2265:16:0", "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 141, + "indexExpression": { + "argumentTypes": null, + "id": 140, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2282:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 26, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "246:10:0", + "nodeType": "IndexAccess", + "src": "2265:27:0", "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" } }, - "src": "224:32:0", + "src": "2245:47:0", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" } }, - "id": 28, + "id": 143, "nodeType": "ExpressionStatement", - "src": "224:32:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 29, - "name": "couponId", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "274:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 11, - "id": 30, - "nodeType": "Return", - "src": "267:15:0" + "src": "2245:47:0" } ] }, "documentation": null, - "id": 32, + "id": 145, "implemented": true, "kind": "function", "modifiers": [], - "name": "claim", + "name": "getToken", "nodeType": "FunctionDefinition", "parameters": { - "id": 8, + "id": 104, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 7, - "name": "couponId", + "id": 103, + "name": "_couponId", "nodeType": "VariableDeclaration", - "scope": 32, - "src": "126:13:0", + "scope": 145, + "src": "1744:17:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1015,10 +3740,10 @@ "typeString": "uint256" }, "typeName": { - "id": 6, - "name": "uint", + "id": 102, + "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "126:4:0", + "src": "1744:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1028,19 +3753,71 @@ "visibility": "internal" } ], - "src": "125:15:0" + "src": "1743:19:0" }, "returnParameters": { - "id": 11, + "id": 115, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 10, - "name": "", + "id": 106, + "name": "tokenID_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1825:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 105, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1825:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 108, + "name": "tokenPetName_", "nodeType": "VariableDeclaration", - "scope": 32, - "src": "157:4:0", + "scope": 145, + "src": "1849:27:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 107, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1849:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 110, + "name": "tokenPetAge_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1887:17:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1048,10 +3825,10 @@ "typeString": "uint256" }, "typeName": { - "id": 9, + "id": 109, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "157:4:0", + "src": "1887:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1059,129 +3836,208 @@ }, "value": null, "visibility": "internal" + }, + { + "constant": false, + "id": 112, + "name": "tokenPetBreed_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1915:28:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 111, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1915:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 114, + "name": "tokenPetLocation_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1954:31:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 113, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1954:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" } ], - "src": "156:6:0" + "src": "1812:182:0" }, - "scope": 43, - "src": "111:178:0", - "stateMutability": "nonpayable", + "scope": 158, + "src": "1726:576:0", + "stateMutability": "view", "superFunction": null, - "visibility": "public" + "visibility": "external" }, { "body": { - "id": 41, + "id": 156, "nodeType": "Block", - "src": "391:33:0", + "src": "2374:44:0", "statements": [ { "expression": { "argumentTypes": null, - "id": 39, - "name": "customers", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "408:9:0", + "baseExpression": { + "argumentTypes": null, + "id": 152, + "name": "customers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "2392:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16] storage ref" + } + }, + "id": 154, + "indexExpression": { + "argumentTypes": null, + "id": 153, + "name": "tokenId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 147, + "src": "2402:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2392:18:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage", - "typeString": "address[16] storage ref" + "typeIdentifier": "t_address", + "typeString": "address" } }, - "functionReturnParameters": 38, - "id": 40, + "functionReturnParameters": 151, + "id": 155, "nodeType": "Return", - "src": "401:16:0" + "src": "2385:25:0" } ] }, "documentation": null, - "id": 42, + "id": 157, "implemented": true, "kind": "function", "modifiers": [], - "name": "getCustomers", + "name": "getOwner", "nodeType": "FunctionDefinition", "parameters": { - "id": 33, + "id": 148, "nodeType": "ParameterList", - "parameters": [], - "src": "347:2:0" + "parameters": [ + { + "constant": false, + "id": 147, + "name": "tokenId", + "nodeType": "VariableDeclaration", + "scope": 157, + "src": "2332:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 146, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2332:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2331:14:0" }, "returnParameters": { - "id": 38, + "id": 151, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 37, + "id": 150, "name": "", "nodeType": "VariableDeclaration", - "scope": 42, - "src": "371:18:0", + "scope": 157, + "src": "2366:7:0", "stateVariable": false, - "storageLocation": "memory", + "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_memory_ptr", - "typeString": "address[16]" + "typeIdentifier": "t_address", + "typeString": "address" }, "typeName": { - "baseType": { - "id": 34, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "371:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 36, - "length": { - "argumentTypes": null, - "hexValue": "3136", - "id": 35, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "379:2:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": null, - "typeString": null - }, - "value": "16" - }, - "nodeType": "ArrayTypeName", - "src": "371:11:0", + "id": 149, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2366:7:0", + "stateMutability": "nonpayable", "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage_ptr", - "typeString": "address[16]" + "typeIdentifier": "t_address", + "typeString": "address" } }, "value": null, "visibility": "internal" } ], - "src": "370:20:0" + "src": "2365:9:0" }, - "scope": 43, - "src": "326:98:0", + "scope": 158, + "src": "2314:104:0", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], - "scope": 44, - "src": "25:402:0" + "scope": 159, + "src": "62:2362:0" } ], - "src": "0:427:0" + "src": "0:2424:0" }, "compiler": { "name": "solc", @@ -1191,12 +4047,12 @@ "5777": { "events": {}, "links": {}, - "address": "0x36d32F8a3582De966671dC61dc729E47364F61b4", - "transactionHash": "0xd524962696b0c736cb995923124f61f3220abfd0a1957dfe6bc751ccbac948aa" + "address": "0x7E800d551028bf152f3514F9a52Fff6974f87096", + "transactionHash": "0x5b0f76d10d3fe81ae5264a95d428cfbf246c6ba03c0acd3619280f875f2bf267" } }, - "schemaVersion": "3.0.1", - "updatedAt": "2019-02-02T15:30:10.675Z", + "schemaVersion": "3.0.0", + "updatedAt": "2019-02-10T14:49:07.724Z", "devdoc": { "methods": {} }, diff --git a/build/contracts/Migrations.json b/build/contracts/Migrations.json index 7f653b7..ff59773 100644 --- a/build/contracts/Migrations.json +++ b/build/contracts/Migrations.json @@ -69,24 +69,24 @@ "signature": "0x0900f010" } ], - "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610314806100606000396000f3fe608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a72305820fcad07ca7cb06b4041d6d2a9913da9c942f924ff81e60fdbba2d2a9ee3f687900029", - "deployedBytecode": "0x608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a72305820fcad07ca7cb06b4041d6d2a9913da9c942f924ff81e60fdbba2d2a9ee3f687900029", - "sourceMap": "25:480:1:-;;;114:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;114:50:1;149:10;141:5;;:18;;;;;;;;;;;;;;;;;;25:480;;;;;;", - "deployedSourceMap": "25:480:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;338:165;;8:9:-1;5:2;;;30:1;27;20:12;5:2;338:165:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;338:165:1;;;;;;;;;;;;;;;;;;;;;;73:36;;8:9:-1;5:2;;;30:1;27;20:12;5:2;73:36:1;;;;;;;;;;;;;;;;;;;;;;;49:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;49:20:1;;;;;;;;;;;;;;;;;;;;;;;;;;;231:103;;8:9:-1;5:2;;;30:1;27;20:12;5:2;231:103:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;231:103:1;;;;;;;;;;;;;;;;;;;;338:165;214:5;;;;;;;;;;;200:19;;:10;:19;;;196:26;;;400:19;433:11;400:45;;451:8;:21;;;473:24;;451:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;451:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;451:47:1;;;;221:1;196:26;338:165;:::o;73:36::-;;;;:::o;49:20::-;;;;;;;;;;;;;:::o;231:103::-;214:5;;;;;;;;;;;200:19;;:10;:19;;;196:26;;;320:9;293:24;:36;;;;196:26;231:103;:::o", - "source": "pragma solidity ^0.5.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier restricted() {\n if (msg.sender == owner) _;\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", - "sourcePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Migrations.sol", + "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610314806100606000396000f3fe608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a72305820a3d1f1dfb027222e6d9d28e434cb365d92f0fcd8f9a2381b35b2260e1796e04d0029", + "deployedBytecode": "0x608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a72305820a3d1f1dfb027222e6d9d28e434cb365d92f0fcd8f9a2381b35b2260e1796e04d0029", + "sourceMap": "27:500:1:-;;;120:52;8:9:-1;5:2;;;30:1;27;20:12;5:2;120:52:1;156:10;148:5;;:18;;;;;;;;;;;;;;;;;;27:500;;;;;;", + "deployedSourceMap": "27:500:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;356:168;;8:9:-1;5:2;;;30:1;27;20:12;5:2;356:168:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;356:168:1;;;;;;;;;;;;;;;;;;;;;;77:36;;8:9:-1;5:2;;;30:1;27;20:12;5:2;77:36:1;;;;;;;;;;;;;;;;;;;;;;;52:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;52:20:1;;;;;;;;;;;;;;;;;;;;;;;;;;;245:105;;8:9:-1;5:2;;;30:1;27;20:12;5:2;245:105:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;245:105:1;;;;;;;;;;;;;;;;;;;;356:168;225:5;;;;;;;;;;;211:19;;:10;:19;;;207:26;;;419:19;452:11;419:45;;471:8;:21;;;493:24;;471:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;471:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;471:47:1;;;;232:1;207:26;356:168;:::o;77:36::-;;;;:::o;52:20::-;;;;;;;;;;;;;:::o;245:105::-;225:5;;;;;;;;;;;211:19;;:10;:19;;;207:26;;;335:9;308:24;:36;;;;207:26;245:105;:::o", + "source": "pragma solidity ^0.5.0;\r\n\r\ncontract Migrations {\r\n address public owner;\r\n uint public last_completed_migration;\r\n\r\n constructor() public {\r\n owner = msg.sender;\r\n }\r\n\r\n modifier restricted() {\r\n if (msg.sender == owner) _;\r\n }\r\n\r\n function setCompleted(uint completed) public restricted {\r\n last_completed_migration = completed;\r\n }\r\n\r\n function upgrade(address new_address) public restricted {\r\n Migrations upgraded = Migrations(new_address);\r\n upgraded.setCompleted(last_completed_migration);\r\n }\r\n}\r\n", + "sourcePath": "C:/Users/Michael/Documents/GitHub/lesson-06/contracts/Migrations.sol", "ast": { - "absolutePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Migrations.sol", + "absolutePath": "/C/Users/Michael/Documents/GitHub/lesson-06/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ - 100 + 215 ] }, - "id": 101, + "id": 216, "nodeType": "SourceUnit", "nodes": [ { - "id": 45, + "id": 160, "literals": [ "solidity", "^", @@ -102,20 +102,20 @@ "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 100, + "id": 215, "linearizedBaseContracts": [ - 100 + 215 ], "name": "Migrations", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, - "id": 47, + "id": 162, "name": "owner", "nodeType": "VariableDeclaration", - "scope": 100, - "src": "49:20:1", + "scope": 215, + "src": "52:20:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -123,10 +123,10 @@ "typeString": "address" }, "typeName": { - "id": 46, + "id": 161, "name": "address", "nodeType": "ElementaryTypeName", - "src": "49:7:1", + "src": "52:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -138,11 +138,11 @@ }, { "constant": false, - "id": 49, + "id": 164, "name": "last_completed_migration", "nodeType": "VariableDeclaration", - "scope": 100, - "src": "73:36:1", + "scope": 215, + "src": "77:36:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -150,10 +150,10 @@ "typeString": "uint256" }, "typeName": { - "id": 48, + "id": 163, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "73:4:1", + "src": "77:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -164,26 +164,26 @@ }, { "body": { - "id": 57, + "id": 172, "nodeType": "Block", - "src": "135:29:1", + "src": "141:31:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 55, + "id": 170, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 52, + "id": 167, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 47, - "src": "141:5:1", + "referencedDeclaration": 162, + "src": "148:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -195,18 +195,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 53, + "id": 168, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "149:3:1", + "referencedDeclaration": 230, + "src": "156:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 54, + "id": 169, "isConstant": false, "isLValue": false, "isPure": false, @@ -214,54 +214,54 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "149:10:1", + "src": "156:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, - "src": "141:18:1", + "src": "148:18:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 56, + "id": 171, "nodeType": "ExpressionStatement", - "src": "141:18:1" + "src": "148:18:1" } ] }, "documentation": null, - "id": 58, + "id": 173, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { - "id": 50, + "id": 165, "nodeType": "ParameterList", "parameters": [], - "src": "125:2:1" + "src": "131:2:1" }, "returnParameters": { - "id": 51, + "id": 166, "nodeType": "ParameterList", "parameters": [], - "src": "135:0:1" + "src": "141:0:1" }, - "scope": 100, - "src": "114:50:1", + "scope": 215, + "src": "120:52:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 66, + "id": 181, "nodeType": "Block", - "src": "190:37:1", + "src": "200:39:1", "statements": [ { "condition": { @@ -270,7 +270,7 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 63, + "id": 178, "isConstant": false, "isLValue": false, "isPure": false, @@ -279,18 +279,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 60, + "id": 175, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "200:3:1", + "referencedDeclaration": 230, + "src": "211:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 61, + "id": 176, "isConstant": false, "isLValue": false, "isPure": false, @@ -298,7 +298,7 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "200:10:1", + "src": "211:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" @@ -308,70 +308,70 @@ "operator": "==", "rightExpression": { "argumentTypes": null, - "id": 62, + "id": 177, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 47, - "src": "214:5:1", + "referencedDeclaration": 162, + "src": "225:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "200:19:1", + "src": "211:19:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, - "id": 65, + "id": 180, "nodeType": "IfStatement", - "src": "196:26:1", + "src": "207:26:1", "trueBody": { - "id": 64, + "id": 179, "nodeType": "PlaceholderStatement", - "src": "221:1:1" + "src": "232:1:1" } } ] }, "documentation": null, - "id": 67, + "id": 182, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { - "id": 59, + "id": 174, "nodeType": "ParameterList", "parameters": [], - "src": "187:2:1" + "src": "197:2:1" }, - "src": "168:59:1", + "src": "178:61:1", "visibility": "internal" }, { "body": { - "id": 78, + "id": 193, "nodeType": "Block", - "src": "287:47:1", + "src": "301:49:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 76, + "id": 191, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 74, + "id": 189, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 49, - "src": "293:24:1", + "referencedDeclaration": 164, + "src": "308:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -381,67 +381,67 @@ "operator": "=", "rightHandSide": { "argumentTypes": null, - "id": 75, + "id": 190, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 69, - "src": "320:9:1", + "referencedDeclaration": 184, + "src": "335:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "293:36:1", + "src": "308:36:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 77, + "id": 192, "nodeType": "ExpressionStatement", - "src": "293:36:1" + "src": "308:36:1" } ] }, "documentation": null, - "id": 79, + "id": 194, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, - "id": 72, + "id": 187, "modifierName": { "argumentTypes": null, - "id": 71, + "id": 186, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 67, - "src": "276:10:1", + "referencedDeclaration": 182, + "src": "290:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", - "src": "276:10:1" + "src": "290:10:1" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { - "id": 70, + "id": 185, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 69, + "id": 184, "name": "completed", "nodeType": "VariableDeclaration", - "scope": 79, - "src": "253:14:1", + "scope": 194, + "src": "267:14:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -449,10 +449,10 @@ "typeString": "uint256" }, "typeName": { - "id": 68, + "id": 183, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "253:4:1", + "src": "267:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -462,53 +462,53 @@ "visibility": "internal" } ], - "src": "252:16:1" + "src": "266:16:1" }, "returnParameters": { - "id": 73, + "id": 188, "nodeType": "ParameterList", "parameters": [], - "src": "287:0:1" + "src": "301:0:1" }, - "scope": 100, - "src": "231:103:1", + "scope": 215, + "src": "245:105:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 98, + "id": 213, "nodeType": "Block", - "src": "394:109:1", + "src": "412:112:1", "statements": [ { "assignments": [ - 87 + 202 ], "declarations": [ { "constant": false, - "id": 87, + "id": 202, "name": "upgraded", "nodeType": "VariableDeclaration", - "scope": 98, - "src": "400:19:1", + "scope": 213, + "src": "419:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" }, "typeName": { "contractScope": null, - "id": 86, + "id": 201, "name": "Migrations", "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 100, - "src": "400:10:1", + "referencedDeclaration": 215, + "src": "419:10:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, @@ -516,18 +516,18 @@ "visibility": "internal" } ], - "id": 91, + "id": 206, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, - "id": 89, + "id": 204, "name": "new_address", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 81, - "src": "433:11:1", + "referencedDeclaration": 196, + "src": "452:11:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -541,18 +541,18 @@ "typeString": "address" } ], - "id": 88, + "id": 203, "name": "Migrations", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "422:10:1", + "referencedDeclaration": 215, + "src": "441:10:1", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$100_$", + "typeIdentifier": "t_type$_t_contract$_Migrations_$215_$", "typeString": "type(contract Migrations)" } }, - "id": 90, + "id": 205, "isConstant": false, "isLValue": false, "isPure": false, @@ -560,14 +560,14 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "422:23:1", + "src": "441:23:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", - "src": "400:45:1" + "src": "419:45:1" }, { "expression": { @@ -575,12 +575,12 @@ "arguments": [ { "argumentTypes": null, - "id": 95, + "id": 210, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 49, - "src": "473:24:1", + "referencedDeclaration": 164, + "src": "493:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -596,32 +596,32 @@ ], "expression": { "argumentTypes": null, - "id": 92, + "id": 207, "name": "upgraded", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 87, - "src": "451:8:1", + "referencedDeclaration": 202, + "src": "471:8:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, - "id": 94, + "id": 209, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "setCompleted", "nodeType": "MemberAccess", - "referencedDeclaration": 79, - "src": "451:21:1", + "referencedDeclaration": 194, + "src": "471:21:1", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256) external" } }, - "id": 96, + "id": 211, "isConstant": false, "isLValue": false, "isPure": false, @@ -629,56 +629,56 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "451:47:1", + "src": "471:47:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 97, + "id": 212, "nodeType": "ExpressionStatement", - "src": "451:47:1" + "src": "471:47:1" } ] }, "documentation": null, - "id": 99, + "id": 214, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, - "id": 84, + "id": 199, "modifierName": { "argumentTypes": null, - "id": 83, + "id": 198, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 67, - "src": "383:10:1", + "referencedDeclaration": 182, + "src": "401:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", - "src": "383:10:1" + "src": "401:10:1" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { - "id": 82, + "id": 197, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 81, + "id": 196, "name": "new_address", "nodeType": "VariableDeclaration", - "scope": 99, - "src": "355:19:1", + "scope": 214, + "src": "373:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -686,10 +686,10 @@ "typeString": "address" }, "typeName": { - "id": 80, + "id": 195, "name": "address", "nodeType": "ElementaryTypeName", - "src": "355:7:1", + "src": "373:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -700,39 +700,39 @@ "visibility": "internal" } ], - "src": "354:21:1" + "src": "372:21:1" }, "returnParameters": { - "id": 85, + "id": 200, "nodeType": "ParameterList", "parameters": [], - "src": "394:0:1" + "src": "412:0:1" }, - "scope": 100, - "src": "338:165:1", + "scope": 215, + "src": "356:168:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], - "scope": 101, - "src": "25:480:1" + "scope": 216, + "src": "27:500:1" } ], - "src": "0:506:1" + "src": "0:529:1" }, "legacyAST": { - "absolutePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Migrations.sol", + "absolutePath": "/C/Users/Michael/Documents/GitHub/lesson-06/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ - 100 + 215 ] }, - "id": 101, + "id": 216, "nodeType": "SourceUnit", "nodes": [ { - "id": 45, + "id": 160, "literals": [ "solidity", "^", @@ -748,20 +748,20 @@ "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 100, + "id": 215, "linearizedBaseContracts": [ - 100 + 215 ], "name": "Migrations", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, - "id": 47, + "id": 162, "name": "owner", "nodeType": "VariableDeclaration", - "scope": 100, - "src": "49:20:1", + "scope": 215, + "src": "52:20:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -769,10 +769,10 @@ "typeString": "address" }, "typeName": { - "id": 46, + "id": 161, "name": "address", "nodeType": "ElementaryTypeName", - "src": "49:7:1", + "src": "52:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -784,11 +784,11 @@ }, { "constant": false, - "id": 49, + "id": 164, "name": "last_completed_migration", "nodeType": "VariableDeclaration", - "scope": 100, - "src": "73:36:1", + "scope": 215, + "src": "77:36:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -796,10 +796,10 @@ "typeString": "uint256" }, "typeName": { - "id": 48, + "id": 163, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "73:4:1", + "src": "77:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -810,26 +810,26 @@ }, { "body": { - "id": 57, + "id": 172, "nodeType": "Block", - "src": "135:29:1", + "src": "141:31:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 55, + "id": 170, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 52, + "id": 167, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 47, - "src": "141:5:1", + "referencedDeclaration": 162, + "src": "148:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -841,18 +841,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 53, + "id": 168, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "149:3:1", + "referencedDeclaration": 230, + "src": "156:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 54, + "id": 169, "isConstant": false, "isLValue": false, "isPure": false, @@ -860,54 +860,54 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "149:10:1", + "src": "156:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, - "src": "141:18:1", + "src": "148:18:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 56, + "id": 171, "nodeType": "ExpressionStatement", - "src": "141:18:1" + "src": "148:18:1" } ] }, "documentation": null, - "id": 58, + "id": 173, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { - "id": 50, + "id": 165, "nodeType": "ParameterList", "parameters": [], - "src": "125:2:1" + "src": "131:2:1" }, "returnParameters": { - "id": 51, + "id": 166, "nodeType": "ParameterList", "parameters": [], - "src": "135:0:1" + "src": "141:0:1" }, - "scope": 100, - "src": "114:50:1", + "scope": 215, + "src": "120:52:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 66, + "id": 181, "nodeType": "Block", - "src": "190:37:1", + "src": "200:39:1", "statements": [ { "condition": { @@ -916,7 +916,7 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 63, + "id": 178, "isConstant": false, "isLValue": false, "isPure": false, @@ -925,18 +925,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 60, + "id": 175, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "200:3:1", + "referencedDeclaration": 230, + "src": "211:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 61, + "id": 176, "isConstant": false, "isLValue": false, "isPure": false, @@ -944,7 +944,7 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "200:10:1", + "src": "211:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" @@ -954,70 +954,70 @@ "operator": "==", "rightExpression": { "argumentTypes": null, - "id": 62, + "id": 177, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 47, - "src": "214:5:1", + "referencedDeclaration": 162, + "src": "225:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "200:19:1", + "src": "211:19:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, - "id": 65, + "id": 180, "nodeType": "IfStatement", - "src": "196:26:1", + "src": "207:26:1", "trueBody": { - "id": 64, + "id": 179, "nodeType": "PlaceholderStatement", - "src": "221:1:1" + "src": "232:1:1" } } ] }, "documentation": null, - "id": 67, + "id": 182, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { - "id": 59, + "id": 174, "nodeType": "ParameterList", "parameters": [], - "src": "187:2:1" + "src": "197:2:1" }, - "src": "168:59:1", + "src": "178:61:1", "visibility": "internal" }, { "body": { - "id": 78, + "id": 193, "nodeType": "Block", - "src": "287:47:1", + "src": "301:49:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 76, + "id": 191, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 74, + "id": 189, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 49, - "src": "293:24:1", + "referencedDeclaration": 164, + "src": "308:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1027,67 +1027,67 @@ "operator": "=", "rightHandSide": { "argumentTypes": null, - "id": 75, + "id": 190, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 69, - "src": "320:9:1", + "referencedDeclaration": 184, + "src": "335:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "293:36:1", + "src": "308:36:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 77, + "id": 192, "nodeType": "ExpressionStatement", - "src": "293:36:1" + "src": "308:36:1" } ] }, "documentation": null, - "id": 79, + "id": 194, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, - "id": 72, + "id": 187, "modifierName": { "argumentTypes": null, - "id": 71, + "id": 186, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 67, - "src": "276:10:1", + "referencedDeclaration": 182, + "src": "290:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", - "src": "276:10:1" + "src": "290:10:1" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { - "id": 70, + "id": 185, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 69, + "id": 184, "name": "completed", "nodeType": "VariableDeclaration", - "scope": 79, - "src": "253:14:1", + "scope": 194, + "src": "267:14:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1095,10 +1095,10 @@ "typeString": "uint256" }, "typeName": { - "id": 68, + "id": 183, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "253:4:1", + "src": "267:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1108,53 +1108,53 @@ "visibility": "internal" } ], - "src": "252:16:1" + "src": "266:16:1" }, "returnParameters": { - "id": 73, + "id": 188, "nodeType": "ParameterList", "parameters": [], - "src": "287:0:1" + "src": "301:0:1" }, - "scope": 100, - "src": "231:103:1", + "scope": 215, + "src": "245:105:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 98, + "id": 213, "nodeType": "Block", - "src": "394:109:1", + "src": "412:112:1", "statements": [ { "assignments": [ - 87 + 202 ], "declarations": [ { "constant": false, - "id": 87, + "id": 202, "name": "upgraded", "nodeType": "VariableDeclaration", - "scope": 98, - "src": "400:19:1", + "scope": 213, + "src": "419:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" }, "typeName": { "contractScope": null, - "id": 86, + "id": 201, "name": "Migrations", "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 100, - "src": "400:10:1", + "referencedDeclaration": 215, + "src": "419:10:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, @@ -1162,18 +1162,18 @@ "visibility": "internal" } ], - "id": 91, + "id": 206, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, - "id": 89, + "id": 204, "name": "new_address", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 81, - "src": "433:11:1", + "referencedDeclaration": 196, + "src": "452:11:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1187,18 +1187,18 @@ "typeString": "address" } ], - "id": 88, + "id": 203, "name": "Migrations", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "422:10:1", + "referencedDeclaration": 215, + "src": "441:10:1", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$100_$", + "typeIdentifier": "t_type$_t_contract$_Migrations_$215_$", "typeString": "type(contract Migrations)" } }, - "id": 90, + "id": 205, "isConstant": false, "isLValue": false, "isPure": false, @@ -1206,14 +1206,14 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "422:23:1", + "src": "441:23:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", - "src": "400:45:1" + "src": "419:45:1" }, { "expression": { @@ -1221,12 +1221,12 @@ "arguments": [ { "argumentTypes": null, - "id": 95, + "id": 210, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 49, - "src": "473:24:1", + "referencedDeclaration": 164, + "src": "493:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1242,32 +1242,32 @@ ], "expression": { "argumentTypes": null, - "id": 92, + "id": 207, "name": "upgraded", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 87, - "src": "451:8:1", + "referencedDeclaration": 202, + "src": "471:8:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, - "id": 94, + "id": 209, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "setCompleted", "nodeType": "MemberAccess", - "referencedDeclaration": 79, - "src": "451:21:1", + "referencedDeclaration": 194, + "src": "471:21:1", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256) external" } }, - "id": 96, + "id": 211, "isConstant": false, "isLValue": false, "isPure": false, @@ -1275,56 +1275,56 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "451:47:1", + "src": "471:47:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 97, + "id": 212, "nodeType": "ExpressionStatement", - "src": "451:47:1" + "src": "471:47:1" } ] }, "documentation": null, - "id": 99, + "id": 214, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, - "id": 84, + "id": 199, "modifierName": { "argumentTypes": null, - "id": 83, + "id": 198, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 67, - "src": "383:10:1", + "referencedDeclaration": 182, + "src": "401:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", - "src": "383:10:1" + "src": "401:10:1" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { - "id": 82, + "id": 197, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 81, + "id": 196, "name": "new_address", "nodeType": "VariableDeclaration", - "scope": 99, - "src": "355:19:1", + "scope": 214, + "src": "373:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1332,10 +1332,10 @@ "typeString": "address" }, "typeName": { - "id": 80, + "id": 195, "name": "address", "nodeType": "ElementaryTypeName", - "src": "355:7:1", + "src": "373:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -1346,26 +1346,26 @@ "visibility": "internal" } ], - "src": "354:21:1" + "src": "372:21:1" }, "returnParameters": { - "id": 85, + "id": 200, "nodeType": "ParameterList", "parameters": [], - "src": "394:0:1" + "src": "412:0:1" }, - "scope": 100, - "src": "338:165:1", + "scope": 215, + "src": "356:168:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], - "scope": 101, - "src": "25:480:1" + "scope": 216, + "src": "27:500:1" } ], - "src": "0:506:1" + "src": "0:529:1" }, "compiler": { "name": "solc", @@ -1375,12 +1375,12 @@ "5777": { "events": {}, "links": {}, - "address": "0x15Ab56EF2Fab86f47a99508557807445801C0459", - "transactionHash": "0x005b8a6f7bfc672a8ada34bb295e899aee1f7a640901f488d922b870e5b57ed7" + "address": "0x89Ee4ABDeA8B80B713C2fb669370DA65369af7C8", + "transactionHash": "0x3beb8eb4f073e9ba2f21679e34a3ce3f816b76ef357cf67d5172fe75abdca728" } }, - "schemaVersion": "3.0.1", - "updatedAt": "2019-02-02T15:30:10.676Z", + "schemaVersion": "3.0.0", + "updatedAt": "2019-02-10T14:49:07.679Z", "devdoc": { "methods": {} }, diff --git a/contracts/Customers.sol b/contracts/Customers.sol index 4d598a2..a37404f 100644 --- a/contracts/Customers.sol +++ b/contracts/Customers.sol @@ -1,21 +1,93 @@ pragma solidity ^0.5.0; +pragma experimental ABIEncoderV2; contract Customers { + + /*** EVENTS ***/ + /// The event emitted (useable by web3) when a token is purchased + event BoughtToken(address indexed buyer, uint256 tokenId); + + address[16] public customers; + /// Price set by contract owner for each token in Wei. + uint256 tokenPrice = 3000000000000000; + + + /// The Name of the Pet + mapping(uint256 => string) tokenPetName; + + mapping(uint256 => uint) tokenPetAge; + + mapping(uint256 => string) tokenPetBreed; + + mapping(uint256 => string) tokenPetLocation; + + + // Claiming a coupon - function claim(uint couponId) public returns (uint) { - require(couponId >= 0 && couponId <= 15); + function claim( + uint couponId, + string memory tokenPetName_, + uint tokenPetAge_, + string memory tokenPetBreed_, + string memory tokenPetLocation_ + + ) public payable returns (uint) { + require(couponId >= 0 && couponId <= 15, ""); + + //Buy adjusting the function to payable then you can require a certain amount of ETH must be spent + //require(msg.value >= tokenPrice, "Amount of Ether sent too small"); + customers[couponId] = msg.sender; + tokenPetName[couponId] = tokenPetName_; + tokenPetAge[couponId] = tokenPetAge_; + tokenPetBreed[couponId] = tokenPetBreed_; + tokenPetLocation[couponId] = tokenPetLocation_; return couponId; } + + + + + + // Retrieving the adopters function getCustomers() public view returns (address[16] memory) { return customers; } + + // @notice Returns all the relevant information about a specific token + // @param _couponId The ID of the token of interest + function getToken(uint256 _couponId) + external + view + returns ( + uint tokenID_, + string memory tokenPetName_, + uint tokenPetAge_, + string memory tokenPetBreed_, + string memory tokenPetLocation_ + + ) { + // TODO: Add Token Score to the details returned + tokenID_ = _couponId; + tokenPetName_ = tokenPetName[_couponId]; + tokenPetAge_ = tokenPetAge[_couponId]; + tokenPetBreed_ = tokenPetBreed[_couponId]; + tokenPetLocation_ = tokenPetLocation[_couponId]; + + } + + + + function getOwner(uint tokenId) public view returns(address){ + return customers[tokenId]; + } + } \ No newline at end of file diff --git a/front/package-lock.json b/front/package-lock.json index b3e19c5..cbb1b81 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -13506,8 +13506,8 @@ }, "react": { "version": "16.7.0", - "resolved": "https://registry.npmjs.org/react/-/react-0.0.0-4a1072194.tgz", - "integrity": "sha512-ZUj2lkUDLjwJaGu4WD0dYSvsfIyhQt2l/AJDlg4ij+rCDU3fSFKgHWanNovViUoaWHAxgrpft3KGFfvWPZH5LA==", + "resolved": "https://registry.npmjs.org/react/-/react-16.7.0.tgz", + "integrity": "sha512-StCz3QY8lxTb5cl2HJxjwLFOXPIFQp+p+hxQfc8WE0QiLfCtIlKj8/+5tjjKm8uSTlAW+fCPaavGFS06V9Ar3A==", "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -13669,8 +13669,8 @@ }, "react-dom": { "version": "16.7.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-0.0.0-4a1072194.tgz", - "integrity": "sha512-GfG8Vh/jMcnJKDpv7T6O1pS/WVqiocjPQ9o9cscW8bjR9W36DT3Xb4pDZT70t1xyVvX48/NrTQGz0H7I3fCLhQ==", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.7.0.tgz", + "integrity": "sha512-D0Ufv1ExCAmF38P2Uh1lwpminZFRXEINJe53zRAbm4KPwSyd6DY/uDoS0Blj9jvPpn1+wivKpZYc8aAAN/nAkg==", "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -14798,8 +14798,8 @@ }, "scheduler": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.0.0-4a1072194.tgz", - "integrity": "sha512-U+PqKfBcR39RFbJrlJPFwDXG2iLOZBGOPzNSWTAGUoOfTiL8qHTkemJeyV5CcL0UyaRgR8g3S469cNWFs/SHIw==", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.12.0.tgz", + "integrity": "sha512-t7MBR28Akcp4Jm+QoR63XgAi9YgCUmgvDHqf5otgAj4QvdoBE4ImCX0ffehefePPG+aitiYHp0g/mW6s4Tp+dw==", "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" diff --git a/front/src/App.js b/front/src/App.js index 13e3200..1fb0ded 100755 --- a/front/src/App.js +++ b/front/src/App.js @@ -19,6 +19,11 @@ class App extends Component { account:null, web3:null, contract:null, + owners:null, + btext:'Claim', + tokenList:[ + // {id:0, title:'Token Name', type: 2} + ] } } @@ -28,52 +33,185 @@ class App extends Component { const accounts = await web3.eth.getAccounts() //Instantiate the smart contract - const contractInstance = new web3.eth.Contract(Customers.abi, '0x36d32F8a3582De966671dC61dc729E47364F61b4') + const contractInstance = new web3.eth.Contract(Customers.abi, '0x7E800d551028bf152f3514F9a52Fff6974f87096') - console.log(accounts, contractInstance) + console.log("d", contractInstance.methods.getToken(0)); - this.setState({account:accounts[0],contract:contractInstance}) + const getOwners = await contractInstance.methods.getCustomers().call(); + + const tokenId = 0 + //Get Owners + const ownerAddress = await contractInstance.methods.getOwner(tokenId).call(); + console.log("e", getOwners, ownerAddress) + + + console.log("a", accounts, contractInstance) + + this.setState({account:accounts[0],contract:contractInstance,getOwners}) + + this.getTokens(web3) + + + } + + + getItemInfo(id){ + + const {tokenList} = this.state; + + var status = "Not Owned"; + var token = tokenList.find(element => element.id == id); + + + if(token != null) + { + + status = "Owned"; + + } + + return status; } - handleAdopt = (data)=>{ + handleAdopt = (thisbutton, data)=>{ // e.preventDefault() - console.log(data) - const {contract, account} = this.state + console.log("b", data) + const {contract, account, web3} = this.state - contract.methods.claim(data.id).send({ from: account, gas: 1000000 }) + contract.methods.claim(data.id, data.name, data.age, data.breed, data.location).send({ from: account, gas: 1000000 }) .then((result) => { - console.log(result) + console.log("c", result); + + this.setState({ btext : "Claimed" }) + + this.getTokens(web3) }) } + + + + getTokens = async (web3) => { + + + let token_array = [] + + const {contract, account} = this.state + + + + + contract.methods.getCustomers().call().then((result) => { + + console.log("f", result) + + for(var i=0;i{ + // console.log(result) + token_array.push( + { + tokenAddress: theaddress, + id:result2.tokenID_, + tokenPetName: result2.tokenPetName_, + tokenPetAge: result2.tokenPetAge_, + tokenPetBreed: result2.tokenPetBreed_, + tokenPetLocation: result2. tokenPetLocation_ + }) + // console.log(token_array) + console.log("g", result[i]); + + this.setState({ tokenList:token_array }) + }) + + + } + + + } + + }) + + + + } + + + + + render() { + const {tokenList} = this.state + + const tokenTable = tokenList.map(function (item) { + // console.log(item) + // map the new array to list items + return {item.id}{item.tokenAddress}{item.tokenPetName}{item.tokenPetAge}{item.tokenPetBreed}{item.tokenPetLocation} + }) + + const tableItems = data.map((value, key) => - + + {value.id} {value.name} {value.age} + {value.breed} {value.location} - + + {this.getItemInfo(value.id)} ); return (
- + +

Pets

+
+ + + {tableItems}
ID Name AgeBreed Location Photo ActionStatus
+ +

+ +

Coupons

+ + + + + + + + + + {/* */} + + {tokenTable} +
IDAddressNameAgeBreedLocationStatus
+ + + + +
); } diff --git a/front/src/contracts/Customers.json b/front/src/contracts/Customers.json index f5b6430..4651ea8 100644 --- a/front/src/contracts/Customers.json +++ b/front/src/contracts/Customers.json @@ -18,7 +18,26 @@ ], "payable": false, "stateMutability": "view", - "type": "function" + "type": "function", + "signature": "0xc0abda2a" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "buyer", + "type": "address" + }, + { + "indexed": false, + "name": "tokenId", + "type": "uint256" + } + ], + "name": "BoughtToken", + "type": "event", + "signature": "0x75424253909c2f4460f8a59099700e980f5b484608c4fdd79f600f5162ac88a5" }, { "constant": false, @@ -26,6 +45,22 @@ { "name": "couponId", "type": "uint256" + }, + { + "name": "tokenPetName_", + "type": "string" + }, + { + "name": "tokenPetAge_", + "type": "uint256" + }, + { + "name": "tokenPetBreed_", + "type": "string" + }, + { + "name": "tokenPetLocation_", + "type": "string" } ], "name": "claim", @@ -35,9 +70,10 @@ "type": "uint256" } ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" + "payable": true, + "stateMutability": "payable", + "type": "function", + "signature": "0xd1420886" }, { "constant": true, @@ -51,23 +87,80 @@ ], "payable": false, "stateMutability": "view", - "type": "function" + "type": "function", + "signature": "0xf1ba7127" + }, + { + "constant": true, + "inputs": [ + { + "name": "_couponId", + "type": "uint256" + } + ], + "name": "getToken", + "outputs": [ + { + "name": "tokenID_", + "type": "uint256" + }, + { + "name": "tokenPetName_", + "type": "string" + }, + { + "name": "tokenPetAge_", + "type": "uint256" + }, + { + "name": "tokenPetBreed_", + "type": "string" + }, + { + "name": "tokenPetLocation_", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function", + "signature": "0xe4b50cb8" + }, + { + "constant": true, + "inputs": [ + { + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getOwner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function", + "signature": "0xc41a360a" } ], - "bytecode": "0x608060405234801561001057600080fd5b506102f4806100206000396000f3fe608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063379607f51461005c578063c0abda2a146100ab578063f1ba712714610126575b600080fd5b34801561006857600080fd5b506100956004803603602081101561007f57600080fd5b8101908080359060200190929190505050610179565b6040518082815260200191505060405180910390f35b3480156100b757600080fd5b506100e4600480360360208110156100ce57600080fd5b81019080803590602001909291905050506101ee565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561013257600080fd5b5061013b610223565b6040518082601060200280838360005b8381101561016657808201518184015260208101905061014b565b5050505090500191505060405180910390f35b600080821015801561018c5750600f8211155b151561019757600080fd5b336000836010811015156101a757fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550819050919050565b6000816010811015156101fd57fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61022b6102a4565b600060108060200260405190810160405280929190826010801561029a576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610250575b5050505050905090565b6102006040519081016040528060109060208202803883398082019150509050509056fea165627a7a72305820e12bd15a549abb43cc074767a798135008ad21ad9e9cd6c16626b34d79a277f60029", - "deployedBytecode": "0x608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063379607f51461005c578063c0abda2a146100ab578063f1ba712714610126575b600080fd5b34801561006857600080fd5b506100956004803603602081101561007f57600080fd5b8101908080359060200190929190505050610179565b6040518082815260200191505060405180910390f35b3480156100b757600080fd5b506100e4600480360360208110156100ce57600080fd5b81019080803590602001909291905050506101ee565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561013257600080fd5b5061013b610223565b6040518082601060200280838360005b8381101561016657808201518184015260208101905061014b565b5050505090500191505060405180910390f35b600080821015801561018c5750600f8211155b151561019757600080fd5b336000836010811015156101a757fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550819050919050565b6000816010811015156101fd57fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61022b6102a4565b600060108060200260405190810160405280929190826010801561029a576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610250575b5050505050905090565b6102006040519081016040528060109060208202803883398082019150509050509056fea165627a7a72305820e12bd15a549abb43cc074767a798135008ad21ad9e9cd6c16626b34d79a277f60029", - "sourceMap": "25:402:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:402:0;;;;;;;", - "deployedSourceMap": "25:402:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111:178;;8:9:-1;5:2;;;30:1;27;20:12;5:2;111:178:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;111:178:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;51:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;51:28:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;51:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;326:98;;8:9:-1;5:2;;;30:1;27;20:12;5:2;326:98:0;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;326:98:0;;;;;;;;;;;;;;;;111:178;157:4;193:1;181:8;:13;;:31;;;;;210:2;198:8;:14;;181:31;173:40;;;;;;;;246:10;224:9;234:8;224:19;;;;;;;;;;;:32;;;;;;;;;;;;;;;;;;274:8;267:15;;111:178;;;:::o;51:28::-;;;;;;;;;;;;;;;;;;;;;;;;;:::o;326:98::-;371:18;;:::i;:::-;408:9;401:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;326:98;:::o;25:402::-;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;25:402:0;;;;:::o", - "source": "pragma solidity ^0.5.0;\n\ncontract Customers {\n\n address[16] public customers;\n\n // Claiming a coupon\n function claim(uint couponId) public returns (uint) {\n require(couponId >= 0 && couponId <= 15);\n\n customers[couponId] = msg.sender;\n\n return couponId;\n }\n\n // Retrieving the adopters\n function getCustomers() public view returns (address[16] memory) {\n return customers;\n }\n\n}", - "sourcePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Customers.sol", + "bytecode": "0x6080604052660aa87bee53800060105534801561001b57600080fd5b50610ae88061002b6000396000f3fe60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c0abda2a14610072578063c41a360a146100af578063d1420886146100ec578063e4b50cb81461011c578063f1ba71271461015d575b600080fd5b34801561007e57600080fd5b506100996004803603610094919081019061071e565b610188565b6040516100a691906108b5565b60405180910390f35b3480156100bb57600080fd5b506100d660048036036100d1919081019061071e565b6101bd565b6040516100e391906108b5565b60405180910390f35b61010660048036036101019190810190610747565b6101f6565b604051610113919061090c565b60405180910390f35b34801561012857600080fd5b50610143600480360361013e919081019061071e565b610335565b604051610154959493929190610927565b60405180910390f35b34801561016957600080fd5b5061017261056a565b60405161017f91906108d0565b60405180910390f35b60008160108110151561019757fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080826010811015156101cd57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008086101580156102095750600f8611155b151561024a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906108ec565b60405180910390fd5b3360008760108110151561025a57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550846011600088815260200190815260200160002090805190602001906102c09291906105eb565b50836012600088815260200190815260200160002081905550826013600088815260200190815260200160002090805190602001906103009291906105eb565b50816014600088815260200190815260200160002090805190602001906103289291906105eb565b5085905095945050505050565b600060606000606080859450601160008781526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103e85780601f106103bd576101008083540402835291602001916103e8565b820191906000526020600020905b8154815290600101906020018083116103cb57829003601f168201915b5050505050935060126000878152602001908152602001600020549250601360008781526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ac5780601f10610481576101008083540402835291602001916104ac565b820191906000526020600020905b81548152906001019060200180831161048f57829003601f168201915b50505050509150601460008781526020019081526020016000208054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561055a5780601f1061052f5761010080835404028352916020019161055a565b820191906000526020600020905b81548152906001019060200180831161053d57829003601f168201915b5050505050905091939590929450565b61057261066b565b60006010806020026040519081016040528092919082601080156105e1576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610597575b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061062c57805160ff191683800117855561065a565b8280016001018555821561065a579182015b8281111561065957825182559160200191906001019061063e565b5b509050610667919061068f565b5090565b61020060405190810160405280601090602082028038833980820191505090505090565b6106b191905b808211156106ad576000816000905550600101610695565b5090565b90565b600082601f83011215156106c757600080fd5b81356106da6106d5826109bc565b61098f565b915080825260208301602083018583830111156106f657600080fd5b610701838284610a5b565b50505092915050565b60006107168235610a51565b905092915050565b60006020828403121561073057600080fd5b600061073e8482850161070a565b91505092915050565b600080600080600060a0868803121561075f57600080fd5b600061076d8882890161070a565b955050602086013567ffffffffffffffff81111561078a57600080fd5b610796888289016106b4565b94505060406107a78882890161070a565b935050606086013567ffffffffffffffff8111156107c457600080fd5b6107d0888289016106b4565b925050608086013567ffffffffffffffff8111156107ed57600080fd5b6107f9888289016106b4565b9150509295509295909350565b61080f81610a15565b82525050565b61081e816109f2565b610827826109e8565b60005b828110156108595761083d858351610806565b61084682610a08565b915060208501945060018101905061082a565b5050505050565b600061086b826109fd565b80845261087f816020860160208601610a6a565b61088881610a9d565b602085010191505092915050565b6000808252602082019050919050565b6108af81610a47565b82525050565b60006020820190506108ca6000830184610806565b92915050565b6000610200820190506108e66000830184610815565b92915050565b6000602082019050818103600083015261090581610896565b9050919050565b600060208201905061092160008301846108a6565b92915050565b600060a08201905061093c60008301886108a6565b818103602083015261094e8187610860565b905061095d60408301866108a6565b818103606083015261096f8185610860565b905081810360808301526109838184610860565b90509695505050505050565b6000604051905081810181811067ffffffffffffffff821117156109b257600080fd5b8060405250919050565b600067ffffffffffffffff8211156109d357600080fd5b601f19601f8301169050602081019050919050565b6000819050919050565b600060109050919050565b600081519050919050565b6000602082019050919050565b6000610a2082610a27565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610a88578082015181840152602081019050610a6d565b83811115610a97576000848401525b50505050565b6000601f19601f830116905091905056fea265627a7a7230582020209641176c5c8e63e53cf692cd1c7308b3222f65209647c37cea1e55093e096c6578706572696d656e74616cf50037", + "deployedBytecode": "0x60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c0abda2a14610072578063c41a360a146100af578063d1420886146100ec578063e4b50cb81461011c578063f1ba71271461015d575b600080fd5b34801561007e57600080fd5b506100996004803603610094919081019061071e565b610188565b6040516100a691906108b5565b60405180910390f35b3480156100bb57600080fd5b506100d660048036036100d1919081019061071e565b6101bd565b6040516100e391906108b5565b60405180910390f35b61010660048036036101019190810190610747565b6101f6565b604051610113919061090c565b60405180910390f35b34801561012857600080fd5b50610143600480360361013e919081019061071e565b610335565b604051610154959493929190610927565b60405180910390f35b34801561016957600080fd5b5061017261056a565b60405161017f91906108d0565b60405180910390f35b60008160108110151561019757fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080826010811015156101cd57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008086101580156102095750600f8611155b151561024a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906108ec565b60405180910390fd5b3360008760108110151561025a57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550846011600088815260200190815260200160002090805190602001906102c09291906105eb565b50836012600088815260200190815260200160002081905550826013600088815260200190815260200160002090805190602001906103009291906105eb565b50816014600088815260200190815260200160002090805190602001906103289291906105eb565b5085905095945050505050565b600060606000606080859450601160008781526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103e85780601f106103bd576101008083540402835291602001916103e8565b820191906000526020600020905b8154815290600101906020018083116103cb57829003601f168201915b5050505050935060126000878152602001908152602001600020549250601360008781526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ac5780601f10610481576101008083540402835291602001916104ac565b820191906000526020600020905b81548152906001019060200180831161048f57829003601f168201915b50505050509150601460008781526020019081526020016000208054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561055a5780601f1061052f5761010080835404028352916020019161055a565b820191906000526020600020905b81548152906001019060200180831161053d57829003601f168201915b5050505050905091939590929450565b61057261066b565b60006010806020026040519081016040528092919082601080156105e1576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610597575b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061062c57805160ff191683800117855561065a565b8280016001018555821561065a579182015b8281111561065957825182559160200191906001019061063e565b5b509050610667919061068f565b5090565b61020060405190810160405280601090602082028038833980820191505090505090565b6106b191905b808211156106ad576000816000905550600101610695565b5090565b90565b600082601f83011215156106c757600080fd5b81356106da6106d5826109bc565b61098f565b915080825260208301602083018583830111156106f657600080fd5b610701838284610a5b565b50505092915050565b60006107168235610a51565b905092915050565b60006020828403121561073057600080fd5b600061073e8482850161070a565b91505092915050565b600080600080600060a0868803121561075f57600080fd5b600061076d8882890161070a565b955050602086013567ffffffffffffffff81111561078a57600080fd5b610796888289016106b4565b94505060406107a78882890161070a565b935050606086013567ffffffffffffffff8111156107c457600080fd5b6107d0888289016106b4565b925050608086013567ffffffffffffffff8111156107ed57600080fd5b6107f9888289016106b4565b9150509295509295909350565b61080f81610a15565b82525050565b61081e816109f2565b610827826109e8565b60005b828110156108595761083d858351610806565b61084682610a08565b915060208501945060018101905061082a565b5050505050565b600061086b826109fd565b80845261087f816020860160208601610a6a565b61088881610a9d565b602085010191505092915050565b6000808252602082019050919050565b6108af81610a47565b82525050565b60006020820190506108ca6000830184610806565b92915050565b6000610200820190506108e66000830184610815565b92915050565b6000602082019050818103600083015261090581610896565b9050919050565b600060208201905061092160008301846108a6565b92915050565b600060a08201905061093c60008301886108a6565b818103602083015261094e8187610860565b905061095d60408301866108a6565b818103606083015261096f8185610860565b905081810360808301526109838184610860565b90509695505050505050565b6000604051905081810181811067ffffffffffffffff821117156109b257600080fd5b8060405250919050565b600067ffffffffffffffff8211156109d357600080fd5b601f19601f8301169050602081019050919050565b6000819050919050565b600060109050919050565b600081519050919050565b6000602082019050919050565b6000610a2082610a27565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610a88578082015181840152602081019050610a6d565b83811115610a97576000848401525b50505050565b6000601f19601f830116905091905056fea265627a7a7230582020209641176c5c8e63e53cf692cd1c7308b3222f65209647c37cea1e55093e096c6578706572696d656e74616cf50037", + "sourceMap": "62:2362:0:-;;;371:16;350:37;;62:2362;8:9:-1;5:2;;;30:1;27;20:12;5:2;62:2362:0;;;;;;;", + "deployedSourceMap": "62:2362:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;253:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;253:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2314:104;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2314:104:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;659:772;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1726:576;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1726:576:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1483:100;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1483:100:0;;;;;;;;;;;;;;;;;;;;253:28;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2314:104::-;2366:7;2392:9;2402:7;2392:18;;;;;;;;;;;;;;;;;;;;2385:25;;2314:104;;;:::o;659:772::-;886:4;923:1;911:8;:13;;:31;;;;;940:2;928:8;:14;;911:31;903:44;;;;;;;;;;;;;;;;;;;;;;;;1181:10;1159:9;1169:8;1159:19;;;;;;;;;;;:32;;;;;;;;;;;;;;;;;;1227:13;1202:12;:22;1215:8;1202:22;;;;;;;;;;;:38;;;;;;;;;;;;:::i;:::-;;1275:12;1251:11;:21;1263:8;1251:21;;;;;;;;;;;:36;;;;1324:14;1298:13;:23;1312:8;1298:23;;;;;;;;;;;:40;;;;;;;;;;;;:::i;:::-;;1378:17;1349:16;:26;1366:8;1349:26;;;;;;;;;;;:46;;;;;;;;;;;;:::i;:::-;;1415:8;1408:15;;659:772;;;;;;;:::o;1726:576::-;1825:13;1849:27;1887:17;1915:28;1954:31;2075:9;2064:20;;2111:12;:23;2124:9;2111:23;;;;;;;;;;;2095:39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2160:11;:22;2172:9;2160:22;;;;;;;;;;;;2145:37;;2210:13;:24;2224:9;2210:24;;;;;;;;;;;2193:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2265:16;:27;2282:9;2265:27;;;;;;;;;;;2245:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1726:576;;;;;;;:::o;1483:100::-;1528:18;;:::i;:::-;1566:9;1559:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1483:100;:::o;62:2362::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;62:2362:0;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;6:442:-1:-;;108:3;101:4;93:6;89:17;85:27;78:35;75:2;;;126:1;123;116:12;75:2;163:6;150:20;185:65;200:49;242:6;200:49;;;185:65;;;176:74;;270:6;263:5;256:21;306:4;298:6;294:17;339:4;332:5;328:16;374:3;365:6;360:3;356:16;353:25;350:2;;;391:1;388;381:12;350:2;401:41;435:6;430:3;425;401:41;;;68:380;;;;;;;;456:118;;523:46;561:6;548:20;523:46;;;514:55;;508:66;;;;;581:241;;685:2;673:9;664:7;660:23;656:32;653:2;;;701:1;698;691:12;653:2;736:1;753:53;798:7;789:6;778:9;774:22;753:53;;;743:63;;715:97;647:175;;;;;829:1061;;;;;;1031:3;1019:9;1010:7;1006:23;1002:33;999:2;;;1048:1;1045;1038:12;999:2;1083:1;1100:53;1145:7;1136:6;1125:9;1121:22;1100:53;;;1090:63;;1062:97;1218:2;1207:9;1203:18;1190:32;1242:18;1234:6;1231:30;1228:2;;;1274:1;1271;1264:12;1228:2;1294:63;1349:7;1340:6;1329:9;1325:22;1294:63;;;1284:73;;1169:194;1394:2;1412:53;1457:7;1448:6;1437:9;1433:22;1412:53;;;1402:63;;1373:98;1530:2;1519:9;1515:18;1502:32;1554:18;1546:6;1543:30;1540:2;;;1586:1;1583;1576:12;1540:2;1606:63;1661:7;1652:6;1641:9;1637:22;1606:63;;;1596:73;;1481:194;1734:3;1723:9;1719:19;1706:33;1759:18;1751:6;1748:30;1745:2;;;1791:1;1788;1781:12;1745:2;1811:63;1866:7;1857:6;1846:9;1842:22;1811:63;;;1801:73;;1685:195;993:897;;;;;;;;;1897:110;1970:31;1995:5;1970:31;;;1965:3;1958:44;1952:55;;;2049:526;2174:53;2221:5;2174:53;;;2273:55;2322:5;2273:55;;;2349:1;2334:229;2359:6;2356:1;2353:13;2334:229;;;2399:53;2448:3;2439:6;2433:13;2399:53;;;2469:59;2521:6;2469:59;;;2459:69;;2551:4;2546:3;2542:14;2535:21;;2381:1;2378;2374:9;2369:14;;2334:229;;;2338:14;2153:422;;;;;2583:300;;2685:39;2718:5;2685:39;;;2741:6;2736:3;2729:19;2753:63;2809:6;2802:4;2797:3;2793:14;2786:4;2779:5;2775:16;2753:63;;;2848:29;2870:6;2848:29;;;2841:4;2836:3;2832:14;2828:50;2821:57;;2665:218;;;;;;2891:194;;3046:1;3041:3;3034:14;3076:2;3071:3;3067:12;3060:19;;3027:58;;;;3093:110;3166:31;3191:5;3166:31;;;3161:3;3154:44;3148:55;;;3210:193;;3318:2;3307:9;3303:18;3295:26;;3332:61;3390:1;3379:9;3375:17;3366:6;3332:61;;;3289:114;;;;;3410:290;;3566:3;3555:9;3551:19;3543:27;;3581:109;3687:1;3676:9;3672:17;3663:6;3581:109;;;3537:163;;;;;3707:387;;3888:2;3877:9;3873:18;3865:26;;3938:9;3932:4;3928:20;3924:1;3913:9;3909:17;3902:47;3963:121;4079:4;3963:121;;;3955:129;;3859:235;;;;4101:193;;4209:2;4198:9;4194:18;4186:26;;4223:61;4281:1;4270:9;4266:17;4257:6;4223:61;;;4180:114;;;;;4301:863;;4581:3;4570:9;4566:19;4558:27;;4596:61;4654:1;4643:9;4639:17;4630:6;4596:61;;;4705:9;4699:4;4695:20;4690:2;4679:9;4675:18;4668:48;4730:68;4793:4;4784:6;4730:68;;;4722:76;;4809:62;4867:2;4856:9;4852:18;4843:6;4809:62;;;4919:9;4913:4;4909:20;4904:2;4893:9;4889:18;4882:48;4944:68;5007:4;4998:6;4944:68;;;4936:76;;5061:9;5055:4;5051:20;5045:3;5034:9;5030:19;5023:49;5086:68;5149:4;5140:6;5086:68;;;5078:76;;4552:612;;;;;;;;;5171:256;;5233:2;5227:9;5217:19;;5271:4;5263:6;5259:17;5370:6;5358:10;5355:22;5334:18;5322:10;5319:34;5316:62;5313:2;;;5391:1;5388;5381:12;5313:2;5411:10;5407:2;5400:22;5211:216;;;;;5434:259;;5578:18;5570:6;5567:30;5564:2;;;5610:1;5607;5600:12;5564:2;5654:4;5650:9;5643:4;5635:6;5631:17;5627:33;5619:41;;5683:4;5677;5673:15;5665:23;;5501:192;;;;5702:109;;5798:6;5787:17;;5779:32;;;;5820:98;;5909:4;5899:14;;5893:25;;;;5925:92;;6006:5;6000:12;5990:22;;5984:33;;;;6025:121;;6135:4;6127:6;6123:17;6112:28;;6105:41;;;;6154:105;;6223:31;6248:5;6223:31;;;6212:42;;6206:53;;;;6266:128;;6346:42;6339:5;6335:54;6324:65;;6318:76;;;;6401:79;;6470:5;6459:16;;6453:27;;;;6487:79;;6556:5;6545:16;;6539:27;;;;6574:145;6655:6;6650:3;6645;6632:30;6711:1;6702:6;6697:3;6693:16;6686:27;6625:94;;;;6728:268;6793:1;6800:101;6814:6;6811:1;6808:13;6800:101;;;6890:1;6885:3;6881:11;6875:18;6871:1;6866:3;6862:11;6855:39;6836:2;6833:1;6829:10;6824:15;;6800:101;;;6916:6;6913:1;6910:13;6907:2;;;6981:1;6972:6;6967:3;6963:16;6956:27;6907:2;6777:219;;;;;7004:97;;7092:2;7088:7;7083:2;7076:5;7072:14;7068:28;7058:38;;7052:49;;;", + "source": "pragma solidity ^0.5.0;\r\npragma experimental ABIEncoderV2;\r\n\r\ncontract Customers {\r\n\r\n\r\n /*** EVENTS ***/\r\n /// The event emitted (useable by web3) when a token is purchased\r\n event BoughtToken(address indexed buyer, uint256 tokenId);\r\n\r\n\r\n address[16] public customers;\r\n\r\n /// Price set by contract owner for each token in Wei.\r\n uint256 tokenPrice = 3000000000000000;\r\n\r\n\r\n /// The Name of the Pet\r\n mapping(uint256 => string) tokenPetName;\r\n\r\n mapping(uint256 => uint) tokenPetAge;\r\n \r\n mapping(uint256 => string) tokenPetBreed;\r\n \r\n mapping(uint256 => string) tokenPetLocation;\r\n\r\n\r\n\r\n // Claiming a coupon\r\n function claim(\r\n uint couponId, \r\n string memory tokenPetName_,\r\n uint tokenPetAge_,\r\n string memory tokenPetBreed_,\r\n string memory tokenPetLocation_ \r\n \r\n ) public payable returns (uint) {\r\n require(couponId >= 0 && couponId <= 15, \"\");\r\n\r\n //Buy adjusting the function to payable then you can require a certain amount of ETH must be spent\r\n //require(msg.value >= tokenPrice, \"Amount of Ether sent too small\");\r\n \r\n\r\n customers[couponId] = msg.sender;\r\n tokenPetName[couponId] = tokenPetName_;\r\n tokenPetAge[couponId] = tokenPetAge_;\r\n tokenPetBreed[couponId] = tokenPetBreed_;\r\n tokenPetLocation[couponId] = tokenPetLocation_;\r\n\r\n return couponId;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n // Retrieving the adopters\r\n function getCustomers() public view returns (address[16] memory) {\r\n return customers;\r\n }\r\n\r\n\r\n // @notice Returns all the relevant information about a specific token\r\n // @param _couponId The ID of the token of interest\r\n function getToken(uint256 _couponId)\r\n external\r\n view\r\n returns (\t\t\r\n uint tokenID_,\r\n string memory tokenPetName_,\r\n uint tokenPetAge_,\r\n string memory tokenPetBreed_,\r\n string memory tokenPetLocation_\r\n\r\n ) {\r\n // TODO: Add Token Score to the details returned\r\n tokenID_ = _couponId;\r\n tokenPetName_ = tokenPetName[_couponId];\r\n tokenPetAge_ = tokenPetAge[_couponId];\r\n tokenPetBreed_ = tokenPetBreed[_couponId];\r\n tokenPetLocation_ = tokenPetLocation[_couponId];\r\n\r\n }\r\n\r\n\r\n\r\n function getOwner(uint tokenId) public view returns(address){\r\n return customers[tokenId];\r\n } \r\n\r\n}", + "sourcePath": "C:/Users/Michael/Documents/GitHub/lesson-06/contracts/Customers.sol", "ast": { - "absolutePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Customers.sol", + "absolutePath": "/C/Users/Michael/Documents/GitHub/lesson-06/contracts/Customers.sol", "exportedSymbols": { "Customers": [ - 43 + 158 ] }, - "id": 44, + "id": 159, "nodeType": "SourceUnit", "nodes": [ { @@ -81,26 +174,105 @@ "nodeType": "PragmaDirective", "src": "0:23:0" }, + { + "id": 2, + "literals": [ + "experimental", + "ABIEncoderV2" + ], + "nodeType": "PragmaDirective", + "src": "25:33:0" + }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 43, + "id": 158, "linearizedBaseContracts": [ - 43 + 158 ], "name": "Customers", "nodeType": "ContractDefinition", "nodes": [ + { + "anonymous": false, + "documentation": "The event emitted (useable by web3) when a token is purchased", + "id": 8, + "name": "BoughtToken", + "nodeType": "EventDefinition", + "parameters": { + "id": 7, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4, + "indexed": true, + "name": "buyer", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "203:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "203:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 6, + "indexed": false, + "name": "tokenId", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "226:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "226:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "202:40:0" + }, + "src": "185:58:0" + }, { "constant": false, - "id": 5, + "id": 12, "name": "customers", "nodeType": "VariableDeclaration", - "scope": 43, - "src": "51:28:0", + "scope": 158, + "src": "253:28:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -109,28 +281,28 @@ }, "typeName": { "baseType": { - "id": 2, + "id": 9, "name": "address", "nodeType": "ElementaryTypeName", - "src": "51:7:0", + "src": "253:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 4, + "id": 11, "length": { "argumentTypes": null, "hexValue": "3136", - "id": 3, + "id": 10, "isConstant": false, "isLValue": false, "isPure": false, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "59:2:0", + "src": "261:2:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": null, @@ -139,7 +311,7 @@ "value": "16" }, "nodeType": "ArrayTypeName", - "src": "51:11:0", + "src": "253:11:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$16_storage_ptr", "typeString": "address[16]" @@ -148,11 +320,234 @@ "value": null, "visibility": "public" }, + { + "constant": false, + "id": 15, + "name": "tokenPrice", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "350:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 13, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "350:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "33303030303030303030303030303030", + "id": 14, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "371:16:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3000000000000000_by_1", + "typeString": "int_const 3000000000000000" + }, + "value": "3000000000000000" + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 19, + "name": "tokenPetName", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "427:39:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 18, + "keyType": { + "id": 16, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "435:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "427:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 17, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "446:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 23, + "name": "tokenPetAge", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "475:36:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + }, + "typeName": { + "id": 22, + "keyType": { + "id": 20, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "483:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "475:24:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + }, + "valueType": { + "id": 21, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "494:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 27, + "name": "tokenPetBreed", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "524:40:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 26, + "keyType": { + "id": 24, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "532:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "524:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 25, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "543:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 31, + "name": "tokenPetLocation", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "577:43:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 30, + "keyType": { + "id": 28, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "585:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "577:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 29, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "596:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, { "body": { - "id": 31, + "id": 90, "nodeType": "Block", - "src": "163:126:0", + "src": "892:539:0", "statements": [ { "expression": { @@ -164,7 +559,7 @@ "typeIdentifier": "t_bool", "typeString": "bool" }, - "id": 19, + "id": 53, "isConstant": false, "isLValue": false, "isPure": false, @@ -175,19 +570,19 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 15, + "id": 49, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, - "id": 13, + "id": 47, "name": "couponId", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "181:8:0", + "referencedDeclaration": 33, + "src": "911:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -198,14 +593,14 @@ "rightExpression": { "argumentTypes": null, "hexValue": "30", - "id": 14, + "id": 48, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "193:1:0", + "src": "923:1:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", @@ -213,7 +608,7 @@ }, "value": "0" }, - "src": "181:13:0", + "src": "911:13:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -227,19 +622,19 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 18, + "id": 52, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, - "id": 16, + "id": 50, "name": "couponId", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "198:8:0", + "referencedDeclaration": 33, + "src": "928:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -250,14 +645,14 @@ "rightExpression": { "argumentTypes": null, "hexValue": "3135", - "id": 17, + "id": 51, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "210:2:0", + "src": "940:2:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_15_by_1", @@ -265,17 +660,35 @@ }, "value": "15" }, - "src": "198:14:0", + "src": "928:14:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "src": "181:31:0", + "src": "911:31:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } + }, + { + "argumentTypes": null, + "hexValue": "", + "id": 54, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "944:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" } ], "expression": { @@ -283,23 +696,27 @@ { "typeIdentifier": "t_bool", "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" } ], - "id": 12, + "id": 46, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ - 118, - 119 + 233, + 234 ], - "referencedDeclaration": 118, - "src": "173:7:0", + "referencedDeclaration": 234, + "src": "903:7:0", "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" } }, - "id": 20, + "id": 55, "isConstant": false, "isLValue": false, "isPure": false, @@ -307,20 +724,20 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "173:40:0", + "src": "903:44:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 21, + "id": 56, "nodeType": "ExpressionStatement", - "src": "173:40:0" + "src": "903:44:0" }, { "expression": { "argumentTypes": null, - "id": 27, + "id": 62, "isConstant": false, "isLValue": false, "isPure": false, @@ -329,26 +746,26 @@ "argumentTypes": null, "baseExpression": { "argumentTypes": null, - "id": 22, + "id": 57, "name": "customers", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "224:9:0", + "referencedDeclaration": 12, + "src": "1159:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$16_storage", "typeString": "address[16] storage ref" } }, - "id": 24, + "id": 59, "indexExpression": { "argumentTypes": null, - "id": 23, + "id": 58, "name": "couponId", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "234:8:0", + "referencedDeclaration": 33, + "src": "1169:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -359,7 +776,7 @@ "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", - "src": "224:19:0", + "src": "1159:19:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -371,18 +788,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 25, + "id": 60, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "246:3:0", + "referencedDeclaration": 230, + "src": "1181:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 26, + "id": 61, "isConstant": false, "isLValue": false, "isPure": false, @@ -390,61 +807,405 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "246:10:0", + "src": "1181:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, - "src": "224:32:0", + "src": "1159:32:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 28, + "id": 63, "nodeType": "ExpressionStatement", - "src": "224:32:0" + "src": "1159:32:0" }, { "expression": { "argumentTypes": null, - "id": 29, - "name": "couponId", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "274:8:0", + "id": 68, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 64, + "name": "tokenPetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 19, + "src": "1202:12:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 66, + "indexExpression": { + "argumentTypes": null, + "id": 65, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1215:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1202:22:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 67, + "name": "tokenPetName_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 35, + "src": "1227:13:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1202:38:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" } }, - "functionReturnParameters": 11, - "id": 30, - "nodeType": "Return", - "src": "267:15:0" - } - ] + "id": 69, + "nodeType": "ExpressionStatement", + "src": "1202:38:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 70, + "name": "tokenPetAge", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23, + "src": "1251:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + } + }, + "id": 72, + "indexExpression": { + "argumentTypes": null, + "id": 71, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1263:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1251:21:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 73, + "name": "tokenPetAge_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 37, + "src": "1275:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1251:36:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 75, + "nodeType": "ExpressionStatement", + "src": "1251:36:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 80, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 76, + "name": "tokenPetBreed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1298:13:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 78, + "indexExpression": { + "argumentTypes": null, + "id": 77, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1312:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1298:23:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 79, + "name": "tokenPetBreed_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 39, + "src": "1324:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1298:40:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 81, + "nodeType": "ExpressionStatement", + "src": "1298:40:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 86, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 82, + "name": "tokenPetLocation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "1349:16:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 84, + "indexExpression": { + "argumentTypes": null, + "id": 83, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1366:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1349:26:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 85, + "name": "tokenPetLocation_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "1378:17:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1349:46:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 87, + "nodeType": "ExpressionStatement", + "src": "1349:46:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 88, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1415:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 45, + "id": 89, + "nodeType": "Return", + "src": "1408:15:0" + } + ] }, "documentation": null, - "id": 32, + "id": 91, "implemented": true, "kind": "function", "modifiers": [], "name": "claim", "nodeType": "FunctionDefinition", "parameters": { - "id": 8, + "id": 42, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 7, + "id": 33, "name": "couponId", "nodeType": "VariableDeclaration", - "scope": 32, - "src": "126:13:0", + "scope": 91, + "src": "684:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 32, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "684:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 35, + "name": "tokenPetName_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "709:27:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 34, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "709:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 37, + "name": "tokenPetAge_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "747:17:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -452,10 +1213,10 @@ "typeString": "uint256" }, "typeName": { - "id": 6, + "id": 36, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "126:4:0", + "src": "747:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -463,21 +1224,73 @@ }, "value": null, "visibility": "internal" + }, + { + "constant": false, + "id": 39, + "name": "tokenPetBreed_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "775:28:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 38, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "775:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 41, + "name": "tokenPetLocation_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "814:31:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 40, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "814:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" } ], - "src": "125:15:0" + "src": "673:188:0" }, "returnParameters": { - "id": 11, + "id": 45, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 10, + "id": 44, "name": "", "nodeType": "VariableDeclaration", - "scope": 32, - "src": "157:4:0", + "scope": 91, + "src": "886:4:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -485,10 +1298,10 @@ "typeString": "uint256" }, "typeName": { - "id": 9, + "id": 43, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "157:4:0", + "src": "886:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -498,65 +1311,65 @@ "visibility": "internal" } ], - "src": "156:6:0" + "src": "885:6:0" }, - "scope": 43, - "src": "111:178:0", - "stateMutability": "nonpayable", + "scope": 158, + "src": "659:772:0", + "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 41, + "id": 100, "nodeType": "Block", - "src": "391:33:0", + "src": "1548:35:0", "statements": [ { "expression": { "argumentTypes": null, - "id": 39, + "id": 98, "name": "customers", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "408:9:0", + "referencedDeclaration": 12, + "src": "1566:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$16_storage", "typeString": "address[16] storage ref" } }, - "functionReturnParameters": 38, - "id": 40, + "functionReturnParameters": 97, + "id": 99, "nodeType": "Return", - "src": "401:16:0" + "src": "1559:16:0" } ] }, "documentation": null, - "id": 42, + "id": 101, "implemented": true, "kind": "function", "modifiers": [], "name": "getCustomers", "nodeType": "FunctionDefinition", "parameters": { - "id": 33, + "id": 92, "nodeType": "ParameterList", "parameters": [], - "src": "347:2:0" + "src": "1504:2:0" }, "returnParameters": { - "id": 38, + "id": 97, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 37, + "id": 96, "name": "", "nodeType": "VariableDeclaration", - "scope": 42, - "src": "371:18:0", + "scope": 101, + "src": "1528:18:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { @@ -565,28 +1378,28 @@ }, "typeName": { "baseType": { - "id": 34, + "id": 93, "name": "address", "nodeType": "ElementaryTypeName", - "src": "371:7:0", + "src": "1528:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 36, + "id": 95, "length": { "argumentTypes": null, "hexValue": "3136", - "id": 35, + "id": 94, "isConstant": false, "isLValue": false, "isPure": false, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "379:2:0", + "src": "1536:2:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": null, @@ -595,7 +1408,7 @@ "value": "16" }, "nodeType": "ArrayTypeName", - "src": "371:11:0", + "src": "1528:11:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$16_storage_ptr", "typeString": "address[16]" @@ -605,310 +1418,2202 @@ "visibility": "internal" } ], - "src": "370:20:0" + "src": "1527:20:0" }, - "scope": 43, - "src": "326:98:0", + "scope": 158, + "src": "1483:100:0", "stateMutability": "view", "superFunction": null, "visibility": "public" - } - ], - "scope": 44, - "src": "25:402:0" - } - ], - "src": "0:427:0" - }, - "legacyAST": { - "absolutePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Customers.sol", - "exportedSymbols": { - "Customers": [ - 43 - ] - }, - "id": 44, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 1, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:0" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", + }, + { + "body": { + "id": 144, + "nodeType": "Block", + "src": "1995:307:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 116, + "name": "tokenID_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 106, + "src": "2064:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 117, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2075:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2064:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 119, + "nodeType": "ExpressionStatement", + "src": "2064:20:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 120, + "name": "tokenPetName_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 108, + "src": "2095:13:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 121, + "name": "tokenPetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 19, + "src": "2111:12:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 123, + "indexExpression": { + "argumentTypes": null, + "id": 122, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2124:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2111:23:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "src": "2095:39:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 125, + "nodeType": "ExpressionStatement", + "src": "2095:39:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 130, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 126, + "name": "tokenPetAge_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 110, + "src": "2145:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 127, + "name": "tokenPetAge", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23, + "src": "2160:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + } + }, + "id": 129, + "indexExpression": { + "argumentTypes": null, + "id": 128, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2172:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2160:22:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2145:37:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 131, + "nodeType": "ExpressionStatement", + "src": "2145:37:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 132, + "name": "tokenPetBreed_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 112, + "src": "2193:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 133, + "name": "tokenPetBreed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "2210:13:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 135, + "indexExpression": { + "argumentTypes": null, + "id": 134, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2224:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2210:24:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "src": "2193:41:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 137, + "nodeType": "ExpressionStatement", + "src": "2193:41:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 138, + "name": "tokenPetLocation_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 114, + "src": "2245:17:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 139, + "name": "tokenPetLocation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "2265:16:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 141, + "indexExpression": { + "argumentTypes": null, + "id": 140, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2282:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2265:27:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "src": "2245:47:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 143, + "nodeType": "ExpressionStatement", + "src": "2245:47:0" + } + ] + }, + "documentation": null, + "id": 145, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getToken", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 104, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 103, + "name": "_couponId", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1744:17:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 102, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1744:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1743:19:0" + }, + "returnParameters": { + "id": 115, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 106, + "name": "tokenID_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1825:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 105, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1825:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 108, + "name": "tokenPetName_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1849:27:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 107, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1849:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 110, + "name": "tokenPetAge_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1887:17:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 109, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1887:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 112, + "name": "tokenPetBreed_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1915:28:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 111, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1915:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 114, + "name": "tokenPetLocation_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1954:31:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 113, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1954:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1812:182:0" + }, + "scope": 158, + "src": "1726:576:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "external" + }, + { + "body": { + "id": 156, + "nodeType": "Block", + "src": "2374:44:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 152, + "name": "customers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "2392:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16] storage ref" + } + }, + "id": 154, + "indexExpression": { + "argumentTypes": null, + "id": 153, + "name": "tokenId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 147, + "src": "2402:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2392:18:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 151, + "id": 155, + "nodeType": "Return", + "src": "2385:25:0" + } + ] + }, + "documentation": null, + "id": 157, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getOwner", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 148, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 147, + "name": "tokenId", + "nodeType": "VariableDeclaration", + "scope": 157, + "src": "2332:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 146, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2332:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2331:14:0" + }, + "returnParameters": { + "id": 151, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 150, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 157, + "src": "2366:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 149, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2366:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2365:9:0" + }, + "scope": 158, + "src": "2314:104:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 159, + "src": "62:2362:0" + } + ], + "src": "0:2424:0" + }, + "legacyAST": { + "absolutePath": "/C/Users/Michael/Documents/GitHub/lesson-06/contracts/Customers.sol", + "exportedSymbols": { + "Customers": [ + 158 + ] + }, + "id": 159, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.5", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:23:0" + }, + { + "id": 2, + "literals": [ + "experimental", + "ABIEncoderV2" + ], + "nodeType": "PragmaDirective", + "src": "25:33:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 43, + "id": 158, "linearizedBaseContracts": [ - 43 + 158 ], "name": "Customers", "nodeType": "ContractDefinition", "nodes": [ { - "constant": false, - "id": 5, - "name": "customers", - "nodeType": "VariableDeclaration", - "scope": 43, - "src": "51:28:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage", - "typeString": "address[16]" + "anonymous": false, + "documentation": "The event emitted (useable by web3) when a token is purchased", + "id": 8, + "name": "BoughtToken", + "nodeType": "EventDefinition", + "parameters": { + "id": 7, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4, + "indexed": true, + "name": "buyer", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "203:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "203:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 6, + "indexed": false, + "name": "tokenId", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "226:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "226:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "202:40:0" + }, + "src": "185:58:0" + }, + { + "constant": false, + "id": 12, + "name": "customers", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "253:28:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16]" + }, + "typeName": { + "baseType": { + "id": 9, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "253:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 11, + "length": { + "argumentTypes": null, + "hexValue": "3136", + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "261:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": null, + "typeString": null + }, + "value": "16" + }, + "nodeType": "ArrayTypeName", + "src": "253:11:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage_ptr", + "typeString": "address[16]" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 15, + "name": "tokenPrice", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "350:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 13, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "350:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "33303030303030303030303030303030", + "id": 14, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "371:16:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3000000000000000_by_1", + "typeString": "int_const 3000000000000000" + }, + "value": "3000000000000000" + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 19, + "name": "tokenPetName", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "427:39:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 18, + "keyType": { + "id": 16, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "435:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "427:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 17, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "446:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 23, + "name": "tokenPetAge", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "475:36:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + }, + "typeName": { + "id": 22, + "keyType": { + "id": 20, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "483:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "475:24:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + }, + "valueType": { + "id": 21, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "494:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 27, + "name": "tokenPetBreed", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "524:40:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 26, + "keyType": { + "id": 24, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "532:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "524:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 25, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "543:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 31, + "name": "tokenPetLocation", + "nodeType": "VariableDeclaration", + "scope": 158, + "src": "577:43:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "typeName": { + "id": 30, + "keyType": { + "id": 28, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "585:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "577:26:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string)" + }, + "valueType": { + "id": 29, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "596:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "body": { + "id": 90, + "nodeType": "Block", + "src": "892:539:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 53, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 49, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 47, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "911:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 48, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "923:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "911:13:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 50, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "928:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3135", + "id": 51, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "940:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "15" + }, + "src": "928:14:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "911:31:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "", + "id": 54, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "944:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + } + ], + "id": 46, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 233, + 234 + ], + "referencedDeclaration": 234, + "src": "903:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 55, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "903:44:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 56, + "nodeType": "ExpressionStatement", + "src": "903:44:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 62, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 57, + "name": "customers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "1159:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16] storage ref" + } + }, + "id": 59, + "indexExpression": { + "argumentTypes": null, + "id": 58, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1169:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1159:19:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 60, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 230, + "src": "1181:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1181:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "1159:32:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 63, + "nodeType": "ExpressionStatement", + "src": "1159:32:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 68, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 64, + "name": "tokenPetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 19, + "src": "1202:12:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 66, + "indexExpression": { + "argumentTypes": null, + "id": 65, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1215:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1202:22:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 67, + "name": "tokenPetName_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 35, + "src": "1227:13:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1202:38:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 69, + "nodeType": "ExpressionStatement", + "src": "1202:38:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 70, + "name": "tokenPetAge", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23, + "src": "1251:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + } + }, + "id": 72, + "indexExpression": { + "argumentTypes": null, + "id": 71, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1263:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1251:21:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 73, + "name": "tokenPetAge_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 37, + "src": "1275:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1251:36:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 75, + "nodeType": "ExpressionStatement", + "src": "1251:36:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 80, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 76, + "name": "tokenPetBreed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1298:13:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 78, + "indexExpression": { + "argumentTypes": null, + "id": 77, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1312:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1298:23:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 79, + "name": "tokenPetBreed_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 39, + "src": "1324:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1298:40:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 81, + "nodeType": "ExpressionStatement", + "src": "1298:40:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 86, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 82, + "name": "tokenPetLocation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "1349:16:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 84, + "indexExpression": { + "argumentTypes": null, + "id": 83, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1366:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1349:26:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 85, + "name": "tokenPetLocation_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "1378:17:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1349:46:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 87, + "nodeType": "ExpressionStatement", + "src": "1349:46:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 88, + "name": "couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1415:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 45, + "id": 89, + "nodeType": "Return", + "src": "1408:15:0" + } + ] + }, + "documentation": null, + "id": 91, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "claim", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 42, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 33, + "name": "couponId", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "684:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 32, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "684:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 35, + "name": "tokenPetName_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "709:27:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 34, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "709:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 37, + "name": "tokenPetAge_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "747:17:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 36, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "747:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 39, + "name": "tokenPetBreed_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "775:28:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 38, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "775:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 41, + "name": "tokenPetLocation_", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "814:31:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 40, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "814:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "673:188:0" + }, + "returnParameters": { + "id": 45, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 44, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 91, + "src": "886:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 43, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "886:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "885:6:0" + }, + "scope": 158, + "src": "659:772:0", + "stateMutability": "payable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 100, + "nodeType": "Block", + "src": "1548:35:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 98, + "name": "customers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "1566:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16] storage ref" + } + }, + "functionReturnParameters": 97, + "id": 99, + "nodeType": "Return", + "src": "1559:16:0" + } + ] }, - "typeName": { - "baseType": { - "id": 2, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "51:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "documentation": null, + "id": 101, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getCustomers", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 92, + "nodeType": "ParameterList", + "parameters": [], + "src": "1504:2:0" + }, + "returnParameters": { + "id": 97, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 96, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 101, + "src": "1528:18:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_memory_ptr", + "typeString": "address[16]" + }, + "typeName": { + "baseType": { + "id": 93, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1528:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 95, + "length": { + "argumentTypes": null, + "hexValue": "3136", + "id": 94, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1536:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": null, + "typeString": null + }, + "value": "16" + }, + "nodeType": "ArrayTypeName", + "src": "1528:11:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage_ptr", + "typeString": "address[16]" + } + }, + "value": null, + "visibility": "internal" } - }, - "id": 4, - "length": { - "argumentTypes": null, - "hexValue": "3136", - "id": 3, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "59:2:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": null, - "typeString": null - }, - "value": "16" - }, - "nodeType": "ArrayTypeName", - "src": "51:11:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage_ptr", - "typeString": "address[16]" - } + ], + "src": "1527:20:0" }, - "value": null, + "scope": 158, + "src": "1483:100:0", + "stateMutability": "view", + "superFunction": null, "visibility": "public" }, { "body": { - "id": 31, + "id": 144, "nodeType": "Block", - "src": "163:126:0", + "src": "1995:307:0", "statements": [ { "expression": { "argumentTypes": null, - "arguments": [ - { + "id": 118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 116, + "name": "tokenID_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 106, + "src": "2064:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 117, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2075:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2064:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 119, + "nodeType": "ExpressionStatement", + "src": "2064:20:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 120, + "name": "tokenPetName_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 108, + "src": "2095:13:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "id": 19, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 15, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 13, - "name": "couponId", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "181:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">=", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 14, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "193:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "181:13:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "BinaryOperation", - "operator": "&&", - "rightExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 18, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 16, - "name": "couponId", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "198:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "hexValue": "3135", - "id": 17, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "210:2:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_15_by_1", - "typeString": "int_const 15" - }, - "value": "15" - }, - "src": "198:14:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "src": "181:31:0", + "id": 121, + "name": "tokenPetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 19, + "src": "2111:12:0", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 123, + "indexExpression": { + "argumentTypes": null, + "id": 122, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2124:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2111:23:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" + }, + "src": "2095:39:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 125, + "nodeType": "ExpressionStatement", + "src": "2095:39:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 130, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 126, + "name": "tokenPetAge_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 110, + "src": "2145:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 127, + "name": "tokenPetAge", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23, + "src": "2160:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", + "typeString": "mapping(uint256 => uint256)" + } + }, + "id": 129, + "indexExpression": { + "argumentTypes": null, + "id": 128, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2172:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 12, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 118, - 119 - ], - "referencedDeclaration": 118, - "src": "173:7:0", + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2160:22:0", "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 20, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "173:40:0", + "src": "2145:37:0", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 21, + "id": 131, "nodeType": "ExpressionStatement", - "src": "173:40:0" + "src": "2145:37:0" }, { "expression": { "argumentTypes": null, - "id": 27, + "id": 136, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { + "argumentTypes": null, + "id": 132, + "name": "tokenPetBreed_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 112, + "src": "2193:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, - "id": 22, - "name": "customers", + "id": 133, + "name": "tokenPetBreed", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "224:9:0", + "referencedDeclaration": 27, + "src": "2210:13:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage", - "typeString": "address[16] storage ref" + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" } }, - "id": 24, + "id": 135, "indexExpression": { "argumentTypes": null, - "id": 23, - "name": "couponId", + "id": 134, + "name": "_couponId", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "234:8:0", + "referencedDeclaration": 103, + "src": "2224:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -917,94 +3622,117 @@ "isConstant": false, "isLValue": true, "isPure": false, - "lValueRequested": true, + "lValueRequested": false, "nodeType": "IndexAccess", - "src": "224:19:0", + "src": "2210:24:0", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "src": "2193:41:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 137, + "nodeType": "ExpressionStatement", + "src": "2193:41:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 138, + "name": "tokenPetLocation_", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 114, + "src": "2245:17:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, - "expression": { + "baseExpression": { "argumentTypes": null, - "id": 25, - "name": "msg", + "id": 139, + "name": "tokenPetLocation", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "246:3:0", + "referencedDeclaration": 31, + "src": "2265:16:0", "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" + "typeIdentifier": "t_mapping$_t_uint256_$_t_string_storage_$", + "typeString": "mapping(uint256 => string storage ref)" + } + }, + "id": 141, + "indexExpression": { + "argumentTypes": null, + "id": 140, + "name": "_couponId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "2282:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 26, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "246:10:0", + "nodeType": "IndexAccess", + "src": "2265:27:0", "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" } }, - "src": "224:32:0", + "src": "2245:47:0", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" } }, - "id": 28, + "id": 143, "nodeType": "ExpressionStatement", - "src": "224:32:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 29, - "name": "couponId", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 7, - "src": "274:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 11, - "id": 30, - "nodeType": "Return", - "src": "267:15:0" + "src": "2245:47:0" } ] }, "documentation": null, - "id": 32, + "id": 145, "implemented": true, "kind": "function", "modifiers": [], - "name": "claim", + "name": "getToken", "nodeType": "FunctionDefinition", "parameters": { - "id": 8, + "id": 104, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 7, - "name": "couponId", + "id": 103, + "name": "_couponId", "nodeType": "VariableDeclaration", - "scope": 32, - "src": "126:13:0", + "scope": 145, + "src": "1744:17:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1012,10 +3740,10 @@ "typeString": "uint256" }, "typeName": { - "id": 6, - "name": "uint", + "id": 102, + "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "126:4:0", + "src": "1744:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1025,19 +3753,71 @@ "visibility": "internal" } ], - "src": "125:15:0" + "src": "1743:19:0" }, "returnParameters": { - "id": 11, + "id": 115, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 10, - "name": "", + "id": 106, + "name": "tokenID_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1825:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 105, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1825:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 108, + "name": "tokenPetName_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1849:27:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 107, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1849:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 110, + "name": "tokenPetAge_", "nodeType": "VariableDeclaration", - "scope": 32, - "src": "157:4:0", + "scope": 145, + "src": "1887:17:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1045,10 +3825,10 @@ "typeString": "uint256" }, "typeName": { - "id": 9, + "id": 109, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "157:4:0", + "src": "1887:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1056,137 +3836,223 @@ }, "value": null, "visibility": "internal" + }, + { + "constant": false, + "id": 112, + "name": "tokenPetBreed_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1915:28:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 111, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1915:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 114, + "name": "tokenPetLocation_", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "1954:31:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 113, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1954:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" } ], - "src": "156:6:0" + "src": "1812:182:0" }, - "scope": 43, - "src": "111:178:0", - "stateMutability": "nonpayable", + "scope": 158, + "src": "1726:576:0", + "stateMutability": "view", "superFunction": null, - "visibility": "public" + "visibility": "external" }, { "body": { - "id": 41, + "id": 156, "nodeType": "Block", - "src": "391:33:0", + "src": "2374:44:0", "statements": [ { "expression": { "argumentTypes": null, - "id": 39, - "name": "customers", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "408:9:0", + "baseExpression": { + "argumentTypes": null, + "id": 152, + "name": "customers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "2392:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$16_storage", + "typeString": "address[16] storage ref" + } + }, + "id": 154, + "indexExpression": { + "argumentTypes": null, + "id": 153, + "name": "tokenId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 147, + "src": "2402:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2392:18:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage", - "typeString": "address[16] storage ref" + "typeIdentifier": "t_address", + "typeString": "address" } }, - "functionReturnParameters": 38, - "id": 40, + "functionReturnParameters": 151, + "id": 155, "nodeType": "Return", - "src": "401:16:0" + "src": "2385:25:0" } ] }, "documentation": null, - "id": 42, + "id": 157, "implemented": true, "kind": "function", "modifiers": [], - "name": "getCustomers", + "name": "getOwner", "nodeType": "FunctionDefinition", "parameters": { - "id": 33, + "id": 148, "nodeType": "ParameterList", - "parameters": [], - "src": "347:2:0" + "parameters": [ + { + "constant": false, + "id": 147, + "name": "tokenId", + "nodeType": "VariableDeclaration", + "scope": 157, + "src": "2332:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 146, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2332:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2331:14:0" }, "returnParameters": { - "id": 38, + "id": 151, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 37, + "id": 150, "name": "", "nodeType": "VariableDeclaration", - "scope": 42, - "src": "371:18:0", + "scope": 157, + "src": "2366:7:0", "stateVariable": false, - "storageLocation": "memory", + "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_memory_ptr", - "typeString": "address[16]" + "typeIdentifier": "t_address", + "typeString": "address" }, "typeName": { - "baseType": { - "id": 34, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "371:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 36, - "length": { - "argumentTypes": null, - "hexValue": "3136", - "id": 35, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "379:2:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": null, - "typeString": null - }, - "value": "16" - }, - "nodeType": "ArrayTypeName", - "src": "371:11:0", + "id": 149, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2366:7:0", + "stateMutability": "nonpayable", "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$16_storage_ptr", - "typeString": "address[16]" + "typeIdentifier": "t_address", + "typeString": "address" } }, "value": null, "visibility": "internal" } ], - "src": "370:20:0" + "src": "2365:9:0" }, - "scope": 43, - "src": "326:98:0", + "scope": 158, + "src": "2314:104:0", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], - "scope": 44, - "src": "25:402:0" + "scope": 159, + "src": "62:2362:0" } ], - "src": "0:427:0" + "src": "0:2424:0" }, "compiler": { "name": "solc", "version": "0.5.0+commit.1d4f565a.Emscripten.clang" }, - "networks": {}, - "schemaVersion": "3.0.1", - "updatedAt": "2019-01-26T19:32:24.368Z", + "networks": { + "5777": { + "events": {}, + "links": {}, + "address": "0x7E800d551028bf152f3514F9a52Fff6974f87096", + "transactionHash": "0x5b0f76d10d3fe81ae5264a95d428cfbf246c6ba03c0acd3619280f875f2bf267" + } + }, + "schemaVersion": "3.0.0", + "updatedAt": "2019-02-10T14:49:07.724Z", "devdoc": { "methods": {} }, diff --git a/front/src/contracts/Migrations.json b/front/src/contracts/Migrations.json index 9c6293e..ff59773 100644 --- a/front/src/contracts/Migrations.json +++ b/front/src/contracts/Migrations.json @@ -69,35 +69,32 @@ "signature": "0x0900f010" } ], - "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610314806100606000396000f3fe608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a72305820d8a35a2ea4407e5fb36d14aefb4df5b120b9438571ba313766efcf8383f90dac0029", - "deployedBytecode": "0x608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a72305820d8a35a2ea4407e5fb36d14aefb4df5b120b9438571ba313766efcf8383f90dac0029", - "sourceMap": "34:480:1:-;;;123:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;123:50:1;158:10;150:5;;:18;;;;;;;;;;;;;;;;;;34:480;;;;;;", - "deployedSourceMap": "34:480:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;8:9:-1;5:2;;;30:1;27;20:12;5:2;347:165:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;347:165:1;;;;;;;;;;;;;;;;;;;;;;82:36;;8:9:-1;5:2;;;30:1;27;20:12;5:2;82:36:1;;;;;;;;;;;;;;;;;;;;;;;58:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;58:20:1;;;;;;;;;;;;;;;;;;;;;;;;;;;240:103;;8:9:-1;5:2;;;30:1;27;20:12;5:2;240:103:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;240:103:1;;;;;;;;;;;;;;;;;;;;347:165;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;409:19;442:11;409:45;;460:8;:21;;;482:24;;460:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;460:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;460:47:1;;;;230:1;205:26;347:165;:::o;82:36::-;;;;:::o;58:20::-;;;;;;;;;;;;;:::o;240:103::-;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;329:9;302:24;:36;;;;205:26;240:103;:::o", - "source": "pragma solidity >=0.4.21 <0.6.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier restricted() {\n if (msg.sender == owner) _;\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", - "sourcePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Migrations.sol", + "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610314806100606000396000f3fe608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a72305820a3d1f1dfb027222e6d9d28e434cb365d92f0fcd8f9a2381b35b2260e1796e04d0029", + "deployedBytecode": "0x608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a72305820a3d1f1dfb027222e6d9d28e434cb365d92f0fcd8f9a2381b35b2260e1796e04d0029", + "sourceMap": "27:500:1:-;;;120:52;8:9:-1;5:2;;;30:1;27;20:12;5:2;120:52:1;156:10;148:5;;:18;;;;;;;;;;;;;;;;;;27:500;;;;;;", + "deployedSourceMap": "27:500:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;356:168;;8:9:-1;5:2;;;30:1;27;20:12;5:2;356:168:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;356:168:1;;;;;;;;;;;;;;;;;;;;;;77:36;;8:9:-1;5:2;;;30:1;27;20:12;5:2;77:36:1;;;;;;;;;;;;;;;;;;;;;;;52:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;52:20:1;;;;;;;;;;;;;;;;;;;;;;;;;;;245:105;;8:9:-1;5:2;;;30:1;27;20:12;5:2;245:105:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;245:105:1;;;;;;;;;;;;;;;;;;;;356:168;225:5;;;;;;;;;;;211:19;;:10;:19;;;207:26;;;419:19;452:11;419:45;;471:8;:21;;;493:24;;471:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;471:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;471:47:1;;;;232:1;207:26;356:168;:::o;77:36::-;;;;:::o;52:20::-;;;;;;;;;;;;;:::o;245:105::-;225:5;;;;;;;;;;;211:19;;:10;:19;;;207:26;;;335:9;308:24;:36;;;;207:26;245:105;:::o", + "source": "pragma solidity ^0.5.0;\r\n\r\ncontract Migrations {\r\n address public owner;\r\n uint public last_completed_migration;\r\n\r\n constructor() public {\r\n owner = msg.sender;\r\n }\r\n\r\n modifier restricted() {\r\n if (msg.sender == owner) _;\r\n }\r\n\r\n function setCompleted(uint completed) public restricted {\r\n last_completed_migration = completed;\r\n }\r\n\r\n function upgrade(address new_address) public restricted {\r\n Migrations upgraded = Migrations(new_address);\r\n upgraded.setCompleted(last_completed_migration);\r\n }\r\n}\r\n", + "sourcePath": "C:/Users/Michael/Documents/GitHub/lesson-06/contracts/Migrations.sol", "ast": { - "absolutePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Migrations.sol", + "absolutePath": "/C/Users/Michael/Documents/GitHub/lesson-06/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ - 100 + 215 ] }, - "id": 101, + "id": 216, "nodeType": "SourceUnit", "nodes": [ { - "id": 45, + "id": 160, "literals": [ "solidity", - ">=", - "0.4", - ".21", - "<", - "0.6", + "^", + "0.5", ".0" ], "nodeType": "PragmaDirective", - "src": "0:32:1" + "src": "0:23:1" }, { "baseContracts": [], @@ -105,20 +102,20 @@ "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 100, + "id": 215, "linearizedBaseContracts": [ - 100 + 215 ], "name": "Migrations", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, - "id": 47, + "id": 162, "name": "owner", "nodeType": "VariableDeclaration", - "scope": 100, - "src": "58:20:1", + "scope": 215, + "src": "52:20:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -126,10 +123,10 @@ "typeString": "address" }, "typeName": { - "id": 46, + "id": 161, "name": "address", "nodeType": "ElementaryTypeName", - "src": "58:7:1", + "src": "52:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -141,11 +138,11 @@ }, { "constant": false, - "id": 49, + "id": 164, "name": "last_completed_migration", "nodeType": "VariableDeclaration", - "scope": 100, - "src": "82:36:1", + "scope": 215, + "src": "77:36:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -153,10 +150,10 @@ "typeString": "uint256" }, "typeName": { - "id": 48, + "id": 163, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "82:4:1", + "src": "77:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -167,26 +164,26 @@ }, { "body": { - "id": 57, + "id": 172, "nodeType": "Block", - "src": "144:29:1", + "src": "141:31:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 55, + "id": 170, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 52, + "id": 167, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 47, - "src": "150:5:1", + "referencedDeclaration": 162, + "src": "148:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -198,18 +195,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 53, + "id": 168, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "158:3:1", + "referencedDeclaration": 230, + "src": "156:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 54, + "id": 169, "isConstant": false, "isLValue": false, "isPure": false, @@ -217,54 +214,54 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "158:10:1", + "src": "156:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, - "src": "150:18:1", + "src": "148:18:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 56, + "id": 171, "nodeType": "ExpressionStatement", - "src": "150:18:1" + "src": "148:18:1" } ] }, "documentation": null, - "id": 58, + "id": 173, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { - "id": 50, + "id": 165, "nodeType": "ParameterList", "parameters": [], - "src": "134:2:1" + "src": "131:2:1" }, "returnParameters": { - "id": 51, + "id": 166, "nodeType": "ParameterList", "parameters": [], - "src": "144:0:1" + "src": "141:0:1" }, - "scope": 100, - "src": "123:50:1", + "scope": 215, + "src": "120:52:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 66, + "id": 181, "nodeType": "Block", - "src": "199:37:1", + "src": "200:39:1", "statements": [ { "condition": { @@ -273,7 +270,7 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 63, + "id": 178, "isConstant": false, "isLValue": false, "isPure": false, @@ -282,18 +279,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 60, + "id": 175, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "209:3:1", + "referencedDeclaration": 230, + "src": "211:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 61, + "id": 176, "isConstant": false, "isLValue": false, "isPure": false, @@ -301,7 +298,7 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "209:10:1", + "src": "211:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" @@ -311,70 +308,70 @@ "operator": "==", "rightExpression": { "argumentTypes": null, - "id": 62, + "id": 177, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 47, - "src": "223:5:1", + "referencedDeclaration": 162, + "src": "225:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "209:19:1", + "src": "211:19:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, - "id": 65, + "id": 180, "nodeType": "IfStatement", - "src": "205:26:1", + "src": "207:26:1", "trueBody": { - "id": 64, + "id": 179, "nodeType": "PlaceholderStatement", - "src": "230:1:1" + "src": "232:1:1" } } ] }, "documentation": null, - "id": 67, + "id": 182, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { - "id": 59, + "id": 174, "nodeType": "ParameterList", "parameters": [], - "src": "196:2:1" + "src": "197:2:1" }, - "src": "177:59:1", + "src": "178:61:1", "visibility": "internal" }, { "body": { - "id": 78, + "id": 193, "nodeType": "Block", - "src": "296:47:1", + "src": "301:49:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 76, + "id": 191, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 74, + "id": 189, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 49, - "src": "302:24:1", + "referencedDeclaration": 164, + "src": "308:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -384,67 +381,67 @@ "operator": "=", "rightHandSide": { "argumentTypes": null, - "id": 75, + "id": 190, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 69, - "src": "329:9:1", + "referencedDeclaration": 184, + "src": "335:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "302:36:1", + "src": "308:36:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 77, + "id": 192, "nodeType": "ExpressionStatement", - "src": "302:36:1" + "src": "308:36:1" } ] }, "documentation": null, - "id": 79, + "id": 194, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, - "id": 72, + "id": 187, "modifierName": { "argumentTypes": null, - "id": 71, + "id": 186, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 67, - "src": "285:10:1", + "referencedDeclaration": 182, + "src": "290:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", - "src": "285:10:1" + "src": "290:10:1" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { - "id": 70, + "id": 185, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 69, + "id": 184, "name": "completed", "nodeType": "VariableDeclaration", - "scope": 79, - "src": "262:14:1", + "scope": 194, + "src": "267:14:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -452,10 +449,10 @@ "typeString": "uint256" }, "typeName": { - "id": 68, + "id": 183, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "262:4:1", + "src": "267:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -465,53 +462,53 @@ "visibility": "internal" } ], - "src": "261:16:1" + "src": "266:16:1" }, "returnParameters": { - "id": 73, + "id": 188, "nodeType": "ParameterList", "parameters": [], - "src": "296:0:1" + "src": "301:0:1" }, - "scope": 100, - "src": "240:103:1", + "scope": 215, + "src": "245:105:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 98, + "id": 213, "nodeType": "Block", - "src": "403:109:1", + "src": "412:112:1", "statements": [ { "assignments": [ - 87 + 202 ], "declarations": [ { "constant": false, - "id": 87, + "id": 202, "name": "upgraded", "nodeType": "VariableDeclaration", - "scope": 98, - "src": "409:19:1", + "scope": 213, + "src": "419:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" }, "typeName": { "contractScope": null, - "id": 86, + "id": 201, "name": "Migrations", "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 100, - "src": "409:10:1", + "referencedDeclaration": 215, + "src": "419:10:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, @@ -519,18 +516,18 @@ "visibility": "internal" } ], - "id": 91, + "id": 206, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, - "id": 89, + "id": 204, "name": "new_address", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 81, - "src": "442:11:1", + "referencedDeclaration": 196, + "src": "452:11:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -544,18 +541,18 @@ "typeString": "address" } ], - "id": 88, + "id": 203, "name": "Migrations", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "431:10:1", + "referencedDeclaration": 215, + "src": "441:10:1", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$100_$", + "typeIdentifier": "t_type$_t_contract$_Migrations_$215_$", "typeString": "type(contract Migrations)" } }, - "id": 90, + "id": 205, "isConstant": false, "isLValue": false, "isPure": false, @@ -563,14 +560,14 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "431:23:1", + "src": "441:23:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", - "src": "409:45:1" + "src": "419:45:1" }, { "expression": { @@ -578,12 +575,12 @@ "arguments": [ { "argumentTypes": null, - "id": 95, + "id": 210, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 49, - "src": "482:24:1", + "referencedDeclaration": 164, + "src": "493:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -599,32 +596,32 @@ ], "expression": { "argumentTypes": null, - "id": 92, + "id": 207, "name": "upgraded", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 87, - "src": "460:8:1", + "referencedDeclaration": 202, + "src": "471:8:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, - "id": 94, + "id": 209, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "setCompleted", "nodeType": "MemberAccess", - "referencedDeclaration": 79, - "src": "460:21:1", + "referencedDeclaration": 194, + "src": "471:21:1", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256) external" } }, - "id": 96, + "id": 211, "isConstant": false, "isLValue": false, "isPure": false, @@ -632,56 +629,56 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "460:47:1", + "src": "471:47:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 97, + "id": 212, "nodeType": "ExpressionStatement", - "src": "460:47:1" + "src": "471:47:1" } ] }, "documentation": null, - "id": 99, + "id": 214, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, - "id": 84, + "id": 199, "modifierName": { "argumentTypes": null, - "id": 83, + "id": 198, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 67, - "src": "392:10:1", + "referencedDeclaration": 182, + "src": "401:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", - "src": "392:10:1" + "src": "401:10:1" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { - "id": 82, + "id": 197, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 81, + "id": 196, "name": "new_address", "nodeType": "VariableDeclaration", - "scope": 99, - "src": "364:19:1", + "scope": 214, + "src": "373:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -689,10 +686,10 @@ "typeString": "address" }, "typeName": { - "id": 80, + "id": 195, "name": "address", "nodeType": "ElementaryTypeName", - "src": "364:7:1", + "src": "373:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -703,50 +700,47 @@ "visibility": "internal" } ], - "src": "363:21:1" + "src": "372:21:1" }, "returnParameters": { - "id": 85, + "id": 200, "nodeType": "ParameterList", "parameters": [], - "src": "403:0:1" + "src": "412:0:1" }, - "scope": 100, - "src": "347:165:1", + "scope": 215, + "src": "356:168:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], - "scope": 101, - "src": "34:480:1" + "scope": 216, + "src": "27:500:1" } ], - "src": "0:515:1" + "src": "0:529:1" }, "legacyAST": { - "absolutePath": "/Users/shannonclarke/Documents/dev/work/workshops/lesson-06/contracts/Migrations.sol", + "absolutePath": "/C/Users/Michael/Documents/GitHub/lesson-06/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ - 100 + 215 ] }, - "id": 101, + "id": 216, "nodeType": "SourceUnit", "nodes": [ { - "id": 45, + "id": 160, "literals": [ "solidity", - ">=", - "0.4", - ".21", - "<", - "0.6", + "^", + "0.5", ".0" ], "nodeType": "PragmaDirective", - "src": "0:32:1" + "src": "0:23:1" }, { "baseContracts": [], @@ -754,20 +748,20 @@ "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 100, + "id": 215, "linearizedBaseContracts": [ - 100 + 215 ], "name": "Migrations", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, - "id": 47, + "id": 162, "name": "owner", "nodeType": "VariableDeclaration", - "scope": 100, - "src": "58:20:1", + "scope": 215, + "src": "52:20:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -775,10 +769,10 @@ "typeString": "address" }, "typeName": { - "id": 46, + "id": 161, "name": "address", "nodeType": "ElementaryTypeName", - "src": "58:7:1", + "src": "52:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -790,11 +784,11 @@ }, { "constant": false, - "id": 49, + "id": 164, "name": "last_completed_migration", "nodeType": "VariableDeclaration", - "scope": 100, - "src": "82:36:1", + "scope": 215, + "src": "77:36:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -802,10 +796,10 @@ "typeString": "uint256" }, "typeName": { - "id": 48, + "id": 163, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "82:4:1", + "src": "77:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -816,26 +810,26 @@ }, { "body": { - "id": 57, + "id": 172, "nodeType": "Block", - "src": "144:29:1", + "src": "141:31:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 55, + "id": 170, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 52, + "id": 167, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 47, - "src": "150:5:1", + "referencedDeclaration": 162, + "src": "148:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -847,18 +841,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 53, + "id": 168, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "158:3:1", + "referencedDeclaration": 230, + "src": "156:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 54, + "id": 169, "isConstant": false, "isLValue": false, "isPure": false, @@ -866,54 +860,54 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "158:10:1", + "src": "156:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, - "src": "150:18:1", + "src": "148:18:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 56, + "id": 171, "nodeType": "ExpressionStatement", - "src": "150:18:1" + "src": "148:18:1" } ] }, "documentation": null, - "id": 58, + "id": 173, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { - "id": 50, + "id": 165, "nodeType": "ParameterList", "parameters": [], - "src": "134:2:1" + "src": "131:2:1" }, "returnParameters": { - "id": 51, + "id": 166, "nodeType": "ParameterList", "parameters": [], - "src": "144:0:1" + "src": "141:0:1" }, - "scope": 100, - "src": "123:50:1", + "scope": 215, + "src": "120:52:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 66, + "id": 181, "nodeType": "Block", - "src": "199:37:1", + "src": "200:39:1", "statements": [ { "condition": { @@ -922,7 +916,7 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 63, + "id": 178, "isConstant": false, "isLValue": false, "isPure": false, @@ -931,18 +925,18 @@ "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 60, + "id": 175, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 115, - "src": "209:3:1", + "referencedDeclaration": 230, + "src": "211:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 61, + "id": 176, "isConstant": false, "isLValue": false, "isPure": false, @@ -950,7 +944,7 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "209:10:1", + "src": "211:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" @@ -960,70 +954,70 @@ "operator": "==", "rightExpression": { "argumentTypes": null, - "id": 62, + "id": 177, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 47, - "src": "223:5:1", + "referencedDeclaration": 162, + "src": "225:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "209:19:1", + "src": "211:19:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, - "id": 65, + "id": 180, "nodeType": "IfStatement", - "src": "205:26:1", + "src": "207:26:1", "trueBody": { - "id": 64, + "id": 179, "nodeType": "PlaceholderStatement", - "src": "230:1:1" + "src": "232:1:1" } } ] }, "documentation": null, - "id": 67, + "id": 182, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { - "id": 59, + "id": 174, "nodeType": "ParameterList", "parameters": [], - "src": "196:2:1" + "src": "197:2:1" }, - "src": "177:59:1", + "src": "178:61:1", "visibility": "internal" }, { "body": { - "id": 78, + "id": 193, "nodeType": "Block", - "src": "296:47:1", + "src": "301:49:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 76, + "id": 191, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 74, + "id": 189, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 49, - "src": "302:24:1", + "referencedDeclaration": 164, + "src": "308:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1033,67 +1027,67 @@ "operator": "=", "rightHandSide": { "argumentTypes": null, - "id": 75, + "id": 190, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 69, - "src": "329:9:1", + "referencedDeclaration": 184, + "src": "335:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "302:36:1", + "src": "308:36:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 77, + "id": 192, "nodeType": "ExpressionStatement", - "src": "302:36:1" + "src": "308:36:1" } ] }, "documentation": null, - "id": 79, + "id": 194, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, - "id": 72, + "id": 187, "modifierName": { "argumentTypes": null, - "id": 71, + "id": 186, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 67, - "src": "285:10:1", + "referencedDeclaration": 182, + "src": "290:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", - "src": "285:10:1" + "src": "290:10:1" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { - "id": 70, + "id": 185, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 69, + "id": 184, "name": "completed", "nodeType": "VariableDeclaration", - "scope": 79, - "src": "262:14:1", + "scope": 194, + "src": "267:14:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1101,10 +1095,10 @@ "typeString": "uint256" }, "typeName": { - "id": 68, + "id": 183, "name": "uint", "nodeType": "ElementaryTypeName", - "src": "262:4:1", + "src": "267:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1114,53 +1108,53 @@ "visibility": "internal" } ], - "src": "261:16:1" + "src": "266:16:1" }, "returnParameters": { - "id": 73, + "id": 188, "nodeType": "ParameterList", "parameters": [], - "src": "296:0:1" + "src": "301:0:1" }, - "scope": 100, - "src": "240:103:1", + "scope": 215, + "src": "245:105:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 98, + "id": 213, "nodeType": "Block", - "src": "403:109:1", + "src": "412:112:1", "statements": [ { "assignments": [ - 87 + 202 ], "declarations": [ { "constant": false, - "id": 87, + "id": 202, "name": "upgraded", "nodeType": "VariableDeclaration", - "scope": 98, - "src": "409:19:1", + "scope": 213, + "src": "419:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" }, "typeName": { "contractScope": null, - "id": 86, + "id": 201, "name": "Migrations", "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 100, - "src": "409:10:1", + "referencedDeclaration": 215, + "src": "419:10:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, @@ -1168,18 +1162,18 @@ "visibility": "internal" } ], - "id": 91, + "id": 206, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, - "id": 89, + "id": 204, "name": "new_address", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 81, - "src": "442:11:1", + "referencedDeclaration": 196, + "src": "452:11:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1193,18 +1187,18 @@ "typeString": "address" } ], - "id": 88, + "id": 203, "name": "Migrations", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "431:10:1", + "referencedDeclaration": 215, + "src": "441:10:1", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$100_$", + "typeIdentifier": "t_type$_t_contract$_Migrations_$215_$", "typeString": "type(contract Migrations)" } }, - "id": 90, + "id": 205, "isConstant": false, "isLValue": false, "isPure": false, @@ -1212,14 +1206,14 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "431:23:1", + "src": "441:23:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", - "src": "409:45:1" + "src": "419:45:1" }, { "expression": { @@ -1227,12 +1221,12 @@ "arguments": [ { "argumentTypes": null, - "id": 95, + "id": 210, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 49, - "src": "482:24:1", + "referencedDeclaration": 164, + "src": "493:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1248,32 +1242,32 @@ ], "expression": { "argumentTypes": null, - "id": 92, + "id": 207, "name": "upgraded", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 87, - "src": "460:8:1", + "referencedDeclaration": 202, + "src": "471:8:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$100", + "typeIdentifier": "t_contract$_Migrations_$215", "typeString": "contract Migrations" } }, - "id": 94, + "id": 209, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "setCompleted", "nodeType": "MemberAccess", - "referencedDeclaration": 79, - "src": "460:21:1", + "referencedDeclaration": 194, + "src": "471:21:1", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256) external" } }, - "id": 96, + "id": 211, "isConstant": false, "isLValue": false, "isPure": false, @@ -1281,56 +1275,56 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "460:47:1", + "src": "471:47:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 97, + "id": 212, "nodeType": "ExpressionStatement", - "src": "460:47:1" + "src": "471:47:1" } ] }, "documentation": null, - "id": 99, + "id": 214, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, - "id": 84, + "id": 199, "modifierName": { "argumentTypes": null, - "id": 83, + "id": 198, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 67, - "src": "392:10:1", + "referencedDeclaration": 182, + "src": "401:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", - "src": "392:10:1" + "src": "401:10:1" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { - "id": 82, + "id": 197, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 81, + "id": 196, "name": "new_address", "nodeType": "VariableDeclaration", - "scope": 99, - "src": "364:19:1", + "scope": 214, + "src": "373:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1338,10 +1332,10 @@ "typeString": "address" }, "typeName": { - "id": 80, + "id": 195, "name": "address", "nodeType": "ElementaryTypeName", - "src": "364:7:1", + "src": "373:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -1352,26 +1346,26 @@ "visibility": "internal" } ], - "src": "363:21:1" + "src": "372:21:1" }, "returnParameters": { - "id": 85, + "id": 200, "nodeType": "ParameterList", "parameters": [], - "src": "403:0:1" + "src": "412:0:1" }, - "scope": 100, - "src": "347:165:1", + "scope": 215, + "src": "356:168:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], - "scope": 101, - "src": "34:480:1" + "scope": 216, + "src": "27:500:1" } ], - "src": "0:515:1" + "src": "0:529:1" }, "compiler": { "name": "solc", @@ -1381,12 +1375,12 @@ "5777": { "events": {}, "links": {}, - "address": "0x7ba1505022b20da07DA6B559e027092bA09af7CF", - "transactionHash": "0xd0bb121c22d1e3390635abb1eba3591d3d201918e829a316314acc8c911a3c31" + "address": "0x89Ee4ABDeA8B80B713C2fb669370DA65369af7C8", + "transactionHash": "0x3beb8eb4f073e9ba2f21679e34a3ce3f816b76ef357cf67d5172fe75abdca728" } }, - "schemaVersion": "3.0.1", - "updatedAt": "2019-01-26T19:33:45.989Z", + "schemaVersion": "3.0.0", + "updatedAt": "2019-02-10T14:49:07.679Z", "devdoc": { "methods": {} }, diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..24e6073 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "lesson-06", + "version": "1.0.0", + "lockfileVersion": 1 +} diff --git a/truffle.js b/truffle-config.js similarity index 100% rename from truffle.js rename to truffle-config.js