{"action":"created","comment":{"url":"https://api.github.com/repos/tendermint/basecoin/pulls/comments/98341320","pull_request_review_id":18980916,"id":98341320,"diff_hunk":"@@ -0,0 +1,183 @@\n+package paytovote\n+\n+import (\n+\t\"fmt\"\n+\n+\tabci \"github.com/tendermint/abci/types\"\n+\t\"github.com/tendermint/basecoin/types\"\n+\t\"github.com/tendermint/go-wire\"\n+)\n+\n+const (\n+\tTypeByteCreateIssue byte = 0x00\n+\tTypeByteVoteFor     byte = 0x01\n+\tTypeByteVoteAgainst byte = 0x02\n+\tTypeByteVoteSpoiled byte = 0x03\n+)\n+\n+type P2VPluginState struct {\n+\tTotalCost    types.Coins\n+\tIssue        string\n+\tvotesFor     int\n+\tvotesAgainst int\n+\tvotesSpoiled int\n+}\n+\n+type P2VTx struct {\n+\tValid            bool\n+\tIssue            string      //Issue being voted for\n+\tActionTypeByte   byte        //How is the vote being cast\n+\tCost2Vote        types.Coins //Cost to vote\n+\tCost2CreateIssue types.Coins //Cost to create a new issue","path":"plugins/paytovote/paytovote.go","position":31,"original_position":31,"commit_id":"bfac5437c34dc513757c56c048531f04ea3acf60","original_commit_id":"bfac5437c34dc513757c56c048531f04ea3acf60","user":{"login":"jaekwon","id":53785,"avatar_url":"https://avatars.githubusercontent.com/u/53785?v=3","gravatar_id":"","url":"https://api.github.com/users/jaekwon","html_url":"https://github.com/jaekwon","followers_url":"https://api.github.com/users/jaekwon/followers","following_url":"https://api.github.com/users/jaekwon/following{/other_user}","gists_url":"https://api.github.com/users/jaekwon/gists{/gist_id}","starred_url":"https://api.github.com/users/jaekwon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaekwon/subscriptions","organizations_url":"https://api.github.com/users/jaekwon/orgs","repos_url":"https://api.github.com/users/jaekwon/repos","events_url":"https://api.github.com/users/jaekwon/events{/privacy}","received_events_url":"https://api.github.com/users/jaekwon/received_events","type":"User","site_admin":false},"body":"We should call these VoteFee and IssueFee.  In my mind, \"Cost\" is what happens to you, a \"Fee\" is what you pay (and sign).","created_at":"2017-01-28T23:17:45Z","updated_at":"2017-01-28T23:23:47Z","html_url":"https://github.com/tendermint/basecoin/pull/13#discussion_r98341320","pull_request_url":"https://api.github.com/repos/tendermint/basecoin/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/tendermint/basecoin/pulls/comments/98341320"},"html":{"href":"https://github.com/tendermint/basecoin/pull/13#discussion_r98341320"},"pull_request":{"href":"https://api.github.com/repos/tendermint/basecoin/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/tendermint/basecoin/pulls/13","id":103522853,"html_url":"https://github.com/tendermint/basecoin/pull/13","diff_url":"https://github.com/tendermint/basecoin/pull/13.diff","patch_url":"https://github.com/tendermint/basecoin/pull/13.patch","issue_url":"https://api.github.com/repos/tendermint/basecoin/issues/13","number":13,"state":"open","locked":false,"title":"Paytovote Plugin Dev","user":{"login":"rigelrozanski","id":20132176,"avatar_url":"https://avatars.githubusercontent.com/u/20132176?v=3","gravatar_id":"","url":"https://api.github.com/users/rigelrozanski","html_url":"https://github.com/rigelrozanski","followers_url":"https://api.github.com/users/rigelrozanski/followers","following_url":"https://api.github.com/users/rigelrozanski/following{/other_user}","gists_url":"https://api.github.com/users/rigelrozanski/gists{/gist_id}","starred_url":"https://api.github.com/users/rigelrozanski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rigelrozanski/subscriptions","organizations_url":"https://api.github.com/users/rigelrozanski/orgs","repos_url":"https://api.github.com/users/rigelrozanski/repos","events_url":"https://api.github.com/users/rigelrozanski/events{/privacy}","received_events_url":"https://api.github.com/users/rigelrozanski/received_events","type":"User","site_admin":false},"body":"@ethanfrey earlier comments:\r\n\r\nThanks for getting a demo up. I have a number questions on the plugin, maybe you can clarify them in the docs or update the code, then I will merge it in.\r\n\r\nMainly design/docs:\r\n\r\nWhy do we have a Valid flag, which is set by the user and no purpose except to raise an error if not set?\r\nWhat are spoiled votes? Are they important in the design?\r\nYou can register the plugin multiple times under different names, each instance can support votes for multiple issues. There should be one way (not two) to enable this multiplicity, counter plugin has one count per plugin, so it makes sense to allow multiple plugins. Or if there is a reason for this document it, please.\r\nEvery tx decides the required cost? This is odd. I would believe that the Plugin is initialized with the cost to create an issue, which is then demanded of every CreateIssue transaction. And upon creating an issue, I specify the cost for each vote, which is stored in the P2VPluginState. Right now, every voter can choose how much to pay, and each is counted equally.\r\nCode details:\r\n\r\nIt would be nice to finish the TODO on line 121 (returning unspent coins) before merging. Also, returning them on failed transactions, so errors are not so expensive\r\nI think it would make sense to have two different Tx types, TxCreateIssue, which specifies Issue and Cost2Vote, and TxVote, which specifies Issue and Vote (enum - yes, no, spoil). You can manually prepend a byte to determine wich type of structure it is, or use go-wire's magic to do this. Here is an example: https://github.com/ethanfrey/signedpost/blob/master/txn/transactions.go\r\nIf we provide sample code to help people build their own apps, it should demonstrate best practices as far as we can.\r\n\r\nPlease ping me again when you address these issues (through code or docs), and I will review again and merge","created_at":"2017-01-27T16:28:22Z","updated_at":"2017-01-28T23:23:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"11144ee167c84e6b014de277fd1182b02187389a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tendermint/basecoin/pulls/13/commits","review_comments_url":"https://api.github.com/repos/tendermint/basecoin/pulls/13/comments","review_comment_url":"https://api.github.com/repos/tendermint/basecoin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tendermint/basecoin/issues/13/comments","statuses_url":"https://api.github.com/repos/tendermint/basecoin/statuses/bfac5437c34dc513757c56c048531f04ea3acf60","head":{"label":"tendermint:paytovote","ref":"paytovote","sha":"bfac5437c34dc513757c56c048531f04ea3acf60","user":{"login":"tendermint","id":7572940,"avatar_url":"https://avatars.githubusercontent.com/u/7572940?v=3","gravatar_id":"","url":"https://api.github.com/users/tendermint","html_url":"https://github.com/tendermint","followers_url":"https://api.github.com/users/tendermint/followers","following_url":"https://api.github.com/users/tendermint/following{/other_user}","gists_url":"https://api.github.com/users/tendermint/gists{/gist_id}","starred_url":"https://api.github.com/users/tendermint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tendermint/subscriptions","organizations_url":"https://api.github.com/users/tendermint/orgs","repos_url":"https://api.github.com/users/tendermint/repos","events_url":"https://api.github.com/users/tendermint/events{/privacy}","received_events_url":"https://api.github.com/users/tendermint/received_events","type":"Organization","site_admin":false},"repo":{"id":51193526,"name":"basecoin","full_name":"tendermint/basecoin","owner":{"login":"tendermint","id":7572940,"avatar_url":"https://avatars.githubusercontent.com/u/7572940?v=3","gravatar_id":"","url":"https://api.github.com/users/tendermint","html_url":"https://github.com/tendermint","followers_url":"https://api.github.com/users/tendermint/followers","following_url":"https://api.github.com/users/tendermint/following{/other_user}","gists_url":"https://api.github.com/users/tendermint/gists{/gist_id}","starred_url":"https://api.github.com/users/tendermint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tendermint/subscriptions","organizations_url":"https://api.github.com/users/tendermint/orgs","repos_url":"https://api.github.com/users/tendermint/repos","events_url":"https://api.github.com/users/tendermint/events{/privacy}","received_events_url":"https://api.github.com/users/tendermint/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tendermint/basecoin","description":"An ABCI cryptocurrency in Golang","fork":false,"url":"https://api.github.com/repos/tendermint/basecoin","forks_url":"https://api.github.com/repos/tendermint/basecoin/forks","keys_url":"https://api.github.com/repos/tendermint/basecoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tendermint/basecoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tendermint/basecoin/teams","hooks_url":"https://api.github.com/repos/tendermint/basecoin/hooks","issue_events_url":"https://api.github.com/repos/tendermint/basecoin/issues/events{/number}","events_url":"https://api.github.com/repos/tendermint/basecoin/events","assignees_url":"https://api.github.com/repos/tendermint/basecoin/assignees{/user}","branches_url":"https://api.github.com/repos/tendermint/basecoin/branches{/branch}","tags_url":"https://api.github.com/repos/tendermint/basecoin/tags","blobs_url":"https://api.github.com/repos/tendermint/basecoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tendermint/basecoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tendermint/basecoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/tendermint/basecoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tendermint/basecoin/statuses/{sha}","languages_url":"https://api.github.com/repos/tendermint/basecoin/languages","stargazers_url":"https://api.github.com/repos/tendermint/basecoin/stargazers","contributors_url":"https://api.github.com/repos/tendermint/basecoin/contributors","subscribers_url":"https://api.github.com/repos/tendermint/basecoin/subscribers","subscription_url":"https://api.github.com/repos/tendermint/basecoin/subscription","commits_url":"https://api.github.com/repos/tendermint/basecoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/tendermint/basecoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/tendermint/basecoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/tendermint/basecoin/issues/comments{/number}","contents_url":"https://api.github.com/repos/tendermint/basecoin/contents/{+path}","compare_url":"https://api.github.com/repos/tendermint/basecoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tendermint/basecoin/merges","archive_url":"https://api.github.com/repos/tendermint/basecoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tendermint/basecoin/downloads","issues_url":"https://api.github.com/repos/tendermint/basecoin/issues{/number}","pulls_url":"https://api.github.com/repos/tendermint/basecoin/pulls{/number}","milestones_url":"https://api.github.com/repos/tendermint/basecoin/milestones{/number}","notifications_url":"https://api.github.com/repos/tendermint/basecoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tendermint/basecoin/labels{/name}","releases_url":"https://api.github.com/repos/tendermint/basecoin/releases{/id}","deployments_url":"https://api.github.com/repos/tendermint/basecoin/deployments","created_at":"2016-02-06T07:15:53Z","updated_at":"2017-01-28T21:44:24Z","pushed_at":"2017-01-28T20:21:18Z","git_url":"git://github.com/tendermint/basecoin.git","ssh_url":"git@github.com:tendermint/basecoin.git","clone_url":"https://github.com/tendermint/basecoin.git","svn_url":"https://github.com/tendermint/basecoin","homepage":"","size":128,"stargazers_count":15,"watchers_count":15,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":6,"forks":10,"open_issues":6,"watchers":15,"default_branch":"master"}},"base":{"label":"tendermint:abci_proof","ref":"abci_proof","sha":"f3aa0d47cfe640f64bbaf5152804756af7b8e2d9","user":{"login":"tendermint","id":7572940,"avatar_url":"https://avatars.githubusercontent.com/u/7572940?v=3","gravatar_id":"","url":"https://api.github.com/users/tendermint","html_url":"https://github.com/tendermint","followers_url":"https://api.github.com/users/tendermint/followers","following_url":"https://api.github.com/users/tendermint/following{/other_user}","gists_url":"https://api.github.com/users/tendermint/gists{/gist_id}","starred_url":"https://api.github.com/users/tendermint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tendermint/subscriptions","organizations_url":"https://api.github.com/users/tendermint/orgs","repos_url":"https://api.github.com/users/tendermint/repos","events_url":"https://api.github.com/users/tendermint/events{/privacy}","received_events_url":"https://api.github.com/users/tendermint/received_events","type":"Organization","site_admin":false},"repo":{"id":51193526,"name":"basecoin","full_name":"tendermint/basecoin","owner":{"login":"tendermint","id":7572940,"avatar_url":"https://avatars.githubusercontent.com/u/7572940?v=3","gravatar_id":"","url":"https://api.github.com/users/tendermint","html_url":"https://github.com/tendermint","followers_url":"https://api.github.com/users/tendermint/followers","following_url":"https://api.github.com/users/tendermint/following{/other_user}","gists_url":"https://api.github.com/users/tendermint/gists{/gist_id}","starred_url":"https://api.github.com/users/tendermint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tendermint/subscriptions","organizations_url":"https://api.github.com/users/tendermint/orgs","repos_url":"https://api.github.com/users/tendermint/repos","events_url":"https://api.github.com/users/tendermint/events{/privacy}","received_events_url":"https://api.github.com/users/tendermint/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tendermint/basecoin","description":"An ABCI cryptocurrency in Golang","fork":false,"url":"https://api.github.com/repos/tendermint/basecoin","forks_url":"https://api.github.com/repos/tendermint/basecoin/forks","keys_url":"https://api.github.com/repos/tendermint/basecoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tendermint/basecoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tendermint/basecoin/teams","hooks_url":"https://api.github.com/repos/tendermint/basecoin/hooks","issue_events_url":"https://api.github.com/repos/tendermint/basecoin/issues/events{/number}","events_url":"https://api.github.com/repos/tendermint/basecoin/events","assignees_url":"https://api.github.com/repos/tendermint/basecoin/assignees{/user}","branches_url":"https://api.github.com/repos/tendermint/basecoin/branches{/branch}","tags_url":"https://api.github.com/repos/tendermint/basecoin/tags","blobs_url":"https://api.github.com/repos/tendermint/basecoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tendermint/basecoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tendermint/basecoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/tendermint/basecoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tendermint/basecoin/statuses/{sha}","languages_url":"https://api.github.com/repos/tendermint/basecoin/languages","stargazers_url":"https://api.github.com/repos/tendermint/basecoin/stargazers","contributors_url":"https://api.github.com/repos/tendermint/basecoin/contributors","subscribers_url":"https://api.github.com/repos/tendermint/basecoin/subscribers","subscription_url":"https://api.github.com/repos/tendermint/basecoin/subscription","commits_url":"https://api.github.com/repos/tendermint/basecoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/tendermint/basecoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/tendermint/basecoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/tendermint/basecoin/issues/comments{/number}","contents_url":"https://api.github.com/repos/tendermint/basecoin/contents/{+path}","compare_url":"https://api.github.com/repos/tendermint/basecoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tendermint/basecoin/merges","archive_url":"https://api.github.com/repos/tendermint/basecoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tendermint/basecoin/downloads","issues_url":"https://api.github.com/repos/tendermint/basecoin/issues{/number}","pulls_url":"https://api.github.com/repos/tendermint/basecoin/pulls{/number}","milestones_url":"https://api.github.com/repos/tendermint/basecoin/milestones{/number}","notifications_url":"https://api.github.com/repos/tendermint/basecoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tendermint/basecoin/labels{/name}","releases_url":"https://api.github.com/repos/tendermint/basecoin/releases{/id}","deployments_url":"https://api.github.com/repos/tendermint/basecoin/deployments","created_at":"2016-02-06T07:15:53Z","updated_at":"2017-01-28T21:44:24Z","pushed_at":"2017-01-28T20:21:18Z","git_url":"git://github.com/tendermint/basecoin.git","ssh_url":"git@github.com:tendermint/basecoin.git","clone_url":"https://github.com/tendermint/basecoin.git","svn_url":"https://github.com/tendermint/basecoin","homepage":"","size":128,"stargazers_count":15,"watchers_count":15,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":6,"forks":10,"open_issues":6,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tendermint/basecoin/pulls/13"},"html":{"href":"https://github.com/tendermint/basecoin/pull/13"},"issue":{"href":"https://api.github.com/repos/tendermint/basecoin/issues/13"},"comments":{"href":"https://api.github.com/repos/tendermint/basecoin/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/tendermint/basecoin/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/tendermint/basecoin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tendermint/basecoin/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/tendermint/basecoin/statuses/bfac5437c34dc513757c56c048531f04ea3acf60"}}}}
{"actor":{"display_login":"jaekwon"}}