{"action":"created","comment":{"url":"https://api.github.com/repos/aragon/aragon-core/pulls/comments/139379054","pull_request_review_id":63301429,"id":139379054,"diff_hunk":"@@ -0,0 +1,432 @@\n+pragma solidity ^0.4.15;\n+\n+import \"../App.sol\";\n+import \"../../common/Initializable.sol\";\n+import \"zeppelin-solidity/contracts/token/ERC20.sol\";\n+import \"../vault/Vault.sol\";\n+import \"../../misc/Crontab.sol\";\n+\n+\n+\n+contract FinanceApp is App, Initializable, Crontab {\n+\n+    Vault vault;\n+\n+    struct AccountingPeriod {\n+\n+        bytes2 ct_sec;\n+        bytes2 ct_min;\n+        bytes2 ct_hour;\n+        bytes2 ct_day;\n+        bytes2 ct_month;\n+        bytes2 ct_weekday;\n+        bytes2 ct_year;\n+        uint startBlock;\n+        uint startTimestamp;\n+        uint endTimestamp;\n+        ERC20[] budgetTokens;\n+        uint[] budgetAmounts;\n+\n+    }\n+\n+    AccountingPeriod public defaultAccountingPeriodSettings;\n+    AccountingPeriod[] public accountingPeriods; // Perhaps use a mapping?\n+\n+    // The concept of sending tokens to or from the org\n+    struct Transaction {\n+        address token;\n+        uint amount;\n+        address externalAddress;\n+        string reference;\n+        uint timestamp;\n+        uint accountingPeriodId;  // in which accounting period did this occur\n+        TransactionType _type;\n+    }\n+\n+    enum TransactionType {\n+        Deposit,\n+        Withdrawal\n+    }\n+\n+    struct Payment {\n+        ERC20 token;\n+        uint amount;\n+        address to;\n+        uint repeat; // number of times this can be paid\n+        uint timesCalled; //\n+        uint startTimestamp; // Initial timestamp \n+        uint nextTimestamp; \n+        bool canceled; // override to cancel a payment\n+        bytes2 ct_sec;\n+        bytes2 ct_min;\n+        bytes2 ct_hour;\n+        bytes2 ct_day;\n+        bytes2 ct_month;\n+        bytes2 ct_weekday;\n+        bytes2 ct_year;\n+    }\n+\n+    Payment[] payments;\n+\n+\n+\n+    // The state a transaction update can be.\n+    // New states should be added to the end to maintain the\n+    // order of the index when interfacing with web3.\n+    enum TransactionState {\n+        New, // not needed?\n+        PendingApproval,\n+        Failed,\n+        Succeeded,\n+        Approved,\n+        Denied\n+    }\n+\n+    // The change in Transaciton state over time\n+    struct TransactionUpdate {\n+        uint transactionId; // Parent Transaction\n+        TransactionState state;\n+        string reason;\n+        address actor; // who performed this update\n+    }\n+\n+    Transaction[] public transactions;\n+    TransactionUpdate[] public transactionUpdates;\n+\n+    // throttledFunctions[string key] = timstamp last run\n+    mapping (string => uint) throttledFunctions;\n+\n+    // Reverse relation of a Transaction ID  -> TransactionsUpdatesIds[]\n+    // transactionUpdatesRelation[tid] = [tuid_0..tuid_N]\n+    mapping (uint => uint[]) public transactionUpdatesRelation;\n+\n+    event WithdrawalFailed(uint transactionId);\n+\n+    function () {\n+    }\n+\n+    function FinanceApp() {\n+    }\n+\n+    /**\n+    @param vaultAddress The vault app to use with this FinanceApp\n+    */\n+    function initialize(address vaultAddress) onlyInit {\n+        initialized();\n+        vault = Vault(vaultAddress);\n+    }\n+\n+    event NewPayment(uint pid);\n+    /**\n+    @notice This will a create a new payment\n+    @param token The token that will be paid\n+    @param amount The amount to be paid \n+    @param repeat This is the number of times that the payment should be sent 1..n times\n+    @param startTimestamp This is when the payments will begin\n+    */\n+    function newPayment(ERC20 token, uint amount, address to, uint repeat, uint startTimestamp, bytes2 ct_sec, bytes2 ct_min, bytes2 ct_hour, bytes2 ct_day, bytes2 ct_month, bytes2 ct_weekday, bytes2 ct_year) auth external {\n+        require(repeat > 0);\n+        uint pid = _newPayment(token, amount, to, startTimestamp);\n+        _setPaymentSchedual(pid, repeat, ct_sec, ct_min, ct_hour, ct_day, ct_month, ct_weekday, ct_year);","path":"contracts/apps/accounting/FinanceApp.sol","position":118,"original_position":130,"commit_id":"0ad3d0b0e1e75789a90afa0a98bdfe84b618d317","original_commit_id":"7c2a132bfa18f34af20a46fb9e22d09ac5c988ef","user":{"login":"readevalprint","id":118430,"avatar_url":"https://avatars2.githubusercontent.com/u/118430?v=4","gravatar_id":"","url":"https://api.github.com/users/readevalprint","html_url":"https://github.com/readevalprint","followers_url":"https://api.github.com/users/readevalprint/followers","following_url":"https://api.github.com/users/readevalprint/following{/other_user}","gists_url":"https://api.github.com/users/readevalprint/gists{/gist_id}","starred_url":"https://api.github.com/users/readevalprint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/readevalprint/subscriptions","organizations_url":"https://api.github.com/users/readevalprint/orgs","repos_url":"https://api.github.com/users/readevalprint/repos","events_url":"https://api.github.com/users/readevalprint/events{/privacy}","received_events_url":"https://api.github.com/users/readevalprint/received_events","type":"User","site_admin":false},"body":"So you mean if `repeat=1` then do the `token.transfer()` immediately?","created_at":"2017-09-18T09:53:01Z","updated_at":"2017-09-18T09:53:01Z","html_url":"https://github.com/aragon/aragon-core/pull/99#discussion_r139379054","pull_request_url":"https://api.github.com/repos/aragon/aragon-core/pulls/99","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/aragon/aragon-core/pulls/comments/139379054"},"html":{"href":"https://github.com/aragon/aragon-core/pull/99#discussion_r139379054"},"pull_request":{"href":"https://api.github.com/repos/aragon/aragon-core/pulls/99"}},"in_reply_to_id":139101226},"pull_request":{"url":"https://api.github.com/repos/aragon/aragon-core/pulls/99","id":140804525,"html_url":"https://github.com/aragon/aragon-core/pull/99","diff_url":"https://github.com/aragon/aragon-core/pull/99.diff","patch_url":"https://github.com/aragon/aragon-core/pull/99.patch","issue_url":"https://api.github.com/repos/aragon/aragon-core/issues/99","number":99,"state":"open","locked":false,"title":"Finance App","user":{"login":"readevalprint","id":118430,"avatar_url":"https://avatars2.githubusercontent.com/u/118430?v=4","gravatar_id":"","url":"https://api.github.com/users/readevalprint","html_url":"https://github.com/readevalprint","followers_url":"https://api.github.com/users/readevalprint/followers","following_url":"https://api.github.com/users/readevalprint/following{/other_user}","gists_url":"https://api.github.com/users/readevalprint/gists{/gist_id}","starred_url":"https://api.github.com/users/readevalprint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/readevalprint/subscriptions","organizations_url":"https://api.github.com/users/readevalprint/orgs","repos_url":"https://api.github.com/users/readevalprint/repos","events_url":"https://api.github.com/users/readevalprint/events{/privacy}","received_events_url":"https://api.github.com/users/readevalprint/received_events","type":"User","site_admin":false},"body":"- [x] update Accounting with recurring payments/invoices\r\n- [x] deposit function should record transactions\r\n- [x] Add natspec\r\n- [ ] More tests","created_at":"2017-09-13T11:54:44Z","updated_at":"2017-09-18T09:53:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8dcfa7632bb9c1a1c1a41557d963ef904f0aa8d0","assignee":{"login":"readevalprint","id":118430,"avatar_url":"https://avatars2.githubusercontent.com/u/118430?v=4","gravatar_id":"","url":"https://api.github.com/users/readevalprint","html_url":"https://github.com/readevalprint","followers_url":"https://api.github.com/users/readevalprint/followers","following_url":"https://api.github.com/users/readevalprint/following{/other_user}","gists_url":"https://api.github.com/users/readevalprint/gists{/gist_id}","starred_url":"https://api.github.com/users/readevalprint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/readevalprint/subscriptions","organizations_url":"https://api.github.com/users/readevalprint/orgs","repos_url":"https://api.github.com/users/readevalprint/repos","events_url":"https://api.github.com/users/readevalprint/events{/privacy}","received_events_url":"https://api.github.com/users/readevalprint/received_events","type":"User","site_admin":false},"assignees":[{"login":"readevalprint","id":118430,"avatar_url":"https://avatars2.githubusercontent.com/u/118430?v=4","gravatar_id":"","url":"https://api.github.com/users/readevalprint","html_url":"https://github.com/readevalprint","followers_url":"https://api.github.com/users/readevalprint/followers","following_url":"https://api.github.com/users/readevalprint/following{/other_user}","gists_url":"https://api.github.com/users/readevalprint/gists{/gist_id}","starred_url":"https://api.github.com/users/readevalprint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/readevalprint/subscriptions","organizations_url":"https://api.github.com/users/readevalprint/orgs","repos_url":"https://api.github.com/users/readevalprint/repos","events_url":"https://api.github.com/users/readevalprint/events{/privacy}","received_events_url":"https://api.github.com/users/readevalprint/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/aragon/aragon-core/pulls/99/commits","review_comments_url":"https://api.github.com/repos/aragon/aragon-core/pulls/99/comments","review_comment_url":"https://api.github.com/repos/aragon/aragon-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aragon/aragon-core/issues/99/comments","statuses_url":"https://api.github.com/repos/aragon/aragon-core/statuses/0ad3d0b0e1e75789a90afa0a98bdfe84b618d317","head":{"label":"aragon:accountingapp","ref":"accountingapp","sha":"0ad3d0b0e1e75789a90afa0a98bdfe84b618d317","user":{"login":"aragon","id":24612534,"avatar_url":"https://avatars1.githubusercontent.com/u/24612534?v=4","gravatar_id":"","url":"https://api.github.com/users/aragon","html_url":"https://github.com/aragon","followers_url":"https://api.github.com/users/aragon/followers","following_url":"https://api.github.com/users/aragon/following{/other_user}","gists_url":"https://api.github.com/users/aragon/gists{/gist_id}","starred_url":"https://api.github.com/users/aragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aragon/subscriptions","organizations_url":"https://api.github.com/users/aragon/orgs","repos_url":"https://api.github.com/users/aragon/repos","events_url":"https://api.github.com/users/aragon/events{/privacy}","received_events_url":"https://api.github.com/users/aragon/received_events","type":"Organization","site_admin":false},"repo":{"id":87797080,"name":"aragon-core","full_name":"aragon/aragon-core","owner":{"login":"aragon","id":24612534,"avatar_url":"https://avatars1.githubusercontent.com/u/24612534?v=4","gravatar_id":"","url":"https://api.github.com/users/aragon","html_url":"https://github.com/aragon","followers_url":"https://api.github.com/users/aragon/followers","following_url":"https://api.github.com/users/aragon/following{/other_user}","gists_url":"https://api.github.com/users/aragon/gists{/gist_id}","starred_url":"https://api.github.com/users/aragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aragon/subscriptions","organizations_url":"https://api.github.com/users/aragon/orgs","repos_url":"https://api.github.com/users/aragon/repos","events_url":"https://api.github.com/users/aragon/events{/privacy}","received_events_url":"https://api.github.com/users/aragon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aragon/aragon-core","description":"Smart contracts for running Aragon Core organizations","fork":false,"url":"https://api.github.com/repos/aragon/aragon-core","forks_url":"https://api.github.com/repos/aragon/aragon-core/forks","keys_url":"https://api.github.com/repos/aragon/aragon-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aragon/aragon-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aragon/aragon-core/teams","hooks_url":"https://api.github.com/repos/aragon/aragon-core/hooks","issue_events_url":"https://api.github.com/repos/aragon/aragon-core/issues/events{/number}","events_url":"https://api.github.com/repos/aragon/aragon-core/events","assignees_url":"https://api.github.com/repos/aragon/aragon-core/assignees{/user}","branches_url":"https://api.github.com/repos/aragon/aragon-core/branches{/branch}","tags_url":"https://api.github.com/repos/aragon/aragon-core/tags","blobs_url":"https://api.github.com/repos/aragon/aragon-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aragon/aragon-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aragon/aragon-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/aragon/aragon-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aragon/aragon-core/statuses/{sha}","languages_url":"https://api.github.com/repos/aragon/aragon-core/languages","stargazers_url":"https://api.github.com/repos/aragon/aragon-core/stargazers","contributors_url":"https://api.github.com/repos/aragon/aragon-core/contributors","subscribers_url":"https://api.github.com/repos/aragon/aragon-core/subscribers","subscription_url":"https://api.github.com/repos/aragon/aragon-core/subscription","commits_url":"https://api.github.com/repos/aragon/aragon-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/aragon/aragon-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/aragon/aragon-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/aragon/aragon-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/aragon/aragon-core/contents/{+path}","compare_url":"https://api.github.com/repos/aragon/aragon-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aragon/aragon-core/merges","archive_url":"https://api.github.com/repos/aragon/aragon-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aragon/aragon-core/downloads","issues_url":"https://api.github.com/repos/aragon/aragon-core/issues{/number}","pulls_url":"https://api.github.com/repos/aragon/aragon-core/pulls{/number}","milestones_url":"https://api.github.com/repos/aragon/aragon-core/milestones{/number}","notifications_url":"https://api.github.com/repos/aragon/aragon-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aragon/aragon-core/labels{/name}","releases_url":"https://api.github.com/repos/aragon/aragon-core/releases{/id}","deployments_url":"https://api.github.com/repos/aragon/aragon-core/deployments","created_at":"2017-04-10T10:11:09Z","updated_at":"2017-09-11T18:03:31Z","pushed_at":"2017-09-18T09:50:48Z","git_url":"git://github.com/aragon/aragon-core.git","ssh_url":"git@github.com:aragon/aragon-core.git","clone_url":"https://github.com/aragon/aragon-core.git","svn_url":"https://github.com/aragon/aragon-core","homepage":"https://aragon.one/core","size":2479,"stargazers_count":87,"watchers_count":87,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":27,"forks":30,"open_issues":27,"watchers":87,"default_branch":"dev"}},"base":{"label":"aragon:dev","ref":"dev","sha":"80a3ce3c0e035b5ade1520f922f89ae444f1e3fa","user":{"login":"aragon","id":24612534,"avatar_url":"https://avatars1.githubusercontent.com/u/24612534?v=4","gravatar_id":"","url":"https://api.github.com/users/aragon","html_url":"https://github.com/aragon","followers_url":"https://api.github.com/users/aragon/followers","following_url":"https://api.github.com/users/aragon/following{/other_user}","gists_url":"https://api.github.com/users/aragon/gists{/gist_id}","starred_url":"https://api.github.com/users/aragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aragon/subscriptions","organizations_url":"https://api.github.com/users/aragon/orgs","repos_url":"https://api.github.com/users/aragon/repos","events_url":"https://api.github.com/users/aragon/events{/privacy}","received_events_url":"https://api.github.com/users/aragon/received_events","type":"Organization","site_admin":false},"repo":{"id":87797080,"name":"aragon-core","full_name":"aragon/aragon-core","owner":{"login":"aragon","id":24612534,"avatar_url":"https://avatars1.githubusercontent.com/u/24612534?v=4","gravatar_id":"","url":"https://api.github.com/users/aragon","html_url":"https://github.com/aragon","followers_url":"https://api.github.com/users/aragon/followers","following_url":"https://api.github.com/users/aragon/following{/other_user}","gists_url":"https://api.github.com/users/aragon/gists{/gist_id}","starred_url":"https://api.github.com/users/aragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aragon/subscriptions","organizations_url":"https://api.github.com/users/aragon/orgs","repos_url":"https://api.github.com/users/aragon/repos","events_url":"https://api.github.com/users/aragon/events{/privacy}","received_events_url":"https://api.github.com/users/aragon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aragon/aragon-core","description":"Smart contracts for running Aragon Core organizations","fork":false,"url":"https://api.github.com/repos/aragon/aragon-core","forks_url":"https://api.github.com/repos/aragon/aragon-core/forks","keys_url":"https://api.github.com/repos/aragon/aragon-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aragon/aragon-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aragon/aragon-core/teams","hooks_url":"https://api.github.com/repos/aragon/aragon-core/hooks","issue_events_url":"https://api.github.com/repos/aragon/aragon-core/issues/events{/number}","events_url":"https://api.github.com/repos/aragon/aragon-core/events","assignees_url":"https://api.github.com/repos/aragon/aragon-core/assignees{/user}","branches_url":"https://api.github.com/repos/aragon/aragon-core/branches{/branch}","tags_url":"https://api.github.com/repos/aragon/aragon-core/tags","blobs_url":"https://api.github.com/repos/aragon/aragon-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aragon/aragon-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aragon/aragon-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/aragon/aragon-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aragon/aragon-core/statuses/{sha}","languages_url":"https://api.github.com/repos/aragon/aragon-core/languages","stargazers_url":"https://api.github.com/repos/aragon/aragon-core/stargazers","contributors_url":"https://api.github.com/repos/aragon/aragon-core/contributors","subscribers_url":"https://api.github.com/repos/aragon/aragon-core/subscribers","subscription_url":"https://api.github.com/repos/aragon/aragon-core/subscription","commits_url":"https://api.github.com/repos/aragon/aragon-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/aragon/aragon-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/aragon/aragon-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/aragon/aragon-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/aragon/aragon-core/contents/{+path}","compare_url":"https://api.github.com/repos/aragon/aragon-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aragon/aragon-core/merges","archive_url":"https://api.github.com/repos/aragon/aragon-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aragon/aragon-core/downloads","issues_url":"https://api.github.com/repos/aragon/aragon-core/issues{/number}","pulls_url":"https://api.github.com/repos/aragon/aragon-core/pulls{/number}","milestones_url":"https://api.github.com/repos/aragon/aragon-core/milestones{/number}","notifications_url":"https://api.github.com/repos/aragon/aragon-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aragon/aragon-core/labels{/name}","releases_url":"https://api.github.com/repos/aragon/aragon-core/releases{/id}","deployments_url":"https://api.github.com/repos/aragon/aragon-core/deployments","created_at":"2017-04-10T10:11:09Z","updated_at":"2017-09-11T18:03:31Z","pushed_at":"2017-09-18T09:50:48Z","git_url":"git://github.com/aragon/aragon-core.git","ssh_url":"git@github.com:aragon/aragon-core.git","clone_url":"https://github.com/aragon/aragon-core.git","svn_url":"https://github.com/aragon/aragon-core","homepage":"https://aragon.one/core","size":2479,"stargazers_count":87,"watchers_count":87,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":27,"forks":30,"open_issues":27,"watchers":87,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aragon/aragon-core/pulls/99"},"html":{"href":"https://github.com/aragon/aragon-core/pull/99"},"issue":{"href":"https://api.github.com/repos/aragon/aragon-core/issues/99"},"comments":{"href":"https://api.github.com/repos/aragon/aragon-core/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/aragon/aragon-core/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/aragon/aragon-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aragon/aragon-core/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/aragon/aragon-core/statuses/0ad3d0b0e1e75789a90afa0a98bdfe84b618d317"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"readevalprint"}}