跳到主要内容

JBOmnichainDeployer4_1

Git Source

Inherits: ERC2771Context, JBPermissioned, IJBOmnichainDeployer4_1, IJBRulesetDataHook4_1, IERC721Receiver

Deploys, manages, and operates Juicebox projects with suckers.

State Variables

PROJECTS

Mints ERC-721s that represent Juicebox project ownership and transfers.

IJBProjects public immutable PROJECTS;

HOOK_DEPLOYER

Deploys tiered ERC-721 hooks for projects.

IJB721TiersHookDeployer public immutable HOOK_DEPLOYER;

SUCKER_REGISTRY

Deploys and tracks suckers for projects.

IJBSuckerRegistry public immutable SUCKER_REGISTRY;

_dataHookOf

Each project's data hook provided on deployment.

mapping(uint256 projectId => mapping(uint256 rulesetId => JBDeployerHookConfig4_1)) internal _dataHookOf;

Functions

constructor

constructor(
IJBSuckerRegistry suckerRegistry,
IJB721TiersHookDeployer hookDeployer,
IJBPermissions permissions,
IJBProjects projects,
address trustedForwarder
)
JBPermissioned(permissions)
ERC2771Context(trustedForwarder);

Parameters

NameTypeDescription
suckerRegistryIJBSuckerRegistryThe registry to use for deploying and tracking each project's suckers.
hookDeployerIJB721TiersHookDeployerThe deployer to use for project's tiered ERC-721 hooks.
permissionsIJBPermissionsThe permissions to use for the contract.
projectsIJBProjectsThe projects to use for the contract.
trustedForwarderaddressThe trusted forwarder for the ERC2771Context.

beforePayRecordedWith

Forward the call to the original data hook.

This function is part of IJBRulesetDataHook, and gets called before the revnet processes a payment.

function beforePayRecordedWith(JBBeforePayRecordedContext calldata context)
external
view
override
returns (uint256 weight, JBPayHookSpecification[] memory hookSpecifications);

Parameters

NameTypeDescription
contextJBBeforePayRecordedContextStandard Juicebox payment context. See JBBeforePayRecordedContext.

Returns

NameTypeDescription
weightuint256The weight which project tokens are minted relative to. This can be used to customize how many tokens get minted by a payment.
hookSpecificationsJBPayHookSpecification[]Amounts (out of what's being paid in) to be sent to pay hooks instead of being paid into the project. Useful for automatically routing funds from a treasury as payments come in.

beforeCashOutRecordedWith

Allow cash outs from suckers without a tax.

This function is part of IJBRulesetDataHook, and gets called before the revnet processes a cash out.

function beforeCashOutRecordedWith(JBBeforeCashOutRecordedContext calldata context)
external
view
override
returns (
uint256 cashOutTaxRate,
uint256 cashOutCount,
uint256 totalSupply,
JBCashOutHookSpecification[] memory hookSpecifications
);

Parameters

NameTypeDescription
contextJBBeforeCashOutRecordedContextStandard Juicebox cash out context. See JBBeforeCashOutRecordedContext.

Returns

NameTypeDescription
cashOutTaxRateuint256The cash out tax rate, which influences the amount of terminal tokens which get cashed out.
cashOutCountuint256The number of project tokens that are cashed out.
totalSupplyuint256The total project token supply.
hookSpecificationsJBCashOutHookSpecification[]The amount of funds and the data to send to cash out hooks (this contract).

dataHookOf

Get the data hook for a project and ruleset.

function dataHookOf(
uint256 projectId,
uint256 rulesetId
)
external
view
override
returns (bool useDataHookForPay, bool useDataHookForCashout, IJBRulesetDataHook4_1 dataHook);

Parameters

NameTypeDescription
projectIduint256The ID of the project to get the data hook for.
rulesetIduint256The ID of the ruleset to get the data hook for.

Returns

NameTypeDescription
useDataHookForPayboolWhether the data hook is used for pay.
useDataHookForCashoutboolWhether the data hook is used for cashout.
dataHookIJBRulesetDataHook4_1The data hook.

hasMintPermissionFor

A flag indicating whether an address has permission to mint a project's tokens on-demand.

A project's data hook can allow any address to mint its tokens.

function hasMintPermissionFor(
uint256 projectId,
JBRuleset memory ruleset,
address addr
)
external
view
override
returns (bool flag);

Parameters

NameTypeDescription
projectIduint256The ID of the project whose token can be minted.
rulesetJBRulesetThe ruleset to check the token minting permission of.
addraddressThe address to check the token minting permission of.

Returns

NameTypeDescription
flagboolA flag indicating whether the address has permission to mint the project's tokens on-demand.

supportsInterface

Indicates if this contract adheres to the specified interface.

See IERC165.supportsInterface.

function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool);

Returns

NameTypeDescription
<none>boolA flag indicating if the provided interface ID is supported.

deploySuckersFor

Deploy new suckers for an existing project.

Only the juicebox's owner can deploy new suckers.

function deploySuckersFor(
uint256 projectId,
REVSuckerDeploymentConfig calldata suckerDeploymentConfiguration
)
external
override
returns (address[] memory suckers);

Parameters

NameTypeDescription
projectIduint256The ID of the project to deploy suckers for.
suckerDeploymentConfigurationREVSuckerDeploymentConfigThe suckers to set up for the project.

launchProjectFor

Creates a project with suckers.

This will mint the project's ERC-721 to the owner's address, queue the specified rulesets, and set up the specified splits and terminals. Each operation within this transaction can be done in sequence separately.

Anyone can deploy a project to any owner's address.

function launchProjectFor(
address owner,
string calldata projectUri,
JBRulesetConfig[] memory rulesetConfigurations,
JBTerminalConfig[] calldata terminalConfigurations,
string calldata memo,
REVSuckerDeploymentConfig calldata suckerDeploymentConfiguration,
IJBController controller
)
external
override
returns (uint256 projectId, address[] memory suckers);

Parameters

NameTypeDescription
owneraddressThe project's owner. The project ERC-721 will be minted to this address.
projectUristringThe project's metadata URI. This is typically an IPFS hash, optionally with the ipfs:// prefix. This can be updated by the project's owner.
rulesetConfigurationsJBRulesetConfig[]The rulesets to queue.
terminalConfigurationsJBTerminalConfig[]The terminals to set up for the project.
memostringA memo to pass along to the emitted event.
suckerDeploymentConfigurationREVSuckerDeploymentConfigThe suckers to set up for the project. Suckers facilitate cross-chain token transfers between peer projects on different networks.
controllerIJBControllerThe controller to use for launching the project.

Returns

NameTypeDescription
projectIduint256The project's ID.
suckersaddress[]

launch721ProjectFor

Launches a new project with a 721 tiers hook attached, and with suckers.

function launch721ProjectFor(
address owner,
JBDeploy721TiersHookConfig calldata deployTiersHookConfig,
JBLaunchProjectConfig calldata launchProjectConfig,
bytes32 salt,
REVSuckerDeploymentConfig calldata suckerDeploymentConfiguration,
IJBController controller
)
external
override
returns (uint256 projectId, IJB721TiersHook hook, address[] memory suckers);

Parameters

NameTypeDescription
owneraddressThe address to set as the owner of the project. The ERC-721 which confers this project's ownership will be sent to this address.
deployTiersHookConfigJBDeploy721TiersHookConfigConfiguration which dictates the behavior of the 721 tiers hook which is being deployed.
launchProjectConfigJBLaunchProjectConfigConfiguration which dictates the behavior of the project which is being launched.
saltbytes32A salt to use for the deterministic deployment.
suckerDeploymentConfigurationREVSuckerDeploymentConfigThe suckers to set up for the project. Suckers facilitate cross-chain
controllerIJBControllerThe controller to use for launching the project.

Returns

NameTypeDescription
projectIduint256The ID of the newly launched project.
hookIJB721TiersHookThe 721 tiers hook that was deployed for the project.
suckersaddress[]

launchRulesetsFor

Launches new rulesets for a project, using this contract as the data hook.

function launchRulesetsFor(
uint256 projectId,
JBRulesetConfig[] calldata rulesetConfigurations,
JBTerminalConfig[] calldata terminalConfigurations,
string calldata memo,
IJBController controller
)
external
override
returns (uint256);

Parameters

NameTypeDescription
projectIduint256The ID of the project to launch the rulesets for.
rulesetConfigurationsJBRulesetConfig[]The rulesets to launch.
terminalConfigurationsJBTerminalConfig[]The terminals to set up for the project.
memostringA memo to pass along to the emitted event.
controllerIJBControllerThe controller to use for launching the rulesets.

Returns

NameTypeDescription
<none>uint256rulesetId The ID of the newly launched rulesets.

launch721RulesetsFor

Launches new rulesets for a project with a 721 tiers hook attached, using this contract as the data hook.

function launch721RulesetsFor(
uint256 projectId,
JBDeploy721TiersHookConfig memory deployTiersHookConfig,
JBLaunchRulesetsConfig calldata launchRulesetsConfig,
IJBController controller,
bytes32 salt
)
external
override
returns (uint256 rulesetId, IJB721TiersHook hook);

Parameters

NameTypeDescription
projectIduint256The ID of the project to launch the rulesets for.
deployTiersHookConfigJBDeploy721TiersHookConfigConfiguration which dictates the behavior of the 721 tiers hook which is being deployed.
launchRulesetsConfigJBLaunchRulesetsConfigConfiguration which dictates the behavior of the rulesets which are being launched.
controllerIJBController
saltbytes32A salt to use for the deterministic deployment.

Returns

NameTypeDescription
rulesetIduint256The ID of the newly launched rulesets.
hookIJB721TiersHookThe 721 tiers hook that was deployed for the project.

queueRulesetsOf

Queues new rulesets for a project, using this contract as the data hook.

function queueRulesetsOf(
uint256 projectId,
JBRulesetConfig[] calldata rulesetConfigurations,
string calldata memo,
IJBController controller
)
external
override
returns (uint256);

Parameters

NameTypeDescription
projectIduint256The ID of the project to queue the rulesets for.
rulesetConfigurationsJBRulesetConfig[]The rulesets to queue.
memostringA memo to pass along to the emitted event.
controllerIJBControllerThe controller to use for queuing the rulesets.

Returns

NameTypeDescription
<none>uint256rulesetId The ID of the newly queued rulesets.

queue721RulesetsOf

Queues new rulesets for a project with a 721 tiers hook attached, using this contract as the data hook.

function queue721RulesetsOf(
uint256 projectId,
JBDeploy721TiersHookConfig memory deployTiersHookConfig,
JBQueueRulesetsConfig calldata queueRulesetsConfig,
IJBController controller,
bytes32 salt
)
external
override
returns (uint256 rulesetId, IJB721TiersHook hook);

Parameters

NameTypeDescription
projectIduint256The ID of the project to queue the rulesets for.
deployTiersHookConfigJBDeploy721TiersHookConfigConfiguration which dictates the behavior of the 721 tiers hook which is being deployed.
queueRulesetsConfigJBQueueRulesetsConfigConfiguration which dictates the behavior of the rulesets which are being queued.
controllerIJBController
saltbytes32A salt to use for the deterministic deployment.

Returns

NameTypeDescription
rulesetIduint256The ID of the newly queued rulesets.
hookIJB721TiersHookThe 721 tiers hook that was deployed for the project.

onERC721Received

Make sure this contract can only receive project NFTs from JBProjects.

function onERC721Received(address, address, uint256, bytes calldata) external view returns (bytes4);

_setup

Sets up a project's rulesets.

function _setup(
uint256 projectId,
JBRulesetConfig[] memory rulesetConfigurations
)
internal
returns (JBRulesetConfig[] memory);

Parameters

NameTypeDescription
projectIduint256The ID of the project to set up.
rulesetConfigurationsJBRulesetConfig[]The rulesets to set up.

Returns

NameTypeDescription
<none>JBRulesetConfig[]rulesetConfigurations The rulesets that were set up.

_from721Config

Converts a 721 ruleset configuration to a regular ruleset configuration.

function _from721Config(
JBPayDataHookRulesetConfig[] calldata launchProjectConfig,
IJB721TiersHook dataHook
)
internal
pure
returns (JBRulesetConfig[] memory rulesetConfigurations);

Parameters

NameTypeDescription
launchProjectConfigJBPayDataHookRulesetConfig[]The 721 ruleset configuration to convert.
dataHookIJB721TiersHookThe data hook to use for the ruleset.

Returns

NameTypeDescription
rulesetConfigurationsJBRulesetConfig[]The converted ruleset configuration.

_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);

Errors

JBOmnichainDeployer_InvalidHook

Thrown when a data hook is set to this contract.

error JBOmnichainDeployer_InvalidHook();