{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/solidity/pulls/comments/86118427","pull_request_review_id":6791900,"id":86118427,"diff_hunk":"@@ -0,0 +1,250 @@\n+/*\n+The MIT License (MIT)\n+\n+Copyright (c) 2016 Alex van de Sande\n+\n+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n+\n+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n+\n+THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n+\n+\n+# Time Locked Multisig\n+\n+This is a different twist on the Congress DAO / Multisig. Instead of every\n+action requiring the approval of an X number of members, instead any\n+transactions can be initiated by a single member, but they all will require a\n+minimum amount of delay before they can be executed, which varies according to\n+the support that transaction has. The more approvals a proposal has, the sooner\n+it can be executed. A member can vote against a transaction, which will mean\n+that it will cancel one of the other approved signatures. In a 5 members DAO,\n+each vote means the time to wait dimishes by 10x.\n+\n+This means that if you don't have urgency, one or two signatures might be all\n+you need to execute any transaction. But if a single key is compromised, other\n+keys can delay that transaction for years, making sure that the main account is\n+emptied out way before that.\n+\n+Transaction delays:\n+\n+(Support - oppositon)/ total members => Time delay (approximate)\n+\n+100% approval: 30 min\n+90%:           1h30\n+80%:           5 hours\n+50%:           about a week\n+25%:           4 months \n+10%:           2 years\n+support=oppos: 5 years or more\n+-10%         18 years\n+\n+*/\n+\n+\n+pragma solidity ^0.4.4;\n+\n+contract owned {\n+    address public owner;\n+\n+    function owned() {\n+        owner = msg.sender;\n+    }\n+\n+    modifier onlyOwner {\n+        if (msg.sender != owner) throw;\n+        _;\n+    }\n+\n+    function transferOwnership(address newOwner) onlyOwner {\n+        owner = newOwner;\n+    }\n+}\n+\n+/// @author Alex van de Sande <avsa@ethereum.org>\n+contract TimeLockMultisig is owned {\n+    Proposal[] public proposals;\n+    uint public numProposals;\n+    mapping (address => uint) public memberId;\n+    Member[] public members;\n+\n+    event ProposalAdded(uint proposalID, address recipient, uint amount, string description);\n+    event Voted(uint proposalID, bool position, address voter, string justification);\n+    event ProposalExecuted(uint proposalID, int result, uint deadline);\n+    event MembershipChanged(address member, bool isMember);\n+    event ChangeOfRules(uint minimumQuorum, uint debatingPeriodInMinutes, int majorityMargin);\n+\n+    struct Proposal {\n+        address recipient;\n+        uint amount;\n+        string description;\n+        bool executed;\n+        int currentResult;\n+        bytes32 proposalHash;\n+        Vote[] votes;\n+        mapping (address => bool) voted;\n+    }\n+\n+    struct Member {\n+        address member;\n+        bool canVote;\n+        string name;\n+        uint memberSince;\n+    }\n+\n+    struct Vote {\n+        bool inSupport;\n+        address voter;\n+        string justification;\n+    }\n+\n+    /* modifier that allows only shareholders to vote and create new proposals */\n+    modifier onlyMembers {\n+        if (\n+            memberId[msg.sender] == 0 ||\n+            !members[memberId[msg.sender]].canVote\n+        )\n+            throw;\n+        _;\n+    }\n+\n+    /* First time setup */\n+    function TimeLockMultisig(address founder, address[] initialMembers) payable {\n+        if (founder != 0) owner = founder;\n+        // It’s necessary to add an empty first member\n+        changeMembership(0, false, ''); \n+        // and let's add the founder, to save a step later\n+        changeMembership(owner, true, 'founder');\n+        changeMembers(initialMembers, true);\n+    }\n+\n+    /*make member*/\n+    function changeMembership(address targetMember, bool canVote, string memberName) onlyOwner {\n+        uint id;\n+        if (memberId[targetMember] == 0) {\n+           memberId[targetMember] = members.length;\n+           id = members.length++;\n+           members[id] = Member({member: targetMember, canVote: canVote, memberSince: now, name: memberName});\n+        } else {\n+            id = memberId[targetMember];\n+            Member m = members[id];\n+            m.canVote = canVote;\n+        }\n+\n+        MembershipChanged(targetMember, canVote);\n+\n+    }\n+\n+    function changeMembers(address[] newMembers, bool canVote) {\n+        for (uint i = 0; i < newMembers.length; i++) {\n+            changeMembership(newMembers[i], canVote, '');\n+        }\n+    }\n+\n+    /* Function to create a new proposal */\n+    function newProposal(\n+        address beneficiary,\n+        uint weiAmount,\n+        string jobDescription,\n+        bytes transactionBytecode\n+    )\n+        onlyMembers\n+        returns (uint proposalID)\n+    {\n+        proposalID = proposals.length++;\n+        Proposal p = proposals[proposalID];\n+        p.recipient = beneficiary;\n+        p.amount = weiAmount;\n+        p.description = jobDescription;\n+        p.proposalHash = sha3(beneficiary, weiAmount, transactionBytecode);\n+        p.executed = false;\n+        ProposalAdded(proposalID, beneficiary, weiAmount, jobDescription);\n+        numProposals = proposalID+1;\n+        vote(proposalID, true, '');\n+\n+        return proposalID;\n+    }\n+\n+\n+    /* Function to create a new proposal */\n+    function newProposalInEther(\n+        address beneficiary,\n+        uint etherAmount,\n+        string jobDescription,\n+        bytes transactionBytecode\n+    )\n+        onlyMembers\n+        returns (uint proposalID)\n+    {\n+        return newProposal(beneficiary, etherAmount * 1 ether, jobDescription, transactionBytecode);\n+    }\n+\n+    /* function to check if a proposal code matches */\n+    function checkProposalCode(\n+        uint proposalNumber,\n+        address beneficiary,\n+        uint etherAmount,\n+        bytes transactionBytecode\n+    )\n+        constant\n+        returns (bool codeChecksOut)\n+    {\n+        Proposal p = proposals[proposalNumber];\n+        return p.proposalHash == sha3(beneficiary, etherAmount, transactionBytecode);\n+    }\n+\n+    function vote(\n+        uint proposalNumber,\n+        bool supportsProposal,\n+        string justificationText\n+    )\n+        onlyMembers\n+        returns (uint voteID)\n+    {\n+        Proposal p = proposals[proposalNumber];         // Get the proposal\n+        if (p.voted[msg.sender] == true) throw;         // If has already voted, cancel\n+        p.voted[msg.sender] = true;                     // Set this voter as having voted\n+        if (supportsProposal) {                         // If they support the proposal\n+            p.currentResult++;                          // Increase score\n+        } else {                                        // If they don't\n+            p.currentResult--;                          // Decrease the score\n+        }\n+        // Create a log of this event\n+        Voted(proposalNumber,  supportsProposal, msg.sender, justificationText);\n+    }\n+\n+    function proposalDeadline(uint proposalNumber) constant returns(uint deadline) {\n+        Proposal p = proposals[proposalNumber];\n+        uint factor = 3*10**uint(6 - (5 * p.currentResult / int(members.length - 1)));","path":"examples/timelockmultisig.sol","position":218,"original_position":218,"commit_id":"d476cb0ed1fd1b0998b2a62dbd1a500ab431acc7","original_commit_id":"d476cb0ed1fd1b0998b2a62dbd1a500ab431acc7","user":{"login":"redsquirrel","id":2512,"avatar_url":"https://avatars.githubusercontent.com/u/2512?v=3","gravatar_id":"","url":"https://api.github.com/users/redsquirrel","html_url":"https://github.com/redsquirrel","followers_url":"https://api.github.com/users/redsquirrel/followers","following_url":"https://api.github.com/users/redsquirrel/following{/other_user}","gists_url":"https://api.github.com/users/redsquirrel/gists{/gist_id}","starred_url":"https://api.github.com/users/redsquirrel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redsquirrel/subscriptions","organizations_url":"https://api.github.com/users/redsquirrel/orgs","repos_url":"https://api.github.com/users/redsquirrel/repos","events_url":"https://api.github.com/users/redsquirrel/events{/privacy}","received_events_url":"https://api.github.com/users/redsquirrel/received_events","type":"User","site_admin":false},"body":"It seems like there's a risk of dividing by zero here. Or is that prevented by line 115?","created_at":"2016-11-02T11:14:50Z","updated_at":"2016-11-02T11:14:50Z","html_url":"https://github.com/ethereum/solidity/pull/1317#discussion_r86118427","pull_request_url":"https://api.github.com/repos/ethereum/solidity/pulls/1317","_links":{"self":{"href":"https://api.github.com/repos/ethereum/solidity/pulls/comments/86118427"},"html":{"href":"https://github.com/ethereum/solidity/pull/1317#discussion_r86118427"},"pull_request":{"href":"https://api.github.com/repos/ethereum/solidity/pulls/1317"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/solidity/pulls/1317","id":91948363,"html_url":"https://github.com/ethereum/solidity/pull/1317","diff_url":"https://github.com/ethereum/solidity/pull/1317.diff","patch_url":"https://github.com/ethereum/solidity/pull/1317.patch","issue_url":"https://api.github.com/repos/ethereum/solidity/issues/1317","number":1317,"state":"open","locked":false,"title":"Add timelock multisig example.","user":{"login":"chriseth","id":9073706,"avatar_url":"https://avatars.githubusercontent.com/u/9073706?v=3","gravatar_id":"","url":"https://api.github.com/users/chriseth","html_url":"https://github.com/chriseth","followers_url":"https://api.github.com/users/chriseth/followers","following_url":"https://api.github.com/users/chriseth/following{/other_user}","gists_url":"https://api.github.com/users/chriseth/gists{/gist_id}","starred_url":"https://api.github.com/users/chriseth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chriseth/subscriptions","organizations_url":"https://api.github.com/users/chriseth/orgs","repos_url":"https://api.github.com/users/chriseth/repos","events_url":"https://api.github.com/users/chriseth/events{/privacy}","received_events_url":"https://api.github.com/users/chriseth/received_events","type":"User","site_admin":false},"body":"This is code by @alexvandesande ","created_at":"2016-11-02T11:01:00Z","updated_at":"2016-11-02T11:14:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dfccc051d0ce0f78458b0bb238166522f5123bae","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ethereum/solidity/pulls/1317/commits","review_comments_url":"https://api.github.com/repos/ethereum/solidity/pulls/1317/comments","review_comment_url":"https://api.github.com/repos/ethereum/solidity/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethereum/solidity/issues/1317/comments","statuses_url":"https://api.github.com/repos/ethereum/solidity/statuses/d476cb0ed1fd1b0998b2a62dbd1a500ab431acc7","head":{"label":"ethereum:timelock","ref":"timelock","sha":"d476cb0ed1fd1b0998b2a62dbd1a500ab431acc7","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":40892817,"name":"solidity","full_name":"ethereum/solidity","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethereum/solidity","description":"The Solidity Contract-Oriented Programming Language","fork":false,"url":"https://api.github.com/repos/ethereum/solidity","forks_url":"https://api.github.com/repos/ethereum/solidity/forks","keys_url":"https://api.github.com/repos/ethereum/solidity/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/solidity/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/solidity/teams","hooks_url":"https://api.github.com/repos/ethereum/solidity/hooks","issue_events_url":"https://api.github.com/repos/ethereum/solidity/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/solidity/events","assignees_url":"https://api.github.com/repos/ethereum/solidity/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/solidity/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/solidity/tags","blobs_url":"https://api.github.com/repos/ethereum/solidity/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/solidity/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/solidity/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/solidity/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/solidity/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/solidity/languages","stargazers_url":"https://api.github.com/repos/ethereum/solidity/stargazers","contributors_url":"https://api.github.com/repos/ethereum/solidity/contributors","subscribers_url":"https://api.github.com/repos/ethereum/solidity/subscribers","subscription_url":"https://api.github.com/repos/ethereum/solidity/subscription","commits_url":"https://api.github.com/repos/ethereum/solidity/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/solidity/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/solidity/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/solidity/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/solidity/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/solidity/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/solidity/merges","archive_url":"https://api.github.com/repos/ethereum/solidity/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/solidity/downloads","issues_url":"https://api.github.com/repos/ethereum/solidity/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/solidity/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/solidity/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/solidity/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/solidity/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/solidity/releases{/id}","deployments_url":"https://api.github.com/repos/ethereum/solidity/deployments","created_at":"2015-08-17T12:27:26Z","updated_at":"2016-11-02T06:21:12Z","pushed_at":"2016-11-02T11:01:00Z","git_url":"git://github.com/ethereum/solidity.git","ssh_url":"git@github.com:ethereum/solidity.git","clone_url":"https://github.com/ethereum/solidity.git","svn_url":"https://github.com/ethereum/solidity","homepage":"","size":16190,"stargazers_count":445,"watchers_count":445,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":207,"mirror_url":null,"open_issues_count":227,"forks":207,"open_issues":227,"watchers":445,"default_branch":"develop"}},"base":{"label":"ethereum:develop","ref":"develop","sha":"1a2c150e3b2f98ef44834aca281692734b74c0db","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":40892817,"name":"solidity","full_name":"ethereum/solidity","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethereum/solidity","description":"The Solidity Contract-Oriented Programming Language","fork":false,"url":"https://api.github.com/repos/ethereum/solidity","forks_url":"https://api.github.com/repos/ethereum/solidity/forks","keys_url":"https://api.github.com/repos/ethereum/solidity/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/solidity/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/solidity/teams","hooks_url":"https://api.github.com/repos/ethereum/solidity/hooks","issue_events_url":"https://api.github.com/repos/ethereum/solidity/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/solidity/events","assignees_url":"https://api.github.com/repos/ethereum/solidity/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/solidity/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/solidity/tags","blobs_url":"https://api.github.com/repos/ethereum/solidity/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/solidity/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/solidity/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/solidity/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/solidity/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/solidity/languages","stargazers_url":"https://api.github.com/repos/ethereum/solidity/stargazers","contributors_url":"https://api.github.com/repos/ethereum/solidity/contributors","subscribers_url":"https://api.github.com/repos/ethereum/solidity/subscribers","subscription_url":"https://api.github.com/repos/ethereum/solidity/subscription","commits_url":"https://api.github.com/repos/ethereum/solidity/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/solidity/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/solidity/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/solidity/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/solidity/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/solidity/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/solidity/merges","archive_url":"https://api.github.com/repos/ethereum/solidity/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/solidity/downloads","issues_url":"https://api.github.com/repos/ethereum/solidity/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/solidity/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/solidity/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/solidity/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/solidity/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/solidity/releases{/id}","deployments_url":"https://api.github.com/repos/ethereum/solidity/deployments","created_at":"2015-08-17T12:27:26Z","updated_at":"2016-11-02T06:21:12Z","pushed_at":"2016-11-02T11:01:00Z","git_url":"git://github.com/ethereum/solidity.git","ssh_url":"git@github.com:ethereum/solidity.git","clone_url":"https://github.com/ethereum/solidity.git","svn_url":"https://github.com/ethereum/solidity","homepage":"","size":16190,"stargazers_count":445,"watchers_count":445,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":207,"mirror_url":null,"open_issues_count":227,"forks":207,"open_issues":227,"watchers":445,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/solidity/pulls/1317"},"html":{"href":"https://github.com/ethereum/solidity/pull/1317"},"issue":{"href":"https://api.github.com/repos/ethereum/solidity/issues/1317"},"comments":{"href":"https://api.github.com/repos/ethereum/solidity/issues/1317/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/solidity/pulls/1317/comments"},"review_comment":{"href":"https://api.github.com/repos/ethereum/solidity/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethereum/solidity/pulls/1317/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/solidity/statuses/d476cb0ed1fd1b0998b2a62dbd1a500ab431acc7"}}}}
{"actor":{"display_login":"redsquirrel"}}