JBDirectory
Inherits: JBPermissioned, Ownable, IJBDirectory
JBDirectory
tracks the terminals and the controller used by each project.
Tracks which IJBTerminal
s each project is currently accepting funds through, and which IJBController
is
managing each project's tokens and rulesets.
State Variables
PROJECTS
Mints ERC-721s that represent project ownership and transfers.
IJBProjects public immutable override PROJECTS;
controllerOf
The specified project's controller, which dictates how its terminals interact with its tokens and rulesets.
mapping(uint256 projectId => IERC165) public override controllerOf;
isAllowedToSetFirstController
Whether the specified address is allowed to set a project's first controller on their behalf.
These addresses/contracts have been vetted by this contract's owner.
mapping(address addr => bool) public override isAllowedToSetFirstController;
_primaryTerminalOf
The primary terminal that a project uses for the specified token.
mapping(uint256 projectId => mapping(address token => IJBTerminal)) internal _primaryTerminalOf;
_terminalsOf
The specified project's terminals.
mapping(uint256 projectId => IJBTerminal[]) internal _terminalsOf;
Functions
constructor
constructor(
IJBPermissions permissions,
IJBProjects projects,
address owner
)
JBPermissioned(permissions)
Ownable(owner);
Parameters
Name | Type | Description |
---|---|---|
permissions | IJBPermissions | A contract storing permissions. |
projects | IJBProjects | A contract which mints ERC-721s that represent project ownership and transfers. |
owner | address | The address that will own the contract. |
primaryTerminalOf
The primary terminal that a project uses for the specified token.
Returns the first terminal that accepts the token if the project hasn't explicitly set a primary terminal for it.
Returns the zero address if no terminal accepts the token.
function primaryTerminalOf(uint256 projectId, address token) external view override returns (IJBTerminal);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to get the primary terminal of. |
token | address | The token that the terminal accepts. |
Returns
Name | Type | Description |
---|---|---|
<none> | IJBTerminal | The primary terminal's address. |
terminalsOf
The specified project's terminals.
function terminalsOf(uint256 projectId) external view override returns (IJBTerminal[] memory);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to get the terminals of. |
Returns
Name | Type | Description |
---|---|---|
<none> | IJBTerminal[] | An array of the project's terminal addresses. |
isTerminalOf
Check if a project uses a specific terminal.
function isTerminalOf(uint256 projectId, IJBTerminal terminal) public view override returns (bool);
Parameters
Name | Type | Description |
---|---|---|
projectId | uint256 | The ID of the project to check. |
terminal | IJBTerminal | The terminal to check for. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | A flag indicating whether the project uses the terminal. |
setIsAllowedToSetFirstController
Add or remove an address/contract from a list of trusted addresses which are allowed to set a first controller for projects.
Only this contract's owner can call this function.
These addresses are vetted controllers as well as contracts designed to launch new projects.
A project can set its own controller without being on this list.
If you would like to add an address/contract to this list, please reach out to this contract's owner.
function setIsAllowedToSetFirstController(address addr, bool flag) external override onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
addr | address | The address to allow or not allow. |
flag | bool | Whether the address is allowed to set first controllers for projects. Use true to allow and false to not allow. |