REVDeployer
Inherits: ERC2771Context, IREVDeployer, IJBRulesetDataHook, IJBCashOutHook, IERC721Receiver
REVDeployer
deploys, manages, and operates Revnets.
Revnets are unowned Juicebox projects which operate autonomously after deployment.
State Variables
CASH_OUT_DELAY
The number of seconds until a revnet's participants can cash out, starting from the time when that revnet is deployed to a new network.
- Only applies to existing revnets which are deploying onto a new network.
- To prevent liquidity/arbitrage issues which might arise when an existing revnet adds a brand-new treasury.
30 days, in seconds.
uint256 public constant override CASH_OUT_DELAY = 2_592_000;
FEE
The cash out fee (as a fraction out of JBConstants.MAX_FEE
).
Cashout fees are paid to the revnet with the FEE_REVNET_ID
.
Fees are charged on cashouts if the cash out tax rate is greater than 0%.
When suckers withdraw funds, they do not pay cash out fees.
uint256 public constant override FEE = 25;
CONTROLLER
The controller used to create and manage Juicebox projects for revnets.
IJBController public immutable override CONTROLLER;
DIRECTORY
The directory of terminals and controllers for Juicebox projects (and revnets).
IJBDirectory public immutable override DIRECTORY;
FEE_REVNET_ID
The Juicebox project ID of the revnet that receives cash out fees.
uint256 public immutable override FEE_REVNET_ID;
HOOK_DEPLOYER
Deploys tiered ERC-721 hooks for revnets.
IJB721TiersHookDeployer public immutable override HOOK_DEPLOYER;
PERMISSIONS
Stores Juicebox project (and revnet) access permissions.
IJBPermissions public immutable override PERMISSIONS;
PROJECTS
Mints ERC-721s that represent Juicebox project (and revnet) ownership and transfers.
IJBProjects public immutable override PROJECTS;
PUBLISHER
Manages the publishing of ERC-721 posts to revnet's tiered ERC-721 hooks.
CTPublisher public immutable override PUBLISHER;
SUCKER_REGISTRY
Deploys and tracks suckers for revnets.
IJBSuckerRegistry public immutable override SUCKER_REGISTRY;
amountToAutoIssue
The number of revnet tokens which can be "auto-minted" (minted without payments) for a specific beneficiary during a stage. Think of this as a per-stage premint.
These tokens can be minted with autoIssueFor(…)
.
mapping(uint256 revnetId => mapping(uint256 stageId => mapping(address beneficiary => uint256))) public override
amountToAutoIssue;
buybackHookOf
Each revnet's buyback data hook. These return buyback hook data.
Buyback hooks are a combined data hook/pay hook.
mapping(uint256 revnetId => IJBRulesetDataHook buybackHook) public override buybackHookOf;
cashOutDelayOf
The timestamp of when cashouts will become available to a specific revnet's participants.
Only applies to existing revnets which are deploying onto a new network.
mapping(uint256 revnetId => uint256 cashOutDelay) public override cashOutDelayOf;
hashedEncodedConfigurationOf
The hashed encoded configuration of each revnet.
This is used to ensure that the encoded configuration of a revnet is the same when deploying suckers for omnichain operations.
mapping(uint256 revnetId => bytes32 hashedEncodedConfiguration) public override hashedEncodedConfigurationOf;
loansOf
Each revnet's loan contract.
Revnets can offer loans to their participants, collateralized by their tokens. Participants can borrow up to the current cash out value of their tokens.
mapping(uint256 revnetId => address) public override loansOf;
tiered721HookOf
Each revnet's tiered ERC-721 hook.
mapping(uint256 revnetId => IJB721TiersHook tiered721Hook) public override tiered721HookOf;
_extraOperatorPermissions
A list of JBPermissonIds
indices to grant to the split operator of a specific revnet.
These should be set in the revnet's deployment process.
mapping(uint256 revnetId => uint256[]) internal _extraOperatorPermissions;
Functions
constructor
constructor(
IJBController controller,
IJBSuckerRegistry suckerRegistry,
uint256 feeRevnetId,
IJB721TiersHookDeployer hookDeployer,
CTPublisher publisher,
address trustedForwarder
)
ERC2771Context(trustedForwarder);
Parameters
Name | Type | Description |
---|---|---|
controller | IJBController | The controller to use for launching and operating the Juicebox projects which will be revnets. |
suckerRegistry | IJBSuckerRegistry | The registry to use for deploying and tracking each revnet's suckers. |
feeRevnetId | uint256 | The Juicebox project ID of the revnet that will receive fees. |
hookDeployer | IJB721TiersHookDeployer | The deployer to use for revnet's tiered ERC-721 hooks. |
publisher | CTPublisher | The croptop publisher revnets can use to publish ERC-721 posts to their tiered ERC-721 hooks. |
trustedForwarder | address | The trusted forwarder for the ERC2771Context. |
beforePayRecordedWith
Before a revnet processes an incoming payment, determine the weight and pay hooks to use.
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
Name | Type | Description |
---|---|---|
context | JBBeforePayRecordedContext | Standard Juicebox payment context. See JBBeforePayRecordedContext . |
Returns
Name | Type | Description |
---|---|---|
weight | uint256 | The weight which revnet tokens are minted relative to. This can be used to customize how many tokens get minted by a payment. |
hookSpecifications | JBPayHookSpecification[] | Amounts (out of what's being paid in) to be sent to pay hooks instead of being paid into the revnet. Useful for automatically routing funds from a treasury as payments come in. |
beforeCashOutRecordedWith
Determine how a cash out from a revnet should be processed.
This function is part of IJBRulesetDataHook
, and gets called before the revnet processes a cash out.
If a sucker is cashing out, no taxes or fees are imposed.
function beforeCashOutRecordedWith(JBBeforeCashOutRecordedContext calldata context)
external
view
override
returns (
uint256 cashOutTaxRate,
uint256 cashOutCount,
uint256 totalSupply,
JBCashOutHookSpecification[] memory hookSpecifications
);
Parameters
Name | Type | Description |
---|---|---|
context | JBBeforeCashOutRecordedContext | Standard Juicebox cash out context. See JBBeforeCashOutRecordedContext . |
Returns
Name | Type | Description |
---|---|---|
cashOutTaxRate | uint256 | The cash out tax rate, which influences the amount of terminal tokens which get cashed out. |
cashOutCount | uint256 | The number of revnet tokens that are cashed out. |
totalSupply | uint256 | The total revnet token supply. |
hookSpecifications | JBCashOutHookSpecification[] | 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 revnet's tokens on-demand.
Required by the IJBRulesetDataHook
interface.
function hasMintPermissionFor(uint256 revnetId, address addr) external view override returns (bool);
Parameters
Name | Type | Description |
---|---|---|
revnetId | uint256 | The ID of the revnet to check permissions for. |
addr | address | The address to check the mint permission of. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | flag A flag indicating whether the address has permission to mint the revnet's tokens on-demand. |
onERC721Received
Make sure this contract can only receive project NFTs from JBProjects
.
function onERC721Received(address, address, uint256, bytes calldata) external view returns (bytes4);
isSplitOperatorOf
A flag indicating whether an address is a revnet's split operator.
function isSplitOperatorOf(uint256 revnetId, address addr) public view override returns (bool);
Parameters
Name | Type | Description |
---|---|---|
revnetId | uint256 | The ID of the revnet. |
addr | address | The address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | flag A flag indicating whether the address is the revnet's split operator. |
supportsInterface
Indicates if this contract adheres to the specified interface.
See IERC165.supportsInterface
.
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | A flag indicating if the provided interface ID is supported. |
_checkIfIsSplitOperatorOf
If the specified address is not the revnet's current split operator, revert.
function _checkIfIsSplitOperatorOf(uint256 revnetId, address operator) internal view;
Parameters
Name | Type | Description |
---|---|---|
revnetId | uint256 | The ID of the revnet to check split operator status for. |
operator | address | The address being checked. |
_isSuckerOf
A flag indicating whether an address is a revnet's sucker.
function _isSuckerOf(uint256 revnetId, address addr) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
revnetId | uint256 | The ID of the revnet to check sucker status for. |
addr | address | The address being checked. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isSucker A flag indicating whether the address is one of the revnet's suckers. |