Dagora PowerPlus NFT Wizard

PowerPlusNFT

PowerPlusNFT is ERC721A contract that is ownable, has royalties, and a pre-sale.

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

Params

struct Params {
  string name_;
  string symbol_;
  string baseURI_;
  uint16 _bulkBuyLimit;
  uint16 _maxAllowListAmount;
  uint96 _royaltyBps;
  uint256 _mintPrice;
  uint256 _presaleMintCost;
  uint256 _maxSupply;
  address _royaltyRecipient;
  address _newOwner;
  bytes32 _merkleRoot;
}

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 paused.

default value is true, contract is paused on deployment.

preSaleActive

bool preSaleActive

Boolean to determine if the contract is in the pre-sale period.

default value is true, contract is in presale state on deployment.

merkleRoot

bytes32 merkleRoot

The merkle root for the allowList.

bulkBuyLimit

uint16 bulkBuyLimit

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

maxAllowListAmount

uint16 maxAllowListAmount

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

this is used during the whitelist period.

mintPrice

uint256 mintPrice

The cost to mint a token.

presaleMintPrice

uint256 presaleMintPrice

The cost to mint a token during the presale period.

maxSupply

uint256 maxSupply

The maximum number of tokens that can be minted.

Minted

event Minted(address to, uint256 tokenId)

AllowListMinted

event AllowListMinted(address to, uint256 tokenId)

BaseURIChanged

event BaseURIChanged(string baseURI)

BaseExtensionChanged

event BaseExtensionChanged(string baseExtension)

MintCostChanged

event MintCostChanged(uint256 mintPrice)

presaleMintPriceChanged

event presaleMintPriceChanged(uint256 presaleMintPrice)

BulkBuyLimitChanged

event BulkBuyLimitChanged(uint16 bulkBuyLimit)

MaxAllowListAmountChanged

event MaxAllowListAmountChanged(uint16 maxAllowListAmount)

PausedToggled

event PausedToggled(bool paused)

PreSaleToggled

event PreSaleToggled(bool preSaleActive)

RoyaltysChanged

event RoyaltysChanged(address royaltyRecipient, uint96 royaltyBps)

allowListMintCount

mapping(address => uint256) allowListMintCount

Mapping to track the number of tokens minted for each address during presale.

constructor

constructor(struct PowerPlusNFT.Params _params) public

The constructor for the contract.

Parameters

NameTypeDescription

_params

struct PowerPlusNFT.Params

The struct containing the parameters for the contract.

isNotPaused

modifier isNotPaused()

Modifier to check if the contract is paused.

isValidMerkleProof

modifier isValidMerkleProof(bytes32[] merkleProof, bytes32 root)

Modifier to check the address is allowed to mint during the presale period.

check the proof provided against the root stored in the contract.

Parameters

NameTypeDescription

merkleProof

bytes32[]

The merkle proof for the address.

root

bytes32

The merkle root for the allowList.

isPublicSale

modifier isPublicSale()

a modifier to check if the contract is in the public sale period.

isPreSale

modifier isPreSale()

a modifier to check if the contract is in the presale period.

mintNFT

function mintNFT(address to, uint256 amount) public payable

Fcuntion to mint nfts.

this function is used during the public sale period.

Parameters

NameTypeDescription

to

address

amount

uint256

The number of tokens to mint.

presaleMintNFT

function presaleMintNFT(bytes32[] _proof, uint256 amount) public payable

Function to mint nfts during the presale period.

Parameters

NameTypeDescription

_proof

bytes32[]

The merkle proof for the address.

amount

uint256

The number of tokens to mint.

reserveTokens

function reserveTokens(uint256 amount) public

Function to mint nfts during the presale period.

this function is used to mint tokens for the team.

Parameters

NameTypeDescription

amount

uint256

The number of tokens to mint.

tokenURI

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

returns the token URI for a given token.

Parameters

NameTypeDescription

tokenId

uint256

The token ID.

togglePaused

function togglePaused() public

Function to toggle the paused state of the contract.

togglePresale

function togglePresale() public

OnlyOwner Function to toggle the presale state of the contract.

setBaseURI

function setBaseURI(string _base_URI) public

OnlyOwner Function to set the base URI for the token URIs.

Parameters

NameTypeDescription

_base_URI

string

The new base URI.

setBaseExtension

function setBaseExtension(string _baseExtension) public

OnlyOwner Function to set the base extension for the token URIs.

Parameters

NameTypeDescription

_baseExtension

string

The new base extension.

setMintPrice

function setMintPrice(uint256 _mintPrice) public

OnlyOwner Function to set the mint cost during the public sale period.

this function is used to set the mint cost during the public sale period.

Parameters

NameTypeDescription

_mintPrice

uint256

The new mint cost during the public sale period.

setPresaleMintPrice

function setPresaleMintPrice(uint256 _presaleMintPrice) public

OnlyOwner Function to set the mint cost during the presale period.

Parameters

NameTypeDescription

_presaleMintPrice

uint256

The new mint cost during the presale period.

setBulkBuyLimit

function setBulkBuyLimit(uint16 _bulkBuyLimit) public

OnlyOwner Function to set the bulk buy limit per transaction, during the public sale period.

Parameters

NameTypeDescription

_bulkBuyLimit

uint16

The new bulk buy limit.

setMaxAllowListAmount

function setMaxAllowListAmount(uint16 _amount) public

OnlyOwner Function to set the max allow list amount per address, during the presale period.

Parameters

NameTypeDescription

_amount

uint16

The new max allow list amount per address.

setMerkleRoot

function setMerkleRoot(bytes32 _merkleRoot) public

OnlyOwner Function to set the merkle root for the presale.

this function is used to set the merkle root for the presale, this is used to verify the merkle proof and check if a address is included.

Parameters

NameTypeDescription

_merkleRoot

bytes32

The new merkle root.

setRoyalties

function setRoyalties(address _royaltyRecipient, uint96 _royaltyBps) public

Function to set the royalties for the contract.

Parameters

NameTypeDescription

_royaltyRecipient

address

The new royalty recipient.

_royaltyBps

uint96

The new royalty bps, denominated by 10000.

withdrawETH

function withdrawETH() public

OnlyOwner Function to withdraw ETH from the contract.

withdrawERC20

function withdrawERC20(address _tokenAddr) public

OnlyOwner function to withdraw ERC20 tokens from the contract.

Parameters

NameTypeDescription

_tokenAddr

address

The address of the ERC20 token to withdraw.

supportsInterface

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

_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