Skip to main content

JuiceboxProject

Git Source

Inherits: IERC721Receiver, Ownable

A contract that inherits from JuiceboxProject can use Juicebox as a business-model-as-a-service.

The owner of the contract makes admin decisions such as:

  • Which address is the funding cycle owner, which can tap funds from the funding cycle.
  • Should this project's Tickets be migrated to a new TerminalV1.

State Variables

terminalDirectory

The direct deposit terminals.

ITerminalDirectory public immutable terminalDirectory;

projectId

The ID of the project that should be used to forward this contract's received payments.

uint256 public projectId;

Functions

constructor

constructor(uint256 _projectId, ITerminalDirectory _terminalDirectory);

Parameters

NameTypeDescription
_projectIduint256The ID of the project that should be used to forward this contract's received payments.
_terminalDirectoryITerminalDirectoryA directory of a project's current Juicebox terminal to receive payments in.

receive

receive() external payable;

withdraw

Withdraws funds stored in this contract.

function withdraw(address payable _beneficiary, uint256 _amount) external onlyOwner;

Parameters

NameTypeDescription
_beneficiaryaddress payableThe address to send the funds to.
_amountuint256The amount to send.

setProjectId

Allows the project that is being managed to be set.

function setProjectId(uint256 _projectId) external onlyOwner;

Parameters

NameTypeDescription
_projectIduint256The ID of the project that is being managed.

pay

Make a payment to this project.

function pay(address _beneficiary, string calldata _memo, bool _preferUnstakedTickets) external payable;

Parameters

NameTypeDescription
_beneficiaryaddressThe address who will receive tickets from this fee.
_memostringA memo that will be included in the published event.
_preferUnstakedTicketsboolWhether ERC20's should be claimed automatically if they have been issued.

transferProjectOwnership

Transfer the ownership of the project to a new owner.

This contract will no longer be able to reconfigure or tap funds from this project.

function transferProjectOwnership(IProjects _projects, address _newOwner, uint256 _projectId, bytes calldata _data)
external
onlyOwner;

Parameters

NameTypeDescription
_projectsIProjectsThe projects contract.
_newOwneraddressThe new project owner.
_projectIduint256The ID of the project to transfer ownership of.
_databytesArbitrary data to include in the transaction.

onERC721Received

Allows this contract to receive a project.

function onERC721Received(address, address, uint256, bytes calldata) public pure override returns (bytes4);

setOperator

function setOperator(
IOperatorStore _operatorStore,
address _operator,
uint256 _projectId,
uint256[] calldata _permissionIndexes
) external onlyOwner;

setOperators

function setOperators(
IOperatorStore _operatorStore,
address[] calldata _operators,
uint256[] calldata _projectIds,
uint256[][] calldata _permissionIndexes
) external onlyOwner;

_takeFee

Take a fee for this project from this contract.

function _takeFee(uint256 _amount, address _beneficiary, string memory _memo, bool _preferUnstakedTickets) internal;

Parameters

NameTypeDescription
_amountuint256The payment amount.
_beneficiaryaddressThe address who will receive tickets from this fee.
_memostringA memo that will be included in the published event.
_preferUnstakedTicketsboolWhether ERC20's should be claimed automatically if they have been issued.