Skip to main content

JBOmnichainDeployer

Git Source

Inherits: ERC2771Context, JBPermissioned, IJBOmnichainDeployer, IJBRulesetDataHook, IERC721Receiver

Deploys, manages, and operates Juicebox projects with suckers.

State Variables

CONTROLLER

The controller used to create and manage Juicebox projects.

IJBController public immutable CONTROLLER;

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 => JBDeployerHookConfig)) public override dataHookOf;

Functions

constructor

constructor(
IJBController controller,
IJBSuckerRegistry suckerRegistry,
IJB721TiersHookDeployer hookDeployer,
address trustedForwarder
)
JBPermissioned(IJBPermissioned(address(controller)).PERMISSIONS())
ERC2771Context(trustedForwarder);

Parameters

NameTypeDescription
controllerIJBControllerThe controller to use for launching and operating the Juicebox projects.
suckerRegistryIJBSuckerRegistryThe registry to use for deploying and tracking each project's suckers.
hookDeployerIJB721TiersHookDeployerThe deployer to use for project's tiered ERC-721 hooks.
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).

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, address addr) external view returns (bool flag);

Parameters

NameTypeDescription
projectIduint256The ID of the project whose token can be minted.
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
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
)
external
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.

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
)
external
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.
suckerDeploymentConfigurationREVSuckerDeploymentConfig

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
)
external
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.

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
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
)
external
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.

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