Life of a project
To launch a project, call JBController4_1.launchProjectFor(...)
.
function launchProjectFor(
address owner,
string calldata projectUri,
JBRulesetConfig[] calldata rulesetConfigurations,
JBTerminalConfig[] calldata terminalConfigurations,
string calldata memo
) external override returns (uint256 projectId) { ... }
If you're launching an omnichain project, you can use the JBOmnichainDeployer4_1.launchProjectFor(...)
transaction, which will also take in information about deploying suckers for each chain pair.
function launchProjectFor(
address owner,
string calldata projectUri,
JBRulesetConfig[] calldata rulesetConfigurations,
JBTerminalConfig[] calldata terminalConfigurations,
string calldata memo,
REVSuckerDeploymentConfig calldata suckerDeploymentConfiguration
)
external
returns (uint256 projectId, address[] memory suckers) { ... }
Check out the Launching a project example page for more info on how to build projects treasuries to various specifications.
View project info
Launching a project will mint a new ERC-721 in the JBProjects
contract. The owner can be found using JBProjects.ownerOf(...)
.
function ownerOf(uint256 projectId) external returns (address owner) { ... }
A link to the project's metadata can be found using JBController4_1.uriOf(...)
.
function uriOf(uint256 projectId) external view returns (string memory)
View rulesets
Ruleset data can be found in the JBController4_1
contract.
function getRulesetOf(
uint256 projectId,
uint256 rulesetId
) external view returns (JBRuleset memory ruleset, JBRulesetMetadata memory metadata)
The project's current ruleset can be found using JBController4_1.currentRulesetOf(...)
.
function currentRulesetOf(uint256 projectId) external view returns (JBRuleset memory ruleset, JBRulesetMetadata memory metadata)
The project's upcoming ruleset can be found using JBController4_1.upcomingRulesetOf(...)
.
By default, the upcoming ruleset is a copy of the current one that starts immediately afterwards, using a discounted weight if applicable.
If the project has queued a new ruleset, the upcoming ruleset will reflect the changes once they are approved by the current ruleset's ballot. Rulesets queued during a ruleset with no ballot are automatically queued.
The project has no upcoming ruleset if the current ruleset has no duration.
function upcomingRulesetOf(uint256 projectId) external view returns (JBRuleset memory ruleset, JBRulesetMetadata memory metadata)
The project's latest queued ruleset can be found using JBController4_1.latestQueuedRulesetOf(...)
.
function latestQueuedRulesetOf(uint256 projectId) external view returns (JBRuleset memory, JBRulesetMetadata memory metadata, JBApprovalStatus);
All of a project's rulesets can be found using JBController4_1.allRulesetsOf(...)
.
function allRulesetsOf(uint256 projectId) external view returns (JBRuleset[] memory rulesets, JBRulesetMetadata[] memory metadata);
View splits
A project's splits data can be found in the JBSplits
contract. A set of splits used for any particular functionality during any particular rulesets configuration can be found using JBSplits.splitsOf(...)
.
function splitsOf(uint256 projectId, uint256 rulesetId, uint256 groupId) external view returns (JBSplit[] memory)
View accounting contexts
A project's accounting contexts data can be found in its IJBTerminal
contracts. For example, if a project is using the JBMultiTerminal
contract, its accounting contexts can be found through its JBMultiTerminal.accountingContextsOf(...)
transaction.
function accountingContextsOf(uint256 projectId) external view returns (JBAccountingContext[] memory) { ... }
Or, through the JBMultiTerminal.accountingContextForTokenOf(...)
transaction.
function accountingContextForTokenOf(
uint256 projectId,
address token
)
external view returns (JBAccountingContext memory) { ... }
View fund access limits
Constraints on accessing a project's funds can found in the JBFundAccessLimits
contract. The payout limit of any terminal during any ruleset using any token with any currency can be found using JBFundAccessLimits.payoutLimitOf(...)
.
function payoutLimitOf(
uint256 projectId,
uint256 rulesetId,
address terminal,
address token,
uint256 currency
) external view returns (uint256 payoutLimit);
Or, get all limits for any currency
function payoutLimitsOf(
uint256 projectId,
uint256 rulesetId,
address terminal,
address token
) external view returns (JBCurrencyAmount[] memory payoutLimits);
The surplus allowance from any terminal during any ruleset using any token with any currency can be found using JBFundAccessLimits.surplusAllowanceOf
.
function surplusAllowanceOf(
uint256 projectId,
uint256 rulesetId,
address terminal,
address token,
uint256 currency
) external view returns (uint256 surplusAllowance);
View terminals and controller
The JBDirectory
contract stores addresses of terminals that a project is currently accepting funds through. A project's currently set terminals can be found using JBDirectory.terminalsOf(...)
, and the address of the terminal to which payments to projects should be sent for any token can be found using JBDirectory.primaryTerminalOf(...)
.
function terminalsOf(uint256 projectId) external view returns (IJBTerminal[] memory) { ... }
function primaryTerminalOf(uint256 projectId, address token) external view returns (IJBTerminal)
The [JBDirectory
](/docs/dev/v4/api/core/f the controller that is managing a project's rulesets and tokens. A projects current controller can be found using JBDirectory.controllerOf(...)
.
function controllerOf(uint256 projectId) external view returns (IERC165) { ... }
Once a project has been created, it can begin accepting funds from anyone through any terminal it has added, using any token that it has specified accounting contexts for. For example, if the project has added the JBMultiTerminal
with only an ETH accounting context, only ETH can be sent to the project by calling its JBMultiTerminal.pay(...)
transaction.
function pay(
uint256 projectId,
address token,
uint256 amount,
address beneficiary,
uint256 minReturnedTokens,
string calldata memo,
bytes calldata metadata
) external payable returns (uint256 beneficiaryTokenCount);
Check out the Paying a project example page for more info on how to pay a project.
View project balance
A project's balance can be found in the JBTerminalStore
contract.
function balanceOf(address terminal, uint256 projectId, address token) external view returns (uint256);