{"action":"created","comment":{"url":"https://api.github.com/repos/zincwork/contracts/pulls/comments/214319578","pull_request_review_id":151351283,"id":214319578,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDMxOTU3OA==","diff_hunk":"@@ -0,0 +1,277 @@\n+// Taken from https://github.com/OriginProtocol/identity-playground/blob/0c9ba5c008d410e1ca82a2b1eed15705db49af0f/contracts/KeyHolder.sol\n+// with some modifitcatioms\n+\n+pragma solidity ^0.4.22;\n+\n+import \"./ERC725.sol\";\n+\n+contract ERC20Basic {\n+    function balanceOf(address _who) public constant returns (uint256);\n+    function transfer(address _to, uint256 _value) public returns (bool);\n+}\n+\n+contract IdentityV1 is ERC725 {\n+\n+    uint256 constant LOGIN_ONLY_KEY = 10;\n+    uint256 constant FUNDS_MANAGEMENT = 11;\n+\n+    uint256 executionNonce;\n+\n+    struct Execution {\n+        address to;\n+        uint256 value;\n+        bytes data;\n+        bool approved;\n+        bool executed;\n+    }\n+\n+    mapping (bytes32 => Key) keys;\n+    mapping (uint256 => bytes32[]) keysByPurpose;\n+    mapping (uint256 => Execution) executions;\n+\n+    event ExecutionFailed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);\n+\n+    constructor() public {\n+        bytes32 _key = keccak256(msg.sender);\n+        keys[_key].key = _key;\n+        keys[_key].purpose = [MANAGEMENT_KEY];\n+        keys[_key].keyType = 1;\n+        keysByPurpose[MANAGEMENT_KEY].push(_key);\n+        emit KeyAdded(_key, MANAGEMENT_KEY, 1);\n+    }\n+\n+    function getKey(bytes32 _key)\n+        public\n+        view\n+        returns(uint256[] purpose, uint256 keyType, bytes32 key)\n+    {\n+        return (keys[_key].purpose, keys[_key].keyType, keys[_key].key);\n+    }\n+\n+    function getKeyPurpose(bytes32 _key)\n+        public\n+        view\n+        returns(uint256[] purpose)\n+    {\n+        return (keys[_key].purpose);\n+    }\n+\n+    function getKeysByPurpose(uint256 _purpose)\n+        public\n+        view\n+        returns(bytes32[] _keys)\n+    {\n+        return keysByPurpose[_purpose];\n+    }\n+\n+    modifier onlyManagement() {\n+        require(keyHasPurpose(keccak256(msg.sender), MANAGEMENT_KEY), \"Sender does not have management key\");\n+        _;\n+    }\n+\n+    modifier onlyAction() {\n+        require(keyHasPurpose(keccak256(msg.sender), ACTION_KEY), \"Sender does not have action key\");\n+        _;\n+    }\n+\n+    modifier onlyFundsManagement() {\n+        require(keyHasPurpose(keccak256(msg.sender), FUNDS_MANAGEMENT), \"Sender does not have funds key\");\n+        _;\n+    }\n+\n+    function addKey(bytes32 _key, uint256 _purpose, uint256 _type)\n+        public\n+        onlyManagement\n+        returns (bool success)\n+    {\n+        if (keyHasPurpose(_key, _purpose)) {\n+            return true;\n+        }\n+\n+        keys[_key].key = _key;\n+        keys[_key].purpose.push(_purpose);\n+        keys[_key].keyType = _type;\n+\n+        keysByPurpose[_purpose].push(_key);\n+\n+        emit KeyAdded(_key, _purpose, _type);\n+\n+        return true;\n+    }\n+\n+    function approve(uint256 _id, bool _approve)\n+        public\n+        onlyAction\n+        returns (bool success)\n+    {\n+        emit Approved(_id, _approve);\n+\n+        if (_approve == true) {\n+            executions[_id].approved = true;\n+            success = executions[_id].to.call(executions[_id].data, 0);\n+            if (success) {\n+                executions[_id].executed = true;\n+                emit Executed(\n+                    _id,\n+                    executions[_id].to,\n+                    executions[_id].value,\n+                    executions[_id].data\n+                );\n+                return;\n+            } else {\n+                emit ExecutionFailed(\n+                    _id,\n+                    executions[_id].to,\n+                    executions[_id].value,\n+                    executions[_id].data\n+                );\n+                return;\n+            }\n+        } else {\n+            executions[_id].approved = false;\n+        }\n+        return true;\n+    }\n+\n+    function execute(address _to, uint256 _value, bytes _data)\n+        public\n+        returns (uint256 executionId)\n+    {\n+        require(!executions[executionNonce].executed, \"Already executed\");\n+        executions[executionNonce].to = _to;\n+        executions[executionNonce].value = _value;\n+        executions[executionNonce].data = _data;\n+\n+        emit ExecutionRequested(executionNonce, _to, _value, _data);\n+\n+        if (keyHasPurpose(bytes32(msg.sender), ACTION_KEY)) {","path":"contracts/IdentityV1.sol","position":147,"original_position":147,"commit_id":"073a038666113d58b593b19d5d16be0e93caf25f","original_commit_id":"073a038666113d58b593b19d5d16be0e93caf25f","user":{"login":"dpp23","id":1880650,"node_id":"MDQ6VXNlcjE4ODA2NTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1880650?v=4","gravatar_id":"","url":"https://api.github.com/users/dpp23","html_url":"https://github.com/dpp23","followers_url":"https://api.github.com/users/dpp23/followers","following_url":"https://api.github.com/users/dpp23/following{/other_user}","gists_url":"https://api.github.com/users/dpp23/gists{/gist_id}","starred_url":"https://api.github.com/users/dpp23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpp23/subscriptions","organizations_url":"https://api.github.com/users/dpp23/orgs","repos_url":"https://api.github.com/users/dpp23/repos","events_url":"https://api.github.com/users/dpp23/events{/privacy}","received_events_url":"https://api.github.com/users/dpp23/received_events","type":"User","site_admin":false},"body":"Yes, of course. ","created_at":"2018-08-31T11:07:29Z","updated_at":"2018-08-31T11:07:29Z","html_url":"https://github.com/zincwork/contracts/pull/22#discussion_r214319578","pull_request_url":"https://api.github.com/repos/zincwork/contracts/pulls/22","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/zincwork/contracts/pulls/comments/214319578"},"html":{"href":"https://github.com/zincwork/contracts/pull/22#discussion_r214319578"},"pull_request":{"href":"https://api.github.com/repos/zincwork/contracts/pulls/22"}},"in_reply_to_id":214317509},"pull_request":{"url":"https://api.github.com/repos/zincwork/contracts/pulls/22","id":212345608,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyMzQ1NjA4","html_url":"https://github.com/zincwork/contracts/pull/22","diff_url":"https://github.com/zincwork/contracts/pull/22.diff","patch_url":"https://github.com/zincwork/contracts/pull/22.patch","issue_url":"https://api.github.com/repos/zincwork/contracts/issues/22","number":22,"state":"open","locked":false,"title":"ERC725 experiment","user":{"login":"dpp23","id":1880650,"node_id":"MDQ6VXNlcjE4ODA2NTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1880650?v=4","gravatar_id":"","url":"https://api.github.com/users/dpp23","html_url":"https://github.com/dpp23","followers_url":"https://api.github.com/users/dpp23/followers","following_url":"https://api.github.com/users/dpp23/following{/other_user}","gists_url":"https://api.github.com/users/dpp23/gists{/gist_id}","starred_url":"https://api.github.com/users/dpp23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpp23/subscriptions","organizations_url":"https://api.github.com/users/dpp23/orgs","repos_url":"https://api.github.com/users/dpp23/repos","events_url":"https://api.github.com/users/dpp23/events{/privacy}","received_events_url":"https://api.github.com/users/dpp23/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-31T10:48:29Z","updated_at":"2018-08-31T11:07:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75fc73d578a465d850c6c051fb8c6f2489e1cd8a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zincwork/contracts/pulls/22/commits","review_comments_url":"https://api.github.com/repos/zincwork/contracts/pulls/22/comments","review_comment_url":"https://api.github.com/repos/zincwork/contracts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zincwork/contracts/issues/22/comments","statuses_url":"https://api.github.com/repos/zincwork/contracts/statuses/073a038666113d58b593b19d5d16be0e93caf25f","head":{"label":"zincwork:erc725","ref":"erc725","sha":"073a038666113d58b593b19d5d16be0e93caf25f","user":{"login":"zincwork","id":30704761,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwNzA0NzYx","avatar_url":"https://avatars0.githubusercontent.com/u/30704761?v=4","gravatar_id":"","url":"https://api.github.com/users/zincwork","html_url":"https://github.com/zincwork","followers_url":"https://api.github.com/users/zincwork/followers","following_url":"https://api.github.com/users/zincwork/following{/other_user}","gists_url":"https://api.github.com/users/zincwork/gists{/gist_id}","starred_url":"https://api.github.com/users/zincwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zincwork/subscriptions","organizations_url":"https://api.github.com/users/zincwork/orgs","repos_url":"https://api.github.com/users/zincwork/repos","events_url":"https://api.github.com/users/zincwork/events{/privacy}","received_events_url":"https://api.github.com/users/zincwork/received_events","type":"Organization","site_admin":false},"repo":{"id":137499980,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc0OTk5ODA=","name":"contracts","full_name":"zincwork/contracts","owner":{"login":"zincwork","id":30704761,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwNzA0NzYx","avatar_url":"https://avatars0.githubusercontent.com/u/30704761?v=4","gravatar_id":"","url":"https://api.github.com/users/zincwork","html_url":"https://github.com/zincwork","followers_url":"https://api.github.com/users/zincwork/followers","following_url":"https://api.github.com/users/zincwork/following{/other_user}","gists_url":"https://api.github.com/users/zincwork/gists{/gist_id}","starred_url":"https://api.github.com/users/zincwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zincwork/subscriptions","organizations_url":"https://api.github.com/users/zincwork/orgs","repos_url":"https://api.github.com/users/zincwork/repos","events_url":"https://api.github.com/users/zincwork/events{/privacy}","received_events_url":"https://api.github.com/users/zincwork/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zincwork/contracts","description":"Smart Contracts developed for Zinc Identity in trustless fashion","fork":false,"url":"https://api.github.com/repos/zincwork/contracts","forks_url":"https://api.github.com/repos/zincwork/contracts/forks","keys_url":"https://api.github.com/repos/zincwork/contracts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zincwork/contracts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zincwork/contracts/teams","hooks_url":"https://api.github.com/repos/zincwork/contracts/hooks","issue_events_url":"https://api.github.com/repos/zincwork/contracts/issues/events{/number}","events_url":"https://api.github.com/repos/zincwork/contracts/events","assignees_url":"https://api.github.com/repos/zincwork/contracts/assignees{/user}","branches_url":"https://api.github.com/repos/zincwork/contracts/branches{/branch}","tags_url":"https://api.github.com/repos/zincwork/contracts/tags","blobs_url":"https://api.github.com/repos/zincwork/contracts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zincwork/contracts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zincwork/contracts/git/refs{/sha}","trees_url":"https://api.github.com/repos/zincwork/contracts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zincwork/contracts/statuses/{sha}","languages_url":"https://api.github.com/repos/zincwork/contracts/languages","stargazers_url":"https://api.github.com/repos/zincwork/contracts/stargazers","contributors_url":"https://api.github.com/repos/zincwork/contracts/contributors","subscribers_url":"https://api.github.com/repos/zincwork/contracts/subscribers","subscription_url":"https://api.github.com/repos/zincwork/contracts/subscription","commits_url":"https://api.github.com/repos/zincwork/contracts/commits{/sha}","git_commits_url":"https://api.github.com/repos/zincwork/contracts/git/commits{/sha}","comments_url":"https://api.github.com/repos/zincwork/contracts/comments{/number}","issue_comment_url":"https://api.github.com/repos/zincwork/contracts/issues/comments{/number}","contents_url":"https://api.github.com/repos/zincwork/contracts/contents/{+path}","compare_url":"https://api.github.com/repos/zincwork/contracts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zincwork/contracts/merges","archive_url":"https://api.github.com/repos/zincwork/contracts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zincwork/contracts/downloads","issues_url":"https://api.github.com/repos/zincwork/contracts/issues{/number}","pulls_url":"https://api.github.com/repos/zincwork/contracts/pulls{/number}","milestones_url":"https://api.github.com/repos/zincwork/contracts/milestones{/number}","notifications_url":"https://api.github.com/repos/zincwork/contracts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zincwork/contracts/labels{/name}","releases_url":"https://api.github.com/repos/zincwork/contracts/releases{/id}","deployments_url":"https://api.github.com/repos/zincwork/contracts/deployments","created_at":"2018-06-15T14:54:56Z","updated_at":"2018-08-18T14:19:40Z","pushed_at":"2018-08-31T10:48:29Z","git_url":"git://github.com/zincwork/contracts.git","ssh_url":"git@github.com:zincwork/contracts.git","clone_url":"https://github.com/zincwork/contracts.git","svn_url":"https://github.com/zincwork/contracts","homepage":"https://zinc.work","size":147,"stargazers_count":2,"watchers_count":2,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"zincwork:master","ref":"master","sha":"30ed4d8072c324a15d9c99ca05691c3c409762c6","user":{"login":"zincwork","id":30704761,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwNzA0NzYx","avatar_url":"https://avatars0.githubusercontent.com/u/30704761?v=4","gravatar_id":"","url":"https://api.github.com/users/zincwork","html_url":"https://github.com/zincwork","followers_url":"https://api.github.com/users/zincwork/followers","following_url":"https://api.github.com/users/zincwork/following{/other_user}","gists_url":"https://api.github.com/users/zincwork/gists{/gist_id}","starred_url":"https://api.github.com/users/zincwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zincwork/subscriptions","organizations_url":"https://api.github.com/users/zincwork/orgs","repos_url":"https://api.github.com/users/zincwork/repos","events_url":"https://api.github.com/users/zincwork/events{/privacy}","received_events_url":"https://api.github.com/users/zincwork/received_events","type":"Organization","site_admin":false},"repo":{"id":137499980,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc0OTk5ODA=","name":"contracts","full_name":"zincwork/contracts","owner":{"login":"zincwork","id":30704761,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwNzA0NzYx","avatar_url":"https://avatars0.githubusercontent.com/u/30704761?v=4","gravatar_id":"","url":"https://api.github.com/users/zincwork","html_url":"https://github.com/zincwork","followers_url":"https://api.github.com/users/zincwork/followers","following_url":"https://api.github.com/users/zincwork/following{/other_user}","gists_url":"https://api.github.com/users/zincwork/gists{/gist_id}","starred_url":"https://api.github.com/users/zincwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zincwork/subscriptions","organizations_url":"https://api.github.com/users/zincwork/orgs","repos_url":"https://api.github.com/users/zincwork/repos","events_url":"https://api.github.com/users/zincwork/events{/privacy}","received_events_url":"https://api.github.com/users/zincwork/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zincwork/contracts","description":"Smart Contracts developed for Zinc Identity in trustless fashion","fork":false,"url":"https://api.github.com/repos/zincwork/contracts","forks_url":"https://api.github.com/repos/zincwork/contracts/forks","keys_url":"https://api.github.com/repos/zincwork/contracts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zincwork/contracts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zincwork/contracts/teams","hooks_url":"https://api.github.com/repos/zincwork/contracts/hooks","issue_events_url":"https://api.github.com/repos/zincwork/contracts/issues/events{/number}","events_url":"https://api.github.com/repos/zincwork/contracts/events","assignees_url":"https://api.github.com/repos/zincwork/contracts/assignees{/user}","branches_url":"https://api.github.com/repos/zincwork/contracts/branches{/branch}","tags_url":"https://api.github.com/repos/zincwork/contracts/tags","blobs_url":"https://api.github.com/repos/zincwork/contracts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zincwork/contracts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zincwork/contracts/git/refs{/sha}","trees_url":"https://api.github.com/repos/zincwork/contracts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zincwork/contracts/statuses/{sha}","languages_url":"https://api.github.com/repos/zincwork/contracts/languages","stargazers_url":"https://api.github.com/repos/zincwork/contracts/stargazers","contributors_url":"https://api.github.com/repos/zincwork/contracts/contributors","subscribers_url":"https://api.github.com/repos/zincwork/contracts/subscribers","subscription_url":"https://api.github.com/repos/zincwork/contracts/subscription","commits_url":"https://api.github.com/repos/zincwork/contracts/commits{/sha}","git_commits_url":"https://api.github.com/repos/zincwork/contracts/git/commits{/sha}","comments_url":"https://api.github.com/repos/zincwork/contracts/comments{/number}","issue_comment_url":"https://api.github.com/repos/zincwork/contracts/issues/comments{/number}","contents_url":"https://api.github.com/repos/zincwork/contracts/contents/{+path}","compare_url":"https://api.github.com/repos/zincwork/contracts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zincwork/contracts/merges","archive_url":"https://api.github.com/repos/zincwork/contracts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zincwork/contracts/downloads","issues_url":"https://api.github.com/repos/zincwork/contracts/issues{/number}","pulls_url":"https://api.github.com/repos/zincwork/contracts/pulls{/number}","milestones_url":"https://api.github.com/repos/zincwork/contracts/milestones{/number}","notifications_url":"https://api.github.com/repos/zincwork/contracts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zincwork/contracts/labels{/name}","releases_url":"https://api.github.com/repos/zincwork/contracts/releases{/id}","deployments_url":"https://api.github.com/repos/zincwork/contracts/deployments","created_at":"2018-06-15T14:54:56Z","updated_at":"2018-08-18T14:19:40Z","pushed_at":"2018-08-31T10:48:29Z","git_url":"git://github.com/zincwork/contracts.git","ssh_url":"git@github.com:zincwork/contracts.git","clone_url":"https://github.com/zincwork/contracts.git","svn_url":"https://github.com/zincwork/contracts","homepage":"https://zinc.work","size":147,"stargazers_count":2,"watchers_count":2,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zincwork/contracts/pulls/22"},"html":{"href":"https://github.com/zincwork/contracts/pull/22"},"issue":{"href":"https://api.github.com/repos/zincwork/contracts/issues/22"},"comments":{"href":"https://api.github.com/repos/zincwork/contracts/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/zincwork/contracts/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/zincwork/contracts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zincwork/contracts/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/zincwork/contracts/statuses/073a038666113d58b593b19d5d16be0e93caf25f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dpp23"}}