Skip to main content

JBNFTRewardDelegate

Delegate that offers project contributors NFTs upon payment.

Also can be used as a data source.

Code​

https://github.com/jbx-protocol/juice-nft-rewards/blob/main/contracts/abstract/JBNFTRewardDelegate.sol

Addresses​

Ethereum mainnet: Not yet deployed

Interfaces​

NameDescription
IJBNFTRewardDelegateGeneral interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.
IJBFundingCycleDataSourceAllows this contract to be attached to a funding cycle to have its methods called during regular protocol operations.
IJBPayDelegateAllows this contract to receive callbacks when a project receives a payment.

Inheritance​

ContractDescription
JBOperatableIncludes convenience functionality for checking a message sender's permissions before executing certain transactions.
ERC721VotesA checkpointable standard definition for non-fungible tokens (NFTs).
OwnableIncludes convenience functionality for specifying an address that owns the contract, with modifiers that only allow access by the owner.

Constructor​

/**
@param _projectId The ID of the project for which this NFT should be minted in response to payments made.
@param _directory The directory of terminals and controllers for projects.
@param _name The name of the token.
@param _symbol The symbol that the token should be represented by.
@param _tokenUriResolver A contract responsible for resolving the token URI for each token ID.
@param _baseUri The token's base URI, to be used if a URI resolver is not provided.
@param _contractUri A URI where contract metadata can be found.
@param __expectedCaller The address that should be calling the data source.
@param _owner The address that will own this contract.
*/
constructor(
uint256 _projectId,
IJBDirectory _directory,
string memory _name,
string memory _symbol,
IJBTokenUriResolver _tokenUriResolver,
string memory _baseUri,
string memory _contractUri,
address __expectedCaller,
address _owner
) ERC721Rari(_name, _symbol) {
projectId = _projectId;
directory = _directory;
baseUri = _baseUri;
tokenUriResolver = _tokenUriResolver;
contractUri = _contractUri;
_expectedCaller = __expectedCaller;

// Transfer the ownership to the specified address.
if (_owner != address(0)) _transferOwnership(_owner);
}
  • _projectId is the ID of the project for which this NFT should be minted in response to payments made.
  • _directory is the directory of terminals and controllers for projects.
  • _name is the name of the token.
  • _symbol is the symbol that the token should be represented by.
  • _tokenUriResolver is a contract responsible for resolving the token URI for each token ID.
  • _baseUri is the token's base URI, to be used if a URI resolver is not provided.
  • _contractUri is a URI where contract metadata can be found.
  • __expectedCaller is the address that should be calling the data source.
  • _owner is the address that will own this contract.

Events​

NameData
SetContractUri
  • string indexed contractUri
  • address caller
SetBaseUri
  • string indexed baseUri
  • address caller
SetTokenUriResolver
  • IToken721UriResolver indexed _newResolver
  • address caller

Properties​

FunctionDefinition
projectId

Traits

  • immutable

Returns

  • uint256
directory

Traits

  • immutable

Returns

baseUri

Traits

  • immutable

Returns

  • string memory
contractUri

Traits

  • immutable

Returns

  • string memory
tokenUriResolver

Traits

  • immutable

Returns

Read​

FunctionDefinition
payParams

Params

Returns

redeemParams

Params

Returns

supportsInterface

Params

  • bytes4 _interfaceId

Returns

  • bool
tokenURI

Params

  • uint256 _tokenId

Returns

  • string memory

Write​

FunctionDefinition
didPay

Params

setContractUri

Params

  • string calldata _contractMetadataUri
setTokenUriResolver

Params

setBaseUri

Params

  • string calldata _baseUri