跳到主要内容

JBProjects

Git Source

Inherits: ERC721, Ownable, IJBProjects

Stores project ownership and metadata.

Projects are represented as ERC-721s.

State Variables

count

The number of projects that have been created using this contract.

The count is incremented with each new project created.

The resulting ERC-721 token ID for each project is the newly incremented count value.

uint256 public override count;

tokenUriResolver

The contract resolving each project ID to its ERC721 URI.

IJBTokenUriResolver public override tokenUriResolver;

Functions

constructor

constructor(address owner, address feeProjectOwner) ERC721("Juicebox Projects", "JUICEBOX") Ownable(owner);

Parameters

NameTypeDescription
owneraddressThe owner of the contract who can set metadata.
feeProjectOwneraddressThe address that will receive the fee-project. If address(0) the fee-project will not be minted.

supportsInterface

Indicates whether this contract adheres to the specified interface.

See IERC165-supportsInterface.

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

Parameters

NameTypeDescription
interfaceIdbytes4The ID of the interface to check for adherence to.

Returns

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

tokenURI

Returns the URI where the ERC-721 standard JSON of a project is hosted.

function tokenURI(uint256 projectId) public view override returns (string memory);

Parameters

NameTypeDescription
projectIduint256The ID of the project to get a URI of.

Returns

NameTypeDescription
<none>stringThe token URI to use for the provided projectId.

setTokenUriResolver

Sets the address of the resolver used to retrieve the tokenURI of projects.

function setTokenUriResolver(IJBTokenUriResolver resolver) external override onlyOwner;

Parameters

NameTypeDescription
resolverIJBTokenUriResolverThe address of the new resolver.

createFor

Create a new project for the specified owner, which mints an NFT (ERC-721) into their wallet.

Anyone can create a project on an owner's behalf.

function createFor(address owner) public override returns (uint256 projectId);

Parameters

NameTypeDescription
owneraddressThe address that will be the owner of the project.

Returns

NameTypeDescription
projectIduint256The token ID of the newly created project.