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
MINTER_ROLE
NAME
VERSION
BLAST(Optional. Used for Blast network)
name
Get token name.
symbol
Get token symbol.
supportsInterface
See {IRubyscore_Achievement}
uri
See {IRubyscore_Achievement}
getTransferStatus
See {IRubyscore_Achievement}
getPrice
See {IRubyscore_Achievement}
getUserNonce
See {IRubyscore_Achievement}
tokenURI
See {IRubyscore_Achievement}
constructor
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
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
See {IRubyscore_Achievement}
setBatchTokenURI
See {IRubyscore_Achievement}
setBaseURI
See {IRubyscore_Achievement}
setPrice
See {IRubyscore_Achievement}
safeMin
See {IRubyscore_Achievement}
setTransferUnlock
See {IRubyscore_Achievement}
withdraw
See {IRubyscore_Achievement}
_mint
See {IRubyscore_Achievement}
_mintBatch
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
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
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
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