{"action":"created","comment":{"url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/comments/199633197","pull_request_review_id":133791143,"id":199633197,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTYzMzE5Nw==","diff_hunk":"@@ -36,17 +36,131 @@ contract CoreIssuanceOrder is\n {\n     using SafeMath for uint256;\n \n+    string constant INVALID_SIGNATURE = \"Invalid order signature.\";\n+\n+    struct IssuanceOrder {\n+        address setAddress;\n+        uint256 quantity;\n+        address makerAddress;\n+        address makerToken;\n+        uint256 makerTokenAmount;\n+        uint256 expiration;\n+        address relayerToken;\n+        uint256 relayerTokenAmount;\n+        uint256 salt;\n+        bytes32 orderHash;\n+    }\n+\n     function fillOrder(\n-        address _maker,\n-        address _setAddress,\n-        uint _quantity\n+        address[4] _addresses,\n+        uint[5] _values,\n+        uint _fillQuantity,\n+        uint8 _v,\n+        bytes32 _r,\n+        bytes32 _s\n     )\n         public\n-        isValidSet(_setAddress)\n-        isPositiveQuantity(_quantity)\n-        isNaturalUnitMultiple(_quantity, _setAddress)\n+        isValidSet(_addresses[0])\n+        isPositiveQuantity(_fillQuantity)\n+        isNaturalUnitMultiple(_fillQuantity, _addresses[0])\n     {\n+\n+        IssuanceOrder memory order = IssuanceOrder({\n+            setAddress: _addresses[0],\n+            quantity: _values[0],\n+            makerAddress: _addresses[1],\n+            makerToken: _addresses[2],\n+            makerTokenAmount: _values[1],\n+            expiration: _values[2],\n+            relayerToken: _addresses[3],\n+            relayerTokenAmount: _values[3],\n+            salt: _values[4],\n+            orderHash: generateOrderHash(\n+                _addresses,\n+                _values\n+            )\n+        });\n+\n+        // Verify order is valid\n+        validateOrder(\n+            order,\n+            _fillQuantity\n+        );\n+\n+        // Verify signature is authentic\n+        require(\n+            validateSignature(\n+                order.orderHash,\n+                order.makerAddress,\n+                _v,\n+                _r,\n+                _s\n+            ),\n+            INVALID_SIGNATURE\n+        );\n+\n         //Issue Set\n-        issueInternal(_maker, _setAddress, _quantity);\n+        issueInternal(\n+            order.makerAddress,\n+            order.setAddress,\n+            _fillQuantity\n+        );\n+    }\n+\n+    function generateOrderHash(\n+        address[4] _addresses,\n+        uint[5] _values\n+    )\n+        public","path":"contracts/core/extensions/CoreIssuanceOrder.sol","position":96,"original_position":96,"commit_id":"0de51628a4153381e9daf421fbb8991fc362ae5a","original_commit_id":"0de51628a4153381e9daf421fbb8991fc362ae5a","user":{"login":"asoong","id":3453571,"node_id":"MDQ6VXNlcjM0NTM1NzE=","avatar_url":"https://avatars3.githubusercontent.com/u/3453571?v=4","gravatar_id":"","url":"https://api.github.com/users/asoong","html_url":"https://github.com/asoong","followers_url":"https://api.github.com/users/asoong/followers","following_url":"https://api.github.com/users/asoong/following{/other_user}","gists_url":"https://api.github.com/users/asoong/gists{/gist_id}","starred_url":"https://api.github.com/users/asoong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asoong/subscriptions","organizations_url":"https://api.github.com/users/asoong/orgs","repos_url":"https://api.github.com/users/asoong/repos","events_url":"https://api.github.com/users/asoong/events{/privacy}","received_events_url":"https://api.github.com/users/asoong/received_events","type":"User","site_admin":false},"body":"I think these belong in a library of some sort as they don’t alter state. You could then test them by adding a mock contract, kind of how we had one for ExchangeOrderHandler","created_at":"2018-07-02T21:58:51Z","updated_at":"2018-07-02T21:58:51Z","html_url":"https://github.com/SetProtocol/set-protocol-contracts/pull/79#discussion_r199633197","pull_request_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/79","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/comments/199633197"},"html":{"href":"https://github.com/SetProtocol/set-protocol-contracts/pull/79#discussion_r199633197"},"pull_request":{"href":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/79"}},"in_reply_to_id":199628629},"pull_request":{"url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/79","id":198780123,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4NzgwMTIz","html_url":"https://github.com/SetProtocol/set-protocol-contracts/pull/79","diff_url":"https://github.com/SetProtocol/set-protocol-contracts/pull/79.diff","patch_url":"https://github.com/SetProtocol/set-protocol-contracts/pull/79.patch","issue_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues/79","number":79,"state":"open","locked":false,"title":"Brian/validate order sig","user":{"login":"bweick","id":11019590,"node_id":"MDQ6VXNlcjExMDE5NTkw","avatar_url":"https://avatars0.githubusercontent.com/u/11019590?v=4","gravatar_id":"","url":"https://api.github.com/users/bweick","html_url":"https://github.com/bweick","followers_url":"https://api.github.com/users/bweick/followers","following_url":"https://api.github.com/users/bweick/following{/other_user}","gists_url":"https://api.github.com/users/bweick/gists{/gist_id}","starred_url":"https://api.github.com/users/bweick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bweick/subscriptions","organizations_url":"https://api.github.com/users/bweick/orgs","repos_url":"https://api.github.com/users/bweick/repos","events_url":"https://api.github.com/users/bweick/events{/privacy}","received_events_url":"https://api.github.com/users/bweick/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-02T20:22:57Z","updated_at":"2018-07-02T21:58:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d0897cc52f1e28b4efa8beeb7eb12a0f230e02cd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/79/commits","review_comments_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/79/comments","review_comment_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues/79/comments","statuses_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/statuses/0de51628a4153381e9daf421fbb8991fc362ae5a","head":{"label":"SetProtocol:brian/validate_order_sig","ref":"brian/validate_order_sig","sha":"0de51628a4153381e9daf421fbb8991fc362ae5a","user":{"login":"SetProtocol","id":33144695,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTQ0Njk1","avatar_url":"https://avatars3.githubusercontent.com/u/33144695?v=4","gravatar_id":"","url":"https://api.github.com/users/SetProtocol","html_url":"https://github.com/SetProtocol","followers_url":"https://api.github.com/users/SetProtocol/followers","following_url":"https://api.github.com/users/SetProtocol/following{/other_user}","gists_url":"https://api.github.com/users/SetProtocol/gists{/gist_id}","starred_url":"https://api.github.com/users/SetProtocol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SetProtocol/subscriptions","organizations_url":"https://api.github.com/users/SetProtocol/orgs","repos_url":"https://api.github.com/users/SetProtocol/repos","events_url":"https://api.github.com/users/SetProtocol/events{/privacy}","received_events_url":"https://api.github.com/users/SetProtocol/received_events","type":"Organization","site_admin":false},"repo":{"id":108693025,"node_id":"MDEwOlJlcG9zaXRvcnkxMDg2OTMwMjU=","name":"set-protocol-contracts","full_name":"SetProtocol/set-protocol-contracts","owner":{"login":"SetProtocol","id":33144695,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTQ0Njk1","avatar_url":"https://avatars3.githubusercontent.com/u/33144695?v=4","gravatar_id":"","url":"https://api.github.com/users/SetProtocol","html_url":"https://github.com/SetProtocol","followers_url":"https://api.github.com/users/SetProtocol/followers","following_url":"https://api.github.com/users/SetProtocol/following{/other_user}","gists_url":"https://api.github.com/users/SetProtocol/gists{/gist_id}","starred_url":"https://api.github.com/users/SetProtocol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SetProtocol/subscriptions","organizations_url":"https://api.github.com/users/SetProtocol/orgs","repos_url":"https://api.github.com/users/SetProtocol/repos","events_url":"https://api.github.com/users/SetProtocol/events{/privacy}","received_events_url":"https://api.github.com/users/SetProtocol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SetProtocol/set-protocol-contracts","description":"{Set} Protocol Smart Contracts","fork":false,"url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts","forks_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/forks","keys_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/teams","hooks_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/hooks","issue_events_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues/events{/number}","events_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/events","assignees_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/assignees{/user}","branches_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/branches{/branch}","tags_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/tags","blobs_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/refs{/sha}","trees_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/statuses/{sha}","languages_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/languages","stargazers_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/stargazers","contributors_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/contributors","subscribers_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/subscribers","subscription_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/subscription","commits_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/commits{/sha}","git_commits_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/commits{/sha}","comments_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/comments{/number}","issue_comment_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues/comments{/number}","contents_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/contents/{+path}","compare_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/merges","archive_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/downloads","issues_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues{/number}","pulls_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls{/number}","milestones_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/milestones{/number}","notifications_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/labels{/name}","releases_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/releases{/id}","deployments_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/deployments","created_at":"2017-10-29T00:06:34Z","updated_at":"2018-06-29T21:24:02Z","pushed_at":"2018-07-02T20:22:57Z","git_url":"git://github.com/SetProtocol/set-protocol-contracts.git","ssh_url":"git@github.com:SetProtocol/set-protocol-contracts.git","clone_url":"https://github.com/SetProtocol/set-protocol-contracts.git","svn_url":"https://github.com/SetProtocol/set-protocol-contracts","homepage":"","size":1522,"stargazers_count":56,"watchers_count":56,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":11,"open_issues":5,"watchers":56,"default_branch":"master"}},"base":{"label":"SetProtocol:master","ref":"master","sha":"72a7614d1198d8a0a267b95af9d333d2b9e77008","user":{"login":"SetProtocol","id":33144695,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTQ0Njk1","avatar_url":"https://avatars3.githubusercontent.com/u/33144695?v=4","gravatar_id":"","url":"https://api.github.com/users/SetProtocol","html_url":"https://github.com/SetProtocol","followers_url":"https://api.github.com/users/SetProtocol/followers","following_url":"https://api.github.com/users/SetProtocol/following{/other_user}","gists_url":"https://api.github.com/users/SetProtocol/gists{/gist_id}","starred_url":"https://api.github.com/users/SetProtocol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SetProtocol/subscriptions","organizations_url":"https://api.github.com/users/SetProtocol/orgs","repos_url":"https://api.github.com/users/SetProtocol/repos","events_url":"https://api.github.com/users/SetProtocol/events{/privacy}","received_events_url":"https://api.github.com/users/SetProtocol/received_events","type":"Organization","site_admin":false},"repo":{"id":108693025,"node_id":"MDEwOlJlcG9zaXRvcnkxMDg2OTMwMjU=","name":"set-protocol-contracts","full_name":"SetProtocol/set-protocol-contracts","owner":{"login":"SetProtocol","id":33144695,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTQ0Njk1","avatar_url":"https://avatars3.githubusercontent.com/u/33144695?v=4","gravatar_id":"","url":"https://api.github.com/users/SetProtocol","html_url":"https://github.com/SetProtocol","followers_url":"https://api.github.com/users/SetProtocol/followers","following_url":"https://api.github.com/users/SetProtocol/following{/other_user}","gists_url":"https://api.github.com/users/SetProtocol/gists{/gist_id}","starred_url":"https://api.github.com/users/SetProtocol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SetProtocol/subscriptions","organizations_url":"https://api.github.com/users/SetProtocol/orgs","repos_url":"https://api.github.com/users/SetProtocol/repos","events_url":"https://api.github.com/users/SetProtocol/events{/privacy}","received_events_url":"https://api.github.com/users/SetProtocol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SetProtocol/set-protocol-contracts","description":"{Set} Protocol Smart Contracts","fork":false,"url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts","forks_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/forks","keys_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/teams","hooks_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/hooks","issue_events_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues/events{/number}","events_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/events","assignees_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/assignees{/user}","branches_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/branches{/branch}","tags_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/tags","blobs_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/refs{/sha}","trees_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/statuses/{sha}","languages_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/languages","stargazers_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/stargazers","contributors_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/contributors","subscribers_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/subscribers","subscription_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/subscription","commits_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/commits{/sha}","git_commits_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/git/commits{/sha}","comments_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/comments{/number}","issue_comment_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues/comments{/number}","contents_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/contents/{+path}","compare_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/merges","archive_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/downloads","issues_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues{/number}","pulls_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls{/number}","milestones_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/milestones{/number}","notifications_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/labels{/name}","releases_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/releases{/id}","deployments_url":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/deployments","created_at":"2017-10-29T00:06:34Z","updated_at":"2018-06-29T21:24:02Z","pushed_at":"2018-07-02T20:22:57Z","git_url":"git://github.com/SetProtocol/set-protocol-contracts.git","ssh_url":"git@github.com:SetProtocol/set-protocol-contracts.git","clone_url":"https://github.com/SetProtocol/set-protocol-contracts.git","svn_url":"https://github.com/SetProtocol/set-protocol-contracts","homepage":"","size":1522,"stargazers_count":56,"watchers_count":56,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":11,"open_issues":5,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/79"},"html":{"href":"https://github.com/SetProtocol/set-protocol-contracts/pull/79"},"issue":{"href":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues/79"},"comments":{"href":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/issues/79/comments"},"review_comments":{"href":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/79/comments"},"review_comment":{"href":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/pulls/79/commits"},"statuses":{"href":"https://api.github.com/repos/SetProtocol/set-protocol-contracts/statuses/0de51628a4153381e9daf421fbb8991fc362ae5a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"asoong"}}