Skip to main content

JBOwnableOverrides

Git Source

Inherits: Context, IJBOwnable, IJBOperatable

Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions and can grant other users permission to those functions. This module is used through inheritance. It will make available the modifier onlyOwner, which can be applied to your functions to restrict their use to the owner or an approved address. Supports meta-transactions.

State Variables​

operatorStore​

A contract storing operator assignments.

IJBOperatorStore public immutable operatorStore;

projects​

The IJBProjects to use to get the owner of a project.

IJBProjects public immutable projects;

jbOwner​

The JBOwner information.

JBOwner public override jbOwner;

Functions​

constructor​

constructor(IJBProjects _projects, IJBOperatorStore _operatorStore);

Parameters

NameTypeDescription
_projectsIJBProjectsthe JBProjects to use to get the owner of the project
_operatorStoreIJBOperatorStorethe operatorStore to use for the permissions

requirePermission​

Only allows the speficied account or an operator of the account to proceed.

modifier requirePermission(address _account, uint256 _domain, uint256 _permissionIndex);

Parameters

NameTypeDescription
_accountaddressThe account to check for.
_domainuint256The domain namespace to look for an operator within.
_permissionIndexuint256The index of the permission to check for.

requirePermissionFromProject​

Only allows callers that have received permission from the projectOwner for this project.

If the owner is not a project then this will always revert

modifier requirePermissionFromProject(uint256 _permissionIndex);

Parameters

NameTypeDescription
_permissionIndexuint256The index of the permission to check for.

requirePermissionAllowingOverride​

Only allows the speficied account, an operator of the account to proceed, or a truthy override flag.

modifier requirePermissionAllowingOverride(address _account, uint256 _domain, uint256 _permissionIndex, bool _override);

Parameters

NameTypeDescription
_accountaddressThe account to check for.
_domainuint256The domain namespace to look for an operator within.
_permissionIndexuint256The index of the permission to check for.
_overrideboolA condition to force allowance for.

owner​

Returns the address of the current project owner.

function owner() public view virtual returns (address);

renounceOwnership​

Leaves the contract without owner. It will not be possible to call onlyOwner/_checkOwner functions anymore. Can only be called by the current owner.

NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

function renounceOwnership() public virtual;

transferOwnership​

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

function transferOwnership(address _newOwner) public virtual;

Parameters

NameTypeDescription
_newOwneraddressthe static address that should receive ownership

transferOwnershipToProject​

Transfer ownership of the contract to a (Juicebox) project.

ProjectID is limited to a uint88

function transferOwnershipToProject(uint256 _projectId) public virtual;

Parameters

NameTypeDescription
_projectIduint256the project that should receive ownership

setPermissionIndex​

Sets the permission index that allows other callers to perform operations on behave of the project owner.

function setPermissionIndex(uint8 _permissionIndex) public virtual;

Parameters

NameTypeDescription
_permissionIndexuint8the permissionIndex to use for 'onlyOwner' calls

_setPermissionIndex​

Sets the permission index that allows other callers to perform operations on behave of the project owner.

Internal function without access restriction.

function _setPermissionIndex(uint8 _permissionIndex) internal virtual;

Parameters

NameTypeDescription
_permissionIndexuint8the permissionIndex to use for 'onlyOwner' calls

_transferOwnership​

helper to allow for drop-in replacement of OZ

function _transferOwnership(address _newOwner) internal virtual;

Parameters

NameTypeDescription
_newOwneraddressthe static address that should become the owner of this contract

_transferOwnership​

Transfers ownership of the contract to a new account (_newOwner) OR a project (_projectID).

Internal function without access restriction.

function _transferOwnership(address _newOwner, uint88 _projectId) internal virtual;

Parameters

NameTypeDescription
_newOwneraddressthe static owner address that should receive ownership
_projectIduint88the projectId this contract should follow ownership of

_checkOwner​

Throws if the sender is not the owner.

function _checkOwner() internal view virtual;

_requirePermission​

Require the message sender is either the account or has the specified permission.

function _requirePermission(address _account, uint256 _domain, uint256 _permissionIndex) internal view virtual;

Parameters

NameTypeDescription
_accountaddressThe account to allow.
_domainuint256The domain namespace within which the permission index will be checked.
_permissionIndexuint256The permission index that an operator must have within the specified domain to be allowed.

_requirePermissionAllowingOverride​

Require the message sender is either the account, has the specified permission, or the override condition is true.

function _requirePermissionAllowingOverride(address _account, uint256 _domain, uint256 _permissionIndex, bool _override)
internal
view
virtual;

Parameters

NameTypeDescription
_accountaddressThe account to allow.
_domainuint256The domain namespace within which the permission index will be checked.
_permissionIndexuint256
_overrideboolThe override condition to allow.

_emitTransferEvent​

function _emitTransferEvent(address previousOwner, address newOwner) internal virtual;

Errors​

UNAUTHORIZED​

error UNAUTHORIZED();

INVALID_NEW_OWNER​

error INVALID_NEW_OWNER(address ownerAddress, uint256 projectId);