diff --git a/.circleci/config.yml b/.circleci/config.yml
index 6cce6f5c41..869881ada7 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -22,7 +22,7 @@ step_setup_global_packages: &step_setup_global_packages
yarn run provision:token:contracts
step_pull_solc_docker: &step_pull_solc_docker
run:
- name: "Pull solc 0.4.23 docker image"
+ name: "Pull solc docker image"
command: docker pull ethereum/solc:0.4.23
jobs:
lint-and-unit-test:
diff --git a/.gitignore b/.gitignore
index 21dda6701f..bd45bdcbe0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,8 +2,6 @@ node_modules
parity-genesis.json
contracts/Updated*
contracts/IUpdated*
-contracts/Token.sol
-contracts/TokenAuthority.sol
keys/*
test-results.xml
0
diff --git a/.solcover.js b/.solcover.js
index 7ea9b59cc0..cb711ba536 100644
--- a/.solcover.js
+++ b/.solcover.js
@@ -2,11 +2,10 @@ module.exports = {
skipFiles: [
'Migrations.sol',
'EtherRouter.sol',
- 'gnosis',
- 'ERC20ExtendedToken.sol',
- 'PatriciaTree'
+ 'PatriciaTree',
+ 'ERC20ExtendedToken.sol'
],
- compileCommand: '../node_modules/.bin/truffle compile',
+ compileCommand: 'yarn run provision:token:contracts:compile',
testCommand: '../node_modules/.bin/truffle test --network coverage',
testrpcOptions: `--port 8555 -i 1999 --acctKeys="./coverageEnv/ganache-accounts.json" --noVMErrorsOnRPCResponse --accounts 12`
};
diff --git a/.soliumignore b/.soliumignore
index 59d7dfacc8..357f9ef2fe 100644
--- a/.soliumignore
+++ b/.soliumignore
@@ -2,9 +2,6 @@ node_modules
helpers
migrations
test
-contracts/Migrations.sol
-contracts/Token.sol
-contracts/TokenAuthority.sol
-contracts/gnosis/MultiSigWallet.sol
lib
-packages
\ No newline at end of file
+packages
+contracts/Migrations.sol
\ No newline at end of file
diff --git a/contracts/Colony.sol b/contracts/Colony.sol
index 3ed96b4ee5..eec75a4285 100755
--- a/contracts/Colony.sol
+++ b/contracts/Colony.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23 <0.5.0;
pragma experimental ABIEncoderV2;
import "./ColonyStorage.sol";
@@ -31,7 +30,7 @@ contract Colony is ColonyStorage, PatriciaTreeProofs {
function setFounderRole(address _user) public stoppable auth {
// To allow only one address to have founder role at a time, we have to remove current founder from their role
- ColonyAuthority colonyAuthority = ColonyAuthority(authority);
+ ColonyAuthority colonyAuthority = ColonyAuthority(address(authority));
colonyAuthority.setUserRole(msg.sender, FOUNDER_ROLE, false);
colonyAuthority.setUserRole(_user, FOUNDER_ROLE, true);
@@ -39,20 +38,20 @@ contract Colony is ColonyStorage, PatriciaTreeProofs {
}
function setAdminRole(address _user) public stoppable auth {
- ColonyAuthority(authority).setUserRole(_user, ADMIN_ROLE, true);
+ ColonyAuthority(address(authority)).setUserRole(_user, ADMIN_ROLE, true);
emit ColonyAdminRoleSet(_user);
}
// Can only be called by the founder role.
function removeAdminRole(address _user) public stoppable auth {
- ColonyAuthority(authority).setUserRole(_user, ADMIN_ROLE, false);
+ ColonyAuthority(address(authority)).setUserRole(_user, ADMIN_ROLE, false);
emit ColonyAdminRoleRemoved(_user);
}
function hasUserRole(address _user, uint8 _role) public view returns (bool) {
- return ColonyAuthority(authority).hasUserRole(_user, _role);
+ return ColonyAuthority(address(authority)).hasUserRole(_user, _role);
}
function getColonyNetworkAddress() public view returns (address) {
@@ -69,7 +68,7 @@ contract Colony is ColonyStorage, PatriciaTreeProofs {
}
function getToken() public view returns (address) {
- return token;
+ return address(token);
}
function initialiseColony(address _colonyNetworkAddress) public stoppable {
@@ -104,7 +103,7 @@ contract Colony is ColonyStorage, PatriciaTreeProofs {
emit ColonyInitialised(_colonyNetworkAddress);
}
- function bootstrapColony(address[] _users, int[] _amounts) public
+ function bootstrapColony(address[] memory _users, int[] memory _amounts) public
stoppable
auth
isInBootstrapPhase
@@ -132,12 +131,12 @@ contract Colony is ColonyStorage, PatriciaTreeProofs {
// Only the colony Network can call this function
require(msg.sender == colonyNetworkAddress, "colony-access-denied-only-network-allowed");
// Function only valid on the Meta Colony
- require(this == IColonyNetwork(colonyNetworkAddress).getMetaColony(), "colony-access-denied-only-meta-colony-allowed");
+ require(address(this) == IColonyNetwork(colonyNetworkAddress).getMetaColony(), "colony-access-denied-only-meta-colony-allowed");
token.mint(_wad);
token.transfer(colonyNetworkAddress, _wad);
}
- function registerColonyLabel(string colonyName, string orbitdb) public stoppable auth {
+ function registerColonyLabel(string memory colonyName, string memory orbitdb) public stoppable auth {
IColonyNetwork(colonyNetworkAddress).registerColonyLabel(colonyName, orbitdb);
}
@@ -184,7 +183,7 @@ contract Colony is ColonyStorage, PatriciaTreeProofs {
initialiseDomain(newLocalSkill);
}
- function getDomain(uint256 _id) public view returns (Domain domain) {
+ function getDomain(uint256 _id) public view returns (Domain memory domain) {
domain = domains[_id];
}
@@ -192,7 +191,7 @@ contract Colony is ColonyStorage, PatriciaTreeProofs {
return domainCount;
}
- modifier verifyKey(bytes key) {
+ modifier verifyKey(bytes memory key) {
uint256 colonyAddress;
uint256 skillid;
uint256 userAddress;
@@ -209,7 +208,7 @@ contract Colony is ColonyStorage, PatriciaTreeProofs {
_;
}
- function verifyReputationProof(bytes key, bytes value, uint branchMask, bytes32[] siblings) // solium-disable-line security/no-assign-params
+ function verifyReputationProof(bytes memory key, bytes memory value, uint branchMask, bytes32[] memory siblings)
public view
stoppable
verifyKey(key)
@@ -228,9 +227,9 @@ contract Colony is ColonyStorage, PatriciaTreeProofs {
require(_newVersion > currentVersion, "colony-version-must-be-newer");
// Requested version has to be registered
address newResolver = IColonyNetwork(colonyNetworkAddress).getColonyVersionResolver(_newVersion);
- require(newResolver != 0x0, "colony-version-must-be-registered");
- EtherRouter e = EtherRouter(address(this));
- e.setResolver(newResolver);
+ require(newResolver != address(0x0), "colony-version-must-be-registered");
+ EtherRouter currentColony = EtherRouter(address(this));
+ currentColony.setResolver(newResolver);
emit ColonyUpgraded(currentVersion, _newVersion);
}
diff --git a/contracts/ColonyAuthority.sol b/contracts/ColonyAuthority.sol
index aa8033a70c..803d916c49 100644
--- a/contracts/ColonyAuthority.sol
+++ b/contracts/ColonyAuthority.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "./CommonAuthority.sol";
@@ -70,12 +69,12 @@ contract ColonyAuthority is CommonAuthority {
setFounderRoleCapability(colony, "setAdminRole(address)");
}
- function setFounderRoleCapability(address colony, bytes sig) private {
+ function setFounderRoleCapability(address colony, bytes memory sig) private {
bytes4 functionSig = bytes4(keccak256(sig));
setRoleCapability(founderRole, colony, functionSig, true);
}
- function setAdminRoleCapability(address colony, bytes sig) private {
+ function setAdminRoleCapability(address colony, bytes memory sig) private {
bytes4 functionSig = bytes4(keccak256(sig));
setRoleCapability(adminRole, colony, functionSig, true);
}
diff --git a/contracts/ColonyDataTypes.sol b/contracts/ColonyDataTypes.sol
index 2f31b65862..481138c480 100755
--- a/contracts/ColonyDataTypes.sol
+++ b/contracts/ColonyDataTypes.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
contract ColonyDataTypes {
diff --git a/contracts/ColonyFunding.sol b/contracts/ColonyFunding.sol
index 5226511c01..2cde7515e9 100755
--- a/contracts/ColonyFunding.sol
+++ b/contracts/ColonyFunding.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23 <0.5.0;
pragma experimental "ABIEncoderV2";
import "./ColonyStorage.sol";
@@ -52,8 +51,15 @@ contract ColonyFunding is ColonyStorage, PatriciaTreeProofs {
{
Task storage task = tasks[_id];
- require(task.roles[EVALUATOR].user == task.roles[MANAGER].user || task.roles[EVALUATOR].user == 0x0, "colony-funding-evaluator-already-set");
- require(task.roles[WORKER].user == task.roles[MANAGER].user || task.roles[WORKER].user == 0x0, "colony-funding-worker-already-set");
+ require(
+ task.roles[EVALUATOR].user == task.roles[MANAGER].user ||
+ task.roles[EVALUATOR].user == address(0x0),
+ "colony-funding-evaluator-already-set");
+
+ require(
+ task.roles[WORKER].user == task.roles[MANAGER].user ||
+ task.roles[WORKER].user == address(0x0),
+ "colony-funding-worker-already-set");
this.setTaskManagerPayout(_id, _token, _managerAmount);
this.setTaskEvaluatorPayout(_id, _token, _evaluatorAmount);
@@ -95,10 +101,9 @@ contract ColonyFunding is ColonyStorage, PatriciaTreeProofs {
uint fee = calculateNetworkFeeForPayout(payout);
uint remainder = sub(payout, fee);
- if (_token == 0x0) {
+ if (_token == address(0x0)) {
// Payout ether
- address user = task.roles[_role].user;
- user.transfer(remainder);
+ msg.sender.transfer(remainder);
// Fee goes directly to Meta Colony
IColonyNetwork colonyNetworkContract = IColonyNetwork(colonyNetworkAddress);
address metaColonyAddress = colonyNetworkContract.getMetaColony();
@@ -169,13 +174,13 @@ contract ColonyFunding is ColonyStorage, PatriciaTreeProofs {
uint toClaim;
uint feeToPay;
uint remainder;
- if (_token == 0x0) {
+ if (_token == address(0x0)) {
// It's ether
toClaim = sub(sub(address(this).balance, nonRewardPotsTotal[_token]), pots[0].balance[_token]);
} else {
// Assume it's an ERC 20 token.
ERC20Extended targetToken = ERC20Extended(_token);
- toClaim = sub(sub(targetToken.balanceOf(this), nonRewardPotsTotal[_token]), pots[0].balance[_token]);
+ toClaim = sub(sub(targetToken.balanceOf(address(this)), nonRewardPotsTotal[_token]), pots[0].balance[_token]);
}
feeToPay = toClaim / getRewardInverse();
@@ -191,7 +196,9 @@ contract ColonyFunding is ColonyStorage, PatriciaTreeProofs {
return nonRewardPotsTotal[_token];
}
- function startNextRewardPayout(address _token, bytes key, bytes value, uint256 branchMask, bytes32[] siblings) public auth stoppable {
+ function startNextRewardPayout(address _token, bytes memory key, bytes memory value, uint256 branchMask, bytes32[] memory siblings)
+ public auth stoppable
+ {
ITokenLocking tokenLocking = ITokenLocking(IColonyNetwork(colonyNetworkAddress).getTokenLocking());
uint256 totalLockCount = tokenLocking.lockToken(address(token));
@@ -204,7 +211,7 @@ contract ColonyFunding is ColonyStorage, PatriciaTreeProofs {
uint256 colonyWideReputation = checkReputation(
rootHash,
domains[1].skillId,
- 0x0,
+ address(0x0),
key,
value,
branchMask,
@@ -228,11 +235,11 @@ contract ColonyFunding is ColonyStorage, PatriciaTreeProofs {
function claimRewardPayout(
uint256 _payoutId,
- uint256[7] _squareRoots,
- bytes key,
- bytes value,
+ uint256[7] memory _squareRoots,
+ bytes memory key,
+ bytes memory value,
uint256 branchMask,
- bytes32[] siblings
+ bytes32[] memory siblings
) public stoppable
{
uint256 userReputation = checkReputation(
@@ -271,7 +278,7 @@ contract ColonyFunding is ColonyStorage, PatriciaTreeProofs {
emit RewardPayoutCycleEnded(_payoutId);
}
- function getRewardPayoutInfo(uint256 _payoutId) public view returns (RewardPayoutCycle rewardPayoutCycle) {
+ function getRewardPayoutInfo(uint256 _payoutId) public view returns (RewardPayoutCycle memory rewardPayoutCycle) {
rewardPayoutCycle = rewardPayoutCycles[_payoutId];
}
@@ -293,10 +300,10 @@ contract ColonyFunding is ColonyStorage, PatriciaTreeProofs {
bytes32 rootHash,
uint256 skillId,
address userAddress,
- bytes key,
- bytes value,
+ bytes memory key,
+ bytes memory value,
uint256 branchMask,
- bytes32[] siblings
+ bytes32[] memory siblings
) internal view returns (uint256)
{
bytes32 impliedRoot = getImpliedRootHashKey(key, value, branchMask, siblings);
@@ -321,7 +328,7 @@ contract ColonyFunding is ColonyStorage, PatriciaTreeProofs {
return reputationValue;
}
- function calculateRewardForUser(uint256 payoutId, uint256[7] squareRoots, uint256 userReputation) internal returns (address, uint256) {
+ function calculateRewardForUser(uint256 payoutId, uint256[7] memory squareRoots, uint256 userReputation) internal returns (address, uint256) {
RewardPayoutCycle memory payout = rewardPayoutCycles[payoutId];
// Checking if payout is active
require(block.timestamp - payout.blockTimestamp <= 60 days, "colony-reward-payout-not-active");
diff --git a/contracts/ColonyNetwork.sol b/contracts/ColonyNetwork.sol
index 07d565a6de..ce1ac36bdf 100644
--- a/contracts/ColonyNetwork.sol
+++ b/contracts/ColonyNetwork.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23 <0.5.0;
pragma experimental "ABIEncoderV2";
import "./ColonyAuthority.sol";
@@ -71,7 +70,7 @@ contract ColonyNetwork is ColonyNetworkStorage {
return colonyVersionResolver[_version];
}
- function getSkill(uint256 _skillId) public view returns (Skill skill) {
+ function getSkill(uint256 _skillId) public view returns (Skill memory skill) {
skill = skills[_skillId];
}
@@ -96,7 +95,7 @@ contract ColonyNetwork is ColonyNetworkStorage {
auth
{
// Token locking address can't be changed
- require(tokenLocking == 0x0, "colony-invalid-token-locking-address");
+ require(tokenLocking == address(0x0), "colony-invalid-token-locking-address");
tokenLocking = _tokenLocking;
emit TokenLockingAddressSet(_tokenLocking);
@@ -123,7 +122,7 @@ contract ColonyNetwork is ColonyNetworkStorage {
stoppable
auth
{
- require(metaColony == 0, "colony-meta-colony-exists-already");
+ require(metaColony == address(0x0), "colony-meta-colony-exists-already");
// Add the root global skill
skillCount += 1;
Skill memory rootGlobalSkill;
@@ -145,34 +144,33 @@ contract ColonyNetwork is ColonyNetworkStorage {
{
require(currentColonyVersion > 0, "colony-network-not-initialised-cannot-create-colony");
EtherRouter etherRouter = new EtherRouter();
+ IColony colony = IColony(address(etherRouter));
address resolverForLatestColonyVersion = colonyVersionResolver[currentColonyVersion];
etherRouter.setResolver(resolverForLatestColonyVersion);
-
- IColony colony = IColony(etherRouter);
colony.setToken(_tokenAddress);
// Creating new instance of colony's authority
- ColonyAuthority authority = new ColonyAuthority(colony);
+ ColonyAuthority authority = new ColonyAuthority(address(colony));
DSAuth dsauth = DSAuth(etherRouter);
dsauth.setAuthority(authority);
- authority.setOwner(etherRouter);
+ authority.setOwner(address(etherRouter));
colony.setFounderRole(msg.sender);
// Colony will not have owner
- dsauth.setOwner(0x0);
+ dsauth.setOwner(address(0x0));
// Initialise the root (domain) local skill with defaults by just incrementing the skillCount
skillCount += 1;
colonyCount += 1;
- colonies[colonyCount] = colony;
- _isColony[colony] = true;
+ colonies[colonyCount] = address(colony);
+ _isColony[address(colony)] = true;
- colony.initialiseColony(this);
- emit ColonyAdded(colonyCount, etherRouter, _tokenAddress);
+ colony.initialiseColony(address(this));
+ emit ColonyAdded(colonyCount, address(etherRouter), _tokenAddress);
- return etherRouter;
+ return address(etherRouter);
}
function addColonyVersion(uint _version, address _resolver) public
diff --git a/contracts/ColonyNetworkAuction.sol b/contracts/ColonyNetworkAuction.sol
index 9af719dba6..985e6ee75a 100644
--- a/contracts/ColonyNetworkAuction.sol
+++ b/contracts/ColonyNetworkAuction.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23 <0.5.0;
import "./ColonyNetworkStorage.sol";
@@ -24,15 +23,15 @@ import "./ColonyNetworkStorage.sol";
contract ColonyNetworkAuction is ColonyNetworkStorage {
function startTokenAuction(address _token) public stoppable {
- require(_token != 0x0, "colony-auction-invalid-token");
+ require(_token != address(0x0), "colony-auction-invalid-token");
uint lastAuctionTimestamp = recentAuctions[_token];
require(lastAuctionTimestamp == 0 || now - lastAuctionTimestamp >= 30 days, "colony-auction-start-too-soon");
address clny = IMetaColony(metaColony).getToken();
- require(clny != 0x0, "colony-auction-invalid-clny-token");
+ require(clny != address(0x0), "colony-auction-invalid-clny-token");
- uint availableTokens = ERC20Extended(_token).balanceOf(this);
+ uint availableTokens = ERC20Extended(_token).balanceOf(address(this));
if (_token==clny) {
// We don't auction CLNY. We just burn it instead.
@@ -42,7 +41,7 @@ contract ColonyNetworkAuction is ColonyNetworkStorage {
}
DutchAuction auction = new DutchAuction(clny, _token, metaColony);
- ERC20Extended(_token).transfer(auction, availableTokens);
+ ERC20Extended(_token).transfer(address(auction), availableTokens);
auction.start();
recentAuctions[_token] = now;
emit AuctionCreated(address(auction), _token, availableTokens);
@@ -122,7 +121,7 @@ contract DutchAuction is DSMath {
function start() public
auctionNotStarted
{
- quantity = token.balanceOf(this);
+ quantity = token.balanceOf(address(this));
assert(quantity > 0);
// Set the minimum price as such that it doesn't cause the finalPrice to be 0
@@ -174,7 +173,7 @@ contract DutchAuction is DSMath {
bidCount += 1;
}
- clnyToken.transferFrom(msg.sender, this, amount);
+ clnyToken.transferFrom(msg.sender, address(this), amount);
bids[msg.sender] = add(bids[msg.sender], amount);
receivedTotal = add(receivedTotal, amount);
@@ -219,11 +218,11 @@ contract DutchAuction is DSMath {
allBidsClaimed
{
// Transfer token remainder to the network
- uint auctionTokenBalance = token.balanceOf(this);
+ uint auctionTokenBalance = token.balanceOf(address(this));
token.transfer(colonyNetwork, auctionTokenBalance);
// Check this contract balances in the working tokens is 0 before we kill it
- assert(clnyToken.balanceOf(this) == 0);
- assert(token.balanceOf(this) == 0);
+ assert(clnyToken.balanceOf(address(this)) == 0);
+ assert(token.balanceOf(address(this)) == 0);
selfdestruct(colonyNetwork);
}
}
diff --git a/contracts/ColonyNetworkAuthority.sol b/contracts/ColonyNetworkAuthority.sol
index d1a66014f8..4488acc894 100644
--- a/contracts/ColonyNetworkAuthority.sol
+++ b/contracts/ColonyNetworkAuthority.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "./CommonAuthority.sol";
diff --git a/contracts/ColonyNetworkDataTypes.sol b/contracts/ColonyNetworkDataTypes.sol
index e843c75d7a..a893d7d621 100755
--- a/contracts/ColonyNetworkDataTypes.sol
+++ b/contracts/ColonyNetworkDataTypes.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
contract ColonyNetworkDataTypes {
diff --git a/contracts/ColonyNetworkENS.sol b/contracts/ColonyNetworkENS.sol
index 269674ae8b..c5bbddacc0 100644
--- a/contracts/ColonyNetworkENS.sol
+++ b/contracts/ColonyNetworkENS.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "./ens/ENS.sol";
import "./ColonyNetworkStorage.sol";
@@ -30,9 +29,9 @@ contract ColonyNetworkENS is ColonyNetworkStorage {
bytes32 constant USER_HASH = keccak256("user");
bytes32 constant COLONY_HASH = keccak256("colony");
- modifier unowned(bytes32 node, string domainName) {
+ modifier unowned(bytes32 node, string memory domainName) {
address currentOwner = ENS(ens).owner(keccak256(abi.encodePacked(node, keccak256(abi.encodePacked(domainName)))));
- require(currentOwner == 0, "colony-label-already-owned");
+ require(currentOwner == address(0x0), "colony-label-already-owned");
_;
}
@@ -49,11 +48,11 @@ contract ColonyNetworkENS is ColonyNetworkStorage {
rootNode = _rootNode;
userNode = keccak256(abi.encodePacked(rootNode, USER_HASH));
colonyNode = keccak256(abi.encodePacked(rootNode, COLONY_HASH));
- ENS(ens).setSubnodeOwner(rootNode, USER_HASH, this);
- ENS(ens).setSubnodeOwner(rootNode, COLONY_HASH, this);
+ ENS(ens).setSubnodeOwner(rootNode, USER_HASH, address(this));
+ ENS(ens).setSubnodeOwner(rootNode, COLONY_HASH, address(this));
}
- function registerUserLabel(string username, string orbitdb)
+ function registerUserLabel(string memory username, string memory orbitdb)
public
stoppable
// NB there is no way to call this as a colony yet - this is just future proofing us once there is
@@ -63,16 +62,16 @@ contract ColonyNetworkENS is ColonyNetworkStorage {
require(bytes(username).length > 0, "colony-user-label-invalid");
require(bytes(userLabels[msg.sender]).length == 0, "colony-user-label-already-owned");
bytes32 subnode = keccak256(abi.encodePacked(username));
- ENS(ens).setSubnodeOwner(userNode, subnode, this);
+ ENS(ens).setSubnodeOwner(userNode, subnode, address(this));
bytes32 node = keccak256(abi.encodePacked(userNode, subnode));
- ENS(ens).setResolver(node, this);
+ ENS(ens).setResolver(node, address(this));
records[node].addr = msg.sender;
records[node].orbitdb = orbitdb;
userLabels[msg.sender] = username;
emit UserLabelRegistered(msg.sender, subnode);
}
- function registerColonyLabel(string colonyName, string orbitdb)
+ function registerColonyLabel(string memory colonyName, string memory orbitdb)
public
calledByColony
unowned(colonyNode, colonyName)
@@ -82,20 +81,20 @@ contract ColonyNetworkENS is ColonyNetworkStorage {
require(bytes(colonyLabels[msg.sender]).length == 0, "colony-already-labeled");
bytes32 subnode = keccak256(abi.encodePacked(colonyName));
- ENS(ens).setSubnodeOwner(colonyNode, subnode, this);
+ ENS(ens).setSubnodeOwner(colonyNode, subnode, address(this));
bytes32 node = keccak256(abi.encodePacked(colonyNode, subnode));
- ENS(ens).setResolver(node, this);
+ ENS(ens).setResolver(node, address(this));
records[node].addr = msg.sender;
records[node].orbitdb = orbitdb;
colonyLabels[msg.sender] = colonyName;
emit ColonyLabelRegistered(msg.sender, subnode);
}
- function getProfileDBAddress(bytes32 node) public view returns (string) {
+ function getProfileDBAddress(bytes32 node) public view returns (string memory orbitDB) {
return records[node].orbitdb;
}
- function lookupRegisteredENSDomain(address addr) public view returns(string) {
+ function lookupRegisteredENSDomain(address addr) public view returns(string memory domain) {
if (bytes(userLabels[addr]).length != 0) {
return string(abi.encodePacked(userLabels[addr], ".user.joincolony.eth"));
} else if (bytes(colonyLabels[addr]).length != 0) {
diff --git a/contracts/ColonyNetworkMining.sol b/contracts/ColonyNetworkMining.sol
index 8694a56c95..25ad9222e3 100644
--- a/contracts/ColonyNetworkMining.sol
+++ b/contracts/ColonyNetworkMining.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "./ColonyNetworkStorage.sol";
@@ -58,7 +57,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage {
}
function getReplacementReputationUpdateLogEntry(address _reputationMiningCycle, uint256 _id) public view returns
- (ReputationLogEntry reputationLogEntry)
+ (ReputationLogEntry memory reputationLogEntry)
{
reputationLogEntry = replacementReputationUpdateLog[_reputationMiningCycle][_id];
}
@@ -67,14 +66,14 @@ contract ColonyNetworkMining is ColonyNetworkStorage {
return replacementReputationUpdateLogsExist[_reputationMiningCycle];
}
- function setReputationRootHash(bytes32 newHash, uint256 newNNodes, address[] stakers, uint256 reward) public
+ function setReputationRootHash(bytes32 newHash, uint256 newNNodes, address[] memory stakers, uint256 reward) public
stoppable
onlyReputationMiningCycle
{
reputationRootHash = newHash;
reputationRootHashNNodes = newNNodes;
// Reward stakers
- activeReputationMiningCycle = 0x0;
+ activeReputationMiningCycle = address(0x0);
startNextCycle();
rewardStakers(stakers, reward);
@@ -82,12 +81,13 @@ contract ColonyNetworkMining is ColonyNetworkStorage {
}
function initialiseReputationMining() public stoppable {
- require(inactiveReputationMiningCycle == 0x0, "colony-reputation-mining-already-initialised");
+ require(inactiveReputationMiningCycle == address(0x0), "colony-reputation-mining-already-initialised");
address clnyToken = IMetaColony(metaColony).getToken();
- require(clnyToken != 0x0, "colony-reputation-mining-clny-token-invalid-address");
+ require(clnyToken != address(0x0), "colony-reputation-mining-clny-token-invalid-address");
- inactiveReputationMiningCycle = new EtherRouter();
- EtherRouter(inactiveReputationMiningCycle).setResolver(miningCycleResolver);
+ EtherRouter e = new EtherRouter();
+ e.setResolver(miningCycleResolver);
+ inactiveReputationMiningCycle = address(e);
IReputationMiningCycle(inactiveReputationMiningCycle).initialise(tokenLocking, clnyToken);
emit ReputationMiningInitialised(inactiveReputationMiningCycle);
@@ -95,15 +95,16 @@ contract ColonyNetworkMining is ColonyNetworkStorage {
function startNextCycle() public stoppable {
address clnyToken = IMetaColony(metaColony).getToken();
- require(clnyToken != 0x0, "colony-reputation-mining-clny-token-invalid-address");
- require(activeReputationMiningCycle == 0x0, "colony-reputation-mining-still-active");
- require(inactiveReputationMiningCycle != 0x0, "colony-reputation-mining-not-initialised");
+ require(clnyToken != address(0x0), "colony-reputation-mining-clny-token-invalid-address");
+ require(activeReputationMiningCycle == address(0x0), "colony-reputation-mining-still-active");
+ require(inactiveReputationMiningCycle != address(0x0), "colony-reputation-mining-not-initialised");
// Inactive now becomes active
activeReputationMiningCycle = inactiveReputationMiningCycle;
IReputationMiningCycle(activeReputationMiningCycle).resetWindow();
- inactiveReputationMiningCycle = new EtherRouter();
- EtherRouter(inactiveReputationMiningCycle).setResolver(miningCycleResolver);
+ EtherRouter e = new EtherRouter();
+ e.setResolver(miningCycleResolver);
+ inactiveReputationMiningCycle = address(e);
IReputationMiningCycle(inactiveReputationMiningCycle).initialise(tokenLocking, clnyToken);
emit ReputationMiningCycleComplete(reputationRootHash, reputationRootHashNNodes);
}
@@ -134,7 +135,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage {
return wmul(stakeTerm, submissionTerm);
}
- function rewardStakers(address[] stakers, uint256 reward) internal {
+ function rewardStakers(address[] memory stakers, uint256 reward) internal {
// Internal unlike punish, because it's only ever called from setReputationRootHash
// Passing an array so that we don't incur the EtherRouter overhead for each staker if we looped over
diff --git a/contracts/ColonyNetworkStorage.sol b/contracts/ColonyNetworkStorage.sol
index e377fde742..75764c0ed2 100644
--- a/contracts/ColonyNetworkStorage.sol
+++ b/contracts/ColonyNetworkStorage.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23 <0.5.0;
import "../lib/dappsys/math.sol";
import "./ERC20Extended.sol";
diff --git a/contracts/ColonyStorage.sol b/contracts/ColonyStorage.sol
index 2d4497ccd9..42117b7b57 100755
--- a/contracts/ColonyStorage.sol
+++ b/contracts/ColonyStorage.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "../lib/dappsys/math.sol";
import "./ERC20Extended.sol";
@@ -141,7 +140,7 @@ contract ColonyStorage is CommonStorage, ColonyDataTypes, DSMath {
}
modifier isAdmin(address _user) {
- require(ColonyAuthority(authority).hasUserRole(_user, ADMIN_ROLE), "colony-not-admin");
+ require(ColonyAuthority(address(authority)).hasUserRole(_user, ADMIN_ROLE), "colony-not-admin");
_;
}
diff --git a/contracts/ColonyTask.sol b/contracts/ColonyTask.sol
index 580a64c25c..000ddcd5f8 100755
--- a/contracts/ColonyTask.sol
+++ b/contracts/ColonyTask.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "./ColonyStorage.sol";
@@ -128,12 +127,12 @@ contract ColonyTask is ColonyStorage {
}
function executeTaskChange(
- uint8[] _sigV,
- bytes32[] _sigR,
- bytes32[] _sigS,
- uint8[] _mode,
+ uint8[] memory _sigV,
+ bytes32[] memory _sigR,
+ bytes32[] memory _sigS,
+ uint8[] memory _mode,
uint256 _value,
- bytes _data) public stoppable
+ bytes memory _data) public stoppable
{
require(_value == 0, "colony-task-change-non-zero-value");
require(_sigR.length == _sigS.length && _sigR.length == _sigV.length, "colony-task-change-signatures-count-do-not-match");
@@ -187,12 +186,12 @@ contract ColonyTask is ColonyStorage {
}
function executeTaskRoleAssignment(
- uint8[] _sigV,
- bytes32[] _sigR,
- bytes32[] _sigS,
- uint8[] _mode,
+ uint8[] memory _sigV,
+ bytes32[] memory _sigR,
+ bytes32[] memory _sigS,
+ uint8[] memory _mode,
uint256 _value,
- bytes _data) public stoppable
+ bytes memory _data) public stoppable
{
require(_value == 0, "colony-task-role-assignment-non-zero-value");
require(_sigR.length == _sigS.length && _sigR.length == _sigV.length, "colony-task-role-assignment-signatures-count-do-not-match");
@@ -296,22 +295,22 @@ contract ColonyTask is ColonyStorage {
function setTaskEvaluatorRole(uint256 _id, address _user) public stoppable self {
// Can only assign role if no one is currently assigned to it
- require(tasks[_id].roles[EVALUATOR].user == 0x0, "colony-task-evaluator-role-already-assigned");
+ require(tasks[_id].roles[EVALUATOR].user == address(0x0), "colony-task-evaluator-role-already-assigned");
setTaskRoleUser(_id, EVALUATOR, _user);
}
function setTaskWorkerRole(uint256 _id, address _user) public stoppable self {
// Can only assign role if no one is currently assigned to it
- require(tasks[_id].roles[WORKER].user == 0x0, "colony-task-worker-role-already-assigned");
+ require(tasks[_id].roles[WORKER].user == address(0x0), "colony-task-worker-role-already-assigned");
setTaskRoleUser(_id, WORKER, _user);
}
function removeTaskEvaluatorRole(uint256 _id) public stoppable self {
- setTaskRoleUser(_id, EVALUATOR, 0x0);
+ setTaskRoleUser(_id, EVALUATOR, address(0x0));
}
function removeTaskWorkerRole(uint256 _id) public stoppable self {
- setTaskRoleUser(_id, WORKER, 0x0);
+ setTaskRoleUser(_id, WORKER, address(0x0));
}
function setTaskDomain(uint256 _id, uint256 _domainId) public
@@ -421,7 +420,7 @@ contract ColonyTask is ColonyStorage {
emit TaskCanceled(_id);
}
- function getTask(uint256 _id) public view returns (bytes32, bytes32, uint8, uint256, uint256, uint256, uint256, uint256, uint256[]) {
+ function getTask(uint256 _id) public view returns (bytes32, bytes32, uint8, uint256, uint256, uint256, uint256, uint256, uint256[] memory) {
Task storage t = tasks[_id];
return (
t.specificationHash,
@@ -436,7 +435,7 @@ contract ColonyTask is ColonyStorage {
);
}
- function getTaskRole(uint256 _id, uint8 _role) public view returns (Role role) {
+ function getTaskRole(uint256 _id, uint8 _role) public view returns (Role memory role) {
role = tasks[_id].roles[_role];
}
@@ -453,7 +452,7 @@ contract ColonyTask is ColonyStorage {
role.rating = role.rateFail ? TaskRatings.Unsatisfactory : TaskRatings.Satisfactory;
}
- uint256 payout = task.payouts[roleId][token];
+ uint256 payout = task.payouts[roleId][address(token)];
int256 reputation = getReputation(payout, role.rating, role.rateFail);
colonyNetworkContract.appendReputationUpdateLog(role.user, reputation, domains[task.domainId].skillId);
@@ -477,12 +476,12 @@ contract ColonyTask is ColonyStorage {
}
function getReviewerAddresses(
- uint8[] _sigV,
- bytes32[] _sigR,
- bytes32[] _sigS,
- uint8[] _mode,
+ uint8[] memory _sigV,
+ bytes32[] memory _sigR,
+ bytes32[] memory _sigS,
+ uint8[] memory _mode,
bytes32 msgHash
- ) internal pure returns (address[])
+ ) internal pure returns (address[] memory)
{
address[] memory reviewerAddresses = new address[](_sigR.length);
for (uint i = 0; i < _sigR.length; i++) {
@@ -503,7 +502,7 @@ contract ColonyTask is ColonyStorage {
// The address.call() syntax is no longer recommended, see:
// https://github.com/ethereum/solidity/issues/2884
- function executeCall(address to, uint256 value, bytes data) internal returns (bool success) {
+ function executeCall(address to, uint256 value, bytes memory data) internal returns (bool success) {
assembly {
success := call(gas, to, value, add(data, 0x20), mload(data), 0, 0)
}
@@ -511,14 +510,14 @@ contract ColonyTask is ColonyStorage {
// Get the function signature and task id from the transaction bytes data
// Note: Relies on the encoded function's first parameter to be the uint256 taskId
- function deconstructCall(bytes _data) internal pure returns (bytes4 sig, uint256 taskId) {
+ function deconstructCall(bytes memory _data) internal pure returns (bytes4 sig, uint256 taskId) {
assembly {
sig := mload(add(_data, 0x20))
taskId := mload(add(_data, 0x24)) // same as calldataload(72)
}
}
- function deconstructRoleChangeCall(bytes _data) internal pure returns (bytes4 sig, uint256 taskId, address userAddress) {
+ function deconstructRoleChangeCall(bytes memory _data) internal pure returns (bytes4 sig, uint256 taskId, address userAddress) {
assembly {
sig := mload(add(_data, 0x20))
taskId := mload(add(_data, 0x24)) // same as calldataload(72)
diff --git a/contracts/CommonAuthority.sol b/contracts/CommonAuthority.sol
index 86b26a6f89..8e39b7803c 100644
--- a/contracts/CommonAuthority.sol
+++ b/contracts/CommonAuthority.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "../lib/dappsys/roles.sol";
@@ -31,7 +30,7 @@ contract CommonAuthority is DSRoles {
setRecoveryRoleCapability(contractAddress, "exitRecoveryMode()");
}
- function setRecoveryRoleCapability(address contractAddress, bytes sig) private {
+ function setRecoveryRoleCapability(address contractAddress, bytes memory sig) private {
bytes4 functionSig = bytes4(keccak256(sig));
setRoleCapability(recoveryRole, contractAddress, functionSig, true);
}
diff --git a/contracts/CommonStorage.sol b/contracts/CommonStorage.sol
index 98f28ad094..04496e9b97 100644
--- a/contracts/CommonStorage.sol
+++ b/contracts/CommonStorage.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "../lib/dappsys/auth.sol";
diff --git a/contracts/ContractEditing.sol b/contracts/ContractEditing.sol
index d8070500d7..a372c541c2 100644
--- a/contracts/ContractEditing.sol
+++ b/contracts/ContractEditing.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
contract ContractEditing {
diff --git a/contracts/ContractRecovery.sol b/contracts/ContractRecovery.sol
index ed29306662..1296bbc645 100644
--- a/contracts/ContractRecovery.sol
+++ b/contracts/ContractRecovery.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "./CommonStorage.sol";
import "./CommonAuthority.sol";
@@ -33,7 +32,7 @@ contract ContractRecovery is CommonStorage {
require(_slot != RESOLVER_SLOT, "colony-common-protected-variable");
// NB. This isn't necessarily a colony - could be ColonyNetwork. But they both have this function, so it's okay.
- IRecovery(this).checkNotAdditionalProtectedVariable(_slot);
+ IRecovery(address(this)).checkNotAdditionalProtectedVariable(_slot);
// Protect key variables
uint64 _recoveryRolesCount = recoveryRolesCount;
@@ -73,7 +72,7 @@ contract ContractRecovery is CommonStorage {
function exitRecoveryMode() public recovery auth {
uint totalAuthorized = recoveryRolesCount;
// Don't double count the owner (if set);
- if (owner != 0x0 && !CommonAuthority(authority).hasUserRole(owner, RECOVERY_ROLE)) {
+ if (owner != address(0x0) && !CommonAuthority(address(authority)).hasUserRole(owner, RECOVERY_ROLE)) {
totalAuthorized += 1;
}
uint numRequired = totalAuthorized / 2 + 1;
@@ -84,16 +83,16 @@ contract ContractRecovery is CommonStorage {
// Can only be called by the founder role.
function setRecoveryRole(address _user) public stoppable auth {
require(recoveryRolesCount < ~uint64(0), "colony-maximum-num-recovery-roles");
- if (!CommonAuthority(authority).hasUserRole(_user, RECOVERY_ROLE)) {
- CommonAuthority(authority).setUserRole(_user, RECOVERY_ROLE, true);
+ if (!CommonAuthority(address(authority)).hasUserRole(_user, RECOVERY_ROLE)) {
+ CommonAuthority(address(authority)).setUserRole(_user, RECOVERY_ROLE, true);
recoveryRolesCount++;
}
}
// Can only be called by the founder role.
function removeRecoveryRole(address _user) public stoppable auth {
- if (CommonAuthority(authority).hasUserRole(_user, RECOVERY_ROLE)) {
- CommonAuthority(authority).setUserRole(_user, RECOVERY_ROLE, false);
+ if (CommonAuthority(address(authority)).hasUserRole(_user, RECOVERY_ROLE)) {
+ CommonAuthority(address(authority)).setUserRole(_user, RECOVERY_ROLE, false);
recoveryRolesCount--;
}
}
diff --git a/contracts/ERC20Extended.sol b/contracts/ERC20Extended.sol
index 6b7339e7ab..bc07fe1471 100644
--- a/contracts/ERC20Extended.sol
+++ b/contracts/ERC20Extended.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "../lib/dappsys/erc20.sol";
diff --git a/contracts/ERC20ExtendedToken.sol b/contracts/ERC20ExtendedToken.sol
index 47215b9026..da487a4681 100644
--- a/contracts/ERC20ExtendedToken.sol
+++ b/contracts/ERC20ExtendedToken.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "../lib/dappsys/auth.sol";
@@ -29,7 +28,7 @@ contract ERC20ExtendedToken is DSTokenBase(0), DSAuth, ERC20Extended {
string public symbol;
string public name;
- constructor(string _name, string _symbol, uint8 _decimals) public {
+ constructor(string memory _name, string memory _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
@@ -42,7 +41,7 @@ contract ERC20ExtendedToken is DSTokenBase(0), DSAuth, ERC20Extended {
_supply = add(_supply, wad);
emit Mint(msg.sender, wad);
- emit Transfer(0x0, msg.sender, wad);
+ emit Transfer(address(0x0), msg.sender, wad);
}
function burn(uint wad) public {
diff --git a/contracts/EtherRouter.sol b/contracts/EtherRouter.sol
index ff7ad78a33..495225cdc2 100644
--- a/contracts/EtherRouter.sol
+++ b/contracts/EtherRouter.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "./Resolver.sol";
import "../lib/dappsys/auth.sol";
@@ -26,7 +25,7 @@ contract EtherRouter is DSAuth {
Resolver public resolver;
function() external payable {
- if (msg.sig == 0x0) {
+ if (msg.sig == 0) {
return;
}
// Contracts that want to receive Ether with a plain "send" have to implement
diff --git a/contracts/IColony.sol b/contracts/IColony.sol
index 24f0a0f2c7..8d3b84ad0a 100644
--- a/contracts/IColony.sol
+++ b/contracts/IColony.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental ABIEncoderV2;
import "./IRecovery.sol";
@@ -31,7 +30,7 @@ contract IColony is ColonyDataTypes, IRecovery {
/// @return colonyAuthority The `ColonyAuthority` contract address
function authority() public view returns (address colonyAuthority);
- /// @notice Get the colony `owner` address. This should be 0x0 at all times
+ /// @notice Get the colony `owner` address. This should be address(0x0) at all times
/// @dev Used for testing.
/// @return colonyOwner Address of the colony owner
function owner() public view returns (address colonyOwner);
@@ -95,7 +94,7 @@ contract IColony is ColonyDataTypes, IRecovery {
/// @dev Only allowed to be called when `taskCount` is 0 by authorized addresses
/// @param _users Array of address to bootstrap with reputation
/// @param _amount Amount of reputation/tokens for every address
- function bootstrapColony(address[] _users, int[] _amount) public;
+ function bootstrapColony(address[] memory _users, int[] memory _amount) public;
/// @notice Mint `_wad` amount of colony tokens. Secured function to authorised members
/// @param _wad Amount to mint
@@ -104,7 +103,7 @@ contract IColony is ColonyDataTypes, IRecovery {
/// @notice Register colony's ENS label
/// @param colonyName The label to register.
/// @param orbitdb The path of the orbitDB database associated with the colony name
- function registerColonyLabel(string colonyName, string orbitdb) public;
+ function registerColonyLabel(string memory colonyName, string memory orbitdb) public;
/// @notice Add a colony domain, and its respective local skill under skill with id `_parentSkillId`
/// New funding pot is created and associated with the domain here
@@ -115,7 +114,7 @@ contract IColony is ColonyDataTypes, IRecovery {
/// @notice Get a domain by id
/// @param _id Id of the domain which details to get
/// @return domain The domain
- function getDomain(uint256 _id) public view returns (Domain domain);
+ function getDomain(uint256 _id) public view returns (Domain memory domain);
/// @notice Get the non-mapping properties of a pot by id
/// @param _id Id of the pot which details to get
@@ -139,7 +138,8 @@ contract IColony is ColonyDataTypes, IRecovery {
/// While public, likely only to be used by the Colony contracts, as it checks that the user is proving their own
/// reputation in the current colony. The `verifyProof` function can be used to verify any proof, though this function
/// is not currently exposed on the Colony's EtherRouter.
- function verifyReputationProof(bytes key, bytes value, uint256 branchMask, bytes32[] siblings) public view returns (bool isValid);
+ function verifyReputationProof(bytes memory key, bytes memory value, uint256 branchMask, bytes32[] memory siblings)
+ public view returns (bool isValid);
// Implemented in ColonyTask.sol
/// @notice Make a new task in the colony. Secured function to authorised members
@@ -170,12 +170,12 @@ contract IColony is ColonyDataTypes, IRecovery {
/// Currently we only accept 0 value transactions but this is kept as a future option
/// @param _data The transaction data
function executeTaskChange(
- uint8[] _sigV,
- bytes32[] _sigR,
- bytes32[] _sigS,
- uint8[] _mode,
+ uint8[] memory _sigV,
+ bytes32[] memory _sigR,
+ bytes32[] memory _sigS,
+ uint8[] memory _mode,
uint256 _value,
- bytes _data
+ bytes memory _data
) public;
/// @notice Executes a task role update transaction `_data` which is approved and signed by two of addresses
@@ -189,12 +189,12 @@ contract IColony is ColonyDataTypes, IRecovery {
/// Currently we only accept 0 value transactions but this is kept as a future option
/// @param _data The transaction data
function executeTaskRoleAssignment(
- uint8[] _sigV,
- bytes32[] _sigR,
- bytes32[] _sigS,
- uint8[] _mode,
+ uint8[] memory _sigV,
+ bytes32[] memory _sigR,
+ bytes32[] memory _sigS,
+ uint8[] memory _mode,
uint256 _value,
- bytes _data
+ bytes memory _data
) public;
/// @notice Submit a hashed secret of the rating for work in task `_id` which was performed by user with task role id `_role`
@@ -346,14 +346,14 @@ contract IColony is ColonyDataTypes, IRecovery {
uint256 potId,
uint256 completionTimestamp,
uint256 domainId,
- uint256[] skillIds
+ uint256[] memory skillIds
);
/// @notice Get the `Role` properties back for role `_role` in task `_id`
/// @param _id Id of the task
/// @param _role Id of the role, as defined in `ColonyStorage` `MANAGER`, `EVALUATOR` and `WORKER` constants
/// @return role The Role
- function getTaskRole(uint256 _id, uint8 _role) public view returns (Role role);
+ function getTaskRole(uint256 _id, uint8 _role) public view returns (Role memory role);
/// @notice Set the reward inverse to pay out from revenue. e.g. if the fee is 1% (or 0.01), set 100
/// @param _rewardInverse The inverse of the reward
@@ -418,7 +418,7 @@ contract IColony is ColonyDataTypes, IRecovery {
/// @param value Reputation value
/// @param branchMask The branchmask of the proof
/// @param siblings The siblings of the proof
- function startNextRewardPayout(address _token, bytes key, bytes value, uint256 branchMask, bytes32[] siblings) public;
+ function startNextRewardPayout(address _token, bytes memory key, bytes memory value, uint256 branchMask, bytes32[] memory siblings) public;
/// @notice Claim the reward payout at `_payoutId`. User needs to provide their reputation and colony-wide reputation
/// which will be proven via Merkle proof inside this function.
@@ -439,14 +439,13 @@ contract IColony is ColonyDataTypes, IRecovery {
/// @param siblings The siblings of the proof
function claimRewardPayout(
uint256 _payoutId,
- uint256[7] _squareRoots,
- bytes key,
- bytes value,
+ uint256[7] memory _squareRoots,
+ bytes memory key,
+ bytes memory value,
uint256 branchMask,
- bytes32[] siblings
+ bytes32[] memory siblings
) public;
-
/// @notice Get useful information about specific reward payout
/// @param _payoutId Id of the reward payout
/// @return RewardPayoutCycle, containing propertes:
@@ -456,7 +455,7 @@ contract IColony is ColonyDataTypes, IRecovery {
/// amount Total amount of tokens taken aside for reward payout
/// tokenAddress Token address
/// blockTimestamp Block number at the time of creation
- function getRewardPayoutInfo(uint256 _payoutId) public view returns ( RewardPayoutCycle rewardPayoutCycle );
+ function getRewardPayoutInfo(uint256 _payoutId) public view returns (RewardPayoutCycle memory rewardPayoutCycle );
/// @notice Finalises the reward payout. Allows creation of next reward payouts for token that has been used in `_payoutId`
/// Can only be called when reward payout cycle is finished i.e when 60 days have passed from its creation
diff --git a/contracts/IColonyNetwork.sol b/contracts/IColonyNetwork.sol
index 16c057dc5a..b7ef34646d 100644
--- a/contracts/IColonyNetwork.sol
+++ b/contracts/IColonyNetwork.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23 <0.5.0;
pragma experimental "ABIEncoderV2";
import "./IRecovery.sol";
@@ -62,7 +61,7 @@ contract IColonyNetwork is ColonyNetworkDataTypes, IRecovery {
/// @return (address, int256, uint256, address, uint256, uint256) An object with the details of the log entry (if it exists)
/// @dev colonyAddress will always be set if the replacement exists
function getReplacementReputationUpdateLogEntry(address _reputationMiningCycle, uint256 _id) public view returns
- (ReputationLogEntry reputationLogEntry);
+ (ReputationLogEntry memory reputationLogEntry);
/// @notice Get whether any replacement log entries have been set for the supplied reputation mining cycle.
/// @notice Used by the client to avoid doubling the number of RPC calls when syncing from scratch.
@@ -71,7 +70,7 @@ contract IColonyNetwork is ColonyNetworkDataTypes, IRecovery {
/// @notice Get the Meta Colony address
/// @return colonyAddress The Meta colony address, if no colony was found, returns 0x0
- function getMetaColony() public view returns (address colonyAddress);
+ function getMetaColony() public view returns (address);
/// @notice Get the number of colonies in the network
/// @return count The colony count
@@ -96,7 +95,7 @@ contract IColonyNetwork is ColonyNetworkDataTypes, IRecovery {
/// @return nParents uint256 `skill.nParents` i.e. the number of parent skills of skill with id `_skillId`
/// @return nChildren uint256 `skill.nChildren` i.e. the number of child skills of skill with id `_skillId`
/// @return isGlobalSkill true if specified skill is a global skill, otherwise false
- function getSkill(uint256 _skillId) public view returns (Skill skill);
+ function getSkill(uint256 _skillId) public view returns (Skill memory skill);
/// @notice Get whether the skill with id _skillId is public or not.
/// @return isGlobalSkill bool
@@ -142,7 +141,7 @@ contract IColonyNetwork is ColonyNetworkDataTypes, IRecovery {
/// Additionally token can optionally support `mint` as defined in `ERC20Extended`
/// Support for `mint` in mandatory only for the Meta Colony Token
/// @return colonyAddress Address of the newly created colony
- function createColony(address _tokenAddress) public returns (address colonyAddress);
+ function createColony(address _tokenAddress) public returns (address);
/// @notice Adds a new Colony contract version and the address of associated `_resolver` contract. Secured function to authorised members
/// Allowed to be called by the Meta Colony only
@@ -199,7 +198,7 @@ contract IColonyNetwork is ColonyNetworkDataTypes, IRecovery {
/// @param newNNodes The updated nodes count value
/// @param stakers Array of users who submitted or backed the hash, being accepted here as the new reputation root hash
/// @param reward Amount of CLNY to be distributed as reward to miners
- function setReputationRootHash(bytes32 newHash, uint256 newNNodes, address[] stakers, uint256 reward) public;
+ function setReputationRootHash(bytes32 newHash, uint256 newNNodes, address[] memory stakers, uint256 reward) public;
/// @notice Starts a new Reputation Mining cycle. Explicitly called only the first time,
/// subsequently called from within `setReputationRootHash`
@@ -229,22 +228,22 @@ contract IColonyNetwork is ColonyNetworkDataTypes, IRecovery {
/// @notice Register a "user.joincolony.eth" label.
/// @param username The label to register
/// @param orbitdb The path of the orbitDB database associated with the user profile
- function registerUserLabel(string username, string orbitdb) public;
+ function registerUserLabel(string memory username, string memory orbitdb) public;
/// @notice Register a "colony.joincolony.eth" label. Can only be called by a Colony.
/// @param colonyName The label to register.
/// @param orbitdb The path of the orbitDB database associated with the colony name
- function registerColonyLabel(string colonyName, string orbitdb) public;
+ function registerColonyLabel(string memory colonyName, string memory orbitdb) public;
/// @notice Retrieve the orbitdb address corresponding to a registered account
/// @param node The Namehash of the account being queried.
/// @return orbitDB A string containing the address of the orbit database
- function getProfileDBAddress(bytes32 node) public view returns (string orbitDB);
+ function getProfileDBAddress(bytes32 node) public view returns (string memory orbitDB);
/// @notice Reverse lookup a username from an address.
/// @param addr The address we wish to find the corresponding ENS domain for (if any)
/// @return domain A string containing the colony-based ENS name corresponding to addr
- function lookupRegisteredENSDomain(address addr) public view returns(string domain);
+ function lookupRegisteredENSDomain(address addr) public view returns(string memory domain);
/// @notice Returns the address the supplied node resolves do, if we are the resolver
/// @param node The namehash of the ENS address being requested
diff --git a/contracts/IMetaColony.sol b/contracts/IMetaColony.sol
index 6b95230915..c96ed1b82c 100644
--- a/contracts/IMetaColony.sol
+++ b/contracts/IMetaColony.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "./IColony.sol";
diff --git a/contracts/IRecovery.sol b/contracts/IRecovery.sol
index 16fed99c1e..a4d7f98681 100644
--- a/contracts/IRecovery.sol
+++ b/contracts/IRecovery.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
diff --git a/contracts/IReputationMiningCycle.sol b/contracts/IReputationMiningCycle.sol
index 0426de5a35..5ecbb7097b 100644
--- a/contracts/IReputationMiningCycle.sol
+++ b/contracts/IReputationMiningCycle.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "./ReputationMiningCycleDataTypes.sol";
@@ -28,12 +27,12 @@ contract IReputationMiningCycle is ReputationMiningCycleDataTypes {
/// @param _round The dispute round to query
/// @param _index The index in the dispute round to query
/// @return The elements of the Submission struct for the submission requested. See ReputationMiningCycleDataTypes for the full description
- function getDisputeRounds(uint256 _round, uint256 _index) public view returns (Submission submission);
+ function getDisputeRounds(uint256 _round, uint256 _index) public view returns (Submission memory submission);
/// @notice The getter for the hashSubmissions mapping, which keeps track of submissions by user.
/// @param _user Address of the user
/// @return submission the Submission struct for the submission requested. See ReputationMiningCycleDataTypes.sol for the full description
- function getReputationHashSubmissions(address _user) public view returns (Submission submission);
+ function getReputationHashSubmissions(address _user) public view returns (Submission memory submission);
/// @notice Get the hash for the corresponding entry.
/// @param submitter The address that submitted the hash
@@ -70,8 +69,12 @@ contract IReputationMiningCycle is ReputationMiningCycleDataTypes {
/// @param jhIntermediateValue The contents of the Justification Tree at the key given by `targetNode` (see function description). The value of `targetNode` is computed locally to establish what to submit to this function.
/// @param branchMask The branchMask of the Merkle proof that `jhIntermediateValue` is the value at key `targetNode`
/// @param siblings The siblings of the Merkle proof that `jhIntermediateValue` is the value at key `targetNode`
- function respondToBinarySearchForChallenge(uint256 round, uint256 idx, bytes jhIntermediateValue, uint branchMask, bytes32[] siblings) public;
-
+ function respondToBinarySearchForChallenge(
+ uint256 round,
+ uint256 idx,
+ bytes memory jhIntermediateValue,
+ uint branchMask,
+ bytes32[] memory siblings) public;
/// @notice Confirm the result of a binary search - depending on how exactly the binary search finished, the saved binary search intermediate state might be incorrect.
/// @notice This function ensures that the intermediate hashes saved are correct.
@@ -80,7 +83,12 @@ contract IReputationMiningCycle is ReputationMiningCycleDataTypes {
/// @param jhIntermediateValue The contents of the Justification Tree at the key given by `targetNode` (see function description). The value of `targetNode` is computed locally to establish what to submit to this function.
/// @param branchMask The branchMask of the Merkle proof that `jhIntermediateValue` is the value at key `targetNode`
/// @param siblings The siblings of the Merkle proof that `jhIntermediateValue` is the value at key `targetNode`
- function confirmBinarySearchResult(uint256 round, uint256 idx, bytes jhIntermediateValue, uint256 branchMask, bytes32[] siblings) public;
+ function confirmBinarySearchResult(
+ uint256 round,
+ uint256 idx,
+ bytes memory jhIntermediateValue,
+ uint256 branchMask,
+ bytes32[] memory siblings) public;
/// @notice Respond to challenge, to establish which (if either) of the two submissions facing off are correct.
/// @param u A `uint256[10]` array. The elements of this array, in order are:
@@ -108,16 +116,16 @@ contract IReputationMiningCycle is ReputationMiningCycleDataTypes {
/// @dev If you know that the disagreement doesn't involve a new reputation being added, the arguments corresponding to the previous new reputation can be zeroed, as they will not be used. You must be sure
/// that this is the case, however, otherwise you risk being found incorrect. Zeroed arguments will result in a cheaper call to this function.
function respondToChallenge(
- uint256[11] u, //An array of 10 UINT Params, ordered as given above.
- bytes _reputationKey,
- bytes32[] reputationSiblings,
- bytes agreeStateReputationValue,
- bytes32[] agreeStateSiblings,
- bytes disagreeStateReputationValue,
- bytes32[] disagreeStateSiblings,
- bytes previousNewReputationKey,
- bytes previousNewReputationValue,
- bytes32[] previousNewReputationSiblings) public;
+ uint256[11] memory u, //An array of 10 UINT Params, ordered as given above.
+ bytes memory _reputationKey,
+ bytes32[] memory reputationSiblings,
+ bytes memory agreeStateReputationValue,
+ bytes32[] memory agreeStateSiblings,
+ bytes memory disagreeStateReputationValue,
+ bytes32[] memory disagreeStateSiblings,
+ bytes memory previousNewReputationKey,
+ bytes memory previousNewReputationValue,
+ bytes32[] memory previousNewReputationSiblings) public;
/// @notice Verify the Justification Root Hash (JRH) for a submitted reputation hash is plausible
/// @param round The round that the hash is currently in.
@@ -134,9 +142,9 @@ contract IReputationMiningCycle is ReputationMiningCycleDataTypes {
uint256 round,
uint256 index,
uint branchMask1,
- bytes32[] siblings1,
+ bytes32[] memory siblings1,
uint branchMask2,
- bytes32[] siblings2) public;
+ bytes32[] memory siblings2) public;
/// @notice Add a new entry to the reputation update log
/// @param _user The address of the user having their reputation changed by this log entry
@@ -161,7 +169,7 @@ contract IReputationMiningCycle is ReputationMiningCycleDataTypes {
/// @notice Get the `ReputationLogEntry` at index `_id`
/// @param _id The reputation log members array index of the entry to get
/// @return reputationUpdateLogEntry The Reputation Update Log Entry
- function getReputationUpdateLogEntry(uint256 _id) public view returns (ReputationLogEntry reputationUpdateLogEntry);
+ function getReputationUpdateLogEntry(uint256 _id) public view returns (ReputationLogEntry memory reputationUpdateLogEntry);
/// @notice Start the reputation log with the rewards for the stakers who backed the accepted new reputation root hash.
/// @param stakers The array of stakers addresses to receive the reward.
@@ -172,8 +180,8 @@ contract IReputationMiningCycle is ReputationMiningCycleDataTypes {
/// @dev Note that the same address might be present multiple times in `stakers` - this is acceptable, and indicates the
/// same address backed the same hash multiple times with different entries.
function rewardStakersWithReputation(
- address[] stakers,
- uint256[] weights,
+ address[] memory stakers,
+ uint256[] memory weights,
address metaColonyAddress,
uint256 reward,
uint256 miningSkillId
diff --git a/contracts/ITokenLocking.sol b/contracts/ITokenLocking.sol
index c8b680404e..84e7cec7b2 100644
--- a/contracts/ITokenLocking.sol
+++ b/contracts/ITokenLocking.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "./TokenLockingDataTypes.sol";
@@ -64,7 +63,7 @@ contract ITokenLocking is TokenLockingDataTypes {
/// @param _stakers Array of the addresses of stakers to punish
/// @param _beneficiary Address of beneficiary to receive forfeited stake
/// @param _amount Amount of stake to slash
- function punishStakers(address[] _stakers, address _beneficiary, uint256 _amount) public;
+ function punishStakers(address[] memory _stakers, address _beneficiary, uint256 _amount) public;
/// @notice Get global lock count for a specific token
/// @param _token Address of the token
@@ -78,5 +77,5 @@ contract ITokenLocking is TokenLockingDataTypes {
/// lockCount User's token lock count
/// amount User's deposited amount
/// timestamp Timestamp of deposit
- function getUserLock(address _token, address _user) public view returns (Lock lock);
+ function getUserLock(address _token, address _user) public view returns (Lock memory lock);
}
diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol
index 574ad421a6..43961a8c90 100644
--- a/contracts/Migrations.sol
+++ b/contracts/Migrations.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
contract Migrations {
diff --git a/contracts/PatriciaTree/Bits.sol b/contracts/PatriciaTree/Bits.sol
index 07fbde0185..14606e8bbd 100644
--- a/contracts/PatriciaTree/Bits.sol
+++ b/contracts/PatriciaTree/Bits.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.16;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
diff --git a/contracts/PatriciaTree/Data.sol b/contracts/PatriciaTree/Data.sol
index f2bf7f77cd..df87830763 100644
--- a/contracts/PatriciaTree/Data.sol
+++ b/contracts/PatriciaTree/Data.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.16;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import {Bits} from "./Bits.sol";
@@ -65,7 +64,7 @@ library Data {
return keccak256(abi.encodePacked(self.node, self.label.length, self.label.data));
}
- function insert(Tree storage self, bytes32 key, bytes value) internal {
+ function insert(Tree storage self, bytes32 key, bytes memory value) internal {
Label memory k = Label(key, 256);
bytes32 valueHash = keccak256(value);
Edge memory e;
@@ -81,7 +80,7 @@ library Data {
}
// Private functions
- function insertAtEdge(Tree storage self, Edge e, Label key, bytes32 value) private returns (Edge) {
+ function insertAtEdge(Tree storage self, Edge memory e, Label memory key, bytes32 value) private returns (Edge memory) {
assert(key.length >= e.label.length);
Label memory prefix;
Label memory suffix;
diff --git a/contracts/PatriciaTree/IPatriciaTree.sol b/contracts/PatriciaTree/IPatriciaTree.sol
index 0dff384e71..5a43191178 100644
--- a/contracts/PatriciaTree/IPatriciaTree.sol
+++ b/contracts/PatriciaTree/IPatriciaTree.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.16;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import {Data} from "./Data.sol";
@@ -11,15 +10,16 @@ import "./IPatriciaTreeBase.sol";
contract IPatriciaTree is IPatriciaTreeBase {
/// @notice Insert the `key`/`value`in the appropriate place in the tree
- function insert(bytes key, bytes value) public;
+ function insert(bytes memory key, bytes memory value) public;
/// @notice Returns the Merkle-proof for the given `key`
/// @return branchMask Bitmask with high bits at the positions in the `key` where we have branch nodes (bit in key denotes direction)
/// @return _siblings Hashes of sibling edges
- function getProof(bytes key) public view returns (uint branchMask, bytes32[] _siblings);
+ function getProof(bytes memory key) public view returns (uint branchMask, bytes32[] memory _siblings);
/// @notice Calculates and returns a root hash for the `key`, `value`, `branchMask` and `siblings`
/// @return rootHash The calculated hash
- function getImpliedRoot(bytes key, bytes value, uint256 branchMask, bytes32[] siblings) public pure returns (bytes32 rootHash);
+ function getImpliedRoot(bytes memory key, bytes memory value, uint256 branchMask, bytes32[] memory siblings)
+ public pure returns (bytes32 rootHash);
}
diff --git a/contracts/PatriciaTree/IPatriciaTreeBase.sol b/contracts/PatriciaTree/IPatriciaTreeBase.sol
index 460c030443..96ca30da7f 100644
--- a/contracts/PatriciaTree/IPatriciaTreeBase.sol
+++ b/contracts/PatriciaTree/IPatriciaTreeBase.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.16;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import {Data} from "./Data.sol";
@@ -16,10 +15,10 @@ contract IPatriciaTreeBase {
/// @notice Get the root edge
/// @return e The root `Data.Edge`
- function getRootEdge() public view returns (Data.Edge e);
+ function getRootEdge() public view returns (Data.Edge memory e);
/// @notice Get the node with the given key
/// @param hash The `keccak256` hash of the actual key
/// @return n `Data.Node` for key `hash`
- function getNode(bytes32 hash) public view returns (Data.Node n);
+ function getNode(bytes32 hash) public view returns (Data.Node memory n);
}
diff --git a/contracts/PatriciaTree/IPatriciaTreeNoHash.sol b/contracts/PatriciaTree/IPatriciaTreeNoHash.sol
index 1215920f93..894a7b8338 100644
--- a/contracts/PatriciaTree/IPatriciaTreeNoHash.sol
+++ b/contracts/PatriciaTree/IPatriciaTreeNoHash.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.16;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import {Data} from "./Data.sol";
@@ -11,15 +10,15 @@ import "./IPatriciaTreeBase.sol";
contract IPatriciaTreeNoHash is IPatriciaTreeBase {
/// @notice Insert the `key`/`value`in the appropriate place in the tree
- function insert(bytes32 key, bytes value) public;
+ function insert(bytes32 key, bytes memory value) public;
/// @notice Returns the Merkle-proof for the given `key`
/// @return branchMask Bitmask with high bits at the positions in the `key` where we have branch nodes (bit in key denotes direction)
/// @return _siblings Hashes of sibling edges
- function getProof(bytes32 key) public view returns (uint branchMask, bytes32[] _siblings);
+ function getProof(bytes32 key) public view returns (uint branchMask, bytes32[] memory _siblings);
/// @notice Calculates and returns a root hash for the `key`, `value`, `branchMask` and `siblings`
/// @return rootHash The calculated hash
- function getImpliedRoot(bytes32 key, bytes value, uint256 branchMask, bytes32[] siblings) public pure returns (bytes32 rootHash);
+ function getImpliedRoot(bytes32 key, bytes memory value, uint256 branchMask, bytes32[] memory siblings) public pure returns (bytes32 rootHash);
}
diff --git a/contracts/PatriciaTree/PatriciaTree.sol b/contracts/PatriciaTree/PatriciaTree.sol
index 8a63a435f5..fe3a177d73 100644
--- a/contracts/PatriciaTree/PatriciaTree.sol
+++ b/contracts/PatriciaTree/PatriciaTree.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.16;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "./PatriciaTreeBase.sol";
@@ -10,15 +9,15 @@ import "./IPatriciaTree.sol";
/// @notice More info at: https://github.com/chriseth/patricia-trie
contract PatriciaTree is IPatriciaTree, PatriciaTreeBase {
- function insert(bytes key, bytes value) public {
+ function insert(bytes memory key, bytes memory value) public {
tree.insert(keccak256(key), value);
}
- function getProof(bytes key) public view returns (uint branchMask, bytes32[] _siblings) {
+ function getProof(bytes memory key) public view returns (uint branchMask, bytes32[] memory _siblings) {
return getProofFunctionality(keccak256(key));
}
- function getImpliedRoot(bytes key, bytes value, uint branchMask, bytes32[] siblings) public
+ function getImpliedRoot(bytes memory key, bytes memory value, uint branchMask, bytes32[] memory siblings) public
pure returns (bytes32)
{
return getImpliedRootHashKey(key, value, branchMask, siblings);
diff --git a/contracts/PatriciaTree/PatriciaTreeBase.sol b/contracts/PatriciaTree/PatriciaTreeBase.sol
index 543048d04c..fc57e26737 100644
--- a/contracts/PatriciaTree/PatriciaTreeBase.sol
+++ b/contracts/PatriciaTree/PatriciaTreeBase.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.16;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import {Data} from "./Data.sol";
@@ -22,15 +21,15 @@ contract PatriciaTreeBase is PatriciaTreeProofs {
return tree.root;
}
- function getRootEdge() public view returns (Data.Edge e) {
+ function getRootEdge() public view returns (Data.Edge memory e) {
e = tree.rootEdge;
}
- function getNode(bytes32 hash) public view returns (Data.Node n) {
+ function getNode(bytes32 hash) public view returns (Data.Node memory n) {
n = tree.nodes[hash];
}
- function getProofFunctionality(bytes32 key) internal view returns (uint branchMask, bytes32[] _siblings) {
+ function getProofFunctionality(bytes32 key) internal view returns (uint branchMask, bytes32[] memory _siblings) {
require(tree.root != 0, "colony-patricia-tree-zero-tree-root");
Data.Label memory k = Data.Label(key, 256);
Data.Edge memory e = tree.rootEdge;
diff --git a/contracts/PatriciaTree/PatriciaTreeNoHash.sol b/contracts/PatriciaTree/PatriciaTreeNoHash.sol
index 0188b0ed33..efde968bfa 100644
--- a/contracts/PatriciaTree/PatriciaTreeNoHash.sol
+++ b/contracts/PatriciaTree/PatriciaTreeNoHash.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.16;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "./PatriciaTreeBase.sol";
@@ -10,15 +9,15 @@ import "./IPatriciaTreeNoHash.sol";
/// @notice More info at: https://github.com/chriseth/patricia-trie
contract PatriciaTreeNoHash is IPatriciaTreeNoHash, PatriciaTreeBase {
- function insert(bytes32 key, bytes value) public {
+ function insert(bytes32 key, bytes memory value) public {
tree.insert(key, value);
}
- function getProof(bytes32 key) public view returns (uint branchMask, bytes32[] _siblings) {
+ function getProof(bytes32 key) public view returns (uint branchMask, bytes32[] memory _siblings) {
return getProofFunctionality(key);
}
- function getImpliedRoot(bytes32 key, bytes value, uint branchMask, bytes32[] siblings) public
+ function getImpliedRoot(bytes32 key, bytes memory value, uint branchMask, bytes32[] memory siblings) public
pure returns (bytes32)
{
return getImpliedRootNoHashKey(key, value, branchMask, siblings);
diff --git a/contracts/PatriciaTree/PatriciaTreeProofs.sol b/contracts/PatriciaTree/PatriciaTreeProofs.sol
index e25fea8737..41af6ad14f 100644
--- a/contracts/PatriciaTree/PatriciaTreeProofs.sol
+++ b/contracts/PatriciaTree/PatriciaTreeProofs.sol
@@ -1,5 +1,4 @@
-pragma solidity ^0.4.16;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import {Data} from "./Data.sol";
@@ -13,7 +12,7 @@ contract PatriciaTreeProofs {
using Data for Data.Edge;
using Data for Data.Label;
- function getImpliedRootHashKey(bytes key, bytes value, uint256 branchMask, bytes32[] siblings) internal
+ function getImpliedRootHashKey(bytes memory key, bytes memory value, uint256 branchMask, bytes32[] memory siblings) internal
pure returns (bytes32)
{
bytes32 hash;
@@ -21,7 +20,7 @@ contract PatriciaTreeProofs {
return hash;
}
- function getImpliedRootNoHashKey(bytes32 key, bytes value, uint256 branchMask, bytes32[] siblings) internal
+ function getImpliedRootNoHashKey(bytes32 key, bytes memory value, uint256 branchMask, bytes32[] memory siblings) internal
pure returns (bytes32)
{
bytes32 hash;
@@ -29,15 +28,15 @@ contract PatriciaTreeProofs {
return hash;
}
- function getFinalPairAndImpliedRootNoHash(bytes32 key, bytes value, uint256 branchMask, bytes32[] siblings) internal
- pure returns (bytes32, bytes32[2])
+ function getFinalPairAndImpliedRootNoHash(bytes32 key, bytes memory value, uint256 branchMask, bytes32[] memory siblings) internal
+ pure returns (bytes32, bytes32[2] memory)
{
return getImpliedRootFunctionality(key, keccak256(value), branchMask, siblings);
}
// solium-disable-next-line security/no-assign-params
- function getImpliedRootFunctionality(bytes32 keyHash, bytes32 valueHash, uint256 branchMask, bytes32[] siblings) private
- pure returns (bytes32, bytes32[2])
+ function getImpliedRootFunctionality(bytes32 keyHash, bytes32 valueHash, uint256 branchMask, bytes32[] memory siblings) private
+ pure returns (bytes32, bytes32[2] memory)
{
Data.Label memory k = Data.Label(keyHash, 256);
Data.Edge memory e;
@@ -57,8 +56,8 @@ contract PatriciaTreeProofs {
if (branchMask == 0) {
e.label = k;
} else {
- uint bitSet = branchMask.lowestBitSet();
- (k, e.label) = k.splitAt(255 - bitSet);
+ uint lowestBitSet = branchMask.lowestBitSet();
+ (k, e.label) = k.splitAt(255 - lowestBitSet);
(, e.label) = e.label.chopFirstBit();
}
return (e.edgeHash(), edgeHashes);
diff --git a/contracts/ReputationMiningCycle.sol b/contracts/ReputationMiningCycle.sol
index 73c9547530..8f9f7fd8b0 100644
--- a/contracts/ReputationMiningCycle.sol
+++ b/contracts/ReputationMiningCycle.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "../lib/dappsys/math.sol";
@@ -104,7 +103,7 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
/// @dev This will only be called once, by ColonyNetwork, in the same transaction that deploys this contract
function initialise(address _tokenLockingAddress, address _clnyTokenAddress) public {
// Prevent this being called multiple times
- require(colonyNetworkAddress == 0, "colony-reputation-mining-cycle-already-initialised");
+ require(colonyNetworkAddress == address(0x0), "colony-reputation-mining-cycle-already-initialised");
colonyNetworkAddress = msg.sender;
tokenLockingAddress = _tokenLockingAddress;
clnyTokenAddress = _clnyTokenAddress;
@@ -297,9 +296,9 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
function respondToBinarySearchForChallenge(
uint256 round,
uint256 idx,
- bytes jhIntermediateValue,
+ bytes memory jhIntermediateValue,
uint256 branchMask,
- bytes32[] siblings
+ bytes32[] memory siblings
) public
{
require(disputeRounds[round][idx].lowerBound != disputeRounds[round][idx].upperBound, "colony-reputation-mining-challenge-not-active");
@@ -329,9 +328,9 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
function confirmBinarySearchResult(
uint256 round,
uint256 idx,
- bytes jhIntermediateValue,
+ bytes memory jhIntermediateValue,
uint256 branchMask,
- bytes32[] siblings
+ bytes32[] memory siblings
) public
{
require(disputeRounds[round][idx].jrhNNodes != 0, "colony-reputation-jrh-hash-not-verified");
@@ -364,9 +363,9 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
uint256 round,
uint256 index,
uint256 branchMask1,
- bytes32[] siblings1,
+ bytes32[] memory siblings1,
uint256 branchMask2,
- bytes32[] siblings2
+ bytes32[] memory siblings2
) public
{
// Require we've not submitted already.
@@ -434,21 +433,21 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
return reputationUpdateLog.length;
}
- function getReputationUpdateLogEntry(uint256 _id) public view returns (ReputationLogEntry) {
+ function getReputationUpdateLogEntry(uint256 _id) public view returns (ReputationLogEntry memory) {
return reputationUpdateLog[_id];
}
- function getReputationHashSubmissions(address _user) public view returns (Submission) {
+ function getReputationHashSubmissions(address _user) public view returns (Submission memory) {
return reputationHashSubmissions[_user];
}
- function getDisputeRounds(uint256 _round, uint256 _index) public view returns (Submission) {
+ function getDisputeRounds(uint256 _round, uint256 _index) public view returns (Submission memory) {
return disputeRounds[_round][_index];
}
function rewardStakersWithReputation(
- address[] stakers,
- uint256[] weights,
+ address[] memory stakers,
+ uint256[] memory weights,
address metaColonyAddress,
uint256 reward,
uint256 miningSkillId
@@ -480,16 +479,16 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
// Internal functions
/////////////////////////
- function submissionWindowClosed() internal view returns(bool) {
+ function submissionWindowClosed() internal view returns (bool) {
return now - reputationMiningWindowOpenTimestamp >= MINING_WINDOW_SIZE;
}
function processBinaryChallengeSearchResponse(
uint256 round,
uint256 idx,
- bytes jhIntermediateValue,
+ bytes memory jhIntermediateValue,
uint256 targetNode,
- bytes32[2] lastSiblings
+ bytes32[2] memory lastSiblings
) internal
{
disputeRounds[round][idx].lastResponseTimestamp = now;
@@ -515,39 +514,6 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
}
}
- function nextPowerOfTwoInclusive(uint256 v) pure private returns (uint) { // solium-disable-line security/no-assign-params
- // Returns the next power of two, or v if v is already a power of two.
- // Doesn't work for zero.
- v--;
- v |= v >> 1;
- v |= v >> 2;
- v |= v >> 4;
- v |= v >> 8;
- v |= v >> 16;
- v |= v >> 32;
- v |= v >> 64;
- v |= v >> 128;
- v++;
- return v;
- }
-
- function expectedProofLength(uint256 nNodes, uint256 node) pure private returns (uint256) { // solium-disable-line security/no-assign-params
- nNodes -= 1;
- uint256 nextPowerOfTwo = nextPowerOfTwoInclusive(nNodes + 1);
- uint256 layers = 0;
- while (nNodes != 0 && (node+1 > nextPowerOfTwo / 2)) {
- nNodes -= nextPowerOfTwo/2;
- node -= nextPowerOfTwo/2;
- layers += 1;
- nextPowerOfTwo = nextPowerOfTwoInclusive(nNodes + 1);
- }
- while (nextPowerOfTwo > 1) {
- layers += 1;
- nextPowerOfTwo >>= 1;
- }
- return layers;
- }
-
function processBinaryChallengeSearchStep(uint256 round, uint256 idx, uint256 targetNode) internal {
uint256 opponentIdx = (idx % 2 == 1 ? idx-1 : idx + 1);
uint256 searchWidth = (disputeRounds[round][idx].upperBound - disputeRounds[round][idx].lowerBound) + 1;
@@ -589,7 +555,7 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
disputeRounds[round][opponentIdx].lastResponseTimestamp = now;
}
- function checkJRHProof1(bytes32 jrh, uint256 branchMask1, bytes32[] siblings1, uint256 reputationRootHashNNodes) internal view {
+ function checkJRHProof1(bytes32 jrh, uint256 branchMask1, bytes32[] memory siblings1, uint256 reputationRootHashNNodes) internal view {
// Proof 1 needs to prove that they started with the current reputation root hash
bytes32 reputationRootHash = IColonyNetwork(colonyNetworkAddress).getReputationRootHash();
bytes memory jhLeafValue = new bytes(64);
@@ -605,7 +571,7 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
uint256 round,
uint256 index,
uint256 branchMask2,
- bytes32[] siblings2,
+ bytes32[] memory siblings2,
uint256 reputationRootHashNNodes
) internal
{
@@ -652,4 +618,36 @@ contract ReputationMiningCycle is ReputationMiningCycleStorage, PatriciaTreeProo
startMemberOfPair(roundNumber, nInRound-2);
}
+ function nextPowerOfTwoInclusive(uint256 v) private pure returns (uint) { // solium-disable-line security/no-assign-params
+ // Returns the next power of two, or v if v is already a power of two.
+ // Doesn't work for zero.
+ v--;
+ v |= v >> 1;
+ v |= v >> 2;
+ v |= v >> 4;
+ v |= v >> 8;
+ v |= v >> 16;
+ v |= v >> 32;
+ v |= v >> 64;
+ v |= v >> 128;
+ v++;
+ return v;
+ }
+
+ function expectedProofLength(uint256 nNodes, uint256 node) private pure returns (uint256) { // solium-disable-line security/no-assign-params
+ nNodes -= 1;
+ uint256 nextPowerOfTwo = nextPowerOfTwoInclusive(nNodes + 1);
+ uint256 layers = 0;
+ while (nNodes != 0 && (node+1 > nextPowerOfTwo / 2)) {
+ nNodes -= nextPowerOfTwo/2;
+ node -= nextPowerOfTwo/2;
+ layers += 1;
+ nextPowerOfTwo = nextPowerOfTwoInclusive(nNodes + 1);
+ }
+ while (nextPowerOfTwo > 1) {
+ layers += 1;
+ nextPowerOfTwo >>= 1;
+ }
+ return layers;
+ }
}
diff --git a/contracts/ReputationMiningCycleDataTypes.sol b/contracts/ReputationMiningCycleDataTypes.sol
index b192f8c228..d6fa01690e 100644
--- a/contracts/ReputationMiningCycleDataTypes.sol
+++ b/contracts/ReputationMiningCycleDataTypes.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
contract ReputationMiningCycleDataTypes {
diff --git a/contracts/ReputationMiningCycleRespond.sol b/contracts/ReputationMiningCycleRespond.sol
index af6d5bdfdd..5f314d2cd0 100644
--- a/contracts/ReputationMiningCycleRespond.sol
+++ b/contracts/ReputationMiningCycleRespond.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "../lib/dappsys/math.sol";
@@ -67,16 +66,16 @@ contract ReputationMiningCycleRespond is ReputationMiningCycleStorage, PatriciaT
uint constant DECAY_DENOMINATOR = 1000000000000000;
function respondToChallenge(
- uint256[11] u, //An array of 11 UINT Params, ordered as given above.
- bytes _reputationKey,
- bytes32[] reputationSiblings,
- bytes agreeStateReputationValue,
- bytes32[] agreeStateSiblings,
- bytes disagreeStateReputationValue,
- bytes32[] disagreeStateSiblings,
- bytes previousNewReputationKey,
- bytes previousNewReputationValue,
- bytes32[] previousNewReputationSiblings
+ uint256[11] memory u, //An array of 11 UINT Params, ordered as given above.
+ bytes memory _reputationKey,
+ bytes32[] memory reputationSiblings,
+ bytes memory agreeStateReputationValue,
+ bytes32[] memory agreeStateSiblings,
+ bytes memory disagreeStateReputationValue,
+ bytes32[] memory disagreeStateSiblings,
+ bytes memory previousNewReputationKey,
+ bytes memory previousNewReputationValue,
+ bytes32[] memory previousNewReputationSiblings
) public
challengeOpen(u[U_ROUND], u[U_IDX])
{
@@ -132,7 +131,7 @@ contract ReputationMiningCycleRespond is ReputationMiningCycleStorage, PatriciaT
// Internal functions
/////////////////////////
- function checkKey(uint256[11] u, bytes memory _reputationKey, bytes memory _reputationValue) internal {
+ function checkKey(uint256[11] memory u, bytes memory _reputationKey, bytes memory _reputationValue) internal {
// If the state transition we're checking is less than the number of nodes in the currently accepted state, it's a decay transition
// Otherwise, look up the corresponding entry in the reputation log.
uint256 updateNumber = disputeRounds[u[U_ROUND]][u[U_IDX]].lowerBound - 1;
@@ -196,8 +195,8 @@ contract ReputationMiningCycleRespond is ReputationMiningCycleStorage, PatriciaT
{
// Work out the expected userAddress and skillId for this updateNumber in this logEntry.
if ((updateNumber - logEntry.nPreviousUpdates + 1) <= logEntry.nUpdates / 2 ) {
- // Then we're updating a colony-wide total, so we expect an address of 0x0
- expectedAddress = 0x0;
+ // Then we're updating a colony-wide total, so we expect an address of address(0x0)
+ expectedAddress = address(0x0);
} else {
// We're updating a user-specific total
expectedAddress = logEntry.user;
@@ -226,11 +225,11 @@ contract ReputationMiningCycleRespond is ReputationMiningCycleStorage, PatriciaT
}
function proveBeforeReputationValue(
- uint256[11] u,
- bytes _reputationKey,
- bytes32[] reputationSiblings,
- bytes agreeStateReputationValue,
- bytes32[] agreeStateSiblings
+ uint256[11] memory u,
+ bytes memory _reputationKey,
+ bytes32[] memory reputationSiblings,
+ bytes memory agreeStateReputationValue,
+ bytes32[] memory agreeStateSiblings
) internal
{
bytes32 jrh = disputeRounds[u[U_ROUND]][u[U_IDX]].jrh;
@@ -278,11 +277,11 @@ contract ReputationMiningCycleRespond is ReputationMiningCycleStorage, PatriciaT
}
function proveAfterReputationValue(
- uint256[11] u,
- bytes _reputationKey,
- bytes32[] reputationSiblings,
- bytes disagreeStateReputationValue,
- bytes32[] disagreeStateSiblings
+ uint256[11] memory u,
+ bytes memory _reputationKey,
+ bytes32[] memory reputationSiblings,
+ bytes memory disagreeStateReputationValue,
+ bytes32[] memory disagreeStateSiblings
) internal view
{
bytes32 jrh = disputeRounds[u[U_ROUND]][u[U_IDX]].jrh;
@@ -313,10 +312,10 @@ contract ReputationMiningCycleRespond is ReputationMiningCycleStorage, PatriciaT
}
function performReputationCalculation(
- uint256[11] u,
- bytes agreeStateReputationValueBytes,
- bytes disagreeStateReputationValueBytes,
- bytes previousNewReputationValueBytes
+ uint256[11] memory u,
+ bytes memory agreeStateReputationValueBytes,
+ bytes memory disagreeStateReputationValueBytes,
+ bytes memory previousNewReputationValueBytes
) internal view
{
// TODO: Possibility of reputation loss - child reputations do not lose the whole of logEntry.amount, but the same fraction logEntry amount is of the user's reputation in skill given by logEntry.skillId
@@ -368,11 +367,11 @@ contract ReputationMiningCycleRespond is ReputationMiningCycleStorage, PatriciaT
}
function checkPreviousReputationInState(
- uint256[11] u,
- bytes32[] agreeStateSiblings,
- bytes previousNewReputationKey,
- bytes previousNewReputationValue,
- bytes32[] previousNewReputationSiblings
+ uint256[11] memory u,
+ bytes32[] memory agreeStateSiblings,
+ bytes memory previousNewReputationKey,
+ bytes memory previousNewReputationValue,
+ bytes32[] memory previousNewReputationSiblings
) internal view
{
// We binary searched to the first disagreement, so the last agreement is the one before
@@ -395,7 +394,7 @@ contract ReputationMiningCycleRespond is ReputationMiningCycleStorage, PatriciaT
require(impliedRoot == disputeRounds[u[U_ROUND]][u[U_IDX]].jrh, "colony-reputation-mining-last-state-disagreement");
}
- function saveProvedReputation(uint256[11] u, bytes previousNewReputationValue) internal {
+ function saveProvedReputation(uint256[11] memory u, bytes memory previousNewReputationValue) internal {
uint256 previousReputationUID;
assembly {
previousReputationUID := mload(add(previousNewReputationValue,0x40))
@@ -409,6 +408,4 @@ contract ReputationMiningCycleRespond is ReputationMiningCycleStorage, PatriciaT
// Save the index for tiebreak scenarios later.
disputeRounds[u[U_ROUND]][u[U_IDX]].provedPreviousReputationUID = previousReputationUID;
}
-
-
}
diff --git a/contracts/ReputationMiningCycleStorage.sol b/contracts/ReputationMiningCycleStorage.sol
index a692ce10de..0a75d21b1a 100644
--- a/contracts/ReputationMiningCycleStorage.sol
+++ b/contracts/ReputationMiningCycleStorage.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23 <0.5.0;
import "../lib/dappsys/auth.sol";
import "./ReputationMiningCycleDataTypes.sol";
diff --git a/contracts/Resolver.sol b/contracts/Resolver.sol
index 3d40268f32..efab9c5a4a 100644
--- a/contracts/Resolver.sol
+++ b/contracts/Resolver.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
import "../lib/dappsys/auth.sol";
@@ -24,7 +23,7 @@ import "../lib/dappsys/auth.sol";
contract Resolver is DSAuth {
mapping (bytes4 => address) public pointers;
- function register(string signature, address destination) public
+ function register(string memory signature, address destination) public
auth
{
pointers[stringToSig(signature)] = destination;
@@ -34,7 +33,7 @@ contract Resolver is DSAuth {
return pointers[sig];
}
- function stringToSig(string signature) public pure returns(bytes4) {
+ function stringToSig(string memory signature) public pure returns(bytes4) {
return bytes4(keccak256(abi.encodePacked(signature)));
}
}
diff --git a/contracts/SafeMath.sol b/contracts/SafeMath.sol
index b565af526d..6fc6163131 100644
--- a/contracts/SafeMath.sol
+++ b/contracts/SafeMath.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
library SafeMath {
diff --git a/contracts/TokenLocking.sol b/contracts/TokenLocking.sol
index 7629a28d95..bca5664577 100644
--- a/contracts/TokenLocking.sol
+++ b/contracts/TokenLocking.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "./ERC20Extended.sol";
@@ -131,7 +130,7 @@ contract TokenLocking is TokenLockingStorage, DSMath {
emit UserTokenWithdrawn(_token, msg.sender, _amount);
}
- function punishStakers(address[] _stakers, address _beneficiary, uint256 _amount) public onlyReputationMiningCycle {
+ function punishStakers(address[] memory _stakers, address _beneficiary, uint256 _amount) public onlyReputationMiningCycle {
address clnyToken = IMetaColony(IColonyNetwork(colonyNetwork).getMetaColony()).getToken();
uint256 lostStake;
// Passing an array so that we don't incur the EtherRouter overhead for each staker if we looped over
@@ -150,7 +149,7 @@ contract TokenLocking is TokenLockingStorage, DSMath {
return totalLockCount[_token];
}
- function getUserLock(address _token, address _user) public view returns (Lock lock) {
+ function getUserLock(address _token, address _user) public view returns (Lock memory lock) {
lock = userLocks[_token][_user];
}
}
diff --git a/contracts/TokenLockingDataTypes.sol b/contracts/TokenLockingDataTypes.sol
index e253943077..e978d06d1b 100644
--- a/contracts/TokenLockingDataTypes.sol
+++ b/contracts/TokenLockingDataTypes.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
contract TokenLockingDataTypes {
diff --git a/contracts/TokenLockingStorage.sol b/contracts/TokenLockingStorage.sol
index 4f98e7d372..1667976a8f 100644
--- a/contracts/TokenLockingStorage.sol
+++ b/contracts/TokenLockingStorage.sol
@@ -15,8 +15,7 @@
along with The Colony Network. If not, see .
*/
-pragma solidity ^0.4.23;
-pragma experimental "v0.5.0";
+pragma solidity >=0.4.23;
pragma experimental "ABIEncoderV2";
import "../lib/dappsys/auth.sol";
diff --git a/contracts/ens/ENS.sol b/contracts/ens/ENS.sol
index 83da0b3b12..aeca9b3665 100644
--- a/contracts/ens/ENS.sol
+++ b/contracts/ens/ENS.sol
@@ -1,4 +1,4 @@
-pragma solidity ^0.4.18;
+pragma solidity >=0.4.23;
/// @title The ENS interface.
diff --git a/contracts/ens/ENSRegistry.sol b/contracts/ens/ENSRegistry.sol
index f8f6e11a50..d8ce408b34 100644
--- a/contracts/ens/ENSRegistry.sol
+++ b/contracts/ens/ENSRegistry.sol
@@ -1,4 +1,4 @@
-pragma solidity ^0.4.18;
+pragma solidity >=0.4.23;
import "./ENS.sol";
@@ -17,7 +17,7 @@ contract ENSRegistry is ENS {
// Permits modifications only by the owner of the specified node, or if unowned.
modifier onlyOwner(bytes32 node) {
address currentOwner = records[node].owner;
- require(currentOwner == 0 || currentOwner == msg.sender, "colony-ens-non-owner-access");
+ require(currentOwner == address(0x0) || currentOwner == msg.sender, "colony-ens-non-owner-access");
_;
}
@@ -39,7 +39,7 @@ contract ENSRegistry is ENS {
/// @param label The hash of the label specifying the subnode.
/// @param owner The address of the new owner.
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public onlyOwner(node) {
- require(records[node].owner != 0, "unowned-node");
+ require(records[node].owner != address(0x0), "unowned-node");
bytes32 subnode = keccak256(abi.encodePacked(node, label));
emit NewOwner(node, label, owner);
records[subnode].owner = owner;
diff --git a/contracts/gnosis/MultiSigWallet.sol b/contracts/gnosis/MultiSigWallet.sol
deleted file mode 100644
index 96fc10f5e3..0000000000
--- a/contracts/gnosis/MultiSigWallet.sol
+++ /dev/null
@@ -1,370 +0,0 @@
-pragma solidity ^0.4.15;
-
-
-/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
-/// @author Stefan George -
-contract MultiSigWallet {
-
- /*
- * Events
- */
- event Confirmation(address indexed sender, uint indexed transactionId);
- event Revocation(address indexed sender, uint indexed transactionId);
- event Submission(uint indexed transactionId);
- event Execution(uint indexed transactionId);
- event ExecutionFailure(uint indexed transactionId);
- event Deposit(address indexed sender, uint value);
- event OwnerAddition(address indexed owner);
- event OwnerRemoval(address indexed owner);
- event RequirementChange(uint required);
-
- /*
- * Constants
- */
- uint constant public MAX_OWNER_COUNT = 50;
-
- /*
- * Storage
- */
- mapping (uint => Transaction) public transactions;
- mapping (uint => mapping (address => bool)) public confirmations;
- mapping (address => bool) public isOwner;
- address[] public owners;
- uint public required;
- uint public transactionCount;
-
- struct Transaction {
- address destination;
- uint value;
- bytes data;
- bool executed;
- }
-
- /*
- * Modifiers
- */
- modifier onlyWallet() {
- require(msg.sender == address(this));
- _;
- }
-
- modifier ownerDoesNotExist(address owner) {
- require(!isOwner[owner]);
- _;
- }
-
- modifier ownerExists(address owner) {
- require(isOwner[owner]);
- _;
- }
-
- modifier transactionExists(uint transactionId) {
- require(transactions[transactionId].destination != 0);
- _;
- }
-
- modifier confirmed(uint transactionId, address owner) {
- require(confirmations[transactionId][owner]);
- _;
- }
-
- modifier notConfirmed(uint transactionId, address owner) {
- require(!confirmations[transactionId][owner]);
- _;
- }
-
- modifier notExecuted(uint transactionId) {
- require(!transactions[transactionId].executed);
- _;
- }
-
- modifier notNull(address _address) {
- require(_address != 0);
- _;
- }
-
- modifier validRequirement(uint ownerCount, uint _required) {
- require(ownerCount <= MAX_OWNER_COUNT
- && _required <= ownerCount
- && _required != 0
- && ownerCount != 0);
- _;
- }
-
- /// @dev Fallback function allows to deposit ether.
- function()
- payable
- {
- if (msg.value > 0)
- Deposit(msg.sender, msg.value);
- }
-
- /*
- * Public functions
- */
- /// @dev Contract constructor sets initial owners and required number of confirmations.
- /// @param _owners List of initial owners.
- /// @param _required Number of required confirmations.
- function MultiSigWallet(address[] _owners, uint _required)
- public
- validRequirement(_owners.length, _required)
- {
- for (uint i=0; i<_owners.length; i++) {
- require(!isOwner[_owners[i]] && _owners[i] != 0);
- isOwner[_owners[i]] = true;
- }
- owners = _owners;
- required = _required;
- }
-
- /// @dev Allows to add a new owner. Transaction has to be sent by wallet.
- /// @param owner Address of new owner.
- function addOwner(address owner)
- public
- onlyWallet
- ownerDoesNotExist(owner)
- notNull(owner)
- validRequirement(owners.length + 1, required)
- {
- isOwner[owner] = true;
- owners.push(owner);
- OwnerAddition(owner);
- }
-
- /// @dev Allows to remove an owner. Transaction has to be sent by wallet.
- /// @param owner Address of owner.
- function removeOwner(address owner)
- public
- onlyWallet
- ownerExists(owner)
- {
- isOwner[owner] = false;
- for (uint i=0; i owners.length)
- changeRequirement(owners.length);
- OwnerRemoval(owner);
- }
-
- /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
- /// @param owner Address of owner to be replaced.
- /// @param newOwner Address of new owner.
- function replaceOwner(address owner, address newOwner)
- public
- onlyWallet
- ownerExists(owner)
- ownerDoesNotExist(newOwner)
- {
- for (uint i=0; i {
// Check for that all public, non-{view,pure} functions have either stoppable or recovery modifiers.
contract.subNodes
- .filter(child => child.type === "FunctionDefinition")
+ .filter(child => child.type === "FunctionDefinition" && child.name !== "")
.forEach(functionDef => {
if (!correctRecoveryModifier(functionDef)) {
console.log("The contract", contractName, "contains a missing stoppable/recovery modifier in function", functionDef.name, ".");
diff --git a/scripts/provision-token-contracts.sh b/scripts/provision-token-contracts.sh
index e1cc12d4f7..6f18aeaa73 100644
--- a/scripts/provision-token-contracts.sh
+++ b/scripts/provision-token-contracts.sh
@@ -3,5 +3,8 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
cd ..
-cp lib/colonyToken/contracts/Token.sol ./contracts/Token.sol
-cp lib/colonyToken/contracts/TokenAuthority.sol ./contracts/TokenAuthority.sol
\ No newline at end of file
+test ! -d ./build/contracts/ && mkdir -p ./build/contracts/
+
+cp lib/colonyToken/build/contracts/Token.json ./build/contracts/Token.json
+cp lib/colonyToken/build/contracts/TokenAuthority.json ./build/contracts/TokenAuthority.json
+cp lib/colonyToken/build/contracts/MultiSigWallet.json ./build/contracts/MultiSigWallet.json
\ No newline at end of file
diff --git a/test/colony-network-mining.js b/test/colony-network-mining.js
index 870c97ee45..a590803ad1 100755
--- a/test/colony-network-mining.js
+++ b/test/colony-network-mining.js
@@ -204,7 +204,7 @@ contract("ColonyNetworkMining", accounts => {
await giveUserCLNYTokens(colonyNetwork, OTHER_ACCOUNT, 9000);
await clny.approve(tokenLocking.address, 10000, { from: OTHER_ACCOUNT });
- await checkErrorRevert(tokenLocking.deposit(clny.address, 10000, { from: OTHER_ACCOUNT }), "ds-token-insufficient-balance");
+ await checkErrorRevert(tokenLocking.deposit(clny.address, 10000, { from: OTHER_ACCOUNT }));
const userBalance = await clny.balanceOf(OTHER_ACCOUNT);
assert.equal(userBalance.toNumber(), 9000);