Dagora PowerNFT Wizard

PowerNFT

PowerNFT is ERC721A contract that is ownable and has royalties.

This contract is used as a template for creating new NFT contracts.

baseURI

string baseURI

The base URI for all tokens.

baseExtension

string baseExtension

The file extension of the metadata can be set to nothing.

default value is json

royaltyRecipient

address royaltyRecipient

The address that will receive the royalties.

isPaused

bool isPaused

Boolean to determine if the contract is isPaused.

default value is true, contract is isPaused on deployment.

mintPrice

uint256 mintPrice

The cost to mint a token.

maxSupply

uint256 maxSupply

The maximum number of tokens that can be minted.

bulkBuyLimit

uint16 bulkBuyLimit

The maximum number of tokens that can be minted in a single transaction.

Minted

event Minted(address to, uint256 tokenId)

BaseURIChanged

event BaseURIChanged(string baseURI)

BaseExtensionChanged

event BaseExtensionChanged(string baseExtension)

MintCostChanged

event MintCostChanged(uint256 mintPrice)

BulkBuyLimitChanged

event BulkBuyLimitChanged(uint16 bulkBuyLimit)

PausedToggled

event PausedToggled(bool isPaused)

RoyaltysChanged

event RoyaltysChanged(address royaltyRecipient, uint96 royaltyBps)

constructor

constructor(string _name, string _symbol, string __baseURI, uint16 _bulkBuyLimit, uint96 _royaltyBps, uint256 _mintPrice, uint256 _maxTotalSupply, address _royaltyRecipient, address _newOwner) public

The constructor for the PowerNFT contract.

Parameters

NameTypeDescription

_name

string

The name of the NFT.

_symbol

string

The symbol of the NFT.

__baseURI

string

The base URI for the NFT.

_bulkBuyLimit

uint16

The maximum number of tokens that can be minted in a single transaction.

_royaltyBps

uint96

The royalty percentage, is denominated by 10000.

_mintPrice

uint256

The cost to mint a token.

_maxTotalSupply

uint256

The maximum number of tokens that can be minted.

_royaltyRecipient

address

The address that will receive the royalties.

_newOwner

address

The address that will be the owner of the contract.

isNotPaused

modifier isNotPaused()

Modifer to check if the contract is isPaused.

mintNFT

function mintNFT(address to, uint256 amount) public payable

Function to Mint nfts.

The amount of tokens to mint must be less than or equal to the bulk buy limit, and contract must not be isPaused.

Parameters

NameTypeDescription

to

address

amount

uint256

The number of tokens to mint.

reserveTokens

function reserveTokens(uint256 amount) public

Function to reserve nfts.

only the owner can call this function.

Parameters

NameTypeDescription

amount

uint256

The number of tokens to mint.

tokenURI

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

returns the Uri for a token.

The token must exist.

Parameters

NameTypeDescription

tokenId

uint256

The id of the token.

setBaseURI

function setBaseURI(string __baseURI) public

OnlyOwner function to set the baseURI.

only the owner can call this function.

Parameters

NameTypeDescription

__baseURI

string

The base URI for the NFT.

setBaseExtension

function setBaseExtension(string _baseExtension) public

OnlyOwner function to set the baseExstension.

only the owner can call this function.

Parameters

NameTypeDescription

_baseExtension

string

The file extension of the metadata can be set to nothing.

setMintPrice

function setMintPrice(uint256 _mintPrice) public

OnlyOwner function to set the mint cost of a nft.

only the owner can call this function.

Parameters

NameTypeDescription

_mintPrice

uint256

The cost to mint a token.

setBulkBuyLimit

function setBulkBuyLimit(uint16 _bulkBuyLimit) public

OnlyOwner function to set the bulk buy limit.

only the owner can call this function.

Parameters

NameTypeDescription

_bulkBuyLimit

uint16

The maximum number of tokens that can be minted in a single transaction.

togglePaused

function togglePaused() public

OnlyOwner function to toggle the isPaused state of the contract.

only the owner can call this function.

setRoyalties

function setRoyalties(address _royaltyRecipient, uint96 _royaltyBps) public

OnlyOwner function to set the royalties.

only the owner can call this function.

Parameters

NameTypeDescription

_royaltyRecipient

address

The address that will receive the royalties.

_royaltyBps

uint96

The royalty percentage, is denominated by 10000.

supportsInterface

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

withdrawETH

function withdrawETH() public

OnlyOwner function to withdraw ETH.

only the owner can call this function. the owner can withdraw the ETH from the contract.

withdrawERC20

function withdrawERC20(address _tokenAddr) public

OnlyOwner function to withdraw ERC20 tokens.

only the owner can call this function.

Parameters

NameTypeDescription

_tokenAddr

address

The address of the ERC20 token.

_beforeTokenTransfers

function _beforeTokenTransfers(address from, address to, uint256 tokenId, uint256 quantity) internal

internal override function that is called before any token transfer.

this function will revert if the contract is paused, pausing transfers of tokens.

Parameters

NameTypeDescription

from

address

The address of the sender.

to

address

The address of the receiver.

tokenId

uint256

The token ID.

quantity

uint256

The quantity of tokens to transfer.

typeOf

function typeOf() public pure virtual returns (string)

function that returns the dagora contract type

Return Values

NameTypeDescription

[0]

string

the dagora contract type

version

function version() public pure returns (string)

function that returns the dagora contract version

Return Values

NameTypeDescription

[0]

string

the dagora contract version

_startTokenId

function _startTokenId() internal view virtual returns (uint256)

internal function that handles that starting tokenId of the collection

Return Values

NameTypeDescription

[0]

uint256

the starting tokenId of the collection eg 1

Last updated

Logo