JBController4_1
Inherits: JBPermissioned, ERC2771Context, IJBController4_1, [IJBMigratable]/docs/v4/api/core/interfaces/IJBMigratable.md)
JBController
coordinates rulesets and project tokens, and is the entry point for most operations related
to rulesets and project tokens.
State Variables
DIRECTORY
The directory of terminals and controllers for projects.
IJBDirectory public immutable override DIRECTORY;
FUND_ACCESS_LIMITS
A contract that stores fund access limits for each project.
IJBFundAccessLimits public immutable override FUND_ACCESS_LIMITS;
PRICES
A contract that stores prices for each project.
IJBPrices public immutable override PRICES;
PROJECTS
Mints ERC-721s that represent project ownership and transfers.
IJBProjects public immutable override PROJECTS;
RULESETS
The contract storing and managing project rulesets.
IJBRulesets public immutable override RULESETS;
SPLITS
The contract that stores splits for each project.
IJBSplits public immutable override SPLITS;
TOKENS
The contract that manages token minting and burning.
IJBTokens public immutable override TOKENS;
OMNICHAIN_RULESET_OPERATOR
The address of the contract that manages omnichain ruleset ops.
address public immutable OMNICHAIN_RULESET_OPERATOR;
pendingReservedTokenBalanceOf
A project's unrealized reserved token balance (i.e. reserved tokens which haven't been sent out to the reserved token split group yet).
mapping(uint256 projectId => uint256) public override pendingReservedTokenBalanceOf;
uriOf
The metadata URI for each project. This is typically an IPFS hash, optionally with an ipfs://
prefix.
mapping(uint256 projectId => string) public override uriOf;
Functions
constructor
constructor(
IJBDirectory directory,
IJBFundAccessLimits fundAccessLimits,
IJBPermissions permissions,
IJBPrices prices,
IJBProjects projects,
IJBRulesets rulesets,
IJBSplits splits,
IJBTokens tokens,
address omnichainRulesetOperator,
address trustedForwarder
)
JBPermissioned(permissions)
ERC2771Context(trustedForwarder);
Parameters
Name | Type | Description |
---|---|---|
directory | IJBDirectory | A contract storing directories of terminals and controllers for each project. |
fundAccessLimits | IJBFundAccessLimits | A contract that stores fund access limits for each project. |
permissions | IJBPermissions | A contract storing permissions. |
prices | IJBPrices | A contract that stores prices for each project. |
projects | IJBProjects | A contract which mints ERC-721s that represent project ownership and transfers. |
rulesets | IJBRulesets | A contract storing and managing project rulesets. |
splits | IJBSplits | A contract that stores splits for each project. |
tokens | IJBTokens | A contract that manages token minting and burning. |
omnichainRulesetOperator | address | The address of the contract that manages omnichain ruleset ops. |
trustedForwarder | address | The trusted forwarder for the ERC2771Context. |
allRulesetsOf
Get an array of a project's rulesets (with metadata) up to a maximum array size, sorted from latest to earliest.
function allRulesetsOf(
uint256 projectId,
uint256 startingId,
uint256 size
)
external
view
override
returns (JBRulesetWithMetadata[] memory rulesets);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to get the rulesets of. |
startingId | uint256 | The ID of the ruleset to begin with. This will be the latest ruleset in the result. If the startingId is 0, passed, the project's latest ruleset will be used. |
size | uint256 | The maximum number of rulesets to return. |
Returns
Name | Type | Description |
---|---|---|
rulesets | JBRulesetWithMetadata[] | The array of rulesets with their metadata. |
currentRulesetOf
A project's currently active ruleset and its metadata.
function currentRulesetOf(uint256 projectId)
external
view
override
returns (JBRuleset memory ruleset, JBRulesetMetadata memory metadata);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to get the current ruleset of. |
Returns
Name | Type | Description |
---|---|---|
ruleset | JBRuleset | The current ruleset's struct. |
metadata | JBRulesetMetadata | The current ruleset's metadata. |
getRulesetOf
Get the JBRuleset
and JBRulesetMetadata
corresponding to the specified rulesetId
.
function getRulesetOf(
uint256 projectId,
uint256 rulesetId
)
external
view
override
returns (JBRuleset memory ruleset, JBRulesetMetadata memory metadata);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project the ruleset belongs to. |
rulesetId | uint256 |
Returns
Name | Type | Description |
---|---|---|
ruleset | JBRuleset | The ruleset's struct. |
metadata | JBRulesetMetadata | The ruleset's metadata. |
latestQueuedRulesetOf
Gets the latest ruleset queued for a project, its approval status, and its metadata.
The 'latest queued ruleset' is the ruleset initialized furthest in the future (at the end of the ruleset queue).
function latestQueuedRulesetOf(uint256 projectId)
external
view
override
returns (JBRuleset memory ruleset, JBRulesetMetadata memory metadata, JBApprovalStatus approvalStatus);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to get the latest ruleset of. |
Returns
Name | Type | Description |
---|---|---|
ruleset | JBRuleset | The struct for the project's latest queued ruleset. |
metadata | JBRulesetMetadata | The ruleset's metadata. |
approvalStatus | JBApprovalStatus | The ruleset's approval status. |
setTerminalsAllowed
Check whether the project's terminals can currently be set.
function setTerminalsAllowed(uint256 projectId) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | A bool which is true if the project allows terminals to be set. |
setControllerAllowed
Check whether the project's controller can currently be set.
function setControllerAllowed(uint256 projectId) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | A bool which is true if the project allows controllers to be set. |
totalTokenSupplyWithReservedTokensOf
Gets the a project token's total supply, including pending reserved tokens.
function totalTokenSupplyWithReservedTokensOf(uint256 projectId) external view override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to get the total token supply of. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The total supply of the project's token, including pending reserved tokens. |
upcomingRulesetOf
A project's next ruleset along with its metadata.
If an upcoming ruleset isn't found, returns an empty ruleset with all properties set to 0.
function upcomingRulesetOf(uint256 projectId)
external
view
override
returns (JBRuleset memory ruleset, JBRulesetMetadata memory metadata);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to get the next ruleset of. |
Returns
Name | Type | Description |
---|---|---|
ruleset | JBRuleset | The upcoming ruleset's struct. |
metadata | JBRulesetMetadata | The upcoming ruleset's metadata. |
supportsInterface
Indicates whether this contract adheres to the specified interface.
See IERC165-supportsInterface.
function supportsInterface(bytes4 interfaceId) public pure override returns (bool);
Parameters
Name | Type | Description |
---|---|---|
interfaceId | bytes4 | The ID of the interface to check for adherence to. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | A flag indicating if the provided interface ID is supported. |
_contextSuffixLength
ERC-2771
specifies the context as being a single address (20 bytes).
function _contextSuffixLength() internal view override(ERC2771Context, Context) returns (uint256);
_currentRulesetOf
The project's current ruleset.
function _currentRulesetOf(uint256 projectId) internal view returns (JBRuleset memory);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | JBRuleset | The project's current ruleset. |
_isTerminalOf
Indicates whether the provided address is a terminal for the project.
function _isTerminalOf(uint256 projectId, address terminal) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to check. |
terminal | address | The address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | A flag indicating if the provided address is a terminal for the project. |
_hasDataHookMintPermissionFor
Indicates whether the provided address has mint permission for the project byway of the data hook.
function _hasDataHookMintPermissionFor(
uint256 projectId,
JBRuleset memory ruleset,
address addr
)
internal
view
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to check. |
ruleset | JBRuleset | The ruleset to check. |
addr | address | The address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | A flag indicating if the provided address has mint permission for the project. |
_msgData
The calldata. Preferred to use over msg.data
.
function _msgData() internal view override(ERC2771Context, Context) returns (bytes calldata);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | calldata The msg.data of this call. |
_msgSender
The message's sender. Preferred to use over msg.sender
.
function _msgSender() internal view override(ERC2771Context, Context) returns (address sender);
Returns
Name | Type | Description |
---|---|---|
sender | address | The address which sent this call. |
_upcomingRulesetOf
The project's upcoming ruleset.
function _upcomingRulesetOf(uint256 projectId) internal view returns (JBRuleset memory);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | JBRuleset | The project's upcoming ruleset. |
addPriceFeed
Add a price feed for a project.
Can only be called by the project's owner or an address with the owner's permission to ADD_PRICE_FEED
.
function addPriceFeed(
uint256 projectId,
uint256 pricingCurrency,
uint256 unitCurrency,
IJBPriceFeed feed
)
external
override;
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to add the feed for. |
pricingCurrency | uint256 | The currency the feed's output price is in terms of. |
unitCurrency | uint256 | The currency being priced by the feed. |
feed | IJBPriceFeed | The address of the price feed to add. |