arrow-left

All pages
gitbookPowered by GitBook
1 of 4

Loading...

Loading...

Loading...

Loading...

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.

Definition

function createFor(address _owner, SNWProjectMetadata calldata _metadata)
external
override
returns (uint256 projectId) { ... }

Arguments:

owner is the address that will be the owner of the project.

metadata is a struct containing metadata content about the project, and domain within which the metadata applies. The function can be accessed externally by anyone. The function overrides a function definition from the ISNWProjects interface. The function returns the token ID of the newly created project.

setTokenUriResolver

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

Definition

function setTokenUriResolver(ISNWTokenUriResolver _newResolver) external override onlyOwner { ... }

Arguments:

  • _newResolver is the address of the new resolver.

Through the onlyOwner modifier, this function can only be accessed by the address that owns this contract.

The function overrides a function definition from the ISNWProjects interface. The function doesn't return anything.

Body

Internal references:

  • tokenUriResolver

Emit a SetTokenUriResolver event with the relevant parameters.

Event references:

  • SetTokenUriResolver

/// Store the new resolver.
tokenUriResolver = _newResolver;
emit SetTokenUriResolver(_newResolver, msg.sender);

Write

setMetadataOf

Allows a project owner to set the project's metadata content for a particular domain namespace.

Only a project's owner or operator can set its metadata.

Applications can use the domain namespace as they wish.

Definition

function setMetadataOf(uint256 _projectId, SNWProjectMetadata calldata _metadata)
  external
  override
  requirePermission(ownerOf(_projectId), _projectId, SNOWperations.SET_METADATA) { ... }

Arguments:

  • _projectId is the ID of the project whose metadata is being changed.

  • _metadata is the struct containing metadata content, and domain within which the metadata applies.

Through the requirePermission modifier, the function is only accessible by the project's owner, or from an operator that has been given the SNWOperations.SET_METADATA permission by the project owner for the provided _projectId.

The function overrides a function definition from the ISNWProjects interface. The function doesn't return anything.

Body

Internal references:

  • metadataContentOf

Emit a SetMetadataCid event with the relevant parameters.

Event references:

  • SetMetadata

// Store the project's new metadata content within the specified domain.
metadataContentOf[_projectId][_metadata.domain] = _metadata.content;
emit SetMetadata(_projectId, _metadata, msg.sender);