跳到主要内容

JBSuckerRegistry

Git Source

Inherits: ERC2771Context, Ownable, JBPermissioned, IJBSuckerRegistry

State Variables

_SUCKER_EXISTS

A constant indicating that this sucker exists and belongs to a specific project.

uint256 internal constant _SUCKER_EXISTS = 1;

DIRECTORY

The juicebox directory.

IJBDirectory public immutable override DIRECTORY;

PROJECTS

A contract which mints ERC-721s that represent project ownership and transfers.

IJBProjects public immutable override PROJECTS;

suckerDeployerIsAllowed

Tracks whether the specified sucker deployer is approved by this registry.

Note: member: deployer The address of the deployer to check.

mapping(address deployer => bool) public override suckerDeployerIsAllowed;

_suckersOf

Tracks the suckers for the specified project.

mapping(uint256 => EnumerableMap.AddressToUintMap) internal _suckersOf;

Functions

constructor

constructor(
IJBDirectory directory,
IJBPermissions permissions,
address initialOwner,
address trusted_forwarder
)
ERC2771Context(trusted_forwarder)
JBPermissioned(permissions)
Ownable(initialOwner);

Parameters

NameTypeDescription
directoryIJBDirectoryThe juicebox directory.
permissionsIJBPermissionsA contract storing permissions.
initialOwneraddressThe initial owner of this contract.
trusted_forwarderaddress

isSuckerOf

Returns true if the specified sucker belongs to the specified project, and was deployed through this registry.

function isSuckerOf(uint256 projectId, address addr) external view override returns (bool);

Parameters

NameTypeDescription
projectIduint256The ID of the project to check for.
addraddressThe address of the sucker to check.

Returns

NameTypeDescription
<none>boolflag A flag indicating if the sucker belongs to the project, and was deployed through this registry.

suckerPairsOf

Helper function for retrieving the projects suckers and their metadata.

function suckerPairsOf(uint256 projectId) external view override returns (JBSuckersPair[] memory pairs);

Parameters

NameTypeDescription
projectIduint256The ID of the project to get the suckers of.

Returns

NameTypeDescription
pairsJBSuckersPair[]The pairs of suckers and their metadata.

suckersOf

Gets all of the specified project's suckers which were deployed through this registry.

function suckersOf(uint256 projectId) external view override returns (address[] memory);

Parameters

NameTypeDescription
projectIduint256The ID of the project to get the suckers of.

Returns

NameTypeDescription
<none>address[]suckers The addresses of the suckers.

_msgData

The calldata. Preferred to use over msg.data.

function _msgData() internal view override(ERC2771Context, Context) returns (bytes calldata);

Returns

NameTypeDescription
<none>bytescalldata 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

NameTypeDescription
senderaddressThe address which sent this call.

_contextSuffixLength

ERC-2771 specifies the context as being a single address (20 bytes).

function _contextSuffixLength() internal view virtual override(ERC2771Context, Context) returns (uint256);

allowSuckerDeployer

Adds a suckers deployer to the allowlist.

Can only be called by this contract's owner (initially project ID 1, or JuiceboxDAO).

function allowSuckerDeployer(address deployer) public override onlyOwner;

Parameters

NameTypeDescription
deployeraddressThe address of the deployer to add.

allowSuckerDeployers

Adds multiple suckers deployer to the allowlist.

Can only be called by this contract's owner (initially project ID 1, or JuiceboxDAO).

function allowSuckerDeployers(address[] calldata deployers) public override onlyOwner;

Parameters

NameTypeDescription
deployersaddress[]The address of the deployer to add.

deploySuckersFor

Deploy one or more suckers for the specified project.

The caller must be the project's owner or have JBPermissionIds.DEPLOY_SUCKERS from the project's owner.

function deploySuckersFor(
uint256 projectId,
bytes32 salt,
JBSuckerDeployerConfig[] calldata configurations
)
public
override
returns (address[] memory suckers);

Parameters

NameTypeDescription
projectIduint256The ID of the project to deploy suckers for.
saltbytes32The salt used to deploy the contract. For the suckers to be peers, this must be the same value on each chain where suckers are deployed.
configurationsJBSuckerDeployerConfig[]The sucker deployer configs to use to deploy the suckers.

Returns

NameTypeDescription
suckersaddress[]The addresses of the deployed suckers.

removeDeprecatedSucker

Lets anyone remove a deprecated sucker from a project.

function removeDeprecatedSucker(uint256 projectId, address sucker) public override;

Parameters

NameTypeDescription
projectIduint256The ID of the project to remove the sucker from.
suckeraddressThe address of the deprecated sucker to remove.

removeSuckerDeployer

Removes a sucker deployer from the allowlist.

Can only be called by this contract's owner (initially project ID 1, or JuiceboxDAO).

function removeSuckerDeployer(address deployer) public override onlyOwner;

Parameters

NameTypeDescription
deployeraddressThe address of the deployer to remove.

Errors

JBSuckerRegistry_InvalidDeployer

error JBSuckerRegistry_InvalidDeployer(IJBSuckerDeployer deployer);

JBSuckerRegistry_RulesetDoesNotAllowAddingSucker

error JBSuckerRegistry_RulesetDoesNotAllowAddingSucker(uint256 projectId);

JBSuckerRegistry_SuckerDoesNotBelongToProject

error JBSuckerRegistry_SuckerDoesNotBelongToProject(uint256 projectId, address sucker);

JBSuckerRegistry_SuckerIsNotDeprecated

error JBSuckerRegistry_SuckerIsNotDeprecated(address sucker, JBSuckerState suckerState);