Skip to content

Commit

Permalink
createColonyForFrontend should allow activating locked tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
area committed Nov 8, 2023
1 parent 6b5624f commit 82f1b34
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion contracts/colonyNetwork/ColonyNetworkDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ contract ColonyNetworkDeployer is ColonyNetworkStorage {
// Extra token bookkeeping if we deployed it
if (_tokenAddress == address(0x0)) {
// Deploy Authority
address[] memory allowedToTransfer;
address[] memory allowedToTransfer = new address[](1);
allowedToTransfer[0] = tokenLocking;
address tokenAuthorityAddress = IColonyNetwork(address(this)).deployTokenAuthority(
address(token),
colonyAddress,
Expand Down
17 changes: 14 additions & 3 deletions test/contracts-network/colony-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {
expectNoEvent,
getColonyEditable,
} = require("../../helpers/test-helper");
const { CURR_VERSION, GLOBAL_SKILL_ID, MIN_STAKE, IPFS_HASH, ADDRESS_ZERO } = require("../../helpers/constants");
const { CURR_VERSION, GLOBAL_SKILL_ID, MIN_STAKE, IPFS_HASH, ADDRESS_ZERO, WAD } = require("../../helpers/constants");
const { setupENSRegistrar } = require("../../helpers/upgradable-contracts");

const { expect } = chai;
Expand All @@ -34,6 +34,7 @@ const IColonyNetwork = artifacts.require("IColonyNetwork");
const IColony = artifacts.require("IColony");
const Token = artifacts.require("Token");
const TokenAuthority = artifacts.require("TokenAuthority");
const TokenLocking = artifacts.require("TokenLocking");
const MetaTxToken = artifacts.require("MetaTxToken");
const FunctionsNotAvailableOnColony = artifacts.require("FunctionsNotAvailableOnColony");

Expand Down Expand Up @@ -255,8 +256,18 @@ contract("Colony Network", (accounts) => {
await colonyNetwork.createColonyForFrontend(token.address, "", "", 0, version, "", "");
});

it("should allow users to create a colony for the frontend in one transaction, deploying a new token", async () => {
await colonyNetwork.createColonyForFrontend(ADDRESS_ZERO, ...getTokenArgs(), version, "", "");
it("should allow users to create a colony for the frontend in one transaction, with a new token that can be activated if locked", async () => {
const tx = await colonyNetwork.createColonyForFrontend(ADDRESS_ZERO, ...getTokenArgs(), version, "", "");
console.log(tx.logs);
const { tokenAddress } = tx.logs.filter((x) => x.event === "TokenDeployed")[0].args;

const tokenLockingAddress = await colonyNetwork.getTokenLocking();
const tokenLocking = await TokenLocking.at(tokenLockingAddress);
const token = await Token.at(tokenAddress);
await token.mint(accounts[0], WAD);

await token.approve(tokenLocking.address, WAD);
await tokenLocking.deposit(tokenAddress, WAD, true);
});
});

Expand Down

0 comments on commit 82f1b34

Please sign in to comment.