{"action":"created","comment":{"url":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/comments/159067857","pull_request_review_id":85964006,"id":159067857,"diff_hunk":"@@ -0,0 +1,103 @@\n+pragma solidity ^0.4.11;\n+\n+import \"../Utils/Ownable.sol\";\n+import \"../Agreement/EscrowedAgreement.sol\";\n+\n+contract Insurance is Ownable {\n+\n+    enum Status {\n+        Unknown,\n+        Active,\n+        ReimbursementRequested,\n+        ReimbursementApproved,\n+        ReimbursementRejected,\n+        Complete\n+    }\n+\n+    struct InsuranceDetails {\n+        Status status;\n+        address beneficiary;\n+    }\n+\n+    ERC20Protocol private token;\n+\n+    mapping (address => InsuranceDetails) public insuredAgreements;\n+\n+    event NewAgreementInsured(address beneficiary, address agreement);\n+    event ReimbursementRequested(address requestor, address agreement);\n+    event ReimbursementApproved(address agreement);\n+    event ReimbursementRejected(address agreement);\n+    event ReimbursementPaid(address payee, address agreement, uint amount);\n+\n+    function Insurance (ERC20Protocol _token) {\n+        token = _token;\n+    }\n+\n+    function () public {\n+        // Nothing. Do not accept ETH transfers.\n+    }\n+\n+    function insure(EscrowedAgreement agreement, uint premium) public {\n+        require (agreement != address(0x0));\n+        require (insuredAgreements[agreement].status == Status.Unknown);\n+        require (agreement.seller() == msg.sender || agreement.buyer() == msg.sender);\n+        require (premium > 0);\n+\n+        /* \n+            The specific insurance contracts inheriting from this contract must override \n+            this function to do additional validations of agreement, premium and other details\n+            before underwriting.\n+        */\n+\n+        insuredAgreements[agreement] = InsuranceDetails(Status.Active, msg.sender);\n+        \n+        assert(token.transferFrom(msg.sender, this, premium));","path":"contracts/protocol/Insurance/Insurance.sol","position":54,"original_position":54,"commit_id":"9f7c33326274dee08b7f7f1a76579e55d5673151","original_commit_id":"9f7c33326274dee08b7f7f1a76579e55d5673151","user":{"login":"levon-hayrapetyan","id":33868377,"avatar_url":"https://avatars3.githubusercontent.com/u/33868377?v=4","gravatar_id":"","url":"https://api.github.com/users/levon-hayrapetyan","html_url":"https://github.com/levon-hayrapetyan","followers_url":"https://api.github.com/users/levon-hayrapetyan/followers","following_url":"https://api.github.com/users/levon-hayrapetyan/following{/other_user}","gists_url":"https://api.github.com/users/levon-hayrapetyan/gists{/gist_id}","starred_url":"https://api.github.com/users/levon-hayrapetyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levon-hayrapetyan/subscriptions","organizations_url":"https://api.github.com/users/levon-hayrapetyan/orgs","repos_url":"https://api.github.com/users/levon-hayrapetyan/repos","events_url":"https://api.github.com/users/levon-hayrapetyan/events{/privacy}","received_events_url":"https://api.github.com/users/levon-hayrapetyan/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2017-12-29T14:40:01Z","updated_at":"2017-12-29T14:40:01Z","html_url":"https://github.com/ambrosus/Ambrosus/pull/25#discussion_r159067857","pull_request_url":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/25","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/comments/159067857"},"html":{"href":"https://github.com/ambrosus/Ambrosus/pull/25#discussion_r159067857"},"pull_request":{"href":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/25"}},"in_reply_to_id":159053374},"pull_request":{"url":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/25","id":160399730,"html_url":"https://github.com/ambrosus/Ambrosus/pull/25","diff_url":"https://github.com/ambrosus/Ambrosus/pull/25.diff","patch_url":"https://github.com/ambrosus/Ambrosus/pull/25.patch","issue_url":"https://api.github.com/repos/ambrosus/Ambrosus/issues/25","number":25,"state":"open","locked":false,"title":"Adding insurance contract to the Ambrosus protocol","user":{"login":"levon-hayrapetyan","id":33868377,"avatar_url":"https://avatars3.githubusercontent.com/u/33868377?v=4","gravatar_id":"","url":"https://api.github.com/users/levon-hayrapetyan","html_url":"https://github.com/levon-hayrapetyan","followers_url":"https://api.github.com/users/levon-hayrapetyan/followers","following_url":"https://api.github.com/users/levon-hayrapetyan/following{/other_user}","gists_url":"https://api.github.com/users/levon-hayrapetyan/gists{/gist_id}","starred_url":"https://api.github.com/users/levon-hayrapetyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levon-hayrapetyan/subscriptions","organizations_url":"https://api.github.com/users/levon-hayrapetyan/orgs","repos_url":"https://api.github.com/users/levon-hayrapetyan/repos","events_url":"https://api.github.com/users/levon-hayrapetyan/events{/privacy}","received_events_url":"https://api.github.com/users/levon-hayrapetyan/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-12-28T14:55:48Z","updated_at":"2017-12-29T14:40:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4296139620a1f4337b2e53732173b02abefc0d30","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/25/commits","review_comments_url":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/25/comments","review_comment_url":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ambrosus/Ambrosus/issues/25/comments","statuses_url":"https://api.github.com/repos/ambrosus/Ambrosus/statuses/9f7c33326274dee08b7f7f1a76579e55d5673151","head":{"label":"levon-hayrapetyan:master","ref":"master","sha":"9f7c33326274dee08b7f7f1a76579e55d5673151","user":{"login":"levon-hayrapetyan","id":33868377,"avatar_url":"https://avatars3.githubusercontent.com/u/33868377?v=4","gravatar_id":"","url":"https://api.github.com/users/levon-hayrapetyan","html_url":"https://github.com/levon-hayrapetyan","followers_url":"https://api.github.com/users/levon-hayrapetyan/followers","following_url":"https://api.github.com/users/levon-hayrapetyan/following{/other_user}","gists_url":"https://api.github.com/users/levon-hayrapetyan/gists{/gist_id}","starred_url":"https://api.github.com/users/levon-hayrapetyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levon-hayrapetyan/subscriptions","organizations_url":"https://api.github.com/users/levon-hayrapetyan/orgs","repos_url":"https://api.github.com/users/levon-hayrapetyan/repos","events_url":"https://api.github.com/users/levon-hayrapetyan/events{/privacy}","received_events_url":"https://api.github.com/users/levon-hayrapetyan/received_events","type":"User","site_admin":false},"repo":{"id":115631666,"name":"Ambrosus","full_name":"levon-hayrapetyan/Ambrosus","owner":{"login":"levon-hayrapetyan","id":33868377,"avatar_url":"https://avatars3.githubusercontent.com/u/33868377?v=4","gravatar_id":"","url":"https://api.github.com/users/levon-hayrapetyan","html_url":"https://github.com/levon-hayrapetyan","followers_url":"https://api.github.com/users/levon-hayrapetyan/followers","following_url":"https://api.github.com/users/levon-hayrapetyan/following{/other_user}","gists_url":"https://api.github.com/users/levon-hayrapetyan/gists{/gist_id}","starred_url":"https://api.github.com/users/levon-hayrapetyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levon-hayrapetyan/subscriptions","organizations_url":"https://api.github.com/users/levon-hayrapetyan/orgs","repos_url":"https://api.github.com/users/levon-hayrapetyan/repos","events_url":"https://api.github.com/users/levon-hayrapetyan/events{/privacy}","received_events_url":"https://api.github.com/users/levon-hayrapetyan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/levon-hayrapetyan/Ambrosus","description":"Ambrosus Protocol Contracts","fork":true,"url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus","forks_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/forks","keys_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/teams","hooks_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/hooks","issue_events_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/issues/events{/number}","events_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/events","assignees_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/assignees{/user}","branches_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/branches{/branch}","tags_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/tags","blobs_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/git/refs{/sha}","trees_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/statuses/{sha}","languages_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/languages","stargazers_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/stargazers","contributors_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/contributors","subscribers_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/subscribers","subscription_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/subscription","commits_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/commits{/sha}","git_commits_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/git/commits{/sha}","comments_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/comments{/number}","issue_comment_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/issues/comments{/number}","contents_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/contents/{+path}","compare_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/merges","archive_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/downloads","issues_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/issues{/number}","pulls_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/pulls{/number}","milestones_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/milestones{/number}","notifications_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/labels{/name}","releases_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/releases{/id}","deployments_url":"https://api.github.com/repos/levon-hayrapetyan/Ambrosus/deployments","created_at":"2017-12-28T14:38:02Z","updated_at":"2017-12-28T14:38:03Z","pushed_at":"2017-12-28T14:53:18Z","git_url":"git://github.com/levon-hayrapetyan/Ambrosus.git","ssh_url":"git@github.com:levon-hayrapetyan/Ambrosus.git","clone_url":"https://github.com/levon-hayrapetyan/Ambrosus.git","svn_url":"https://github.com/levon-hayrapetyan/Ambrosus","homepage":"","size":415,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ambrosus:master","ref":"master","sha":"c94519e220fb0ca8b31c2064ba0d472626d36fef","user":{"login":"ambrosus","id":29900823,"avatar_url":"https://avatars0.githubusercontent.com/u/29900823?v=4","gravatar_id":"","url":"https://api.github.com/users/ambrosus","html_url":"https://github.com/ambrosus","followers_url":"https://api.github.com/users/ambrosus/followers","following_url":"https://api.github.com/users/ambrosus/following{/other_user}","gists_url":"https://api.github.com/users/ambrosus/gists{/gist_id}","starred_url":"https://api.github.com/users/ambrosus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambrosus/subscriptions","organizations_url":"https://api.github.com/users/ambrosus/orgs","repos_url":"https://api.github.com/users/ambrosus/repos","events_url":"https://api.github.com/users/ambrosus/events{/privacy}","received_events_url":"https://api.github.com/users/ambrosus/received_events","type":"Organization","site_admin":false},"repo":{"id":88036747,"name":"Ambrosus","full_name":"ambrosus/Ambrosus","owner":{"login":"ambrosus","id":29900823,"avatar_url":"https://avatars0.githubusercontent.com/u/29900823?v=4","gravatar_id":"","url":"https://api.github.com/users/ambrosus","html_url":"https://github.com/ambrosus","followers_url":"https://api.github.com/users/ambrosus/followers","following_url":"https://api.github.com/users/ambrosus/following{/other_user}","gists_url":"https://api.github.com/users/ambrosus/gists{/gist_id}","starred_url":"https://api.github.com/users/ambrosus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambrosus/subscriptions","organizations_url":"https://api.github.com/users/ambrosus/orgs","repos_url":"https://api.github.com/users/ambrosus/repos","events_url":"https://api.github.com/users/ambrosus/events{/privacy}","received_events_url":"https://api.github.com/users/ambrosus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ambrosus/Ambrosus","description":"Ambrosus Protocol Contracts","fork":false,"url":"https://api.github.com/repos/ambrosus/Ambrosus","forks_url":"https://api.github.com/repos/ambrosus/Ambrosus/forks","keys_url":"https://api.github.com/repos/ambrosus/Ambrosus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ambrosus/Ambrosus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ambrosus/Ambrosus/teams","hooks_url":"https://api.github.com/repos/ambrosus/Ambrosus/hooks","issue_events_url":"https://api.github.com/repos/ambrosus/Ambrosus/issues/events{/number}","events_url":"https://api.github.com/repos/ambrosus/Ambrosus/events","assignees_url":"https://api.github.com/repos/ambrosus/Ambrosus/assignees{/user}","branches_url":"https://api.github.com/repos/ambrosus/Ambrosus/branches{/branch}","tags_url":"https://api.github.com/repos/ambrosus/Ambrosus/tags","blobs_url":"https://api.github.com/repos/ambrosus/Ambrosus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ambrosus/Ambrosus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ambrosus/Ambrosus/git/refs{/sha}","trees_url":"https://api.github.com/repos/ambrosus/Ambrosus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ambrosus/Ambrosus/statuses/{sha}","languages_url":"https://api.github.com/repos/ambrosus/Ambrosus/languages","stargazers_url":"https://api.github.com/repos/ambrosus/Ambrosus/stargazers","contributors_url":"https://api.github.com/repos/ambrosus/Ambrosus/contributors","subscribers_url":"https://api.github.com/repos/ambrosus/Ambrosus/subscribers","subscription_url":"https://api.github.com/repos/ambrosus/Ambrosus/subscription","commits_url":"https://api.github.com/repos/ambrosus/Ambrosus/commits{/sha}","git_commits_url":"https://api.github.com/repos/ambrosus/Ambrosus/git/commits{/sha}","comments_url":"https://api.github.com/repos/ambrosus/Ambrosus/comments{/number}","issue_comment_url":"https://api.github.com/repos/ambrosus/Ambrosus/issues/comments{/number}","contents_url":"https://api.github.com/repos/ambrosus/Ambrosus/contents/{+path}","compare_url":"https://api.github.com/repos/ambrosus/Ambrosus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ambrosus/Ambrosus/merges","archive_url":"https://api.github.com/repos/ambrosus/Ambrosus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ambrosus/Ambrosus/downloads","issues_url":"https://api.github.com/repos/ambrosus/Ambrosus/issues{/number}","pulls_url":"https://api.github.com/repos/ambrosus/Ambrosus/pulls{/number}","milestones_url":"https://api.github.com/repos/ambrosus/Ambrosus/milestones{/number}","notifications_url":"https://api.github.com/repos/ambrosus/Ambrosus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ambrosus/Ambrosus/labels{/name}","releases_url":"https://api.github.com/repos/ambrosus/Ambrosus/releases{/id}","deployments_url":"https://api.github.com/repos/ambrosus/Ambrosus/deployments","created_at":"2017-04-12T09:53:56Z","updated_at":"2017-12-28T22:33:24Z","pushed_at":"2017-12-28T14:55:49Z","git_url":"git://github.com/ambrosus/Ambrosus.git","ssh_url":"git@github.com:ambrosus/Ambrosus.git","clone_url":"https://github.com/ambrosus/Ambrosus.git","svn_url":"https://github.com/ambrosus/Ambrosus","homepage":"","size":412,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":9,"open_issues":1,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/25"},"html":{"href":"https://github.com/ambrosus/Ambrosus/pull/25"},"issue":{"href":"https://api.github.com/repos/ambrosus/Ambrosus/issues/25"},"comments":{"href":"https://api.github.com/repos/ambrosus/Ambrosus/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ambrosus/Ambrosus/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/ambrosus/Ambrosus/statuses/9f7c33326274dee08b7f7f1a76579e55d5673151"}},"author_association":"NONE"}}
{"actor":{"display_login":"levon-hayrapetyan"}}