diff --git a/contracts/testHelpers/TestExtensions.sol b/contracts/testHelpers/TestExtensions.sol
deleted file mode 100644
index dd4df28525..0000000000
--- a/contracts/testHelpers/TestExtensions.sol
+++ /dev/null
@@ -1,103 +0,0 @@
-// SPDX-License-Identifier: GPL-3.0-or-later
-/*
- This file is part of The Colony Network.
-
- The Colony Network is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- The Colony Network is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with The Colony Network. If not, see .
-*/
-
-pragma solidity 0.8.23;
-pragma experimental ABIEncoderV2;
-
-import { ColonyExtensionMeta } from "../extensions/ColonyExtensionMeta.sol";
-import { IColony } from "./../colony/IColony.sol";
-
-abstract contract TestExtension is ColonyExtensionMeta {
- function install(address _colony) public override auth {
- require(address(colony) == address(0x0), "extension-already-installed");
-
- colony = IColony(_colony);
- }
-
- function finishUpgrade() public override auth {} // solhint-disable-line no-empty-blocks
-
- function deprecate(bool _deprecated) public override auth {
- deprecated = _deprecated;
- }
-
- function uninstall() public override auth {
- selfdestruct(payable(address(colony)));
- }
-}
-
-contract TestExtension0 is TestExtension {
- function identifier() public pure override returns (bytes32) {
- return keccak256("TestExtension");
- }
-
- function version() public pure override returns (uint256) {
- return 0;
- }
-}
-
-contract TestExtension1 is TestExtension {
- function identifier() public pure override returns (bytes32) {
- return keccak256("TestExtension");
- }
-
- function version() public pure override returns (uint256) {
- return 1;
- }
-
- function receiveEther() external payable {} // solhint-disable-line no-empty-blocks
-
- function foo() public notDeprecated {} // solhint-disable-line no-empty-blocks
-}
-
-contract TestExtension2 is TestExtension {
- function identifier() public pure override returns (bytes32) {
- return keccak256("TestExtension");
- }
-
- function version() public pure override returns (uint256) {
- return 2;
- }
-}
-
-contract TestExtension3 is TestExtension {
- function identifier() public pure override returns (bytes32) {
- return keccak256("TestExtension");
- }
-
- function version() public pure override returns (uint256) {
- return 3;
- }
-}
-
-contract TestVotingToken is TestExtension {
- function identifier() public pure override returns (bytes32) {
- return keccak256("VotingToken");
- }
-
- function version() public pure override returns (uint256) {
- return 1;
- }
-
- function lockToken() public returns (uint256) {
- return colony.lockToken();
- }
-
- function unlockTokenForUser(address _user, uint256 _lockId) public {
- colony.unlockTokenForUser(_user, _lockId);
- }
-}
diff --git a/contracts/testHelpers/testExtensions/TestExtension0.sol b/contracts/testHelpers/testExtensions/TestExtension0.sol
new file mode 100644
index 0000000000..5f26c05b9b
--- /dev/null
+++ b/contracts/testHelpers/testExtensions/TestExtension0.sol
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+/*
+ This file is part of The Colony Network.
+
+ The Colony Network is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The Colony Network is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with The Colony Network. If not, see .
+*/
+
+pragma solidity 0.8.23;
+pragma experimental ABIEncoderV2;
+
+import { TestExtensionBase } from "./TestExtensionBase.sol";
+
+contract TestExtension0 is TestExtensionBase {
+ function identifier() public pure override returns (bytes32) {
+ return keccak256("TestExtension");
+ }
+
+ function version() public pure override returns (uint256) {
+ return 0;
+ }
+}
diff --git a/contracts/testHelpers/testExtensions/TestExtension1.sol b/contracts/testHelpers/testExtensions/TestExtension1.sol
new file mode 100644
index 0000000000..7f4b0510b7
--- /dev/null
+++ b/contracts/testHelpers/testExtensions/TestExtension1.sol
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+/*
+ This file is part of The Colony Network.
+
+ The Colony Network is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The Colony Network is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with The Colony Network. If not, see .
+*/
+
+pragma solidity 0.8.23;
+pragma experimental ABIEncoderV2;
+
+import { TestExtensionBase } from "./TestExtensionBase.sol";
+
+contract TestExtension1 is TestExtensionBase {
+ function identifier() public pure override returns (bytes32) {
+ return keccak256("TestExtension");
+ }
+
+ function version() public pure override returns (uint256) {
+ return 1;
+ }
+
+ function receiveEther() external payable {} // solhint-disable-line no-empty-blocks
+
+ function foo() public notDeprecated {} // solhint-disable-line no-empty-blocks
+}
diff --git a/contracts/testHelpers/testExtensions/TestExtension2.sol b/contracts/testHelpers/testExtensions/TestExtension2.sol
new file mode 100644
index 0000000000..fbdf6a6841
--- /dev/null
+++ b/contracts/testHelpers/testExtensions/TestExtension2.sol
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+/*
+ This file is part of The Colony Network.
+
+ The Colony Network is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The Colony Network is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with The Colony Network. If not, see .
+*/
+
+pragma solidity 0.8.23;
+pragma experimental ABIEncoderV2;
+
+import { TestExtensionBase } from "./TestExtensionBase.sol";
+
+contract TestExtension2 is TestExtensionBase {
+ function identifier() public pure override returns (bytes32) {
+ return keccak256("TestExtension");
+ }
+
+ function version() public pure override returns (uint256) {
+ return 2;
+ }
+}
diff --git a/contracts/testHelpers/testExtensions/TestExtension3.sol b/contracts/testHelpers/testExtensions/TestExtension3.sol
new file mode 100644
index 0000000000..13c6f0e621
--- /dev/null
+++ b/contracts/testHelpers/testExtensions/TestExtension3.sol
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+/*
+ This file is part of The Colony Network.
+
+ The Colony Network is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The Colony Network is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with The Colony Network. If not, see .
+*/
+
+pragma solidity 0.8.23;
+pragma experimental ABIEncoderV2;
+
+import { TestExtensionBase } from "./TestExtensionBase.sol";
+
+contract TestExtension3 is TestExtensionBase {
+ function identifier() public pure override returns (bytes32) {
+ return keccak256("TestExtension");
+ }
+
+ function version() public pure override returns (uint256) {
+ return 3;
+ }
+}
diff --git a/contracts/testHelpers/testExtensions/TestExtensionBase.sol b/contracts/testHelpers/testExtensions/TestExtensionBase.sol
new file mode 100644
index 0000000000..66c08854e6
--- /dev/null
+++ b/contracts/testHelpers/testExtensions/TestExtensionBase.sol
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+/*
+ This file is part of The Colony Network.
+
+ The Colony Network is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The Colony Network is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with The Colony Network. If not, see .
+*/
+
+pragma solidity 0.8.23;
+pragma experimental ABIEncoderV2;
+
+import { ColonyExtensionMeta } from "./../../extensions/ColonyExtensionMeta.sol";
+import { IColony } from "./../../colony/IColony.sol";
+
+abstract contract TestExtensionBase is ColonyExtensionMeta {
+ function install(address _colony) public override auth {
+ require(address(colony) == address(0x0), "extension-already-installed");
+
+ colony = IColony(_colony);
+ }
+
+ function finishUpgrade() public override auth {} // solhint-disable-line no-empty-blocks
+
+ function deprecate(bool _deprecated) public override auth {
+ deprecated = _deprecated;
+ }
+
+ function uninstall() public override auth {
+ selfdestruct(payable(address(colony)));
+ }
+}
diff --git a/contracts/testHelpers/testExtensions/TestVotingToken.sol b/contracts/testHelpers/testExtensions/TestVotingToken.sol
new file mode 100644
index 0000000000..c91a349a86
--- /dev/null
+++ b/contracts/testHelpers/testExtensions/TestVotingToken.sol
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+/*
+ This file is part of The Colony Network.
+
+ The Colony Network is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The Colony Network is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with The Colony Network. If not, see .
+*/
+
+pragma solidity 0.8.23;
+pragma experimental ABIEncoderV2;
+
+import { TestExtensionBase } from "./TestExtensionBase.sol";
+
+contract TestVotingToken is TestExtensionBase {
+ function identifier() public pure override returns (bytes32) {
+ return keccak256("VotingToken");
+ }
+
+ function version() public pure override returns (uint256) {
+ return 1;
+ }
+
+ function lockToken() public returns (uint256) {
+ return colony.lockToken();
+ }
+
+ function unlockTokenForUser(address _user, uint256 _lockId) public {
+ colony.unlockTokenForUser(_user, _lockId);
+ }
+}
diff --git a/helpers/upgradable-contracts.js b/helpers/upgradable-contracts.js
index 19d227d3ce..d3cb07a714 100644
--- a/helpers/upgradable-contracts.js
+++ b/helpers/upgradable-contracts.js
@@ -3,16 +3,36 @@ const namehash = require("eth-ens-namehash");
const assert = require("assert");
const fs = require("fs");
-exports.parseImplementation = function parseImplementation(contractName, functionsToResolve, deployedImplementations) {
+function readArtifact(contractDir, contractName) {
+ const artifactPath = `./artifacts/contracts/${contractDir}/${contractName}.sol/${contractName}.json`;
+ try {
+ return JSON.parse(fs.readFileSync(artifactPath, "utf8"));
+ } catch {
+ const commonArtifactPath = `./artifacts/contracts/common/${contractName}.sol/${contractName}.json`;
+ return JSON.parse(fs.readFileSync(commonArtifactPath, "utf8"));
+ }
+}
+
+function readSource(contractDir, contractName) {
+ const contractPath = `./contracts/${contractDir}/${contractName}.sol`;
+ try {
+ return fs.readFileSync(contractPath, "utf8");
+ } catch {
+ const commonContractPath = `./contracts/common/${contractName}.sol`;
+ return fs.readFileSync(commonContractPath, "utf8");
+ }
+}
+
+exports.parseImplementation = function parseImplementation(contractDir, contractName, functionsToResolve, deployedImplementations) {
// Goes through a contract, and sees if anything in it is in the interface. If it is, then wire up the resolver to point at it
- const contract = JSON.parse(fs.readFileSync(`./build/contracts/${contractName}.json`));
+ const contract = readArtifact(contractDir, contractName);
contract.abi.map((value) => {
const fName = value.name;
if (functionsToResolve[fName]) {
if (
functionsToResolve[fName].definedIn !== "" &&
functionsToResolve[fName].definedIn !== deployedImplementations[contractName] &&
- contract.source.indexOf(`function ${fName}`) >= 0 // Avoid false positives by inheritence
+ readSource(contractDir, contractName).indexOf(`function ${fName}`) >= 0 // Avoid inheritence false positives
) {
// We allow function overloads so long as they are in the same file.
// eslint-disable-next-line no-console
@@ -33,18 +53,18 @@ exports.parseImplementation = function parseImplementation(contractName, functio
});
};
-exports.setupEtherRouter = async function setupEtherRouter(interfaceContract, deployedImplementations, resolver) {
+exports.setupEtherRouter = async function setupEtherRouter(contractDir, interfaceName, deployedImplementations, resolver) {
const functionsToResolve = {};
// Load ABI of the interface of the contract we're trying to stich together
- const iAbi = JSON.parse(fs.readFileSync(`./build/contracts/${interfaceContract}.json`, "utf8")).abi;
+ const iAbi = readArtifact(contractDir, interfaceName).abi;
iAbi.map((value) => {
const fName = value.name;
const fType = value.type;
- // These are from DSAuth, and so are on EtherRouter itself without any more help.
- if (fName !== "authority" && fName !== "owner" && !fName.includes("c_0x")) {
- // We only care about functions.
- if (fType === "function") {
+ // We only care about functions.
+ if (fType === "function") {
+ // These are from DSAuth, and so are on EtherRouter itself without any more help.
+ if (fName !== "authority" && fName !== "owner" && !fName.includes("c_0x")) {
// Gets the types of the parameters, which is all we care about for function signatures.
const fInputs = value.inputs.map((parameter) => parameter.type);
// Record function name
@@ -53,7 +73,9 @@ exports.setupEtherRouter = async function setupEtherRouter(interfaceContract, de
}
return functionsToResolve;
});
- Object.keys(deployedImplementations).map((name) => exports.parseImplementation(name, functionsToResolve, deployedImplementations));
+ Object.keys(deployedImplementations).map((name) => {
+ return exports.parseImplementation(contractDir, name, functionsToResolve, deployedImplementations);
+ });
// Iterate over the ABI again to make sure we get overloads - the functionToResolve is only indexed by name, not signature.
for (let i = 0; i < iAbi.length; i += 1) {
// We do it like this rather than a nice await Promise.all on a mapped array of promises because of
@@ -95,7 +117,7 @@ exports.setupColonyVersionResolver = async function setupColonyVersionResolver(
deployedImplementations.ContractRecovery = contractRecovery.address;
deployedImplementations.ColonyArbitraryTransaction = colonyArbitraryTransaction.address;
- await exports.setupEtherRouter("IMetaColony", deployedImplementations, resolver);
+ await exports.setupEtherRouter("colony", "IMetaColony", deployedImplementations, resolver);
};
exports.setupUpgradableColonyNetwork = async function setupUpgradableColonyNetwork(
@@ -118,14 +140,14 @@ exports.setupUpgradableColonyNetwork = async function setupUpgradableColonyNetwo
deployedImplementations.ColonyNetworkExtensions = colonyNetworkExtensions.address;
deployedImplementations.ContractRecovery = contractRecovery.address;
- await exports.setupEtherRouter("IColonyNetwork", deployedImplementations, resolver);
+ await exports.setupEtherRouter("colonyNetwork", "IColonyNetwork", deployedImplementations, resolver);
await etherRouter.setResolver(resolver.address);
};
exports.setupUpgradableTokenLocking = async function setupUpgradableTokenLocking(etherRouter, resolver, tokenLocking) {
const deployedImplementations = {};
deployedImplementations.TokenLocking = tokenLocking.address;
- await exports.setupEtherRouter("ITokenLocking", deployedImplementations, resolver);
+ await exports.setupEtherRouter("tokenLocking", "ITokenLocking", deployedImplementations, resolver);
await etherRouter.setResolver(resolver.address);
const registeredResolver = await etherRouter.resolver();
@@ -144,7 +166,7 @@ exports.setupReputationMiningCycleResolver = async function setupReputationMinin
deployedImplementations.ReputationMiningCycleRespond = reputationMiningCycleRespond.address;
deployedImplementations.ReputationMiningCycleBinarySearch = reputationMiningCycleBinarySearch.address;
- await exports.setupEtherRouter("IReputationMiningCycle", deployedImplementations, resolver);
+ await exports.setupEtherRouter("reputationMiningCycle", "IReputationMiningCycle", deployedImplementations, resolver);
await colonyNetwork.setMiningResolver(resolver.address);
};
diff --git a/migrations/9_setup_extensions.js b/migrations/9_setup_extensions.js
index 77bf656260..7bac0c780e 100644
--- a/migrations/9_setup_extensions.js
+++ b/migrations/9_setup_extensions.js
@@ -23,7 +23,7 @@ const EtherRouter = artifacts.require("./EtherRouter");
const IColonyNetwork = artifacts.require("./IColonyNetwork");
const IMetaColony = artifacts.require("./IMetaColony");
-async function addExtension(colonyNetwork, interfaceName, extensionName, implementations) {
+async function addExtension(colonyNetwork, contractDir, interfaceName, extensionName, implementations) {
const metaColonyAddress = await colonyNetwork.getMetaColony();
const metaColony = await IMetaColony.at(metaColonyAddress);
@@ -35,7 +35,7 @@ async function addExtension(colonyNetwork, interfaceName, extensionName, impleme
for (let idx = 0; idx < implementations.length; idx += 1) {
deployedImplementations[implementations[idx].contractName] = deployments[idx].address;
}
- await setupEtherRouter(interfaceName, deployedImplementations, resolver);
+ await setupEtherRouter(contractDir, interfaceName, deployedImplementations, resolver);
await metaColony.addExtensionToNetwork(NAME_HASH, resolver.address);
console.log(`### ${extensionName} extension installed`);
}
@@ -45,15 +45,15 @@ module.exports = async function (deployer, network, accounts) {
const etherRouterDeployed = await EtherRouter.deployed();
const colonyNetwork = await IColonyNetwork.at(etherRouterDeployed.address);
- await addExtension(colonyNetwork, "CoinMachine", "CoinMachine", [CoinMachine]);
- await addExtension(colonyNetwork, "EvaluatedExpenditure", "EvaluatedExpenditure", [EvaluatedExpenditure]);
- await addExtension(colonyNetwork, "FundingQueue", "FundingQueue", [FundingQueue]);
- await addExtension(colonyNetwork, "OneTxPayment", "OneTxPayment", [OneTxPayment]);
- await addExtension(colonyNetwork, "ReputationBootstrapper", "ReputationBootstrapper", [ReputationBootstrapper]);
- await addExtension(colonyNetwork, "StakedExpenditure", "StakedExpenditure", [StakedExpenditure]);
- await addExtension(colonyNetwork, "StreamingPayments", "StreamingPayments", [StreamingPayments]);
- await addExtension(colonyNetwork, "TokenSupplier", "TokenSupplier", [TokenSupplier]);
- await addExtension(colonyNetwork, "IVotingReputation", "VotingReputation", [
+ await addExtension(colonyNetwork, "extensions", "CoinMachine", "CoinMachine", [CoinMachine]);
+ await addExtension(colonyNetwork, "extensions", "EvaluatedExpenditure", "EvaluatedExpenditure", [EvaluatedExpenditure]);
+ await addExtension(colonyNetwork, "extensions", "FundingQueue", "FundingQueue", [FundingQueue]);
+ await addExtension(colonyNetwork, "extensions", "OneTxPayment", "OneTxPayment", [OneTxPayment]);
+ await addExtension(colonyNetwork, "extensions", "ReputationBootstrapper", "ReputationBootstrapper", [ReputationBootstrapper]);
+ await addExtension(colonyNetwork, "extensions", "StakedExpenditure", "StakedExpenditure", [StakedExpenditure]);
+ await addExtension(colonyNetwork, "extensions", "StreamingPayments", "StreamingPayments", [StreamingPayments]);
+ await addExtension(colonyNetwork, "extensions", "TokenSupplier", "TokenSupplier", [TokenSupplier]);
+ await addExtension(colonyNetwork, "extensions/votingReputation", "IVotingReputation", "VotingReputation", [
VotingReputation,
VotingReputationStaking,
VotingReputationMisalignedRecovery,
diff --git a/scripts/check-recovery.js b/scripts/check-recovery.js
index 53987ef5be..96fe3ba834 100755
--- a/scripts/check-recovery.js
+++ b/scripts/check-recovery.js
@@ -87,7 +87,12 @@ walkSync("./contracts/").forEach((contractName) => {
"contracts/testHelpers/TasksPayments.sol",
"contracts/testHelpers/ToggleableToken.sol",
"contracts/testHelpers/FunctionsNotAvailableOnColony.sol",
- "contracts/testHelpers/TestExtensions.sol",
+ "contracts/testHelpers/testExtensions/TestExtensionBase.sol",
+ "contracts/testHelpers/testExtensions/TestExtension0.sol",
+ "contracts/testHelpers/testExtensions/TestExtension1.sol",
+ "contracts/testHelpers/testExtensions/TestExtension2.sol",
+ "contracts/testHelpers/testExtensions/TestExtension3.sol",
+ "contracts/testHelpers/testExtensions/TestVotingToken.sol",
"contracts/testHelpers/TransferTest.sol",
"contracts/testHelpers/RequireExecuteCall.sol",
"contracts/testHelpers/VotingReputationMisaligned.sol",
diff --git a/scripts/check-storage.js b/scripts/check-storage.js
index 43e8acc5ad..ce1602cde9 100755
--- a/scripts/check-storage.js
+++ b/scripts/check-storage.js
@@ -46,7 +46,12 @@ walkSync("./contracts/").forEach((contractName) => {
"contracts/reputationMiningCycle/ReputationMiningCycleStorage.sol",
"contracts/testHelpers/ERC721Mock.sol",
"contracts/testHelpers/ToggleableToken.sol",
- "contracts/testHelpers/TestExtensions.sol",
+ "contracts/testHelpers/testExtensions/TestExtensionBase.sol",
+ "contracts/testHelpers/testExtensions/TestExtension0.sol",
+ "contracts/testHelpers/testExtensions/TestExtension1.sol",
+ "contracts/testHelpers/testExtensions/TestExtension2.sol",
+ "contracts/testHelpers/testExtensions/TestExtension3.sol",
+ "contracts/testHelpers/testExtensions/TestVotingToken.sol",
"contracts/testHelpers/GasGuzzler.sol",
"contracts/testHelpers/VotingReputationMisaligned.sol",
"contracts/tokenLocking/TokenLockingStorage.sol",
diff --git a/scripts/mockBridgeMonitor.js b/scripts/mockBridgeMonitor.js
index 3eff5e8361..8935b98264 100644
--- a/scripts/mockBridgeMonitor.js
+++ b/scripts/mockBridgeMonitor.js
@@ -1,6 +1,7 @@
const ethers = require("ethers");
-const bridgeAbi = require("../build/contracts/BridgeMock.json").abi; // eslint-disable-line import/no-unresolved
+// eslint-disable-next-line import/no-unresolved
+const bridgeAbi = require("../artifacts/contracts/testHelpers/BridgeMock.sol/BridgeMock.json").abi;
class MockBridgeMonitor {
/**
diff --git a/test/contracts-network/colony-expenditure.js b/test/contracts-network/colony-expenditure.js
index f5853234a6..02527cef1d 100644
--- a/test/contracts-network/colony-expenditure.js
+++ b/test/contracts-network/colony-expenditure.js
@@ -1104,7 +1104,7 @@ contract("Colony Expenditure", (accounts) => {
before(async () => {
const extensionImplementation = await TestExtension0.new();
const resolver = await Resolver.new();
- await setupEtherRouter("TestExtension0", { TestExtension0: extensionImplementation.address }, resolver);
+ await setupEtherRouter("testHelpers/testExtensions", "TestExtension0", { TestExtension0: extensionImplementation.address }, resolver);
await metaColony.addExtensionToNetwork(TEST_EXTENSION, resolver.address);
});
diff --git a/test/contracts-network/colony-network-extensions.js b/test/contracts-network/colony-network-extensions.js
index b90aee22ec..06d898dd2d 100644
--- a/test/contracts-network/colony-network-extensions.js
+++ b/test/contracts-network/colony-network-extensions.js
@@ -55,23 +55,23 @@ contract("Colony Network Extensions", (accounts) => {
testExtension0Resolver = await Resolver.new();
const testExtension0 = await TestExtension0.new();
- await setupEtherRouter("TestExtension0", { TestExtension0: testExtension0.address }, testExtension0Resolver);
+ await setupEtherRouter("testHelpers/testExtensions", "TestExtension0", { TestExtension0: testExtension0.address }, testExtension0Resolver);
testExtension1Resolver = await Resolver.new();
const testExtension1 = await TestExtension1.new();
- await setupEtherRouter("TestExtension1", { TestExtension1: testExtension1.address }, testExtension1Resolver);
+ await setupEtherRouter("testHelpers/testExtensions", "TestExtension1", { TestExtension1: testExtension1.address }, testExtension1Resolver);
testExtension2Resolver = await Resolver.new();
const testExtension2 = await TestExtension2.new();
- await setupEtherRouter("TestExtension2", { TestExtension2: testExtension2.address }, testExtension2Resolver);
+ await setupEtherRouter("testHelpers/testExtensions", "TestExtension2", { TestExtension2: testExtension2.address }, testExtension2Resolver);
testExtension3Resolver = await Resolver.new();
const testExtension3 = await TestExtension3.new();
- await setupEtherRouter("TestExtension3", { TestExtension3: testExtension3.address }, testExtension3Resolver);
+ await setupEtherRouter("testHelpers/testExtensions", "TestExtension3", { TestExtension3: testExtension3.address }, testExtension3Resolver);
testVotingTokenResolver = await Resolver.new();
const testVotingToken = await TestVotingToken.new();
- await setupEtherRouter("TestVotingToken", { TestVotingToken: testVotingToken.address }, testVotingTokenResolver);
+ await setupEtherRouter("testHelpers/testExtensions", "TestVotingToken", { TestVotingToken: testVotingToken.address }, testVotingTokenResolver);
await metaColony.addExtensionToNetwork(TEST_EXTENSION, testExtension1Resolver.address);
await metaColony.addExtensionToNetwork(TEST_EXTENSION, testExtension2Resolver.address);
diff --git a/test/contracts-network/colony-network-recovery.js b/test/contracts-network/colony-network-recovery.js
index 111fb74552..8730004855 100644
--- a/test/contracts-network/colony-network-recovery.js
+++ b/test/contracts-network/colony-network-recovery.js
@@ -494,10 +494,10 @@ contract("Colony Network Recovery", (accounts) => {
// We use the existing deployments for the majority of the functions
const deployedImplementations = {};
- deployedImplementations.ReputationMiningCycle = await ReputationMiningCycle.deployed();
- deployedImplementations.ReputationMiningCycleRespond = await ReputationMiningCycleRespond.deployed();
- deployedImplementations.ReputationMiningCycleBinarySearch = await ReputationMiningCycleBinarySearch.deployed();
- await setupEtherRouter("IReputationMiningCycle", deployedImplementations, newResolver);
+ deployedImplementations.ReputationMiningCycle = (await ReputationMiningCycle.deployed()).address;
+ deployedImplementations.ReputationMiningCycleRespond = (await ReputationMiningCycleRespond.deployed()).address;
+ deployedImplementations.ReputationMiningCycleBinarySearch = (await ReputationMiningCycleBinarySearch.deployed()).address;
+ await setupEtherRouter("reputationMiningCycle", "IReputationMiningCycle", deployedImplementations, newResolver);
// Now add our extra functions.
// Add ReputationMiningCycleEditing to the resolver
diff --git a/test/contracts-network/colony-task.js b/test/contracts-network/colony-task.js
index 8ffecb54a2..fba82bb7b2 100644
--- a/test/contracts-network/colony-task.js
+++ b/test/contracts-network/colony-task.js
@@ -1982,7 +1982,7 @@ contract.skip("ColonyTask", (accounts) => {
const extensionImplementation = await TestExtension0.new();
const resolver = await Resolver.new();
- await setupEtherRouter("TestExtension0", { TestExtension0: extensionImplementation.address }, resolver);
+ await setupEtherRouter("testHelpers/testExtensions", "TestExtension0", { TestExtension0: extensionImplementation.address }, resolver);
await metaColony.addExtensionToNetwork(TEST_EXTENSION, resolver.address);
diff --git a/test/contracts-network/token-locking.js b/test/contracts-network/token-locking.js
index 1b9fb157d6..6f66e4a411 100644
--- a/test/contracts-network/token-locking.js
+++ b/test/contracts-network/token-locking.js
@@ -340,7 +340,7 @@ contract("Token Locking", (addresses) => {
// Make an extension available on the network that is able to lock tokens.
const testVotingTokenResolver = await Resolver.new();
const testVotingToken = await TestVotingToken.new();
- await setupEtherRouter("TestVotingToken", { TestVotingToken: testVotingToken.address }, testVotingTokenResolver);
+ await setupEtherRouter("testHelpers/testExtensions", "TestVotingToken", { TestVotingToken: testVotingToken.address }, testVotingTokenResolver);
TEST_VOTING_TOKEN = soliditySha3("VotingToken");
const metaColonyAddress = await colonyNetwork.getMetaColony();
const metaColony = await IMetaColony.at(metaColonyAddress);
diff --git a/test/packages/metaTransactionBroadcaster.js b/test/packages/metaTransactionBroadcaster.js
index 547369b53c..b12db090ac 100644
--- a/test/packages/metaTransactionBroadcaster.js
+++ b/test/packages/metaTransactionBroadcaster.js
@@ -87,7 +87,7 @@ contract.skip("Metatransaction broadcaster", (accounts) => {
const coinMachineImplementation = await CoinMachine.new();
const resolver = await Resolver.new();
- await setupEtherRouter("CoinMachine", { CoinMachine: coinMachineImplementation.address }, resolver);
+ await setupEtherRouter("extensions", "CoinMachine", { CoinMachine: coinMachineImplementation.address }, resolver);
const versionSig = await resolver.stringToSig("version()");
const target = await resolver.lookup(versionSig);
@@ -732,7 +732,7 @@ contract.skip("Metatransaction broadcaster", (accounts) => {
it("a transaction that would be valid but is too expensive is rejected and not mined", async function () {
const extensionImplementation = await GasGuzzler.new();
const resolver = await Resolver.new();
- await setupEtherRouter("GasGuzzler", { GasGuzzler: extensionImplementation.address }, resolver);
+ await setupEtherRouter("testHelpers", "GasGuzzler", { GasGuzzler: extensionImplementation.address }, resolver);
const TEST_EXTENSION = soliditySha3("GasGuzzler");
const mcAddress = await colonyNetwork.getMetaColony();
diff --git a/test/truffle-fixture.js b/test/truffle-fixture.js
index 6f41f43e18..3ee47aedd6 100644
--- a/test/truffle-fixture.js
+++ b/test/truffle-fixture.js
@@ -325,7 +325,7 @@ async function setupExtensions() {
const metaColonyAddress = await colonyNetwork.getMetaColony();
const metaColony = await IMetaColony.at(metaColonyAddress);
- async function addExtension(interfaceName, extensionName, implementations) {
+ async function addExtension(contractDir, interfaceName, extensionName, implementations) {
const NAME_HASH = soliditySha3(extensionName);
const deployments = await Promise.all(implementations.map((x) => x.new()));
const resolver = await Resolver.new();
@@ -334,19 +334,23 @@ async function setupExtensions() {
for (let idx = 0; idx < implementations.length; idx += 1) {
deployedImplementations[implementations[idx].contractName] = deployments[idx].address;
}
- await setupEtherRouter(interfaceName, deployedImplementations, resolver);
+ await setupEtherRouter(contractDir, interfaceName, deployedImplementations, resolver);
await metaColony.addExtensionToNetwork(NAME_HASH, resolver.address);
}
- await addExtension("CoinMachine", "CoinMachine", [CoinMachine]);
- await addExtension("EvaluatedExpenditure", "EvaluatedExpenditure", [EvaluatedExpenditure]);
- await addExtension("FundingQueue", "FundingQueue", [FundingQueue]);
- await addExtension("OneTxPayment", "OneTxPayment", [OneTxPayment]);
- await addExtension("ReputationBootstrapper", "ReputationBootstrapper", [ReputationBootstrapper]);
- await addExtension("StakedExpenditure", "StakedExpenditure", [StakedExpenditure]);
- await addExtension("StreamingPayments", "StreamingPayments", [StreamingPayments]);
- await addExtension("TokenSupplier", "TokenSupplier", [TokenSupplier]);
- await addExtension("IVotingReputation", "VotingReputation", [VotingReputation, VotingReputationStaking, VotingReputationMisalignedRecovery]);
- await addExtension("Whitelist", "Whitelist", [Whitelist]);
- await addExtension("StagedExpenditure", "StagedExpenditure", [StagedExpenditure]);
+ await addExtension("extensions", "CoinMachine", "CoinMachine", [CoinMachine]);
+ await addExtension("extensions", "EvaluatedExpenditure", "EvaluatedExpenditure", [EvaluatedExpenditure]);
+ await addExtension("extensions", "FundingQueue", "FundingQueue", [FundingQueue]);
+ await addExtension("extensions", "OneTxPayment", "OneTxPayment", [OneTxPayment]);
+ await addExtension("extensions", "ReputationBootstrapper", "ReputationBootstrapper", [ReputationBootstrapper]);
+ await addExtension("extensions", "StakedExpenditure", "StakedExpenditure", [StakedExpenditure]);
+ await addExtension("extensions", "StreamingPayments", "StreamingPayments", [StreamingPayments]);
+ await addExtension("extensions", "TokenSupplier", "TokenSupplier", [TokenSupplier]);
+ await addExtension("extensions/votingReputation", "IVotingReputation", "VotingReputation", [
+ VotingReputation,
+ VotingReputationStaking,
+ VotingReputationMisalignedRecovery,
+ ]);
+ await addExtension("extensions", "Whitelist", "Whitelist", [Whitelist]);
+ await addExtension("extensions", "StagedExpenditure", "StagedExpenditure", [StagedExpenditure]);
}