Skip to content

Commit

Permalink
Remove isGlobaSkill function in favour of using getSkill
Browse files Browse the repository at this point in the history
  • Loading branch information
elenadimitrova committed Jul 17, 2018
1 parent 191d06e commit fdfc184
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
4 changes: 0 additions & 4 deletions contracts/ColonyNetwork.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ contract ColonyNetwork is ColonyNetworkStorage {
return (skill.nParents, skill.nChildren, skill.globalSkill);
}

function isGlobalSkill(uint256 _skillId) public view returns (bool) {
return skills[_skillId].globalSkill;
}

function getReputationRootHash() public view returns (bytes32) {
return reputationRootHash;
}
Expand Down
4 changes: 3 additions & 1 deletion contracts/ColonyStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ contract ColonyStorage is DSAuth, DSMath {

modifier globalSkill(uint256 _skillId) {
IColonyNetwork colonyNetworkContract = IColonyNetwork(colonyNetworkAddress);
require(colonyNetworkContract.isGlobalSkill(_skillId));
bool isGlobalSkill;
(, , isGlobalSkill) = colonyNetworkContract.getSkill(_skillId);
require(isGlobalSkill);
_;
}

Expand Down
5 changes: 0 additions & 5 deletions contracts/IColonyNetwork.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ contract IColonyNetwork {
/// @return isGlobalSkill true if specified skill is a global skill, otherwise false
function getSkill(uint256 _skillId) public view returns (uint256 nParents, uint256 nChildren, bool isGlobalSkill);

/// @notice Checks if skill with id `_skillId` is a global skill
/// @param _skillId Id of the skill
/// @return isGlobalSkill true if skill with id `_skillId` is a global skill, false otherwise
function isGlobalSkill(uint256 _skillId) public view returns (bool isGlobalSkill);

/// @notice Adds a reputation update entry to log
/// @dev Errors if it is called by anyone but a colony or if skill with id `_skillId` does not exist or
/// @param _user The address of the user for the reputation update
Expand Down
16 changes: 8 additions & 8 deletions test/colony-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ contract("ColonyNetwork", accounts => {
assert.equal(rootGlobalSkill[0].toNumber(), 0);
assert.equal(rootGlobalSkill[1].toNumber(), 0);

const globalSkill1 = await colonyNetwork.isGlobalSkill.call(1);
assert.isTrue(globalSkill1);
const globalSkill1 = await colonyNetwork.getSkill.call(1);
assert.isTrue(globalSkill1[2]);

const globalSkill2 = await colonyNetwork.isGlobalSkill.call(2);
assert.isFalse(globalSkill2);
const globalSkill2 = await colonyNetwork.getSkill.call(2);
assert.isFalse(globalSkill2[2]);

const localSkill1 = await colonyNetwork.isGlobalSkill.call(3);
assert.isFalse(localSkill1);
const localSkill1 = await colonyNetwork.getSkill.call(3);
assert.isFalse(localSkill1[2]);

const rootGlobalSkillId = await colonyNetwork.getRootGlobalSkillId.call();
assert.equal(rootGlobalSkillId, 1);
Expand All @@ -142,8 +142,8 @@ contract("ColonyNetwork", accounts => {
assert.equal(rootLocalSkill[0].toNumber(), 0);
assert.equal(rootLocalSkill[1].toNumber(), 0);

const isGlobal = await colonyNetwork.isGlobalSkill.call(2);
assert.isFalse(isGlobal);
const skill = await colonyNetwork.getSkill.call(2);
assert.isFalse(skill[2]);

const { colonyAddress } = logs[0].args;
const colony = await Colony.at(colonyAddress);
Expand Down

0 comments on commit fdfc184

Please sign in to comment.