launchProjectFor
Contract: JBController
- Step by step
 - Code
 - Events
 - Bug bounty
 
Creates a project. This will mint an ERC-721 into the specified owner's account, configure a first funding cycle, and set up any splits.
Each operation within this transaction can be done in sequence separately.
Anyone can deploy a project on an owner's behalf.
Definition
function launchProjectFor(
  address _owner,
  JBProjectMetadata calldata _projectMetadata,
  JBFundingCycleData calldata _data,
  JBFundingCycleMetadata calldata _metadata,
  uint256 _mustStartAtOrAfter,
  JBGroupedSplits[] calldata _groupedSplits,
  JBFundAccessConstraints[] calldata _fundAccessConstraints,
  IJBPaymentTerminal[] calldata _terminals,
  string calldata _memo
) external virtual override returns (uint256 projectId) { ... }
- Arguments:
_owneris the address to set as the owner of the project. The project ERC-721 will be owned by this address._projectMetadatais aJBProjectMetadatadata structure to associate with the project within a particular domain. This can be updated any time by the owner of the project._datais aJBFundingCycleDatadata structure that defines the project's first funding cycle. These properties will remain fixed for the duration of the funding cycle._metadatais aJBFundingCycleMetadatadata structure specifying the controller specific params that a funding cycle can have. These properties will remain fixed for the duration of the funding cycle._mustStartAtOrAfteris the time before which the configured funding cycle cannot start._groupedSplitsis an array ofJBGroupedSplitsdata structures containing splits to set for any number of groups. The core protocol makes use of groups defined inJBSplitsGroups._fundAccessConstraintsis an array ofJBFundAccessConstraintsdata structures containing amounts that a project can use from its treasury for each payment terminal. Amounts are fixed point numbers using the same number of decimals as the accompanying terminal. The_distributionLimitand_overflowAllowanceparameters must fit in auint232. The_distributionLimitapplies for each funding cycle, and the_overflowAllowanceapplies for the entirety of the configuration._terminalsis an array ofIJBPaymentTerminalpayment terminals to add for the project._memois a memo to pass along to the emitted event.
 - The function can be accessed externally by anyone.
 - The function can be overriden by inheriting contracts.
 - The function overrides a function definition from the 
IJBControllerinterface. - The function returns the ID of the project that was launched.
 
Body
- 
Keep a reference to the directory.
// Keep a reference to the directory.
IJBDirectory _directory = directory;Internal references:
 - 
Create the project. This will mint an ERC-721 in the owner's wallet representing ownership over the project.
// Mint the project into the wallet of the message sender.
projectId = projects.createFor(_owner, _projectMetadata);Internal references:
External references:
 - 
Set this controller as the controller of the project.
// Set this contract as the project's controller in the directory.
_directory.setControllerOf(projectId, address(this));External references:
 - 
Configure the project's funding cycle, fund access constraints, and splits. Get a reference to the resulting funding cycle's configuration.
// Configure the first funding cycle.
uint256 _configuration = _configure(
projectId,
_data,
_metadata,
_mustStartAtOrAfter,
_groupedSplits,
_fundAccessConstraints
);Internal references:
 - 
If terminals were provided, add them to the list of terminals the project can accept funds through.
// Add the provided terminals to the list of terminals.
if (_terminals.length > 0) _directory.setTerminalsOf(projectId, _terminals);External references:
 - 
Emit a
LaunchProjectevent with the relevant parameters.emit LaunchProject(_configuration, projectId, _memo, msg.sender);Event references:
 
/**
  @notice
  Creates a project. This will mint an ERC-721 into the specified owner's account, configure a first funding cycle, and set up any splits.
  @dev
  Each operation within this transaction can be done in sequence separately.
  @dev
  Anyone can deploy a project on an owner's behalf.
  @param _owner The address to set as the owner of the project. The project ERC-721 will be owned by this address.
  @param _projectMetadata Metadata to associate with the project within a particular domain. This can be updated any time by the owner of the project.
  @param _data Data that defines the project's first funding cycle. These properties will remain fixed for the duration of the funding cycle.
  @param _metadata Metadata specifying the controller specific params that a funding cycle can have. These properties will remain fixed for the duration of the funding cycle.
  @param _mustStartAtOrAfter The time before which the configured funding cycle can't start.
  @param _groupedSplits An array of splits to set for any number of groups.
  @param _fundAccessConstraints An array containing amounts that a project can use from its treasury for each payment terminal. Amounts are fixed point numbers using the same number of decimals as the accompanying terminal. The `_distributionLimit` and `_overflowAllowance` parameters must fit in a `uint232`.
  @param _terminals Payment terminals to add for the project.
  @param _memo A memo to pass along to the emitted event.
  @return projectId The ID of the project.
*/
function launchProjectFor(
  address _owner,
  JBProjectMetadata calldata _projectMetadata,
  JBFundingCycleData calldata _data,
  JBFundingCycleMetadata calldata _metadata,
  uint256 _mustStartAtOrAfter,
  JBGroupedSplits[] calldata _groupedSplits,
  JBFundAccessConstraints[] calldata _fundAccessConstraints,
  IJBPaymentTerminal[] calldata _terminals,
  string calldata _memo
) external virtual override returns (uint256 projectId) {
  // Keep a reference to the directory.
  IJBDirectory _directory = directory;
  // Mint the project into the wallet of the message sender.
  projectId = projects.createFor(_owner, _projectMetadata);
  // Set this contract as the project's controller in the directory.
  _directory.setControllerOf(projectId, address(this));
  // Configure the first funding cycle.
  uint256 _configuration = _configure(
    projectId,
    _data,
    _metadata,
    _mustStartAtOrAfter,
    _groupedSplits,
    _fundAccessConstraints
  );
  // Add the provided terminals to the list of terminals.
  if (_terminals.length > 0) _directory.setTerminalsOf(projectId, _terminals);
  emit LaunchProject(_configuration, projectId, _memo, msg.sender);
}
| Name | Data | 
|---|---|
LaunchProject | 
  | 
| 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 |