JBOwnable
Inherits: JBOwnableOverrides
A function restricted by JBOwnable
can only be called by a Juicebox project's owner, a specified owner
address (if set), or addresses with permission from the owner.
*A function with the onlyOwner
modifier from JBOwnable
can only be called by addresses with owner access
based on a JBOwner
struct:
- If
JBOwner.projectId
isn't zero, the address holding theJBProjects
NFT with theJBOwner.projectId
ID is the owner. - If
JBOwner.projectId
is set to0
, theJBOwner.owner
address is the owner. - The owner can give other addresses access with
JBPermissions.setPermissionsFor(...)
, using theJBOwner.permissionId
permission.*
To use onlyOwner
, inherit this contract and apply the modifier to a function.
Functions
constructor
To make a Juicebox project's owner this contract's owner, pass that project's ID as the
initialProjectIdOwner
.
To make a specific address the owner, pass that address as the initialOwner
and 0
as the
initialProjectIdOwner
.
The owner can give other addresses owner access through the permissions
contract.
constructor(
IJBPermissions permissions,
IJBProjects projects,
address initialOwner,
uint88 initialProjectIdOwner
)
JBOwnableOverrides(permissions, projects, initialOwner, initialProjectIdOwner);
Parameters
Name | Type | Description |
---|---|---|
permissions | IJBPermissions | A contract storing permissions. |
projects | IJBProjects | Mints ERC-721s that represent project ownership and transfers. |
initialOwner | address | An address with owner access (until ownership is transferred). |
initialProjectIdOwner | uint88 | The ID of the Juicebox project whose owner has owner access (until ownership is transferred). |
onlyOwner
Reverts if called by an address without owner access.
modifier onlyOwner() virtual;
_emitTransferEvent
Either newOwner
or newProjectId
is non-zero or both are zero. But they can never both be non-zero.
This function exists because some contracts will try to deploy contracts for a project before
function _emitTransferEvent(address previousOwner, address newOwner, uint88 newProjectId) internal virtual override;