Skip to content

Commit 18cfb0c

Browse files
authored
Merge pull request #1110 from JoinColony/develop
Merge develop in to master to prepare for release
2 parents e6bc04b + 0b78037 commit 18cfb0c

File tree

72 files changed

+32706
-22613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+32706
-22613
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ jobs:
142142
- run:
143143
name: "Running network contracts unit tests"
144144
command: npm run test:contracts
145+
- run:
146+
name: "Check contract sizes"
147+
command: npx truffle run contract-size --checkMaxSize
145148
- run:
146149
name: "Cleanup ganache leftovers"
147150
command: npm run clean:ganache

contracts/colony/Colony.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ pragma solidity 0.7.3;
1919
pragma experimental ABIEncoderV2;
2020

2121
import "./../common/ERC20Extended.sol";
22+
import "./../common/Multicall.sol";
2223
import "./../common/IEtherRouter.sol";
2324
import "./../common/BasicMetaTransaction.sol";
2425
import "./../tokenLocking/ITokenLocking.sol";
2526
import "./ColonyStorage.sol";
2627

27-
contract Colony is BasicMetaTransaction, ColonyStorage, PatriciaTreeProofs {
28+
contract Colony is BasicMetaTransaction, Multicall, ColonyStorage, PatriciaTreeProofs {
2829

29-
// V10: G Lightweight Spaceship
3030
// This function, exactly as defined, is used in build scripts. Take care when updating.
3131
// Version number should be upped with every change in Colony or its dependency contracts or libraries.
32-
function version() public pure returns (uint256 colonyVersion) { return 10; }
32+
function version() public pure returns (uint256 colonyVersion) { return 11; }
3333

3434
function getColonyNetwork() public view returns (address) {
3535
return colonyNetworkAddress;

contracts/colony/ColonyArbitraryTransaction.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ contract ColonyArbitraryTransaction is ColonyStorage {
9494

9595
if (sig == APPROVE_SIG) { approveTransactionCleanup(_to, _action); }
9696

97+
emit ArbitraryTransaction(_to, _action, res);
98+
9799
return res;
98100
}
99101

contracts/colony/ColonyDataTypes.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ interface ColonyDataTypes {
347347
/// @param amount The (maximum) amount the address is having its reputation changed by
348348
event ArbitraryReputationUpdate(address agent, address user, uint256 skillId, int256 amount);
349349

350+
event ArbitraryTransaction(address target, bytes data, bool success);
351+
350352
struct RewardPayoutCycle {
351353
// Reputation root hash at the time of reward payout creation
352354
bytes32 reputationState;

contracts/colony/ColonyTask.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ contract ColonyTask is ColonyStorage {
570570
}
571571

572572
reviewerAddresses[i] = ecrecover(txHash, _sigV[i], _sigR[i], _sigS[i]);
573+
require(reviewerAddresses[i] != address(0), "colony-task-invalid-signature");
573574
}
574575
return reviewerAddresses;
575576
}

contracts/colony/IColony.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ pragma experimental ABIEncoderV2;
2020

2121
import "./../common/IRecovery.sol";
2222
import "./../common/IBasicMetaTransaction.sol";
23+
import "./../common/IMulticall.sol";
2324
import "./ColonyDataTypes.sol";
2425

2526

26-
/// @title Colony interface
27-
/// @notice All externally available functions are available here and registered to work with EtherRouter Network contract
28-
interface IColony is ColonyDataTypes, IRecovery, IBasicMetaTransaction {
27+
interface IColony is ColonyDataTypes, IRecovery, IBasicMetaTransaction, IMulticall {
2928
// Implemented in DSAuth.sol
3029
/// @notice Get the `ColonyAuthority` for the colony.
3130
/// @return colonyAuthority The `ColonyAuthority` contract address

contracts/colony/IMetaColony.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ pragma experimental "ABIEncoderV2";
2121
import "./IColony.sol";
2222

2323

24-
/// @title MetaColony interface
25-
/// @notice All externally available functions are available here and registered to work with EtherRouter Network contract
2624
interface IMetaColony is IColony {
2725
/// @notice Mints CLNY in the Meta Colony and transfers them to the colony network.
2826
/// Only allowed to be called on the Meta Colony by the colony network.

contracts/colonyNetwork/ColonyNetwork.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ pragma experimental "ABIEncoderV2";
2121
import "./../common/BasicMetaTransaction.sol";
2222
import "./../reputationMiningCycle/IReputationMiningCycle.sol";
2323
import "./ColonyNetworkStorage.sol";
24+
import "./../common/Multicall.sol";
2425

2526

26-
contract ColonyNetwork is BasicMetaTransaction, ColonyNetworkStorage {
27+
contract ColonyNetwork is BasicMetaTransaction, ColonyNetworkStorage, Multicall {
2728

2829
function isColony(address _colony) public view returns (bool) {
2930
return _isColony[_colony];

contracts/colonyNetwork/ColonyNetworkDeployer.sol

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import "./../colony/ColonyAuthority.sol";
2323
import "./../colony/IColony.sol";
2424
import "./ColonyNetworkStorage.sol";
2525
import "./IColonyNetwork.sol";
26+
import "./../metaTxToken/MetaTxToken.sol";
2627

2728

2829
contract ColonyNetworkDeployer is ColonyNetworkStorage {
@@ -93,6 +94,43 @@ contract ColonyNetworkDeployer is ColonyNetworkStorage {
9394
return colonyAddress;
9495
}
9596

97+
function createColonyForFrontend(
98+
address _tokenAddress,
99+
string memory _name,
100+
string memory _symbol,
101+
uint8 _decimals,
102+
uint256 _version,
103+
string memory _colonyName,
104+
string memory _metadata
105+
)
106+
public stoppable
107+
returns (address token, address colony)
108+
{
109+
// Create Token
110+
MetaTxToken token;
111+
if (_tokenAddress == address(0x0)){
112+
token = MetaTxToken(IColonyNetwork(address(this)).deployTokenViaNetwork(_name, _symbol, _decimals));
113+
emit TokenDeployed(address(token));
114+
} else {
115+
token = MetaTxToken(_tokenAddress);
116+
}
117+
118+
// Create Colony
119+
address colonyAddress = createColony(address(token), _version, _colonyName, _metadata);
120+
121+
// Extra token bookkeeping if we deployed it
122+
if (_tokenAddress == address(0x0)){
123+
// Deploy Authority
124+
address[] memory allowedToTransfer;
125+
address tokenAuthorityAddress = IColonyNetwork(address(this)).deployTokenAuthority(address(token), colonyAddress, allowedToTransfer);
126+
// Set Authority
127+
token.setAuthority(DSAuthority(tokenAuthorityAddress));
128+
token.setOwner(msgSender());
129+
}
130+
131+
return (address(token), colonyAddress);
132+
}
133+
96134
function deployColony(address _tokenAddress, uint256 _version) internal returns (address) {
97135
require(_tokenAddress != address(0x0), "colony-token-invalid-address");
98136
require(colonyVersionResolver[_version] != address(0x00), "colony-network-invalid-version");

contracts/colonyNetwork/ColonyNetworkENS.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ import "./ColonyNetworkStorage.sol";
2222
import "./../common/MultiChain.sol";
2323

2424

25-
/// @title First-In-First-Served ENS Registrar
26-
/// @notice A registrar that allocates subdomains to the first person to claim them.
27-
/// @notice Source modified from https://github.com/ensdomains/ens/blob/master/contracts/FIFSRegistrar.sol
2825
contract ColonyNetworkENS is ColonyNetworkStorage, MultiChain {
2926

3027
bytes32 constant USER_HASH = keccak256("user");

0 commit comments

Comments
 (0)