Secure the networkBug Bounty 2019

Tokens and Funding

Whether you brought your own ERC20 token from an existing token contract or created a new token at the same time that you created a colony, you can use the TokenClient to call and send transactions associated with the token contract.

TokenClient handles all the functions in the ERC20 standard interface, as well as mint and burn. Functions that you would ordinarily be able to perform as the contract owner may be performed by anyone in the colony with either FOUNDER or ADMIN authority. You can learn more about authority roles in Managing Permissions.

Token Methods

The following methods are associated with the token contract.

Create Token

Creating a new token is simple using an instance of the ColonyNetworkClient:

// Create a token
await networkClient.createToken.send({
  name,
  symbol,
});

Get Token Info

We can get the token info using an instance of the TokenClient:

// View token
await colonyClient.tokenClient.getTokenInfo.call()

Set Token Owner

If we want to call token contract methods such as mint and burn using the ColonyClient, we will need to set the owner of the token contract to the address of our colony contract. This is recommended if you created a new token specifically for your colony and you would like assigned ADMIN to have permission calling the token contract methods. This is not required and it will not be possible if you are using an existing token and you are not the owner of the token contract.

We can set the owner of the token contract using an instance of the TokenClient:

// Set token owner
await colonyClient.tokenClient.setOwner.send({ owner });

Note: You must be the owner of the token contract to call this method.

Mint Tokens

We can mint tokens using an instance of the ColonyClient:

// Mint tokens
await colonyClient.mintTokens.send({ amount });

Note: The colony must be the owner of the token contract and you must be a FOUNDER or ADMIN to call this method.

Burn Tokens

We can burn tokens using an instance of the ColonyClient:

// Burn tokens
await colonyClient.burnTokens.send({ amount });

Note: The colony must be the owner of the token contract and you must be a FOUNDER or ADMIN to call this method.

Get Total Supply

We can get the total supply of out token using an instance of the TokenClient:

// Get total supply
await colonyClient.tokenClient.getTotalSupply.call();

Colony Methods

The following methods are associated with the colony contract.

Claim Colony Funds

We can claim colony funds using an instance of the ColonyClient:

// Claim colony funds
await colonyClient.claimColonyFunds.send({ token })

Move Funds Between Pots

We can move funds between pots using an instance of the ColonyClient:

// Move funds between pots
await colonyClient.moveFundsBetweenPots.send({
  fromPot,
  toPot,
  amount,
  token,
})

Note: You must be a FOUNDER or ADMIN to call this method.

Get Pot Balance

We can get the balance of a pot using an instance of the ColonyClient:

// Get pot balance
await colonyClient.getFundingPotBalance.call({
  potId,
  token,
})