Skip to content

Commit

Permalink
Due to dapphub/ds-note#4 removed DSToken from tests and instead use i…
Browse files Browse the repository at this point in the history
…nstances of our own Token
  • Loading branch information
elenadimitrova committed May 19, 2019
1 parent e0dd9a0 commit c7f7fa2
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 46 deletions.
8 changes: 4 additions & 4 deletions test-gas-costs/gasCosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
import ReputationMinerTestWrapper from "../packages/reputation-miner/test/ReputationMinerTestWrapper";
import MaliciousReputationMinerExtraRep from "../packages/reputation-miner/test/MaliciousReputationMinerExtraRep";

const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const IColony = artifacts.require("IColony");
const IMetaColony = artifacts.require("IMetaColony");
const IColonyNetwork = artifacts.require("IColonyNetwork");
Expand Down Expand Up @@ -88,7 +88,7 @@ contract("All", function(accounts) {
await IColony.defaults({ gasPrice });

const otherTokenArgs = getTokenArgs();
otherToken = await DSToken.new(otherTokenArgs[1]);
otherToken = await Token.new(...otherTokenArgs);

await fundColonyWithTokens(colony, token, INITIAL_FUNDING);
});
Expand All @@ -97,7 +97,7 @@ contract("All", function(accounts) {
describe("Gas costs", function() {
it("when working with the Colony Network", async function() {
const tokenArgs = getTokenArgs();
const colonyToken = await DSToken.new(tokenArgs[1]);
const colonyToken = await Token.new(...tokenArgs);
await colonyNetwork.createColony(colonyToken.address);
});

Expand Down Expand Up @@ -281,7 +281,7 @@ contract("All", function(accounts) {
const managerReputation = WAD.muln(100);

const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
const { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
const newColony = await IColony.at(colonyAddress);
Expand Down
6 changes: 3 additions & 3 deletions test-upgrade/colony-network-upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable prefer-arrow-callback */
import { getTokenArgs } from "../helpers/test-helper";

const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const EtherRouter = artifacts.require("EtherRouter");
const Resolver = artifacts.require("Resolver");
Expand All @@ -20,12 +20,12 @@ contract("ColonyNetwork contract upgrade", function() {

// Setup 2 test colonies
const tokenArgs1 = getTokenArgs();
const newToken = await DSToken.new(tokenArgs1[1]);
const newToken = await Token.new(...tokenArgs1);
let { logs } = await colonyNetwork.createColony(newToken.address);
colonyAddress1 = logs[0].args.colonyAddress;

const tokenArgs2 = getTokenArgs();
const newToken2 = await DSToken.new(tokenArgs2[1]);
const newToken2 = await Token.new(...tokenArgs2);
({ logs } = await colonyNetwork.createColony(newToken2.address));
colonyAddress2 = logs[0].args.colonyAddress;

Expand Down
6 changes: 3 additions & 3 deletions test-upgrade/colony-upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ColonyPayment = artifacts.require("ColonyPayment");
const ColonyFunding = artifacts.require("ColonyFunding");
const UpdatedColony = artifacts.require("UpdatedColony");
const IUpdatedColony = artifacts.require("IUpdatedColony");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const ContractRecovery = artifacts.require("ContractRecovery");

contract("Colony contract upgrade", accounts => {
Expand Down Expand Up @@ -43,7 +43,7 @@ contract("Colony contract upgrade", accounts => {
dueDate = await currentBlockTime();

const tokenArgs = getTokenArgs();
const colonyToken = await DSToken.new(tokenArgs[1]);
const colonyToken = await Token.new(...tokenArgs);
const { logs } = await colonyNetwork.createColony(colonyToken.address);
const { colonyAddress } = logs[0].args;
colony = await IColony.at(colonyAddress);
Expand All @@ -52,7 +52,7 @@ contract("Colony contract upgrade", accounts => {
colonyFunding = await ColonyFunding.new();
contractRecovery = await ContractRecovery.new();
const tokenAddress = await colony.getToken();
token = await DSToken.at(tokenAddress);
token = await Token.at(tokenAddress);

await makeTask({ colony, dueDate });
await makeTask({ colony, dueDate: dueDate + 1, hash: SPECIFICATION_HASH_UPDATED });
Expand Down
4 changes: 2 additions & 2 deletions test/colony-funding.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ chai.use(bnChai(web3.utils.BN));

const EtherRouter = artifacts.require("EtherRouter");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");

contract("Colony Funding", accounts => {
const MANAGER = accounts[0];
Expand All @@ -51,7 +51,7 @@ contract("Colony Funding", accounts => {
await colony.setRewardInverse(100);

const otherTokenArgs = getTokenArgs();
otherToken = await DSToken.new(otherTokenArgs[0]);
otherToken = await Token.new(...otherTokenArgs);
});

describe("when receiving tokens", () => {
Expand Down
10 changes: 5 additions & 5 deletions test/colony-network-auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { expect } = chai;
chai.use(bnChai(web3.utils.BN));

const DutchAuction = artifacts.require("DutchAuction");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");

contract("Colony Network Auction", accounts => {
const BIDDER_1 = accounts[1];
Expand Down Expand Up @@ -42,7 +42,7 @@ contract("Colony Network Auction", accounts => {
await colonyNetwork.startNextCycle();

const args = getTokenArgs();
token = await DSToken.new(args[1]);
token = await Token.new(...args);
await token.mint(colonyNetwork.address, quantity);
const { logs, receipt } = await colonyNetwork.startTokenAuction(token.address);
createAuctionTxReceipt = receipt;
Expand Down Expand Up @@ -77,7 +77,7 @@ contract("Colony Network Auction", accounts => {

it("should fail with zero quantity", async () => {
const args = getTokenArgs();
const otherToken = await DSToken.new(args[1]);
const otherToken = await Token.new(...args);
await checkErrorRevert(colonyNetwork.startTokenAuction(otherToken.address));
});

Expand All @@ -104,7 +104,7 @@ contract("Colony Network Auction", accounts => {

it("should set the minimum price correctly for quantity < 1e18", async () => {
const args = getTokenArgs();
const otherToken = await DSToken.new(args[1]);
const otherToken = await Token.new(...args);
await otherToken.mint(colonyNetwork.address, WAD.divn(10));
const { logs } = await colonyNetwork.startTokenAuction(otherToken.address);
const auctionAddress = logs[0].args.auction;
Expand Down Expand Up @@ -353,7 +353,7 @@ contract("Colony Network Auction", accounts => {
let otherToken;
beforeEach(async () => {
const args = getTokenArgs();
otherToken = await DSToken.new(args[1]);
otherToken = await Token.new(...args);
});

const auctionPropsLowQuantitiesLowPrice = [
Expand Down
12 changes: 6 additions & 6 deletions test/colony-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ENSRegistry = artifacts.require("ENSRegistry");
const EtherRouter = artifacts.require("EtherRouter");
const Resolver = artifacts.require("Resolver");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");

contract("Colony Network", accounts => {
const SAMPLE_RESOLVER = "0x65a760e7441cf435086ae45e14a0c8fc1080f54c";
Expand Down Expand Up @@ -115,7 +115,7 @@ contract("Colony Network", accounts => {
});

it("should maintain correct count of colonies", async () => {
const token = await DSToken.new(getTokenArgs()[1]);
const token = await Token.new(...getTokenArgs());
await colonyNetwork.createColony(token.address);
await colonyNetwork.createColony(token.address);
await colonyNetwork.createColony(token.address);
Expand Down Expand Up @@ -146,7 +146,7 @@ contract("Colony Network", accounts => {
});

it("should fail to create meta colony if it already exists", async () => {
const token = await DSToken.new(TOKEN_ARGS[1]);
const token = await Token.new(...TOKEN_ARGS);
await checkErrorRevert(colonyNetwork.createMetaColony(token.address), "colony-meta-colony-exists-already");
});

Expand Down Expand Up @@ -174,22 +174,22 @@ contract("Colony Network", accounts => {
});

it("should fail if ETH is sent", async () => {
const token = await DSToken.new(TOKEN_ARGS[1]);
const token = await Token.new(...TOKEN_ARGS);
await checkErrorRevert(colonyNetwork.createColony(token.address, { value: 1, gas: createColonyGas }));

const colonyNetworkBalance = await web3GetBalance(colonyNetwork.address);
expect(colonyNetworkBalance).to.be.zero;
});

it("should log a ColonyAdded event", async () => {
const token = await DSToken.new(TOKEN_ARGS[1]);
const token = await Token.new(...TOKEN_ARGS);
await expectEvent(colonyNetwork.createColony(token.address), "ColonyAdded");
});
});

describe("when getting existing colonies", () => {
it("should allow users to get the address of a colony by its index", async () => {
const token = await DSToken.new(TOKEN_ARGS[1]);
const token = await Token.new(...TOKEN_ARGS);
await colonyNetwork.createColony(token.address);
await colonyNetwork.createColony(token.address);
await colonyNetwork.createColony(token.address);
Expand Down
4 changes: 2 additions & 2 deletions test/colony-payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ chai.use(bnChai(web3.utils.BN));
const EtherRouter = artifacts.require("EtherRouter");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const IMetaColony = artifacts.require("IMetaColony");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");

contract("Colony Payment", accounts => {
const RECIPIENT = accounts[3];
Expand All @@ -38,7 +38,7 @@ contract("Colony Payment", accounts => {
await fundColonyWithTokens(colony, token, WAD.muln(20));

const tokenArgs = getTokenArgs();
otherToken = await DSToken.new(tokenArgs[1]);
otherToken = await Token.new(...tokenArgs);
});

describe("when adding payments", () => {
Expand Down
22 changes: 11 additions & 11 deletions test/colony-reward-payouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const IColony = artifacts.require("IColony");
const IMetaColony = artifacts.require("IMetaColony");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const ITokenLocking = artifacts.require("ITokenLocking");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const DSRoles = artifacts.require("DSRoles");

const contractLoader = new TruffleLoader({
Expand Down Expand Up @@ -75,7 +75,7 @@ contract("Colony Reward Payouts", accounts => {
await colony.setRewardInverse(100);

const otherTokenArgs = getTokenArgs();
otherToken = await DSToken.new(otherTokenArgs[0]);
otherToken = await Token.new(...otherTokenArgs);

await fundColonyWithTokens(colony, otherToken, initialFunding);
await colony.mintTokens(initialFunding.muln(100).divn(99)); // Tke in to account 1% being siphoned off for rewards
Expand Down Expand Up @@ -144,7 +144,7 @@ contract("Colony Reward Payouts", accounts => {

it("should not be able to create reward payout if passed reputation is not from the correct colony", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
const { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
const newColony = await IColony.at(colonyAddress);
Expand Down Expand Up @@ -262,7 +262,7 @@ contract("Colony Reward Payouts", accounts => {

it("should not be able to start a reward payout if no one holds colony tokens", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
const { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
const newColony = await IColony.at(colonyAddress);
Expand Down Expand Up @@ -298,7 +298,7 @@ contract("Colony Reward Payouts", accounts => {

it("should be able to collect rewards from multiple payouts of different token", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await fundColonyWithTokens(colony, newToken, initialFunding);

const tx1 = await colony.startNextRewardPayout(newToken.address, ...colonyWideReputationProof);
Expand All @@ -313,7 +313,7 @@ contract("Colony Reward Payouts", accounts => {

it("should not be able to claim payout if colony-wide reputation is 0", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
const { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
const newColony = await IColony.at(colonyAddress);
Expand Down Expand Up @@ -456,7 +456,7 @@ contract("Colony Reward Payouts", accounts => {

it("should not be able to claim funds if previous payout is not claimed", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await fundColonyWithTokens(colony, newToken, initialFunding);

await colony.startNextRewardPayout(otherToken.address, ...colonyWideReputationProof);
Expand Down Expand Up @@ -559,7 +559,7 @@ contract("Colony Reward Payouts", accounts => {
it("should be able to collect payout from two colonies at the same time", async () => {
// Setting up a new token and two colonies
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);

let { logs } = await colonyNetwork.createColony(newToken.address);
let { colonyAddress } = logs[0].args;
Expand Down Expand Up @@ -676,7 +676,7 @@ contract("Colony Reward Payouts", accounts => {
it("should not be able to claim reward payout from a colony that didn't create it", async () => {
// Setting up a new token and two colonies
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);

let { logs } = await colonyNetwork.createColony(newToken.address);
let { colonyAddress } = logs[0].args;
Expand Down Expand Up @@ -815,14 +815,14 @@ contract("Colony Reward Payouts", accounts => {
total reputation/tokens: ${data.totalReputation.toString()}`, async () => {
// Setting up a new token and colony
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
let { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
await newToken.setOwner(colonyAddress);
const newColony = await IColony.at(colonyAddress);

const payoutTokenArgs = getTokenArgs();
const payoutToken = await DSToken.new(payoutTokenArgs[0]);
const payoutToken = await Token.new(...payoutTokenArgs);
await fundColonyWithTokens(newColony, payoutToken, data.totalAmountOfPayoutTokens);
// Issuing colony's internal tokens so they can be given to users in `bootstrapColony`
await newColony.mintTokens(data.totalReputation);
Expand Down
4 changes: 2 additions & 2 deletions test/colony-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ chai.use(bnChai(web3.utils.BN));
const EtherRouter = artifacts.require("EtherRouter");
const IMetaColony = artifacts.require("IMetaColony");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const TaskSkillEditing = artifacts.require("TaskSkillEditing");

contract("ColonyTask", accounts => {
Expand All @@ -89,7 +89,7 @@ contract("ColonyTask", accounts => {
await colony.setAdministrationRole(1, 0, COLONY_ADMIN, 1, true);

const otherTokenArgs = getTokenArgs();
otherToken = await DSToken.new(otherTokenArgs[1]);
otherToken = await Token.new(...otherTokenArgs);
});

describe("when creating tasks", () => {
Expand Down
4 changes: 2 additions & 2 deletions test/colony.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { makeTask, setupColonyNetwork, setupMetaColonyWithLockedCLNYToken, setup
const { expect } = chai;
chai.use(bnChai(web3.utils.BN));

const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const IReputationMiningCycle = artifacts.require("IReputationMiningCycle");

contract("Colony", accounts => {
Expand Down Expand Up @@ -71,7 +71,7 @@ contract("Colony", accounts => {

it("should emit correct Mint event when minting tokens", async () => {
const tokenArgs = getTokenArgs();
const otherToken = await DSToken.new(tokenArgs[1]);
const otherToken = await Token.new(...tokenArgs);

await expectAllEvents(otherToken.methods["mint(uint256)"](100), ["Mint"]);
});
Expand Down
4 changes: 2 additions & 2 deletions test/reputation-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const { expect } = chai;
chai.use(bnChai(web3.utils.BN));

const IReputationMiningCycle = artifacts.require("IReputationMiningCycle");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const TaskSkillEditing = artifacts.require("TaskSkillEditing");

contract("Reputation Updates", accounts => {
Expand Down Expand Up @@ -369,7 +369,7 @@ contract("Reputation Updates", accounts => {
it("should not add entries to the reputation log for payments that are not in the colony home token", async () => {
const RECIPIENT = accounts[3];
const tokenArgs = getTokenArgs();
const otherToken = await DSToken.new(tokenArgs[1]);
const otherToken = await Token.new(...tokenArgs);
await fundColonyWithTokens(metaColony, otherToken, WAD.muln(2));

await metaColony.addPayment(1, 0, RECIPIENT, otherToken.address, WAD, 1, 3);
Expand Down
6 changes: 3 additions & 3 deletions test/token-locking.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ chai.use(bnChai(web3.utils.BN));
const EtherRouter = artifacts.require("EtherRouter");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const ITokenLocking = artifacts.require("ITokenLocking");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");

const contractLoader = new TruffleLoader({
contractDir: path.resolve(__dirname, "..", "build", "contracts")
Expand Down Expand Up @@ -50,7 +50,7 @@ contract("Token Locking", addresses => {
await colony.bootstrapColony([userAddress], [usersTokens]);

const tokenArgs = getTokenArgs();
otherToken = await DSToken.new(tokenArgs[1]);
otherToken = await Token.new(...tokenArgs);

await giveUserCLNYTokensAndStake(colonyNetwork, addresses[4], DEFAULT_STAKE);
const client = new ReputationMinerTestWrapper({
Expand Down Expand Up @@ -254,7 +254,7 @@ contract("Token Locking", addresses => {
await colony.startNextRewardPayout(otherToken.address, ...colonyWideReputationProof);

const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await colony.startNextRewardPayout(newToken.address, ...colonyWideReputationProof);

const totalLockCount = await tokenLocking.getTotalLockCount(token.address);
Expand Down
Loading

0 comments on commit c7f7fa2

Please sign in to comment.