diff --git a/build/contracts/CapCoin.json b/build/contracts/CapCoin.json index 3376311a..d6b00d85 100644 --- a/build/contracts/CapCoin.json +++ b/build/contracts/CapCoin.json @@ -15,6 +15,25 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "posts", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -62,11 +81,42 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "addressToPost", + "outputs": [ + { + "name": "url", + "type": "string" + }, + { + "name": "lotteryAmount", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], "name": "getUser", "outputs": [ + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint256" + }, { "name": "", "type": "string" @@ -80,6 +130,20 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "name": "url", + "type": "string" + } + ], + "name": "createPost", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [ @@ -97,6 +161,10 @@ { "name": "coinBalance", "type": "uint256" + }, + { + "name": "postNum", + "type": "uint256" } ], "payable": false, @@ -109,6 +177,11 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "anonymous": false, "inputs": [ @@ -132,20 +205,32 @@ ], "name": "BoughtTokens", "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "url", + "type": "string" + } + ], + "name": "CreatedPost", + "type": "event" } ], - "bytecode": "0x6060604052620f42406000556000600155341561001b57600080fd5b60016002819055506108d9806100326000396000f300606060405260043610610077576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062ce8e3e1461007c5780633610724e146100e6578063365b98b214610109578063507ffba51461016c578063832880e7146101c9578063edf538861461025e575b600080fd5b341561008757600080fd5b61008f610334565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100d25780820151818401526020810190506100b7565b505050509050019250505060405180910390f35b34156100f157600080fd5b61010760048080359060200190919050506103c8565b005b341561011457600080fd5b61012a60048080359060200190919050506104b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561017757600080fd5b6101c7600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506104f2565b005b34156101d457600080fd5b6101dc61065e565b6040518080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015610222578082015181840152602081019050610207565b50505050905090810190601f16801561024f5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b341561026957600080fd5b610295600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610791565b60405180806020018381526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156103245780601f106102f957610100808354040283529160200191610324565b820191906000526020600020905b81548152906001019060200180831161030757829003601f168201915b5050935050505060405180910390f35b61033c6107b4565b60048054806020026020016040519081016040528092919081815260200182805480156103be57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610374575b5050505050905090565b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008282540192505081905550806001600082825401925050819055508060008082825403925050819055507ffe1367e498701f2dfab80a3d41740d46fd7cba533430e611917f0f3df823279a600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546040518082815260200191505060405180910390a150565b6004818154811015156104c257fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508181600001908051906020019061054d9291906107c8565b506000816001018190555060016004805480600101828161056e9190610848565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050507f66ab3fea2083d9ba15d99b595186fe7fc18e6eba393c0fc056f420e96c3caa44826040518080602001828103825283818151815260200191508051906020019080838360005b83811015610620578082015181840152602081019050610605565b50505050905090810190601f16801561064d5780820380516001836020036101000a031916815260200191505b509250505060405180910390a15050565b610666610874565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154818054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107825780601f1061075757610100808354040283529160200191610782565b820191906000526020600020905b81548152906001019060200180831161076557829003601f168201915b50505050509150915091509091565b600360205280600052604060002060009150905080600001908060010154905082565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061080957805160ff1916838001178555610837565b82800160010185558215610837579182015b8281111561083657825182559160200191906001019061081b565b5b5090506108449190610888565b5090565b81548183558181151161086f5781836000526020600020918201910161086e9190610888565b5b505050565b602060405190810160405280600081525090565b6108aa91905b808211156108a657600081600090555060010161088e565b5090565b905600a165627a7a723058209531aa55e21d60a82232c0b2963be0625f15d1c3fee53d5c2f257a76292a6ed70029", - "deployedBytecode": "0x606060405260043610610077576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062ce8e3e1461007c5780633610724e146100e6578063365b98b214610109578063507ffba51461016c578063832880e7146101c9578063edf538861461025e575b600080fd5b341561008757600080fd5b61008f610334565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100d25780820151818401526020810190506100b7565b505050509050019250505060405180910390f35b34156100f157600080fd5b61010760048080359060200190919050506103c8565b005b341561011457600080fd5b61012a60048080359060200190919050506104b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561017757600080fd5b6101c7600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506104f2565b005b34156101d457600080fd5b6101dc61065e565b6040518080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015610222578082015181840152602081019050610207565b50505050905090810190601f16801561024f5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b341561026957600080fd5b610295600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610791565b60405180806020018381526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156103245780601f106102f957610100808354040283529160200191610324565b820191906000526020600020905b81548152906001019060200180831161030757829003601f168201915b5050935050505060405180910390f35b61033c6107b4565b60048054806020026020016040519081016040528092919081815260200182805480156103be57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610374575b5050505050905090565b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008282540192505081905550806001600082825401925050819055508060008082825403925050819055507ffe1367e498701f2dfab80a3d41740d46fd7cba533430e611917f0f3df823279a600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546040518082815260200191505060405180910390a150565b6004818154811015156104c257fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508181600001908051906020019061054d9291906107c8565b506000816001018190555060016004805480600101828161056e9190610848565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050507f66ab3fea2083d9ba15d99b595186fe7fc18e6eba393c0fc056f420e96c3caa44826040518080602001828103825283818151815260200191508051906020019080838360005b83811015610620578082015181840152602081019050610605565b50505050905090810190601f16801561064d5780820380516001836020036101000a031916815260200191505b509250505060405180910390a15050565b610666610874565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154818054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107825780601f1061075757610100808354040283529160200191610782565b820191906000526020600020905b81548152906001019060200180831161076557829003601f168201915b50505050509150915091509091565b600360205280600052604060002060009150905080600001908060010154905082565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061080957805160ff1916838001178555610837565b82800160010185558215610837579182015b8281111561083657825182559160200191906001019061081b565b5b5090506108449190610888565b5090565b81548183558181151161086f5781836000526020600020918201910161086e9190610888565b5b505050565b602060405190810160405280600081525090565b6108aa91905b808211156108a657600081600090555060010161088e565b5090565b905600a165627a7a723058209531aa55e21d60a82232c0b2963be0625f15d1c3fee53d5c2f257a76292a6ed70029", - "sourceMap": "26:980:0:-;;;137:7;119:25;;167:1;148:20;;193:46;;;;;;;;233:1;219:11;:15;;;;26:980;;;;;;", - "deployedSourceMap": "26:980:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;571:75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;797:207:0;;;;;;;;;;;;;;;;;;;;;;;;;;353:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;380:187;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;650:143;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;303:46:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;571:75;612:9;;:::i;:::-;636:5;629:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;571:75;:::o;797:207::-;883:6;842:13;:25;856:10;842:25;;;;;;;;;;;;;;;:37;;;:47;;;;;;;;;;;910:6;895:11;;:21;;;;;;;;;;;936:6;922:10;;:20;;;;;;;;;;;948:51;961:13;:25;975:10;961:25;;;;;;;;;;;;;;;:37;;;948:51;;;;;;;;;;;;;;;;;;797:207;:::o;353:22::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;380:187::-;426:8;437:13;:25;451:10;437:25;;;;;;;;;;;;;;;426:36;;481:4;469;:9;;:16;;;;;;;;;;;;:::i;:::-;;510:1;491:4;:16;;:20;;;;542:1;518:5;:22;;;;;;;;;;;:::i;:::-;;;;;;;;;;529:10;518:22;;;;;;;;;;;;;;;;;;;;;;:25;;549:13;557:4;549:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;380:187:0;;:::o;650:143::-;690:6;;:::i;:::-;698:4;718:13;:25;732:10;718:25;;;;;;;;;;;;;;;:30;;750:13;:25;764:10;750:25;;;;;;;;;;;;;;;:37;;;710:78;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;650:143;;:::o;303:46::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;26:980::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", - "source": "pragma solidity ^0.4.18;\n\ncontract CapCoin {\n\n event NewUser(string name);\n event BoughtTokens(uint coinBalance);\n\n uint coinSupply = 1000000;\n uint coinsBought = 0;\n uint contractNum;\n\n function CapCoin () {\n contractNum = 1;\n }\n\n struct User {\n string name;\n uint coinBalance;\n }\n\n mapping (address => User) public addressToUser;\n address[] public users;\n\n function createUser(string name) public {\n var user = addressToUser[msg.sender];\n\n user.name = name;\n user.coinBalance = 0;\n\n users.push(msg.sender) -1;\n NewUser(name);\n }\n\n function getUsers() public view returns (address[]) {\n return users;\n }\n\n function getUser() public view returns (string, uint) {\n return (addressToUser[msg.sender].name, addressToUser[msg.sender].coinBalance);\n }\n\n function buyTokens(uint amount) public {\n addressToUser[msg.sender].coinBalance += amount;\n coinsBought += amount;\n coinSupply -= amount;\n BoughtTokens(addressToUser[msg.sender].coinBalance);\n }\n}\n", + "bytecode": "0x6060604052620f42406000556000600155341561001b57600080fd5b6001600281905550610e5d806100326000396000f300606060405260043610610098576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062ce8e3e1461009a5780630b1e7f83146101045780633610724e14610167578063365b98b21461018a578063507ffba5146101ed578063763f17c41461024a578063832880e714610320578063c7303c6114610428578063edf5388614610485575b005b34156100a557600080fd5b6100ad610562565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100f05780820151818401526020810190506100d5565b505050509050019250505060405180910390f35b341561010f57600080fd5b61012560048080359060200190919050506105f6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561017257600080fd5b6101886004808035906020019091905050610635565b005b341561019557600080fd5b6101ab6004808035906020019091905050610720565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101f857600080fd5b610248600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061075f565b005b341561025557600080fd5b610281600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108cb565b60405180806020018381526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156103105780601f106102e557610100808354040283529160200191610310565b820191906000526020600020905b8154815290600101906020018083116102f357829003601f168201915b5050935050505060405180910390f35b341561032b57600080fd5b6103336108ee565b604051808060200185815260200180602001848152602001838103835287818151815260200191508051906020019080838360005b83811015610383578082015181840152602081019050610368565b50505050905090810190601f1680156103b05780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156103e95780820151818401526020810190506103ce565b50505050905090810190601f1680156104165780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b341561043357600080fd5b610483600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610b52565b005b341561049057600080fd5b6104bc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d0f565b60405180806020018481526020018381526020018281038252858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156105515780601f1061052657610100808354040283529160200191610551565b820191906000526020600020905b81548152906001019060200180831161053457829003601f168201915b505094505050505060405180910390f35b61056a610d38565b60058054806020026020016040519081016040528092919081815260200182805480156105ec57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116105a2575b5050505050905090565b60068181548110151561060557fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008282540192505081905550806001600082825401925050819055508060008082825403925050819055507ffe1367e498701f2dfab80a3d41740d46fd7cba533430e611917f0f3df823279a600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546040518082815260200191505060405180910390a150565b60058181548110151561072f57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050818160000190805190602001906107ba929190610d4c565b50600081600101819055506001600580548060010182816107db9190610dcc565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050507f66ab3fea2083d9ba15d99b595186fe7fc18e6eba393c0fc056f420e96c3caa44826040518080602001828103825283818151815260200191508051906020019080838360005b8381101561088d578082015181840152602081019050610872565b50505050905090810190601f1680156108ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390a15050565b600460205280600052604060002060009150905080600001908060010154905082565b6108f6610df8565b6000610900610df8565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154838054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aa15780601f10610a7657610100808354040283529160200191610aa1565b820191906000526020600020905b815481529060010190602001808311610a8457829003601f168201915b50505050509350818054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b3d5780601f10610b1257610100808354040283529160200191610b3d565b820191906000526020600020905b815481529060010190602001808311610b2057829003601f168201915b50505050509150935093509350935090919293565b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905081816000019080519060200190610bad929190610d4c565b5060058160010181905550600160068054806001018281610bce9190610dcc565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050506005600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825403925050819055507f3b6c110dfadc879ec2bbc1dc567f9065fd5ea5846bce75fddba0f60ffcc79fac826040518080602001828103825283818151815260200191508051906020019080838360005b83811015610cd1578082015181840152602081019050610cb6565b50505050905090810190601f168015610cfe5780820380516001836020036101000a031916815260200191505b509250505060405180910390a15050565b600360205280600052604060002060009150905080600001908060010154908060020154905083565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610d8d57805160ff1916838001178555610dbb565b82800160010185558215610dbb579182015b82811115610dba578251825591602001919060010190610d9f565b5b509050610dc89190610e0c565b5090565b815481835581811511610df357818360005260206000209182019101610df29190610e0c565b5b505050565b602060405190810160405280600081525090565b610e2e91905b80821115610e2a576000816000905550600101610e12565b5090565b905600a165627a7a723058208250da5121e6843ef4de46d1a13b5495e399c896acfd7db568a1c91654e623d90029", + "deployedBytecode": "0x606060405260043610610098576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062ce8e3e1461009a5780630b1e7f83146101045780633610724e14610167578063365b98b21461018a578063507ffba5146101ed578063763f17c41461024a578063832880e714610320578063c7303c6114610428578063edf5388614610485575b005b34156100a557600080fd5b6100ad610562565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100f05780820151818401526020810190506100d5565b505050509050019250505060405180910390f35b341561010f57600080fd5b61012560048080359060200190919050506105f6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561017257600080fd5b6101886004808035906020019091905050610635565b005b341561019557600080fd5b6101ab6004808035906020019091905050610720565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101f857600080fd5b610248600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061075f565b005b341561025557600080fd5b610281600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108cb565b60405180806020018381526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156103105780601f106102e557610100808354040283529160200191610310565b820191906000526020600020905b8154815290600101906020018083116102f357829003601f168201915b5050935050505060405180910390f35b341561032b57600080fd5b6103336108ee565b604051808060200185815260200180602001848152602001838103835287818151815260200191508051906020019080838360005b83811015610383578082015181840152602081019050610368565b50505050905090810190601f1680156103b05780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156103e95780820151818401526020810190506103ce565b50505050905090810190601f1680156104165780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b341561043357600080fd5b610483600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610b52565b005b341561049057600080fd5b6104bc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d0f565b60405180806020018481526020018381526020018281038252858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156105515780601f1061052657610100808354040283529160200191610551565b820191906000526020600020905b81548152906001019060200180831161053457829003601f168201915b505094505050505060405180910390f35b61056a610d38565b60058054806020026020016040519081016040528092919081815260200182805480156105ec57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116105a2575b5050505050905090565b60068181548110151561060557fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008282540192505081905550806001600082825401925050819055508060008082825403925050819055507ffe1367e498701f2dfab80a3d41740d46fd7cba533430e611917f0f3df823279a600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546040518082815260200191505060405180910390a150565b60058181548110151561072f57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050818160000190805190602001906107ba929190610d4c565b50600081600101819055506001600580548060010182816107db9190610dcc565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050507f66ab3fea2083d9ba15d99b595186fe7fc18e6eba393c0fc056f420e96c3caa44826040518080602001828103825283818151815260200191508051906020019080838360005b8381101561088d578082015181840152602081019050610872565b50505050905090810190601f1680156108ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390a15050565b600460205280600052604060002060009150905080600001908060010154905082565b6108f6610df8565b6000610900610df8565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154838054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aa15780601f10610a7657610100808354040283529160200191610aa1565b820191906000526020600020905b815481529060010190602001808311610a8457829003601f168201915b50505050509350818054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b3d5780601f10610b1257610100808354040283529160200191610b3d565b820191906000526020600020905b815481529060010190602001808311610b2057829003601f168201915b50505050509150935093509350935090919293565b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905081816000019080519060200190610bad929190610d4c565b5060058160010181905550600160068054806001018281610bce9190610dcc565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050506005600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825403925050819055507f3b6c110dfadc879ec2bbc1dc567f9065fd5ea5846bce75fddba0f60ffcc79fac826040518080602001828103825283818151815260200191508051906020019080838360005b83811015610cd1578082015181840152602081019050610cb6565b50505050905090810190601f168015610cfe5780820380516001836020036101000a031916815260200191505b509250505060405180910390a15050565b600360205280600052604060002060009150905080600001908060010154908060020154905083565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610d8d57805160ff1916838001178555610dbb565b82800160010185558215610dbb579182015b82811115610dba578251825591602001919060010190610d9f565b5b509050610dc89190610e0c565b5090565b815481835581811511610df357818360005260206000209182019101610df29190610e0c565b5b505050565b602060405190810160405280600081525090565b610e2e91905b80821115610e2a576000816000905550600101610e12565b5090565b905600a165627a7a723058208250da5121e6843ef4de46d1a13b5495e399c896acfd7db568a1c91654e623d90029", + "sourceMap": "26:1569:0:-;;;170:7;152:25;;200:1;181:20;;226:46;;;;;;;;266:1;252:11;:15;;;;26:1569;;;;;;", + "deployedSourceMap": "26:1569:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;759:75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;541:22:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1089:207;;;;;;;;;;;;;;;;;;;;;;;;;;515:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;568:187;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;465:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;838:247;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1300:259:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;415:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;759:75;800:9;;:::i;:::-;824:5;817:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;759:75;:::o;541:22::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1089:207::-;1175:6;1134:13;:25;1148:10;1134:25;;;;;;;;;;;;;;;:37;;;:47;;;;;;;;;;;1202:6;1187:11;;:21;;;;;;;;;;;1228:6;1214:10;;:20;;;;;;;;;;;1240:51;1253:13;:25;1267:10;1253:25;;;;;;;;;;;;;;;:37;;;1240:51;;;;;;;;;;;;;;;;;;1089:207;:::o;515:22::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;568:187::-;614:8;625:13;:25;639:10;625:25;;;;;;;;;;;;;;;614:36;;669:4;657;:9;;:16;;;;;;;;;;;;:::i;:::-;;698:1;679:4;:16;;:20;;;;730:1;706:5;:22;;;;;;;;;;;:::i;:::-;;;;;;;;;;717:10;706:22;;;;;;;;;;;;;;;;;;;;;;:25;;737:13;745:4;737:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;568:187:0;;:::o;465:46::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;838:247::-;878:6;;:::i;:::-;886:4;892:6;;:::i;:::-;900:4;920:13;:25;934:10;920:25;;;;;;;;;;;;;;;:30;;958:13;:25;972:10;958:25;;;;;;;;;;;;;;;:37;;;1003:13;:25;1017:10;1003:25;;;;;;;;;;;;;;;:29;;1040:13;:25;1054:10;1040:25;;;;;;;;;;;;;;;:39;;;912:168;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;838:247;;;;:::o;1300:259::-;1369:8;1380:13;:25;1394:10;1380:25;;;;;;;;;;;;;;;1369:36;;1422:3;1411:4;:8;;:14;;;;;;;;;;;;:::i;:::-;;1452:1;1431:4;:18;;:22;;;;1483:1;1459:5;:22;;;;;;;;;;;:::i;:::-;;;;;;;;;;1470:10;1459:22;;;;;;;;;;;;;;;;;;;;;;:25;;1531:1;1490:13;:25;1504:10;1490:25;;;;;;;;;;;;;;;:37;;;:42;;;;;;;;;;;1538:16;1550:3;1538:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1300:259:0;;:::o;415:46::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;26:1569::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "source": "pragma solidity ^0.4.18;\n\ncontract CapCoin {\n\n event NewUser(string name);\n event BoughtTokens(uint coinBalance);\n event CreatedPost(string url);\n\n uint coinSupply = 1000000;\n uint coinsBought = 0;\n uint contractNum;\n\n function CapCoin () {\n contractNum = 1;\n }\n\n struct User {\n string name;\n uint coinBalance;\n uint postNum;\n }\n\n struct Post {\n string url;\n uint lotteryAmount;\n }\n\n mapping (address => User) public addressToUser;\n mapping (address => Post) public addressToPost;\n address[] public users;\n address[] public posts;\n\n function createUser(string name) public {\n var user = addressToUser[msg.sender];\n\n user.name = name;\n user.coinBalance = 0;\n\n users.push(msg.sender) -1;\n NewUser(name);\n }\n\n function getUsers() public view returns (address[]) {\n return users;\n }\n\n function getUser() public view returns (string, uint, string, uint) {\n return (addressToUser[msg.sender].name,\n addressToUser[msg.sender].coinBalance,\n addressToPost[msg.sender].url,\n addressToPost[msg.sender].lotteryAmount);\n }\n\n function buyTokens(uint amount) public {\n addressToUser[msg.sender].coinBalance += amount;\n coinsBought += amount;\n coinSupply -= amount;\n BoughtTokens(addressToUser[msg.sender].coinBalance);\n }\n\n function createPost(string url) public {\n // 5 coins per post\n var post = addressToPost[msg.sender];\n post.url = url;\n post.lotteryAmount = 5;\n posts.push(msg.sender) -1;\n addressToUser[msg.sender].coinBalance -= 5;\n CreatedPost(url);\n }\n\n function() internal payable {}\n}\n", "sourcePath": "/Users/schwartzz8990/Dropbox/fullstack/capCoin/contracts/CapCoin.sol", "ast": { "attributes": { "absolutePath": "/Users/schwartzz8990/Dropbox/fullstack/capCoin/contracts/CapCoin.sol", "exportedSymbols": { "CapCoin": [ - 134 + 215 ] } }, @@ -175,10 +260,10 @@ "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ - 134 + 215 ], "name": "CapCoin", - "scope": 135 + "scope": 216 }, "children": [ { @@ -271,11 +356,56 @@ "name": "EventDefinition", "src": "78:37:0" }, + { + "attributes": { + "anonymous": false, + "name": "CreatedPost" + }, + "children": [ + { + "children": [ + { + "attributes": { + "constant": false, + "indexed": false, + "name": "url", + "scope": 13, + "stateVariable": false, + "storageLocation": "default", + "type": "string memory", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "string", + "type": "string storage pointer" + }, + "id": 10, + "name": "ElementaryTypeName", + "src": "136:6:0" + } + ], + "id": 11, + "name": "VariableDeclaration", + "src": "136:10:0" + } + ], + "id": 12, + "name": "ParameterList", + "src": "135:12:0" + } + ], + "id": 13, + "name": "EventDefinition", + "src": "118:30:0" + }, { "attributes": { "constant": false, "name": "coinSupply", - "scope": 134, + "scope": 215, "stateVariable": true, "storageLocation": "default", "type": "uint256", @@ -287,9 +417,9 @@ "name": "uint", "type": "uint256" }, - "id": 10, + "id": 14, "name": "ElementaryTypeName", - "src": "119:4:0" + "src": "152:4:0" }, { "attributes": { @@ -304,20 +434,20 @@ "type": "int_const 1000000", "value": "1000000" }, - "id": 11, + "id": 15, "name": "Literal", - "src": "137:7:0" + "src": "170:7:0" } ], - "id": 12, + "id": 16, "name": "VariableDeclaration", - "src": "119:25:0" + "src": "152:25:0" }, { "attributes": { "constant": false, "name": "coinsBought", - "scope": 134, + "scope": 215, "stateVariable": true, "storageLocation": "default", "type": "uint256", @@ -329,9 +459,9 @@ "name": "uint", "type": "uint256" }, - "id": 13, + "id": 17, "name": "ElementaryTypeName", - "src": "148:4:0" + "src": "181:4:0" }, { "attributes": { @@ -346,20 +476,20 @@ "type": "int_const 0", "value": "0" }, - "id": 14, + "id": 18, "name": "Literal", - "src": "167:1:0" + "src": "200:1:0" } ], - "id": 15, + "id": 19, "name": "VariableDeclaration", - "src": "148:20:0" + "src": "181:20:0" }, { "attributes": { "constant": false, "name": "contractNum", - "scope": 134, + "scope": 215, "stateVariable": true, "storageLocation": "default", "type": "uint256", @@ -372,14 +502,14 @@ "name": "uint", "type": "uint256" }, - "id": 16, + "id": 20, "name": "ElementaryTypeName", - "src": "172:4:0" + "src": "205:4:0" } ], - "id": 17, + "id": 21, "name": "VariableDeclaration", - "src": "172:16:0" + "src": "205:16:0" }, { "attributes": { @@ -391,7 +521,7 @@ ], "name": "CapCoin", "payable": false, - "scope": 134, + "scope": 215, "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" @@ -404,9 +534,9 @@ ] }, "children": [], - "id": 18, + "id": 22, "name": "ParameterList", - "src": "210:2:0" + "src": "243:2:0" }, { "attributes": { @@ -415,9 +545,9 @@ ] }, "children": [], - "id": 19, + "id": 23, "name": "ParameterList", - "src": "213:0:0" + "src": "246:0:0" }, { "children": [ @@ -440,13 +570,13 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 17, + "referencedDeclaration": 21, "type": "uint256", "value": "contractNum" }, - "id": 20, + "id": 24, "name": "Identifier", - "src": "219:11:0" + "src": "252:11:0" }, { "attributes": { @@ -461,35 +591,35 @@ "type": "int_const 1", "value": "1" }, - "id": 21, + "id": 25, "name": "Literal", - "src": "233:1:0" + "src": "266:1:0" } ], - "id": 22, + "id": 26, "name": "Assignment", - "src": "219:15:0" + "src": "252:15:0" } ], - "id": 23, + "id": 27, "name": "ExpressionStatement", - "src": "219:15:0" + "src": "252:15:0" } ], - "id": 24, + "id": 28, "name": "Block", - "src": "213:26:0" + "src": "246:26:0" } ], - "id": 25, + "id": 29, "name": "FunctionDefinition", - "src": "193:46:0" + "src": "226:46:0" }, { "attributes": { "canonicalName": "CapCoin.User", "name": "User", - "scope": 134, + "scope": 215, "visibility": "public" }, "children": [ @@ -497,7 +627,7 @@ "attributes": { "constant": false, "name": "name", - "scope": 30, + "scope": 36, "stateVariable": false, "storageLocation": "default", "type": "string storage pointer", @@ -510,20 +640,111 @@ "name": "string", "type": "string storage pointer" }, - "id": 26, + "id": 30, "name": "ElementaryTypeName", - "src": "261:6:0" + "src": "294:6:0" } ], - "id": 27, + "id": 31, "name": "VariableDeclaration", - "src": "261:11:0" + "src": "294:11:0" }, { "attributes": { "constant": false, "name": "coinBalance", - "scope": 30, + "scope": 36, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint", + "type": "uint256" + }, + "id": 32, + "name": "ElementaryTypeName", + "src": "311:4:0" + } + ], + "id": 33, + "name": "VariableDeclaration", + "src": "311:16:0" + }, + { + "attributes": { + "constant": false, + "name": "postNum", + "scope": 36, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint", + "type": "uint256" + }, + "id": 34, + "name": "ElementaryTypeName", + "src": "333:4:0" + } + ], + "id": 35, + "name": "VariableDeclaration", + "src": "333:12:0" + } + ], + "id": 36, + "name": "StructDefinition", + "src": "276:74:0" + }, + { + "attributes": { + "canonicalName": "CapCoin.Post", + "name": "Post", + "scope": 215, + "visibility": "public" + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "url", + "scope": 41, + "stateVariable": false, + "storageLocation": "default", + "type": "string storage pointer", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "string", + "type": "string storage pointer" + }, + "id": 37, + "name": "ElementaryTypeName", + "src": "372:6:0" + } + ], + "id": 38, + "name": "VariableDeclaration", + "src": "372:10:0" + }, + { + "attributes": { + "constant": false, + "name": "lotteryAmount", + "scope": 41, "stateVariable": false, "storageLocation": "default", "type": "uint256", @@ -536,25 +757,25 @@ "name": "uint", "type": "uint256" }, - "id": 28, + "id": 39, "name": "ElementaryTypeName", - "src": "278:4:0" + "src": "388:4:0" } ], - "id": 29, + "id": 40, "name": "VariableDeclaration", - "src": "278:16:0" + "src": "388:18:0" } ], - "id": 30, + "id": 41, "name": "StructDefinition", - "src": "243:56:0" + "src": "354:57:0" }, { "attributes": { "constant": false, "name": "addressToUser", - "scope": 134, + "scope": 215, "stateVariable": true, "storageLocation": "default", "type": "mapping(address => struct CapCoin.User storage ref)", @@ -572,36 +793,120 @@ "name": "address", "type": "address" }, - "id": 31, + "id": 42, "name": "ElementaryTypeName", - "src": "312:7:0" + "src": "424:7:0" }, { "attributes": { "contractScope": null, "name": "User", - "referencedDeclaration": 30, + "referencedDeclaration": 36, "type": "struct CapCoin.User storage pointer" }, - "id": 32, + "id": 43, "name": "UserDefinedTypeName", - "src": "323:4:0" + "src": "435:4:0" } ], - "id": 33, + "id": 44, + "name": "Mapping", + "src": "415:25:0" + } + ], + "id": 45, + "name": "VariableDeclaration", + "src": "415:46:0" + }, + { + "attributes": { + "constant": false, + "name": "addressToPost", + "scope": 215, + "stateVariable": true, + "storageLocation": "default", + "type": "mapping(address => struct CapCoin.Post storage ref)", + "value": null, + "visibility": "public" + }, + "children": [ + { + "attributes": { + "type": "mapping(address => struct CapCoin.Post storage ref)" + }, + "children": [ + { + "attributes": { + "name": "address", + "type": "address" + }, + "id": 46, + "name": "ElementaryTypeName", + "src": "474:7:0" + }, + { + "attributes": { + "contractScope": null, + "name": "Post", + "referencedDeclaration": 41, + "type": "struct CapCoin.Post storage pointer" + }, + "id": 47, + "name": "UserDefinedTypeName", + "src": "485:4:0" + } + ], + "id": 48, "name": "Mapping", - "src": "303:25:0" + "src": "465:25:0" } ], - "id": 34, + "id": 49, "name": "VariableDeclaration", - "src": "303:46:0" + "src": "465:46:0" }, { "attributes": { "constant": false, "name": "users", - "scope": 134, + "scope": 215, + "stateVariable": true, + "storageLocation": "default", + "type": "address[] storage ref", + "value": null, + "visibility": "public" + }, + "children": [ + { + "attributes": { + "length": null, + "type": "address[] storage pointer" + }, + "children": [ + { + "attributes": { + "name": "address", + "type": "address" + }, + "id": 50, + "name": "ElementaryTypeName", + "src": "515:7:0" + } + ], + "id": 51, + "name": "ArrayTypeName", + "src": "515:9:0" + } + ], + "id": 52, + "name": "VariableDeclaration", + "src": "515:22:0" + }, + { + "attributes": { + "constant": false, + "name": "posts", + "scope": 215, "stateVariable": true, "storageLocation": "default", "type": "address[] storage ref", @@ -620,19 +925,19 @@ "name": "address", "type": "address" }, - "id": 35, + "id": 53, "name": "ElementaryTypeName", - "src": "353:7:0" + "src": "541:7:0" } ], - "id": 36, + "id": 54, "name": "ArrayTypeName", - "src": "353:9:0" + "src": "541:9:0" } ], - "id": 37, + "id": 55, "name": "VariableDeclaration", - "src": "353:22:0" + "src": "541:22:0" }, { "attributes": { @@ -644,7 +949,7 @@ ], "name": "createUser", "payable": false, - "scope": 134, + "scope": 215, "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" @@ -656,7 +961,7 @@ "attributes": { "constant": false, "name": "name", - "scope": 74, + "scope": 92, "stateVariable": false, "storageLocation": "default", "type": "string memory", @@ -669,19 +974,19 @@ "name": "string", "type": "string storage pointer" }, - "id": 38, + "id": 56, "name": "ElementaryTypeName", - "src": "400:6:0" + "src": "588:6:0" } ], - "id": 39, + "id": 57, "name": "VariableDeclaration", - "src": "400:11:0" + "src": "588:11:0" } ], - "id": 40, + "id": 58, "name": "ParameterList", - "src": "399:13:0" + "src": "587:13:0" }, { "attributes": { @@ -690,16 +995,16 @@ ] }, "children": [], - "id": 41, + "id": 59, "name": "ParameterList", - "src": "420:0:0" + "src": "608:0:0" }, { "children": [ { "attributes": { "assignments": [ - 42 + 60 ] }, "children": [ @@ -707,7 +1012,7 @@ "attributes": { "constant": false, "name": "user", - "scope": 74, + "scope": 92, "stateVariable": false, "storageLocation": "default", "type": "struct CapCoin.User storage pointer", @@ -716,9 +1021,9 @@ "visibility": "internal" }, "children": [], - "id": 42, + "id": 60, "name": "VariableDeclaration", - "src": "426:8:0" + "src": "614:8:0" }, { "attributes": { @@ -736,13 +1041,13 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 34, + "referencedDeclaration": 45, "type": "mapping(address => struct CapCoin.User storage ref)", "value": "addressToUser" }, - "id": 43, + "id": 61, "name": "Identifier", - "src": "437:13:0" + "src": "625:13:0" }, { "attributes": { @@ -762,28 +1067,28 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 146, + "referencedDeclaration": 227, "type": "msg", "value": "msg" }, - "id": 44, + "id": 62, "name": "Identifier", - "src": "451:3:0" + "src": "639:3:0" } ], - "id": 45, + "id": 63, "name": "MemberAccess", - "src": "451:10:0" + "src": "639:10:0" } ], - "id": 46, + "id": 64, "name": "IndexAccess", - "src": "437:25:0" + "src": "625:25:0" } ], - "id": 47, + "id": 65, "name": "VariableDeclarationStatement", - "src": "426:36:0" + "src": "614:36:0" }, { "children": [ @@ -806,7 +1111,7 @@ "isPure": false, "lValueRequested": true, "member_name": "name", - "referencedDeclaration": 27, + "referencedDeclaration": 31, "type": "string storage ref" }, "children": [ @@ -816,18 +1121,18 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 42, + "referencedDeclaration": 60, "type": "struct CapCoin.User storage pointer", "value": "user" }, - "id": 48, + "id": 66, "name": "Identifier", - "src": "469:4:0" + "src": "657:4:0" } ], - "id": 50, + "id": 68, "name": "MemberAccess", - "src": "469:9:0" + "src": "657:9:0" }, { "attributes": { @@ -835,23 +1140,23 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 39, + "referencedDeclaration": 57, "type": "string memory", "value": "name" }, - "id": 51, + "id": 69, "name": "Identifier", - "src": "481:4:0" + "src": "669:4:0" } ], - "id": 52, + "id": 70, "name": "Assignment", - "src": "469:16:0" + "src": "657:16:0" } ], - "id": 53, + "id": 71, "name": "ExpressionStatement", - "src": "469:16:0" + "src": "657:16:0" }, { "children": [ @@ -874,7 +1179,7 @@ "isPure": false, "lValueRequested": true, "member_name": "coinBalance", - "referencedDeclaration": 29, + "referencedDeclaration": 33, "type": "uint256" }, "children": [ @@ -884,18 +1189,18 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 42, + "referencedDeclaration": 60, "type": "struct CapCoin.User storage pointer", "value": "user" }, - "id": 54, + "id": 72, "name": "Identifier", - "src": "491:4:0" + "src": "679:4:0" } ], - "id": 56, + "id": 74, "name": "MemberAccess", - "src": "491:16:0" + "src": "679:16:0" }, { "attributes": { @@ -910,19 +1215,19 @@ "type": "int_const 0", "value": "0" }, - "id": 57, + "id": 75, "name": "Literal", - "src": "510:1:0" + "src": "698:1:0" } ], - "id": 58, + "id": 76, "name": "Assignment", - "src": "491:20:0" + "src": "679:20:0" } ], - "id": 59, + "id": 77, "name": "ExpressionStatement", - "src": "491:20:0" + "src": "679:20:0" }, { "children": [ @@ -979,18 +1284,18 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 37, + "referencedDeclaration": 52, "type": "address[] storage ref", "value": "users" }, - "id": 60, + "id": 78, "name": "Identifier", - "src": "518:5:0" + "src": "706:5:0" } ], - "id": 62, + "id": 80, "name": "MemberAccess", - "src": "518:10:0" + "src": "706:10:0" }, { "attributes": { @@ -1010,23 +1315,23 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 146, + "referencedDeclaration": 227, "type": "msg", "value": "msg" }, - "id": 63, + "id": 81, "name": "Identifier", - "src": "529:3:0" + "src": "717:3:0" } ], - "id": 64, + "id": 82, "name": "MemberAccess", - "src": "529:10:0" + "src": "717:10:0" } ], - "id": 65, + "id": 83, "name": "FunctionCall", - "src": "518:22:0" + "src": "706:22:0" }, { "attributes": { @@ -1041,19 +1346,19 @@ "type": "int_const 1", "value": "1" }, - "id": 66, + "id": 84, "name": "Literal", - "src": "542:1:0" + "src": "730:1:0" } ], - "id": 67, + "id": 85, "name": "BinaryOperation", - "src": "518:25:0" + "src": "706:25:0" } ], - "id": 68, + "id": 86, "name": "ExpressionStatement", - "src": "518:25:0" + "src": "706:25:0" }, { "children": [ @@ -1087,9 +1392,9 @@ "type": "function (string memory)", "value": "NewUser" }, - "id": 69, + "id": 87, "name": "Identifier", - "src": "549:7:0" + "src": "737:7:0" }, { "attributes": { @@ -1097,33 +1402,33 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 39, + "referencedDeclaration": 57, "type": "string memory", "value": "name" }, - "id": 70, + "id": 88, "name": "Identifier", - "src": "557:4:0" + "src": "745:4:0" } ], - "id": 71, + "id": 89, "name": "FunctionCall", - "src": "549:13:0" + "src": "737:13:0" } ], - "id": 72, + "id": 90, "name": "ExpressionStatement", - "src": "549:13:0" + "src": "737:13:0" } ], - "id": 73, + "id": 91, "name": "Block", - "src": "420:147:0" + "src": "608:147:0" } ], - "id": 74, + "id": 92, "name": "FunctionDefinition", - "src": "380:187:0" + "src": "568:187:0" }, { "attributes": { @@ -1135,7 +1440,7 @@ ], "name": "getUsers", "payable": false, - "scope": 134, + "scope": 215, "stateMutability": "view", "superFunction": null, "visibility": "public" @@ -1148,9 +1453,9 @@ ] }, "children": [], - "id": 75, + "id": 93, "name": "ParameterList", - "src": "588:2:0" + "src": "776:2:0" }, { "children": [ @@ -1158,7 +1463,7 @@ "attributes": { "constant": false, "name": "", - "scope": 83, + "scope": 101, "stateVariable": false, "storageLocation": "default", "type": "address[] memory", @@ -1177,30 +1482,30 @@ "name": "address", "type": "address" }, - "id": 76, + "id": 94, "name": "ElementaryTypeName", - "src": "612:7:0" + "src": "800:7:0" } ], - "id": 77, + "id": 95, "name": "ArrayTypeName", - "src": "612:9:0" + "src": "800:9:0" } ], - "id": 78, + "id": 96, "name": "VariableDeclaration", - "src": "612:9:0" + "src": "800:9:0" } ], - "id": 79, + "id": 97, "name": "ParameterList", - "src": "611:11:0" + "src": "799:11:0" }, { "children": [ { "attributes": { - "functionReturnParameters": 79 + "functionReturnParameters": 97 }, "children": [ { @@ -1209,28 +1514,28 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 37, + "referencedDeclaration": 52, "type": "address[] storage ref", "value": "users" }, - "id": 80, + "id": 98, "name": "Identifier", - "src": "636:5:0" + "src": "824:5:0" } ], - "id": 81, + "id": 99, "name": "Return", - "src": "629:12:0" + "src": "817:12:0" } ], - "id": 82, + "id": 100, "name": "Block", - "src": "623:23:0" + "src": "811:23:0" } ], - "id": 83, + "id": 101, "name": "FunctionDefinition", - "src": "571:75:0" + "src": "759:75:0" }, { "attributes": { @@ -1242,7 +1547,7 @@ ], "name": "getUser", "payable": false, - "scope": 134, + "scope": 215, "stateMutability": "view", "superFunction": null, "visibility": "public" @@ -1255,9 +1560,9 @@ ] }, "children": [], - "id": 84, + "id": 102, "name": "ParameterList", - "src": "666:2:0" + "src": "854:2:0" }, { "children": [ @@ -1265,7 +1570,7 @@ "attributes": { "constant": false, "name": "", - "scope": 103, + "scope": 135, "stateVariable": false, "storageLocation": "default", "type": "string memory", @@ -1278,20 +1583,72 @@ "name": "string", "type": "string storage pointer" }, - "id": 85, + "id": 103, "name": "ElementaryTypeName", - "src": "690:6:0" + "src": "878:6:0" } ], - "id": 86, + "id": 104, + "name": "VariableDeclaration", + "src": "878:6:0" + }, + { + "attributes": { + "constant": false, + "name": "", + "scope": 135, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint", + "type": "uint256" + }, + "id": 105, + "name": "ElementaryTypeName", + "src": "886:4:0" + } + ], + "id": 106, + "name": "VariableDeclaration", + "src": "886:4:0" + }, + { + "attributes": { + "constant": false, + "name": "", + "scope": 135, + "stateVariable": false, + "storageLocation": "default", + "type": "string memory", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "string", + "type": "string storage pointer" + }, + "id": 107, + "name": "ElementaryTypeName", + "src": "892:6:0" + } + ], + "id": 108, "name": "VariableDeclaration", - "src": "690:6:0" + "src": "892:6:0" }, { "attributes": { "constant": false, "name": "", - "scope": 103, + "scope": 135, "stateVariable": false, "storageLocation": "default", "type": "uint256", @@ -1304,25 +1661,25 @@ "name": "uint", "type": "uint256" }, - "id": 87, + "id": 109, "name": "ElementaryTypeName", - "src": "698:4:0" + "src": "900:4:0" } ], - "id": 88, + "id": 110, "name": "VariableDeclaration", - "src": "698:4:0" + "src": "900:4:0" } ], - "id": 89, + "id": 111, "name": "ParameterList", - "src": "689:14:0" + "src": "877:28:0" }, { "children": [ { "attributes": { - "functionReturnParameters": 89 + "functionReturnParameters": 111 }, "children": [ { @@ -1333,7 +1690,7 @@ "isLValue": false, "isPure": false, "lValueRequested": false, - "type": "tuple(string storage ref,uint256)" + "type": "tuple(string storage ref,uint256,string storage ref,uint256)" }, "children": [ { @@ -1344,7 +1701,7 @@ "isPure": false, "lValueRequested": false, "member_name": "name", - "referencedDeclaration": 27, + "referencedDeclaration": 31, "type": "string storage ref" }, "children": [ @@ -1364,13 +1721,13 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 34, + "referencedDeclaration": 45, "type": "mapping(address => struct CapCoin.User storage ref)", "value": "addressToUser" }, - "id": 90, + "id": 112, "name": "Identifier", - "src": "718:13:0" + "src": "920:13:0" }, { "attributes": { @@ -1390,28 +1747,28 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 146, + "referencedDeclaration": 227, "type": "msg", "value": "msg" }, - "id": 91, + "id": 113, "name": "Identifier", - "src": "732:3:0" + "src": "934:3:0" } ], - "id": 92, + "id": 114, "name": "MemberAccess", - "src": "732:10:0" + "src": "934:10:0" } ], - "id": 93, + "id": 115, "name": "IndexAccess", - "src": "718:25:0" + "src": "920:25:0" } ], - "id": 94, + "id": 116, "name": "MemberAccess", - "src": "718:30:0" + "src": "920:30:0" }, { "attributes": { @@ -1421,7 +1778,7 @@ "isPure": false, "lValueRequested": false, "member_name": "coinBalance", - "referencedDeclaration": 29, + "referencedDeclaration": 33, "type": "uint256" }, "children": [ @@ -1441,13 +1798,167 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 34, + "referencedDeclaration": 45, "type": "mapping(address => struct CapCoin.User storage ref)", "value": "addressToUser" }, - "id": 95, + "id": 117, + "name": "Identifier", + "src": "958:13:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "member_name": "sender", + "referencedDeclaration": null, + "type": "address" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 227, + "type": "msg", + "value": "msg" + }, + "id": 118, + "name": "Identifier", + "src": "972:3:0" + } + ], + "id": 119, + "name": "MemberAccess", + "src": "972:10:0" + } + ], + "id": 120, + "name": "IndexAccess", + "src": "958:25:0" + } + ], + "id": 121, + "name": "MemberAccess", + "src": "958:37:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "url", + "referencedDeclaration": 38, + "type": "string storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "type": "struct CapCoin.Post storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 49, + "type": "mapping(address => struct CapCoin.Post storage ref)", + "value": "addressToPost" + }, + "id": 122, + "name": "Identifier", + "src": "1003:13:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "member_name": "sender", + "referencedDeclaration": null, + "type": "address" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 227, + "type": "msg", + "value": "msg" + }, + "id": 123, + "name": "Identifier", + "src": "1017:3:0" + } + ], + "id": 124, + "name": "MemberAccess", + "src": "1017:10:0" + } + ], + "id": 125, + "name": "IndexAccess", + "src": "1003:25:0" + } + ], + "id": 126, + "name": "MemberAccess", + "src": "1003:29:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "lotteryAmount", + "referencedDeclaration": 40, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "type": "struct CapCoin.Post storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 49, + "type": "mapping(address => struct CapCoin.Post storage ref)", + "value": "addressToPost" + }, + "id": 127, "name": "Identifier", - "src": "750:13:0" + "src": "1040:13:0" }, { "attributes": { @@ -1467,48 +1978,48 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 146, + "referencedDeclaration": 227, "type": "msg", "value": "msg" }, - "id": 96, + "id": 128, "name": "Identifier", - "src": "764:3:0" + "src": "1054:3:0" } ], - "id": 97, + "id": 129, "name": "MemberAccess", - "src": "764:10:0" + "src": "1054:10:0" } ], - "id": 98, + "id": 130, "name": "IndexAccess", - "src": "750:25:0" + "src": "1040:25:0" } ], - "id": 99, + "id": 131, "name": "MemberAccess", - "src": "750:37:0" + "src": "1040:39:0" } ], - "id": 100, + "id": 132, "name": "TupleExpression", - "src": "717:71:0" + "src": "919:161:0" } ], - "id": 101, + "id": 133, "name": "Return", - "src": "710:78:0" + "src": "912:168:0" } ], - "id": 102, + "id": 134, "name": "Block", - "src": "704:89:0" + "src": "906:179:0" } ], - "id": 103, + "id": 135, "name": "FunctionDefinition", - "src": "650:143:0" + "src": "838:247:0" }, { "attributes": { @@ -1520,7 +2031,7 @@ ], "name": "buyTokens", "payable": false, - "scope": 134, + "scope": 215, "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" @@ -1532,7 +2043,7 @@ "attributes": { "constant": false, "name": "amount", - "scope": 133, + "scope": 165, "stateVariable": false, "storageLocation": "default", "type": "uint256", @@ -1545,19 +2056,19 @@ "name": "uint", "type": "uint256" }, - "id": 104, + "id": 136, "name": "ElementaryTypeName", - "src": "816:4:0" + "src": "1108:4:0" } ], - "id": 105, + "id": 137, "name": "VariableDeclaration", - "src": "816:11:0" + "src": "1108:11:0" } ], - "id": 106, + "id": 138, "name": "ParameterList", - "src": "815:13:0" + "src": "1107:13:0" }, { "attributes": { @@ -1566,9 +2077,9 @@ ] }, "children": [], - "id": 107, + "id": 139, "name": "ParameterList", - "src": "836:0:0" + "src": "1128:0:0" }, { "children": [ @@ -1593,7 +2104,7 @@ "isPure": false, "lValueRequested": true, "member_name": "coinBalance", - "referencedDeclaration": 29, + "referencedDeclaration": 33, "type": "uint256" }, "children": [ @@ -1613,13 +2124,13 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 34, + "referencedDeclaration": 45, "type": "mapping(address => struct CapCoin.User storage ref)", "value": "addressToUser" }, - "id": 108, + "id": 140, "name": "Identifier", - "src": "842:13:0" + "src": "1134:13:0" }, { "attributes": { @@ -1639,28 +2150,28 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 146, + "referencedDeclaration": 227, "type": "msg", "value": "msg" }, - "id": 109, + "id": 141, "name": "Identifier", - "src": "856:3:0" + "src": "1148:3:0" } ], - "id": 110, + "id": 142, "name": "MemberAccess", - "src": "856:10:0" + "src": "1148:10:0" } ], - "id": 111, + "id": 143, "name": "IndexAccess", - "src": "842:25:0" + "src": "1134:25:0" } ], - "id": 112, + "id": 144, "name": "MemberAccess", - "src": "842:37:0" + "src": "1134:37:0" }, { "attributes": { @@ -1668,23 +2179,23 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 105, + "referencedDeclaration": 137, "type": "uint256", "value": "amount" }, - "id": 113, + "id": 145, "name": "Identifier", - "src": "883:6:0" + "src": "1175:6:0" } ], - "id": 114, + "id": 146, "name": "Assignment", - "src": "842:47:0" + "src": "1134:47:0" } ], - "id": 115, + "id": 147, "name": "ExpressionStatement", - "src": "842:47:0" + "src": "1134:47:0" }, { "children": [ @@ -1705,13 +2216,13 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 15, + "referencedDeclaration": 19, "type": "uint256", "value": "coinsBought" }, - "id": 116, + "id": 148, "name": "Identifier", - "src": "895:11:0" + "src": "1187:11:0" }, { "attributes": { @@ -1719,23 +2230,23 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 105, + "referencedDeclaration": 137, "type": "uint256", "value": "amount" }, - "id": 117, + "id": 149, "name": "Identifier", - "src": "910:6:0" + "src": "1202:6:0" } ], - "id": 118, + "id": 150, "name": "Assignment", - "src": "895:21:0" + "src": "1187:21:0" } ], - "id": 119, + "id": 151, "name": "ExpressionStatement", - "src": "895:21:0" + "src": "1187:21:0" }, { "children": [ @@ -1756,13 +2267,13 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 12, + "referencedDeclaration": 16, "type": "uint256", "value": "coinSupply" }, - "id": 120, + "id": 152, "name": "Identifier", - "src": "922:10:0" + "src": "1214:10:0" }, { "attributes": { @@ -1770,23 +2281,23 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 105, + "referencedDeclaration": 137, "type": "uint256", "value": "amount" }, - "id": 121, + "id": 153, "name": "Identifier", - "src": "936:6:0" + "src": "1228:6:0" } ], - "id": 122, + "id": 154, "name": "Assignment", - "src": "922:20:0" + "src": "1214:20:0" } ], - "id": 123, + "id": 155, "name": "ExpressionStatement", - "src": "922:20:0" + "src": "1214:20:0" }, { "children": [ @@ -1820,9 +2331,9 @@ "type": "function (uint256)", "value": "BoughtTokens" }, - "id": 124, + "id": 156, "name": "Identifier", - "src": "948:12:0" + "src": "1240:12:0" }, { "attributes": { @@ -1832,7 +2343,7 @@ "isPure": false, "lValueRequested": false, "member_name": "coinBalance", - "referencedDeclaration": 29, + "referencedDeclaration": 33, "type": "uint256" }, "children": [ @@ -1852,13 +2363,13 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 34, + "referencedDeclaration": 45, "type": "mapping(address => struct CapCoin.User storage ref)", "value": "addressToUser" }, - "id": 125, + "id": 157, "name": "Identifier", - "src": "961:13:0" + "src": "1253:13:0" }, { "attributes": { @@ -1878,58 +2389,720 @@ "overloadedDeclarations": [ null ], - "referencedDeclaration": 146, + "referencedDeclaration": 227, "type": "msg", "value": "msg" }, - "id": 126, + "id": 158, "name": "Identifier", - "src": "975:3:0" + "src": "1267:3:0" } ], - "id": 127, + "id": 159, "name": "MemberAccess", - "src": "975:10:0" + "src": "1267:10:0" } ], - "id": 128, + "id": 160, "name": "IndexAccess", - "src": "961:25:0" + "src": "1253:25:0" } ], - "id": 129, + "id": 161, "name": "MemberAccess", - "src": "961:37:0" + "src": "1253:37:0" } ], - "id": 130, + "id": 162, "name": "FunctionCall", - "src": "948:51:0" + "src": "1240:51:0" } ], - "id": 131, + "id": 163, "name": "ExpressionStatement", - "src": "948:51:0" + "src": "1240:51:0" + } + ], + "id": 164, + "name": "Block", + "src": "1128:168:0" + } + ], + "id": 165, + "name": "FunctionDefinition", + "src": "1089:207:0" + }, + { + "attributes": { + "constant": false, + "implemented": true, + "isConstructor": false, + "modifiers": [ + null + ], + "name": "createPost", + "payable": false, + "scope": 215, + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + "children": [ + { + "children": [ + { + "attributes": { + "constant": false, + "name": "url", + "scope": 210, + "stateVariable": false, + "storageLocation": "default", + "type": "string memory", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "string", + "type": "string storage pointer" + }, + "id": 166, + "name": "ElementaryTypeName", + "src": "1320:6:0" + } + ], + "id": 167, + "name": "VariableDeclaration", + "src": "1320:10:0" } ], - "id": 132, + "id": 168, + "name": "ParameterList", + "src": "1319:12:0" + }, + { + "attributes": { + "parameters": [ + null + ] + }, + "children": [], + "id": 169, + "name": "ParameterList", + "src": "1339:0:0" + }, + { + "children": [ + { + "attributes": { + "assignments": [ + 170 + ] + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "post", + "scope": 210, + "stateVariable": false, + "storageLocation": "default", + "type": "struct CapCoin.Post storage pointer", + "typeName": null, + "value": null, + "visibility": "internal" + }, + "children": [], + "id": 170, + "name": "VariableDeclaration", + "src": "1369:8:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "type": "struct CapCoin.Post storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 49, + "type": "mapping(address => struct CapCoin.Post storage ref)", + "value": "addressToPost" + }, + "id": 171, + "name": "Identifier", + "src": "1380:13:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "member_name": "sender", + "referencedDeclaration": null, + "type": "address" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 227, + "type": "msg", + "value": "msg" + }, + "id": 172, + "name": "Identifier", + "src": "1394:3:0" + } + ], + "id": 173, + "name": "MemberAccess", + "src": "1394:10:0" + } + ], + "id": 174, + "name": "IndexAccess", + "src": "1380:25:0" + } + ], + "id": 175, + "name": "VariableDeclarationStatement", + "src": "1369:36:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "string storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "member_name": "url", + "referencedDeclaration": 38, + "type": "string storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 170, + "type": "struct CapCoin.Post storage pointer", + "value": "post" + }, + "id": 176, + "name": "Identifier", + "src": "1411:4:0" + } + ], + "id": 178, + "name": "MemberAccess", + "src": "1411:8:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 167, + "type": "string memory", + "value": "url" + }, + "id": 179, + "name": "Identifier", + "src": "1422:3:0" + } + ], + "id": 180, + "name": "Assignment", + "src": "1411:14:0" + } + ], + "id": 181, + "name": "ExpressionStatement", + "src": "1411:14:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "member_name": "lotteryAmount", + "referencedDeclaration": 40, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 170, + "type": "struct CapCoin.Post storage pointer", + "value": "post" + }, + "id": 182, + "name": "Identifier", + "src": "1431:4:0" + } + ], + "id": 184, + "name": "MemberAccess", + "src": "1431:18:0" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "35", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 5", + "value": "5" + }, + "id": 185, + "name": "Literal", + "src": "1452:1:0" + } + ], + "id": 186, + "name": "Assignment", + "src": "1431:22:0" + } + ], + "id": 187, + "name": "ExpressionStatement", + "src": "1431:22:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "-", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "isStructConstructorCall": false, + "lValueRequested": false, + "names": [ + null + ], + "type": "uint256", + "type_conversion": false + }, + "children": [ + { + "attributes": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "member_name": "push", + "referencedDeclaration": null, + "type": "function (address) returns (uint256)" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 55, + "type": "address[] storage ref", + "value": "posts" + }, + "id": 188, + "name": "Identifier", + "src": "1459:5:0" + } + ], + "id": 190, + "name": "MemberAccess", + "src": "1459:10:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "member_name": "sender", + "referencedDeclaration": null, + "type": "address" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 227, + "type": "msg", + "value": "msg" + }, + "id": 191, + "name": "Identifier", + "src": "1470:3:0" + } + ], + "id": 192, + "name": "MemberAccess", + "src": "1470:10:0" + } + ], + "id": 193, + "name": "FunctionCall", + "src": "1459:22:0" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "31", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 1", + "value": "1" + }, + "id": 194, + "name": "Literal", + "src": "1483:1:0" + } + ], + "id": 195, + "name": "BinaryOperation", + "src": "1459:25:0" + } + ], + "id": 196, + "name": "ExpressionStatement", + "src": "1459:25:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "-=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "member_name": "coinBalance", + "referencedDeclaration": 33, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "type": "struct CapCoin.User storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 45, + "type": "mapping(address => struct CapCoin.User storage ref)", + "value": "addressToUser" + }, + "id": 197, + "name": "Identifier", + "src": "1490:13:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "member_name": "sender", + "referencedDeclaration": null, + "type": "address" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 227, + "type": "msg", + "value": "msg" + }, + "id": 198, + "name": "Identifier", + "src": "1504:3:0" + } + ], + "id": 199, + "name": "MemberAccess", + "src": "1504:10:0" + } + ], + "id": 200, + "name": "IndexAccess", + "src": "1490:25:0" + } + ], + "id": 201, + "name": "MemberAccess", + "src": "1490:37:0" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "35", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 5", + "value": "5" + }, + "id": 202, + "name": "Literal", + "src": "1531:1:0" + } + ], + "id": 203, + "name": "Assignment", + "src": "1490:42:0" + } + ], + "id": 204, + "name": "ExpressionStatement", + "src": "1490:42:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "isStructConstructorCall": false, + "lValueRequested": false, + "names": [ + null + ], + "type": "tuple()", + "type_conversion": false + }, + "children": [ + { + "attributes": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 13, + "type": "function (string memory)", + "value": "CreatedPost" + }, + "id": 205, + "name": "Identifier", + "src": "1538:11:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 167, + "type": "string memory", + "value": "url" + }, + "id": 206, + "name": "Identifier", + "src": "1550:3:0" + } + ], + "id": 207, + "name": "FunctionCall", + "src": "1538:16:0" + } + ], + "id": 208, + "name": "ExpressionStatement", + "src": "1538:16:0" + } + ], + "id": 209, + "name": "Block", + "src": "1339:220:0" + } + ], + "id": 210, + "name": "FunctionDefinition", + "src": "1300:259:0" + }, + { + "attributes": { + "constant": false, + "implemented": true, + "isConstructor": false, + "modifiers": [ + null + ], + "name": "", + "payable": true, + "scope": 215, + "stateMutability": "payable", + "superFunction": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "parameters": [ + null + ] + }, + "children": [], + "id": 211, + "name": "ParameterList", + "src": "1571:2:0" + }, + { + "attributes": { + "parameters": [ + null + ] + }, + "children": [], + "id": 212, + "name": "ParameterList", + "src": "1591:0:0" + }, + { + "attributes": { + "statements": [ + null + ] + }, + "children": [], + "id": 213, "name": "Block", - "src": "836:168:0" + "src": "1591:2:0" } ], - "id": 133, + "id": 214, "name": "FunctionDefinition", - "src": "797:207:0" + "src": "1563:30:0" } ], - "id": 134, + "id": 215, "name": "ContractDefinition", - "src": "26:980:0" + "src": "26:1569:0" } ], - "id": 135, + "id": 216, "name": "SourceUnit", - "src": "0:1007:0" + "src": "0:1596:0" }, "compiler": { "name": "solc", @@ -1943,5 +3116,5 @@ } }, "schemaVersion": "1.0.1", - "updatedAt": "2018-01-18T21:50:57.977Z" + "updatedAt": "2018-01-19T04:15:13.230Z" } \ No newline at end of file diff --git a/build/contracts/Migrations.json b/build/contracts/Migrations.json index f4950e39..0a710b3f 100644 --- a/build/contracts/Migrations.json +++ b/build/contracts/Migrations.json @@ -823,5 +823,5 @@ } }, "schemaVersion": "1.0.1", - "updatedAt": "2018-01-18T21:50:57.978Z" + "updatedAt": "2018-01-19T04:15:13.232Z" } \ No newline at end of file diff --git a/build/contracts/SimpleStorage.json b/build/contracts/SimpleStorage.json index 153dab28..c39922f9 100644 --- a/build/contracts/SimpleStorage.json +++ b/build/contracts/SimpleStorage.json @@ -344,5 +344,5 @@ } }, "schemaVersion": "1.0.1", - "updatedAt": "2018-01-18T21:50:57.975Z" + "updatedAt": "2018-01-19T04:15:13.219Z" } \ No newline at end of file diff --git a/contracts/CapCoin.sol b/contracts/CapCoin.sol index 8fdd7eba..4b9c04f6 100644 --- a/contracts/CapCoin.sol +++ b/contracts/CapCoin.sol @@ -4,6 +4,7 @@ contract CapCoin { event NewUser(string name); event BoughtTokens(uint coinBalance); + event CreatedPost(string url); uint coinSupply = 1000000; uint coinsBought = 0; @@ -16,10 +17,18 @@ contract CapCoin { struct User { string name; uint coinBalance; + uint postNum; + } + + struct Post { + string url; + uint lotteryAmount; } mapping (address => User) public addressToUser; + mapping (address => Post) public addressToPost; address[] public users; + address[] public posts; function createUser(string name) public { var user = addressToUser[msg.sender]; @@ -35,8 +44,11 @@ contract CapCoin { return users; } - function getUser() public view returns (string, uint) { - return (addressToUser[msg.sender].name, addressToUser[msg.sender].coinBalance); + function getUser() public view returns (string, uint, string, uint) { + return (addressToUser[msg.sender].name, + addressToUser[msg.sender].coinBalance, + addressToPost[msg.sender].url, + addressToPost[msg.sender].lotteryAmount); } function buyTokens(uint amount) public { @@ -45,4 +57,16 @@ contract CapCoin { coinSupply -= amount; BoughtTokens(addressToUser[msg.sender].coinBalance); } + + function createPost(string url) public { + // 5 coins per post + var post = addressToPost[msg.sender]; + post.url = url; + post.lotteryAmount = 5; + posts.push(msg.sender) -1; + addressToUser[msg.sender].coinBalance -= 5; + CreatedPost(url); + } + + function() internal payable {} } diff --git a/readme.md b/readme.md index 3b472189..7e9a99a0 100644 --- a/readme.md +++ b/readme.md @@ -10,5 +10,3 @@ c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3 http://127.0.0.1:7545 - - diff --git a/src/components/CreatePost.js b/src/components/CreatePost.js new file mode 100644 index 00000000..c3c3495c --- /dev/null +++ b/src/components/CreatePost.js @@ -0,0 +1,81 @@ +import React, { Component } from 'react' +import {connect} from 'react-redux' +import { Link } from 'react-router-dom'; +import TextField from 'material-ui/TextField'; +import Post from './Post'; +import RaisedButton from 'material-ui/RaisedButton'; +import { post } from '../store/posts'; + +class CreatePost extends Component { + constructor(props){ + super(props); + this.state = { canPost: this.props.user.coinBalance >= 5, + postUrl: "" } + } + + handleChange = (event) => { + this.setState({ + postUrl: event.target.value, + }); + }; + + render(){ + return( +