issueFor
Contract: JBTokenStore
Interface: IJBTokenStore
- Step by step
 - Code
 - Errors
 - Events
 - Bug bounty
 
Issues an project's ERC-20 tokens that'll be used when claiming tokens.
Deploys a project's ERC-20 token contract.
Only a project's current controller can issue its token.
Definition
function issueFor(
  uint256 _projectId,
  string calldata _name,
  string calldata _symbol
) external override onlyController(_projectId) returns (IJBToken token) { ... }
- Arguments:
_projectIdis the ID of the project being issued tokens._nameis the ERC-20's name._symbolis the ERC-20's symbol.
 - Through the 
onlyControllermodifier, the function can only be accessed by the controller of the_projectId. - The function overrides a function definition from the 
IJBTokenStoreinterface. - The function returns the token that was issued.
 
Body
- 
Make sure a name was provided.
// There must be a name.
if (bytes(_name).length == 0) revert EMPTY_NAME(); - 
Make sure a symbol was provided.
// There must be a symbol.
if (bytes(_symbol).length == 0) revert EMPTY_SYMBOL(); - 
Make sure the project doesn't already have a token.
// The project shouldn't already have a token.
if (tokenOf[_projectId] != IJBToken(address(0))) revert PROJECT_ALREADY_HAS_TOKEN();Internal references:
 - 
Deploy a new instance of a
JBTokencontract. Assign it to the return value.// Deploy the token contract.
token = new JBToken(_name, _symbol); - 
Store the newly deployed token contract as the token of the project.
// Store the token contract.
tokenOf[_projectId] = token;Internal references:
 - 
Store the project the token is being used for.
// Store the project for the token.
projectOf[token] = _projectId;Internal references:
 - 
Emit an
Issueevent with the relevant parameters.emit Issue(_projectId, token, _name, _symbol, msg.sender);Event references:
 
/**
  @notice
  Issues an project's ERC-20 tokens that'll be used when claiming tokens.
  @dev
  Deploys a project's ERC-20 token contract.
  @dev
  Only a project's current controller can issue its token.
  @param _projectId The ID of the project being issued tokens.
  @param _name The ERC-20's name.
  @param _symbol The ERC-20's symbol.
  @return token The token that was issued.
*/
function issueFor(
  uint256 _projectId,
  string calldata _name,
  string calldata _symbol
) external override onlyController(_projectId) returns (IJBToken token) {
  // There must be a name.
  if (bytes(_name).length == 0) revert EMPTY_NAME();
  // There must be a symbol.
  if (bytes(_symbol).length == 0) revert EMPTY_SYMBOL();
  // The project shouldn't already have a token.
  if (tokenOf[_projectId] != IJBToken(address(0))) revert PROJECT_ALREADY_HAS_TOKEN();
  // Deploy the token contract.
  token = new JBToken(_name, _symbol);
  // Store the token contract.
  tokenOf[_projectId] = token;
  // Store the project for the token.
  projectOf[token] = _projectId;
  emit Issue(_projectId, token, _name, _symbol, msg.sender);
}
| String | Description | 
|---|---|
EMPTY_NAME | Thrown if a name wasn't specified for the token. | 
EMPTY_SYMBOL | Thrown if a symbol wasn't specified for the token. | 
PROJECT_ALREADY_HAS_TOKEN | Thrown if the project already has a token. | 
| Category | Description | Reward | 
|---|---|---|
| Optimization | Help make this operation more efficient. | 0.5ETH | 
| Low severity | Identify a vulnerability in this operation that could lead to an inconvenience for a user of the protocol or for a protocol developer. | 1ETH | 
| High severity | Identify a vulnerability in this operation that could lead to data corruption or loss of funds. | 5+ETH |