From dbe8c45bef875f284fbb1a88ff96b1d10e53aa51 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Fri, 19 May 2017 16:06:53 -0300 Subject: [PATCH] archictecture build ok --- contracts/src/BountyBank.sol | 12 +- contracts/src/GitHubAPIReg.sol | 19 ++- contracts/src/GitHubOracle.sol | 80 +++++++----- contracts/src/GitHubPoints.sol | 167 +++++++++++--------------- contracts/src/GitHubRepositoryReg.sol | 31 +++-- contracts/src/GitHubUserReg.sol | 33 +++-- contracts/src/GitRepository.sol | 28 ++--- contracts/src/GitRepositoryToken.sol | 8 +- contracts/src/NameRegistry.sol | 2 +- 9 files changed, 208 insertions(+), 172 deletions(-) diff --git a/contracts/src/BountyBank.sol b/contracts/src/BountyBank.sol index 5a97762..46bf276 100644 --- a/contracts/src/BountyBank.sol +++ b/contracts/src/BountyBank.sol @@ -1,7 +1,7 @@ -pragma solidity ^0.4.9; - -import "lib/ethereans/management/Owned.sol"; - +import "Owned.sol"; + +pragma solidity ^0.4.11; + contract BountyBank is Owned { enum State {CLOSED, OPEN, CLAIMED} @@ -42,10 +42,10 @@ contract BountyBank is Owned { bounties[num].points += points; } - function close(uint num) only_owner { + function close(uint num, uint _closedAt) only_owner { if(bounties[num].state == State.CLAIMED) throw; bounties[num].state = State.CLOSED; - bounties[num].closedAt = now; + bounties[num].closedAt = _closedAt; } function claim(uint num){ diff --git a/contracts/src/GitHubAPIReg.sol b/contracts/src/GitHubAPIReg.sol index d2c052f..c062c9b 100644 --- a/contracts/src/GitHubAPIReg.sol +++ b/contracts/src/GitHubAPIReg.sol @@ -3,13 +3,17 @@ * Abstract Logic for GitHubOracle Registries. * Ricardo Guilherme Schmidt <3esmit@gmail.com> */ -import "lib/ethereans/management/Owned.sol"; -import "lib/oraclize/oraclizeAPI_0.4.sol"; +import "Owned.sol"; +import "oraclizeAPI_0.4.sol"; +import "strings.sol"; pragma solidity ^0.4.11; contract GitHubAPIReg is Owned, usingOraclize { - string credentials = ""; + using strings for string; + using strings for strings.slice; + + string cred = ""; event OracleEvent(bytes32 myid, string result, bytes proof); @@ -19,11 +23,16 @@ contract GitHubAPIReg is Owned, usingOraclize { //owner management function setAPICredentials(string _client_id, string _client_secret) only_owner { - credentials = strConcat("?client_id=",_client_id,"&client_secret=",_client_secret,""); + strings.slice [] memory cm = new strings.slice[](5); + cm[0] = strings.toSlice("?client_id="); + cm[1] = _client_id.toSlice(); + cm[2] = strings.toSlice("&client_secret="); + cm[4] = _client_secret.toSlice(); + cred = strings.toSlice("").join(cm); } function clearAPICredentials() only_owner { - credentials = ""; + cred = ""; } function getNextString(bytes _str, uint8 _pos) internal constant returns (string, uint8) { diff --git a/contracts/src/GitHubOracle.sol b/contracts/src/GitHubOracle.sol index 77360da..ee17e58 100644 --- a/contracts/src/GitHubOracle.sol +++ b/contracts/src/GitHubOracle.sol @@ -13,8 +13,8 @@ * Released under GPLv3 License */ -import "lib/oraclize/oraclizeAPI_0.4.sol"; -import "lib/ethereans/management/Owned.sol"; +import "oraclizeAPI_0.4.sol"; +import "Owned.sol"; import "./GitHubUserReg.sol"; import "./GitHubRepositoryReg.sol"; import "./GitHubPoints.sol"; @@ -29,44 +29,70 @@ contract GitHubOracle is Owned, DGitI { mapping (uint256 => Repository) repositories; mapping (uint256 => mapping (uint256 => uint256)) pending; - + + modifier oraclized { + if(msg.sender != address(gitHubPoints)) throw; + _; + } + struct Repository { - bytes20 head; - bytes20 tail; + string head; + string tail; + mapping (string => string) pending; } function initialize() only_owner { - userReg = GitHubUserRegFactory.create(); - repositoryReg = GitHubRepositoryRegFactory.create(); - gitHubPoints = GitHubPointsFactory.create(); + if(address(userReg) == 0x0){ + userReg = GHUserReg.create(); + }else if(address(repositoryReg) == 0x0){ + repositoryReg = GHRepoReg.create(); + }else if(address(gitHubPoints) == 0x0){ + gitHubPoints = GHPoints.create(); + }else throw; } - function updateCommits(string _repository, string _token) payable{ + function update(string _repository, string _token) payable { uint256 repoId = repositoryReg.getId(_repository); if(repoId == 0) throw; - gitHubPoints.updateCommits.value(msg.value)(_repository, "master", repositories[repoId].head,_token); + gitHubPoints.update.value(msg.value)(_repository, "master", repositories[repoId].head,_token); } - function updateIssue(string _repository, string issue, string _token) payable{ - gitHubPoints.updateIssue.value(msg.value)(_repository,issue,_token); + function issue(string _repository, string _issue, string _token) payable { + gitHubPoints.issue.value(msg.value)(_repository,_issue,_token); + } + + function __pendingScan(uint256 _projectId, string _lastCommit, string _pendingTail) oraclized { + repositories[_projectId].pending[_pendingTail] = _lastCommit; + } + + function __setHead(uint256 _projectId, string _head) oraclized { + repositories[_projectId].head = _head; + } + + function __setTail(uint256 _projectId, string _tail) oraclized { + repositories[_projectId].tail = _tail; + } + + function __setIssue(uint256 _projectId, uint256 _issueId, bool _state, uint256 _closedAt) oraclized { + GitRepositoryI repo = GitRepositoryI(repositoryReg.getAddr(_projectId)); + repo.setBounty(_issueId, _state, _closedAt); + } + + function __setIssuePoints(uint256 _projectId, uint256 _issueId, uint256 _userId, uint256 _points) oraclized { + GitRepositoryI repo = GitRepositoryI(repositoryReg.getAddr(_projectId)); + repo.setBountyPoints(_issueId, userReg.getAddr(_userId), _points); } - function getRepository(uint projectId) constant returns (address){ - return repositoryReg.getAddr(projectId); - } - function getRepository(string full_name) constant returns (address){ - return repositoryReg.getAddr(full_name); - } event NewPoints(uint repoId, uint userId, uint total, bool claimed); - function __newPoints(uint repoId, uint userId, uint total) + function __newPoints(uint _repoId, uint _userId, uint _points) only_owner { - GitRepositoryI repoaddr = GitRepositoryI(repositoryReg.getAddr(repoId)); - bool claimed = repoaddr.claim(userReg.getAddr(userId), total); + GitRepositoryI repoaddr = GitRepositoryI(repositoryReg.getAddr(_repoId)); + bool claimed = repoaddr.claim(userReg.getAddr(_userId), _points); if(!claimed){ //try to claim points - addPending(repoId, userId, total); //set as a pending points + pending[_userId][_repoId] += _points; //set as a pending points } - NewPoints(repoId,userId,total,claimed); + NewPoints(_repoId, _userId, _points, claimed); } //claims pending points @@ -78,11 +104,5 @@ contract GitHubOracle is Owned, DGitI { NewPoints(_repoId,_userId,total,true); } else throw; } - - function addPending(uint256 _repoId, uint256 _userId, uint256 _points) internal { - pending[_userId][_repoId] += _points; - } - - - + } \ No newline at end of file diff --git a/contracts/src/GitHubPoints.sol b/contracts/src/GitHubPoints.sol index 8e97251..c7946bf 100644 --- a/contracts/src/GitHubPoints.sol +++ b/contracts/src/GitHubPoints.sol @@ -1,26 +1,29 @@ -import "lib/oraclize/oraclizeAPI_0.4.sol"; -import "lib/ethereans/management/Owned.sol"; -import "lib/strings.sol"; +import "oraclizeAPI_0.4.sol"; +import "Owned.sol"; +import "strings.sol"; pragma solidity ^0.4.11; contract DGitI { - function __setHead(uint256 projectId, string branch, bytes20 head); - function __setTail(uint256 projectId, string branch, bytes20 tail); + function __setHead(uint256 projectId, string head); + function __setTail(uint256 projectId, string tail); function __newPoints(uint256 projectId, uint256 userId, uint total); + function __pendingScan(uint256 projectId, string lastCommit, string pendingTail); function __setIssue(uint256 projectId, uint256 issueId, bool state, uint256 closedAt); function __setIssuePoints(uint256 projectId, uint256 issueId, uint256 userId, uint256 points); } contract GitHubPoints is Owned, usingOraclize{ - + + using strings for string; + using strings for strings.slice; + string private cred = ""; string private script = ""; - enum OracleType { CLAIM_COMMIT, CLAIM_CONTINUE, UPDATE_ISSUE } - mapping (bytes32 => OracleType) claimType; //temporary db enumerating oraclize calls - mapping (bytes32 => bytes20) commitClaim; //temporary db for oraclize commit token claim calls - mapping (bytes32 => Request) request; //temporary db + enum Command { UPDATE, RESUME, ISSUE } + mapping (bytes32 => Command) command; //temporary db enumerating oraclize calls + mapping (bytes32 => string) lastCommits; //temporary db for oraclize commit token claim calls //stores temporary data for oraclize repository commit claim struct CommitClaim { @@ -28,86 +31,62 @@ contract GitHubPoints is Owned, usingOraclize{ bytes20 commitid; } - struct Request { - address caller; - OracleType ot; - } - - function _query_start(string _repository, string _branch, string _cred) internal { - strConcat("[computation] ['", script, "', 'update-new', '", _repository, strConcat("','", _branch,"', '", _cred,"']")) - } - - function start(string _repository, string _branch, string _cred) payable only_owner { + function update(string _repository, string _branch, string _lastCommit, string _cred) payable only_owner { if(bytes(_cred).length == 0) _cred = cred; - bytes32 ocid = oraclize_query("nested", _query_start(_repository,_branch,_cred)); - claimType[ocid] = OracleType.CLAIM_COMMIT; - request[ocid].caller = msg.sender; - request[ocid].ot = OracleType.CLAIM_COMMIT; - } - - function update(string _repository, string _branch, string _commitid, string _cred) payable only_owner { - if(bytes(_cred).length == 0) _cred = cred; - bytes32 ocid = oraclize_query("nested", _query_update(_repository,_branch,_commitid,_cred)); - claimType[ocid] = OracleType.CLAIM_COMMIT; - commitClaim[ocid] = toBytes20(_commitid); - request[ocid].caller = msg.sender; - request[ocid].ot = OracleType.CLAIM_COMMIT; + bytes32 ocid = oraclize_query("nested", _query_update(_repository,_branch,_lastCommit,_cred)); + command[ocid] = Command.UPDATE; + lastCommits[ocid] = _lastCommit; } function resume(string _repository, string _branch, string _lastCommit, string _limitCommit, string _cred) - payable only_owner{ + payable only_owner { if(bytes(_cred).length == 0) _cred = cred; bytes32 ocid = oraclize_query("nested", _query_resume(_repository,_branch,_lastCommit,_limitCommit,_cred)); - claimType[ocid] = OracleType.CLAIM_CONTINUE; - commitClaim[ocid] = toBytes20(_lastCommit); - request[ocid].caller = msg.sender; - request[ocid].ot = OracleType.CLAIM_CONTINUE; + command[ocid] = Command.RESUME; + lastCommits[ocid] = _lastCommit; } - function issue(string _repository, string issue, string _cred) - payable only_owner{ + function issue(string _repository, string _issue, string _cred) + payable only_owner { if(bytes(_cred).length == 0) _cred = cred; + command[ocid] = Command.ISSUE; bytes32 ocid = oraclize_query("nested", _query_issue(_repository,_issue,_cred)); - request[ocid].caller = msg.sender; - request[ocid].ot = OracleType.UPDATE_ISSUE; } event OracleEvent(bytes32 myid, string result, bytes proof); //oraclize response callback function __callback(bytes32 myid, string result, bytes proof) { OracleEvent(myid, result, proof); - if (msg.sender != oraclize.cbAddress()){ - throw; - }else if(claimType[myid] == OracleType.UPDATE_ISSUE){ - _updateIssue(myid, result); - }else{ - _updateCommits(commitClaim[myid], result,claimType[myid]==OracleType.CLAIM_CONTINUE); + if (msg.sender != oraclize.cbAddress()) throw; + Command comm = command[myid]; + if(comm == Command.UPDATE) { + _update(lastCommits[myid], result); + }else if(comm == Command.ISSUE) { + _issue(result); + }else if (comm == Command.RESUME) { + _resume(lastCommits[myid], result); + delete lastCommits[myid]; } - delete claimType[myid]; //should always be deleted + delete command[myid]; } - function _updateCommits(bytes20 oldCommit, string result, bool resume) internal { + function _update(string _lastCommit, string result) internal { DGitI dGit = DGitI(owner); bytes memory v = bytes(result); uint8 pos = 0; string memory temp; uint256 projectId; (projectId,pos) = getNextUInt(v,pos); - string memory branch; - (branch,pos) = getNextString(v,pos); - (temp,pos) = getNextString(v,pos); - bytes20 head = toBytes20(temp); - (temp,pos) = getNextString(v,pos); - bytes20 tail = toBytes20(temp); - dGit.__setHead(projectId,branch,head); - if(resume){ - dGit.__setTail(projectId,branch,tail); - }else{ - if(oldCommit == 0x0){ - dGit.__setTail(projectId,branch,tail); - }else if (oldCommit != tail){ - //TODO: acceptContinueUpdateUntilLimit(tail,oldCommit) - } + (temp,pos) = getNextString(v,pos); //branch + (temp,pos) = getNextString(v,pos); //head + dGit.__setHead(projectId,temp); //head + + (temp,pos) = getNextString(v,pos); //tail + if(bytes(_lastCommit).length == 0){ + dGit.__setTail(projectId,temp); + } + if (sha3(_lastCommit) != sha3(temp)){ //update didn't reached _lastCommit + dGit.__pendingScan(projectId,_lastCommit,temp); } uint numAuthors; (numAuthors,pos) = getNextUInt(v,pos); @@ -119,9 +98,34 @@ contract GitHubPoints is Owned, usingOraclize{ dGit.__newPoints(projectId,userId,points); } } + + function _resume(string _lastCommit, string result) internal { + DGitI dGit = DGitI(owner); + bytes memory v = bytes(result); + uint8 pos = 0; + string memory temp; + uint256 projectId; + (projectId,pos) = getNextUInt(v,pos); + string memory branch; + (branch,pos) = getNextString(v,pos); + string memory head; + (head,pos) = getNextString(v,pos); + string memory tail; + (tail,pos) = getNextString(v,pos); + dGit.__setTail(projectId,tail); + uint numAuthors; + (numAuthors,pos) = getNextUInt(v,pos); + uint userId; + uint points; + for(uint i; i < numAuthors; i++){ + (userId,pos) = getNextUInt(v,pos); + (points,pos) = getNextUInt(v,pos); + dGit.__newPoints(projectId,userId,points); + } + } - function _updateIssue(bytes32 myid, string result) internal { - DGitI dGit = DGitI(request[myid].caller); + function _issue(string result) internal { + DGitI dGit = DGitI(owner); bytes memory v = bytes(result); uint8 pos = 0; string memory temp; @@ -178,14 +182,6 @@ contract GitHubPoints is Owned, usingOraclize{ cm[2] = strings.toSlice("']"); return strings.toSlice("").join(cm); } - - function _query_start(string _repository, string _branch, string _cred) internal returns (string) { - strings.slice memory comma = strings.toSlice(","); - strings.slice [] memory cm = new strings.slice[](2); - cm[0] = _repository.toSlice(); - cm[1] = _branch.toSlice(); - return _query_script("update",comma.join(cm),_cred); - } function _query_update(string _repository, string _branch, string _lastCommit, string _cred) internal returns (string) { strings.slice memory comma = strings.toSlice(","); @@ -214,25 +210,6 @@ contract GitHubPoints is Owned, usingOraclize{ return _query_script("resume",comma.join(cm),_cred); } - //"ethereans/TheEtherian","master","client,secret" - function query_start(string _repository, string _branch, string _cred) constant returns (string) { - return _query_start(_repository,_branch,_cred); - } - - //"ethereans/TheEtherian","master","3258ebfded07a6e35d400994db507e456e194716","client,secret" - function query_update(string _repository, string _branch, string _lastCommit, string _cred) constant returns (string) { - return _query_update(_repository,_branch,_lastCommit,_cred); - } - - //"ethereans/TheEtherian","master","3258ebfded07a6e35d400994db507e456e194716","3acd26bf0f1f68ac2d7d26bfceb624bb0f01593a","client,secret" - function query_resume(string _repository, string _branch, string _lastCommit, string _limitCommit, string _cred) constant returns (string) { - return _query_resume(_repository,_branch,_lastCommit,_limitCommit,_cred); - } - - //"ethereans/TheEtherian","1","client,secret" - function query_issue(string _repository, string _issue, string _cred) constant returns (string) { - return _query_issue(_repository,_issue,_cred); - } function toBytes20(string memory source) internal constant returns (bytes20 result) { assembly { @@ -295,7 +272,7 @@ contract GitHubPoints is Owned, usingOraclize{ } } -library GitHubPointsFactory { +library GHPoints { function create() returns (GitHubPoints){ return new GitHubPoints(""); diff --git a/contracts/src/GitHubRepositoryReg.sol b/contracts/src/GitHubRepositoryReg.sol index f70ba6b..0df676d 100644 --- a/contracts/src/GitHubRepositoryReg.sol +++ b/contracts/src/GitHubRepositoryReg.sol @@ -7,11 +7,14 @@ import "./GitHubAPIReg.sol"; import "./NameRegistry.sol"; import "./GitRepository.sol"; +import "strings.sol"; pragma solidity ^0.4.11; contract GitHubRepositoryReg is NameRegistry, GitHubAPIReg { - + using strings for string; + using strings for strings.slice; + mapping (uint256 => Repository) public repositories; event NewRepository(address addr, uint256 projectId, string full_name, string default_branch); @@ -22,8 +25,10 @@ contract GitHubRepositoryReg is NameRegistry, GitHubAPIReg { string branch; } - function register(string _repository) payable { - oraclize_query("URL", _getQuery(_repository), getAddr(_repository) == 0x00? 4000000 : 1000000); + function register(string _repository, string _cred) payable { + if(bytes(_cred).length == 0) _cred = cred; + uint gas = getAddr(_repository) == 0x00? 4000000 : 1000000; + oraclize_query("URL", _query_script(_repository,_cred), gas); } function getAddr(uint256 _id) public constant returns(address addr) { @@ -48,11 +53,11 @@ contract GitHubRepositoryReg is NameRegistry, GitHubAPIReg { if (msg.sender != oraclize.cbAddress()){ throw; }else { - _setRepository(myid, result); + _setRepository(result); } } - function _setRepository(bytes32 myid, string result) internal //[85743750, "ethereans/TheEtherian", "master"] + function _setRepository(string result) internal //[85743750, "ethereans/TheEtherian", "master"] { bytes memory v = bytes(result); uint8 pos = 0; @@ -64,7 +69,9 @@ contract GitHubRepositoryReg is NameRegistry, GitHubAPIReg { (default_branch,pos) = getNextString(v,pos); address repoAddr = repositories[projectId].addr; if(repoAddr == 0x0){ - //repoAddr = address(GitFactory.newGitRepository(projectId, full_name, default_branch)); + GitRepositoryI repo = GitFactory.newGitRepository(projectId, full_name); + repo.setOwner(owner); + repoAddr = address(repo); indexes[sha3(repoAddr)] = projectId; indexes[sha3(full_name)] = projectId; NewRepository(repoAddr, projectId, full_name, default_branch); @@ -78,12 +85,16 @@ contract GitHubRepositoryReg is NameRegistry, GitHubAPIReg { } } //internal helper functions - function _getQuery(string _repository) internal constant returns (string){ - return strConcat("json(https://api.github.com/repos/",_repository,credentials,").$.id,full_name,default_branch"); + function _query_script(string _repository, string _cred) internal returns (string) { + strings.slice [] memory cm = new strings.slice[](5); + cm[0] = strings.toSlice("json(https://api.github.com/repos/"); + cm[1] = _repository.toSlice(); + cm[2] = _cred.toSlice(); + cm[4] = strings.toSlice(").$.id,full_name,default_branch"); + return strings.toSlice("").join(cm); } - } -library GitHubRepositoryRegFactory { +library GHRepoReg { function create() returns (GitHubRepositoryReg){ return new GitHubRepositoryReg(); diff --git a/contracts/src/GitHubUserReg.sol b/contracts/src/GitHubUserReg.sol index 4ebd032..553fc81 100644 --- a/contracts/src/GitHubUserReg.sol +++ b/contracts/src/GitHubUserReg.sol @@ -5,11 +5,14 @@ */ import "GitHubAPIReg.sol"; import "NameRegistry.sol"; +import "strings.sol"; pragma solidity ^0.4.11; contract GitHubUserReg is NameRegistry, GitHubAPIReg { - + using strings for string; + using strings for strings.slice; + mapping (bytes32 => UserClaim) userClaim; //temporary db for oraclize user register queries mapping (uint256 => User) users; @@ -26,8 +29,9 @@ contract GitHubUserReg is NameRegistry, GitHubAPIReg { string login; } - function register(string _github_user, string _gistid) payable { - bytes32 ocid = oraclize_query("nested", _getQuery(_github_user, _gistid)); + function register(string _github_user, string _gistid, string _cred) payable { + if(bytes(_cred).length == 0) _cred = cred; + bytes32 ocid = oraclize_query("nested", _query_script(_github_user, _gistid,_cred)); userClaim[ocid] = UserClaim({sender: msg.sender, login: _github_user}); } @@ -76,10 +80,25 @@ contract GitHubUserReg is NameRegistry, GitHubAPIReg { delete userClaim[myid]; //should always be deleted } - //internal helper functions - function _getQuery(string _github_user, string _gistid) internal constant returns (string){ - string memory a = strConcat("[identity] ${[URL] https://gist.githubusercontent.com/", _github_user,"/",_gistid,"/raw/registereth.txt}, ${[URL] json(https://api.github.com/gists/"); - return strConcat(a, _gistid, credentials, ").owner.[login,id]}",""); + function _query_script(string _github_user, string _gistid, string _cred) internal returns (string) { + strings.slice [] memory cm = new strings.slice[](8); + cm[0] = strings.toSlice("[identity] ${[URL] https://gist.githubusercontent.com/"); + cm[1] = _github_user.toSlice(); + cm[2] = strings.toSlice("/"); + cm[3] = _gistid.toSlice(); + cm[4] = strings.toSlice("/raw/register.txt}, ${[URL] json(https://api.github.com/gists/"); + cm[5] = _gistid.toSlice(); + cm[6] = _cred.toSlice(); + cm[7] = strings.toSlice(").owner.[login,id]}"); + return strings.toSlice("").join(cm); + } + +} + +library GHUserReg{ + + function create() returns (GitHubUserReg){ + return new GitHubUserReg(); } } \ No newline at end of file diff --git a/contracts/src/GitRepository.sol b/contracts/src/GitRepository.sol index 327707e..2e58298 100644 --- a/contracts/src/GitRepository.sol +++ b/contracts/src/GitRepository.sol @@ -1,5 +1,3 @@ -pragma solidity ^0.4.8; - /** * Contract that mint tokens by github commit stats * @@ -15,17 +13,20 @@ pragma solidity ^0.4.8; * Released under GPLv3 License */ -import "lib/ethereans/bank/CollaborationBank.sol"; -import "lib/ethereans/management/Owned.sol"; +import "CollaborationBank.sol"; +import "Owned.sol"; import "./BountyBank.sol"; import "./GitRepositoryToken.sol"; +pragma solidity ^0.4.11; -contract GitRepositoryI { +contract GitRepositoryI is Owned{ function claim(address _user, uint _total) returns (bool) ; + function setBounty(uint256 _issueId, bool _state, uint256 _closedAt); + function setBountyPoints(uint256 _issueId, address _claimer, uint256 _points); } -contract GitRepository is GitRepositoryI, Owned { +contract GitRepository is GitRepositoryI { GitRepositoryToken public token; CollaborationBank public donationBank; @@ -49,7 +50,6 @@ contract GitRepository is GitRepositoryI, Owned { bountyBank = new BountyBank(); } - //oracle claim request function claim(address _user, uint _total) only_owner returns (bool) { @@ -61,15 +61,15 @@ contract GitRepository is GitRepositoryI, Owned { } } - function bountyState(uint issue, bool open) only_owner { - if (open) bountyBank.open(issue); - else bountyBank.close(issue); - } - - function bountyState(uint issue, address claimer, uint points) only_owner { - bountyBank.setClaimer(issue,claimer,points); + function setBounty(uint256 _issueId, bool _state, uint256 _closedAt) only_owner { + if (_state) bountyBank.open(_issueId); + else bountyBank.close(_issueId,_closedAt); } + function setBountyPoints(uint256 _issueId, address _claimer, uint256 _points) only_owner { + bountyBank.setClaimer(_issueId,_claimer,_points); + } + } library GitFactory { diff --git a/contracts/src/GitRepositoryToken.sol b/contracts/src/GitRepositoryToken.sol index 3a9b81d..5098d21 100644 --- a/contracts/src/GitRepositoryToken.sol +++ b/contracts/src/GitRepositoryToken.sol @@ -1,5 +1,3 @@ -pragma solidity ^0.4.8; - /** * Contract that mint tokens by github commit stats * @@ -15,8 +13,10 @@ pragma solidity ^0.4.8; * Released under GPLv3 License */ -import "lib/ethereans/token/LockerToken.sol"; -import "lib/ethereans/management/Owned.sol"; +import "LockerToken.sol"; +import "Owned.sol"; + +pragma solidity ^0.4.11; contract GitRepositoryToken is LockerToken { diff --git a/contracts/src/NameRegistry.sol b/contracts/src/NameRegistry.sol index bef006e..33494fc 100644 --- a/contracts/src/NameRegistry.sol +++ b/contracts/src/NameRegistry.sol @@ -3,7 +3,7 @@ * Interface for Name Registries. * Ricardo Guilherme Schmidt <3esmit@gmail.com> */ -pragma solidity ^0.4.9; +pragma solidity ^0.4.11; contract NameRegistry { function getAddr(uint256 _id) public constant returns(address addr);