Rubyscore_Achievement

An ERC1155 token contract for minting and managing achievements with URI support. Rubyscore_Achievement can be minted by users with the MINTER_ROLE after proper authorization.

OPERATOR_ROLE

bytes32 OPERATOR_ROLE

MINTER_ROLE

bytes32 MINTER_ROLE

NAME

string NAME

VERSION

string VERSION

BLAST(Optional. Used for Blast network)

IBlast BLAST

name

string name

Get token name.

symbol

string symbol

Get token symbol.

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

See {IRubyscore_Achievement}

uri

function uri(uint256 tokenId) public view returns (string)

See {IRubyscore_Achievement}

getTransferStatus

function getTransferStatus(uint256 tokenId) external view returns (bool)

See {IRubyscore_Achievement}

getPrice

function getPrice() external view returns (uint256)

See {IRubyscore_Achievement}

getUserNonce

function getUserNonce(address userAddress) external view returns (uint256)

See {IRubyscore_Achievement}

tokenURI

function tokenURI(uint256 tokenId) public view returns (string)

See {IRubyscore_Achievement}

constructor

constructor(address admin, address operator, address minter, string baseURI, string _name, string _symbol) public

Constructor for the Rubyscore_Achievement contract.

Initializes the contract with roles and settings. It sets the base URI for token metadata to the provided baseURI. It grants the DEFAULT_ADMIN_ROLE, OPERATOR_ROLE, and MINTER_ROLE to the specified addresses. It also initializes the contract with EIP712 support and ERC1155 functionality. And also configures the system for the Blast network.

Parameters

NameTypeDescription

admin

address

The address of the admin role, which has overall control.

operator

address

The address of the operator role, responsible for unlock tokens and set base URI.

minter

address

The address of the minter role, authorized to mint achievements and responsible for setting token URIs.

baseURI

string

The base URI for token metadata.

_name

string

_symbol

string

setTokenURI

function setTokenURI(uint256 tokenId, string newTokenURI) public

See {IRubyscore_Achievement}

setBatchTokenURI

function setBatchTokenURI(uint256[] tokenIds, string[] newTokenURIs) external

See {IRubyscore_Achievement}

setBaseURI

function setBaseURI(string newBaseURI) external

See {IRubyscore_Achievement}

setPrice

function setPrice(uint256 newPrice) external

See {IRubyscore_Achievement}

safeMin

function safeMint(struct IRubyscore_Achievement.MintParams mintParams, bytes operatorSignature) external payable

See {IRubyscore_Achievement}

setTransferUnlock

function setTransferUnlock(uint256 tokenId, bool lock) external

See {IRubyscore_Achievement}

withdraw

function withdraw() external

See {IRubyscore_Achievement}

_mint

function _mint(address to, uint256 id, bytes data) internal

See {IRubyscore_Achievement}

_mintBatch

function _mintBatch(address to, uint256[] ids, bytes data) internal

Internal function to safely mint multiple NFTs in a batch for a specified recipient.

This function checks if the recipient already owns any of the specified NFTs to prevent duplicates. It is intended for batch minting operations where multiple NFTs can be minted at once.

Parameters

NameTypeDescription

to

address

The address of the recipient to mint the NFTs for.

ids

uint256[]

An array of NFT IDs to mint.

data

bytes

Additional data to include in the minting transaction.

_beforeTokenTransfer

function _beforeTokenTransfer(address operator, address from, address to, uint256[] ids, uint256[] amounts, bytes data) internal

Internal function that is called before the transfer of tokens.

This function enforces transfer restrictions based on the 'transferUnlock' status of individual tokens. If a token has its transfer locked and the 'from' address is not zero (indicating a user-to-contract transfer), it will revert to prevent unauthorized transfers. It then delegates the transfer logic to the parent contracts 'ERC1155' and 'ERC1155Supply'.

Parameters

NameTypeDescription

operator

address

The address that initiates or approves the transfer.

from

address

The address from which the tokens are being transferred.

to

address

The address to which the tokens are being transferred.

ids

uint256[]

An array of token IDs to be transferred.

amounts

uint256[]

An array of token amounts corresponding to the IDs to be transferred.

data

bytes

Additional data to include in the transfer.

Last updated