Solidity API
ERC721PresetL2
This module is supposed to be used in layer 2 (execution layer).
_totalMinted
uint256 _totalMinted
_baseTokenURI
string _baseTokenURI
_maxSupply
uint256 _maxSupply
_isPrivate
bool _isPrivate
_erc20Address
address _erc20Address
_price
uint256 _price
_totalAllowed
uint256 _totalAllowed
_allowlist
mapping(address => uint256) _allowlist
PAUSER_ROLE
bytes32 PAUSER_ROLE
Withdraw
event Withdraw(address from, address to, uint256 amount)
SetPrivacy
event SetPrivacy(bool isPrivate)
SetPrice
event SetPrice(address tokenAddress, uint256 price)
IncrementAllowedAmount
event IncrementAllowedAmount(address user, uint256 amount)
constructor
constructor(address bridgeAddress, string name, string symbol, string baseURI, uint256 maxSupply) public
setPrivacy
function setPrivacy(bool isPrivate) external
Enables/disables private sale.
Requirements:
- It must be called by only admin.
Emits a {SetPrivacy} event.
setPrice
function setPrice(address tokenAddress, uint256 price) external
Sets price for an NFT.
Requirements:
- It must be called by only admin.
- If {tokenAddress} is non-zero address, then {price} must be greater than 0.
Emits a {SetPrice} event.
Zero address is for native token case.
withdraw
function withdraw() external
Withdraws ERC20 tokens.
Requirements:
- It must be called by only admin.
Emits a {Withdraw} event.
incrementAllowedAmount
function incrementAllowedAmount(address[] addresses, uint256 amount) external
Increments allowed amount for minting.
Requirements:
- It must be called by only admin.
- Sum of allowed amounts must be less than or equal to {_maxSupply}.
mint
function mint(uint256 quantity) external payable
Mints tokens. If {_erc20Address} is non-zero address, then ERC20 token is accepted for price.
Requirements:
- If it's a private sale, sender must be in allowlist.
- If it's a private sale, after minting {balance} must not exceed allowed amount
- {quantity} must not be zero.
- {quantity} must not be more than the number of available tokens.
- {msg.value} must be zero if {_erc20address} is non-zero address.
- {msg.value} must be correct value if {_erc20address} is zero address.
burn
function burn(uint256 tokenId) external virtual
pause
function pause() external
unpause
function unpause() external
totalMinted
function totalMinted() external view returns (uint256)
totalAllowed
function totalAllowed() external view returns (uint256)
amountAllowed
function amountAllowed(address user) external view returns (uint256)
_beforeTokenTransfer
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual
_Hook that is called before any token transfer. This includes minting and burning.
Calling conditions:
- When
from
andto
are both non-zero,from
'stokenId
will be transferred toto
. - When
from
is zero,tokenId
will be minted forto
. - When
to
is zero,from
'stokenId
will be burned. from
andto
are never both zero.
To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]._
_baseURI
function _baseURI() internal view returns (string)
Base URI for computing {tokenURI}. If set, the resulting URI for each
token will be the concatenation of the baseURI
and the tokenId
. Empty
by default, can be overridden in child contracts.