From 9fefe9cdf7f977de02a7081a3149b5b4b6884db2 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Fri, 19 May 2017 21:12:11 -0300 Subject: [PATCH] changed owned to controlled --- contracts/BountyBank.sol | 4 ++-- contracts/Controlled.sol | 17 +++++++++++++++++ contracts/GitHubAPIReg.sol | 4 ++-- contracts/GitHubOracle.sol | 4 ++-- contracts/GitHubPoints.sol | 4 ++-- contracts/GitRepository.sol | 4 ++-- contracts/GitRepositoryToken.sol | 2 +- contracts/Lockable.sol | 2 -- contracts/LockerToken.sol | 3 ++- contracts/Owned.sol | 17 ----------------- 10 files changed, 30 insertions(+), 31 deletions(-) create mode 100644 contracts/Controlled.sol delete mode 100644 contracts/Owned.sol diff --git a/contracts/BountyBank.sol b/contracts/BountyBank.sol index 46bf276..629eb81 100644 --- a/contracts/BountyBank.sol +++ b/contracts/BountyBank.sol @@ -1,8 +1,8 @@ -import "Owned.sol"; +import "Controlled.sol"; pragma solidity ^0.4.11; -contract BountyBank is Owned { +contract BountyBank is Controlled { enum State {CLOSED, OPEN, CLAIMED} diff --git a/contracts/Controlled.sol b/contracts/Controlled.sol new file mode 100644 index 0000000..b26afcb --- /dev/null +++ b/contracts/Controlled.sol @@ -0,0 +1,17 @@ +pragma solidity ^0.4.11; + +contract Controlled { + /// @notice The address of the controller is the only address that can call + /// a function with this modifier + modifier onlyController { if (msg.sender != controller) throw; _; } + + address public controller; + + function Controlled() { controller = msg.sender;} + + /// @notice Changes the controller of the contract + /// @param _newController The new controller of the contract + function changeController(address _newController) onlyController { + controller = _newController; + } +} \ No newline at end of file diff --git a/contracts/GitHubAPIReg.sol b/contracts/GitHubAPIReg.sol index 5483dc4..18f3191 100644 --- a/contracts/GitHubAPIReg.sol +++ b/contracts/GitHubAPIReg.sol @@ -3,13 +3,13 @@ * Abstract Logic for GitHubOracle Registries. * Ricardo Guilherme Schmidt <3esmit@gmail.com> */ -import "Owned.sol"; +import "Controlled.sol"; import "oraclizeAPI_0.4.sol"; import "strings.sol"; pragma solidity ^0.4.11; -contract GitHubAPIReg is Owned, usingOraclize { +contract GitHubAPIReg is Controlled, usingOraclize { using strings for string; using strings for strings.slice; diff --git a/contracts/GitHubOracle.sol b/contracts/GitHubOracle.sol index 297e4a5..e684f8c 100644 --- a/contracts/GitHubOracle.sol +++ b/contracts/GitHubOracle.sol @@ -14,14 +14,14 @@ */ import "oraclizeAPI_0.4.sol"; -import "Owned.sol"; +import "Controlled.sol"; import "./GitHubUserReg.sol"; import "./GitHubRepositoryReg.sol"; import "./GitHubPoints.sol"; pragma solidity ^0.4.11; -contract GitHubOracle is Owned, DGitI { +contract GitHubOracle is Controlled, DGitI { GitHubUserReg public userReg; GitHubRepositoryReg public repositoryReg; diff --git a/contracts/GitHubPoints.sol b/contracts/GitHubPoints.sol index 59432e9..9ba424d 100644 --- a/contracts/GitHubPoints.sol +++ b/contracts/GitHubPoints.sol @@ -1,5 +1,5 @@ import "oraclizeAPI_0.4.sol"; -import "Owned.sol"; +import "Controlled.sol"; import "strings.sol"; pragma solidity ^0.4.11; @@ -13,7 +13,7 @@ contract DGitI { function __setIssuePoints(uint256 projectId, uint256 issueId, uint256 userId, uint256 points); } -contract GitHubPoints is Owned, usingOraclize{ +contract GitHubPoints is Controlled, usingOraclize{ using strings for string; using strings for strings.slice; diff --git a/contracts/GitRepository.sol b/contracts/GitRepository.sol index dd8ed4d..2011173 100644 --- a/contracts/GitRepository.sol +++ b/contracts/GitRepository.sol @@ -14,13 +14,13 @@ */ import "CollaborationBank.sol"; -import "Owned.sol"; +import "Controlled.sol"; import "./BountyBank.sol"; import "./GitRepositoryToken.sol"; pragma solidity ^0.4.11; -contract GitRepositoryI is Owned{ +contract GitRepositoryI is Controlled{ function claim(address _user, uint _total) returns (bool) ; function setBounty(uint256 _issueId, bool _state, uint256 _closedAt); function setBountyPoints(uint256 _issueId, address _claimer, uint256 _points); diff --git a/contracts/GitRepositoryToken.sol b/contracts/GitRepositoryToken.sol index 5098d21..b06b337 100644 --- a/contracts/GitRepositoryToken.sol +++ b/contracts/GitRepositoryToken.sol @@ -14,7 +14,7 @@ */ import "LockerToken.sol"; -import "Owned.sol"; +import "Controlled.sol"; pragma solidity ^0.4.11; diff --git a/contracts/Lockable.sol b/contracts/Lockable.sol index 0950aee..45e5c64 100644 --- a/contracts/Lockable.sol +++ b/contracts/Lockable.sol @@ -1,5 +1,3 @@ -import "./Owned.sol"; - pragma solidity ^0.4.11; contract Lockable { diff --git a/contracts/LockerToken.sol b/contracts/LockerToken.sol index cfc295a..7ea7e40 100644 --- a/contracts/LockerToken.sol +++ b/contracts/LockerToken.sol @@ -7,10 +7,11 @@ import "./AbstractToken.sol"; import "Lockable.sol"; +import "Controlled.sol"; pragma solidity ^0.4.11; -contract LockerToken is AbstractToken, Lockable, Owned { +contract LockerToken is AbstractToken, Lockable, Controlled { Lockable public locker = this; function unlinkLocker() only_owner { diff --git a/contracts/Owned.sol b/contracts/Owned.sol deleted file mode 100644 index 1552c91..0000000 --- a/contracts/Owned.sol +++ /dev/null @@ -1,17 +0,0 @@ -pragma solidity ^0.4.11; - -contract Owned { - address public owner= msg.sender; - event NewOwner(address owner); - - modifier only_owner { - if (msg.sender != owner) throw; - _; - } - - function setOwner(address _owner) - only_owner { - owner = _owner; - NewOwner(_owner); - } -}