updated functions and modifiers to controller

This commit is contained in:
Ricardo Guilherme Schmidt
2017-05-19 21:55:11 -03:00
parent 9fefe9cdf7
commit fb561250c1
7 changed files with 25 additions and 25 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ contract GitHubAPIReg is Controlled, usingOraclize {
}
//owner management
function setAPICredentials(string _client_id, string _client_secret) only_owner {
function setAPICredentials(string _client_id, string _client_secret) onlyController {
strings.slice [] memory cm = new strings.slice[](5);
cm[0] = strings.toSlice("?client_id=");
cm[1] = _client_id.toSlice();
@@ -31,7 +31,7 @@ contract GitHubAPIReg is Controlled, usingOraclize {
cred = strings.toSlice("").join(cm);
}
function clearAPICredentials() only_owner {
function clearAPICredentials() onlyController {
cred = "";
}
+7 -7
View File
@@ -41,7 +41,7 @@ contract GitHubOracle is Controlled, DGitI {
mapping (string => string) pending;
}
function __init_regs() only_owner {
function __init_regs() onlyController {
if(address(userReg) == 0x0){
userReg = GHUserReg.create();
}
@@ -50,7 +50,7 @@ contract GitHubOracle is Controlled, DGitI {
}
}
function __set_points_script(string _arg) only_owner {
function __set_points_script(string _arg) onlyController {
if(address(gitHubPoints) == 0x0){
gitHubPoints = GHPoints.create(_arg);
}else {
@@ -58,10 +58,10 @@ contract GitHubOracle is Controlled, DGitI {
}
}
function __setController(address __newcontroller) only_owner {
userReg.setOwner(newContract);
repoReg.setOwner(newContract);
gitHubPoints.setOwner(newContract);
function __changeController(address _newController) onlyController {
userReg.changeController(_newController);
repoReg.changeController(newContract);
gitHubPoints.changeController(newContract);
}
function update(string _repository, string _token) payable {
@@ -99,7 +99,7 @@ contract GitHubOracle is Controlled, DGitI {
event NewPoints(uint repoId, uint userId, uint total, bool claimed);
function __newPoints(uint _repoId, uint _userId, uint _points)
only_owner {
oraclized {
GitRepositoryI repoaddr = GitRepositoryI(repositoryReg.getAddr(_repoId));
bool claimed = repoaddr.claim(userReg.getAddr(_userId), _points);
if(!claimed){ //try to claim points
+7 -7
View File
@@ -31,14 +31,14 @@ contract GitHubPoints is Controlled, usingOraclize{
bytes20 commitid;
}
function start(string _repository, string _branch, string _cred) payable only_owner {
function start(string _repository, string _branch, string _cred) payable onlyController {
if(bytes(_cred).length == 0) _cred = cred;
bytes32 ocid = oraclize_query("nested", _query_start(_repository,_branch,_cred));
command[ocid] = Command.START;
branches[ocid] = _branch;
}
function update(string _repository, string _branch, string _lastCommit, string _cred) payable only_owner {
function update(string _repository, string _branch, string _lastCommit, string _cred) payable onlyController {
if(bytes(_cred).length == 0) _cred = cred;
bytes32 ocid = oraclize_query("nested", _query_update(_repository,_branch,_lastCommit,_cred));
command[ocid] = Command.UPDATE;
@@ -47,7 +47,7 @@ contract GitHubPoints is Controlled, usingOraclize{
}
function resume(string _repository, string _branch, string _lastCommit, string _limitCommit, string _cred)
payable only_owner {
payable onlyController {
if(bytes(_cred).length == 0) _cred = cred;
bytes32 ocid = oraclize_query("nested", _query_resume(_repository,_branch,_lastCommit,_limitCommit,_cred));
command[ocid] = Command.RESUME;
@@ -56,7 +56,7 @@ contract GitHubPoints is Controlled, usingOraclize{
}
function issue(string _repository, string _issue, string _cred)
payable only_owner {
payable onlyController {
if(bytes(_cred).length == 0) _cred = cred;
command[ocid] = Command.ISSUE;
bytes32 ocid = oraclize_query("nested", _query_issue(_repository,_issue,_cred));
@@ -197,15 +197,15 @@ contract GitHubPoints is Controlled, usingOraclize{
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
}
function setAPICredentials(string _client_id_comma_client_secret) only_owner {
function setAPICredentials(string _client_id_comma_client_secret) onlyController {
cred = _client_id_comma_client_secret;
}
function setScript(string _script) only_owner{
function setScript(string _script) onlyController{
script = _script;
}
function clearAPICredentials() only_owner {
function clearAPICredentials() onlyController {
cred = "";
}
+2 -2
View File
@@ -69,8 +69,8 @@ contract GitHubRepositoryReg is NameRegistry, GitHubAPIReg {
(default_branch,pos) = getNextString(v,pos);
address repoAddr = repositories[projectId].addr;
if(repoAddr == 0x0){
GitRepositoryI repo = GitFactory.newGitRepository(projectId, full_name);
repo.setOwner(owner);
GitReposcitoryI repo = GitFactory.newGitRepository(projectId, full_name);
repo.changeController(controller);
repoAddr = address(repo);
indexes[sha3(repoAddr)] = projectId;
indexes[sha3(full_name)] = projectId;
+3 -3
View File
@@ -52,7 +52,7 @@ contract GitRepository is GitRepositoryI {
//oracle claim request
function claim(address _user, uint _total)
only_owner returns (bool) {
onlyController returns (bool) {
if(!token.lock() && _user != 0x0){
token.mint(_user, _total);
return true;
@@ -61,12 +61,12 @@ contract GitRepository is GitRepositoryI {
}
}
function setBounty(uint256 _issueId, bool _state, uint256 _closedAt) only_owner {
function setBounty(uint256 _issueId, bool _state, uint256 _closedAt) onlyController {
if (_state) bountyBank.open(_issueId);
else bountyBank.close(_issueId,_closedAt);
}
function setBountyPoints(uint256 _issueId, address _claimer, uint256 _points) only_owner {
function setBountyPoints(uint256 _issueId, address _claimer, uint256 _points) onlyController {
bountyBank.setClaimer(_issueId,_claimer,_points);
}
+1 -1
View File
@@ -27,7 +27,7 @@ contract GitRepositoryToken is LockerToken {
}
function mint(address _who, uint256 _value)
only_owner when_locked(false) {
onlyController when_locked(false) {
_mint(_who,_value);
}
+3 -3
View File
@@ -14,13 +14,13 @@ pragma solidity ^0.4.11;
contract LockerToken is AbstractToken, Lockable, Controlled {
Lockable public locker = this;
function unlinkLocker() only_owner {
function unlinkLocker() onlyController {
locker = this;
}
function linkLocker(Lockable _locker) only_owner {
function linkLocker(Lockable _locker) onlyController {
locker = _locker;
}
function setlock(bool _lock) only_owner {
function setlock(bool _lock) onlyController {
setLock(_lock);
}