CRYPTO NEWS

Contributors piling into Bitcoin, Ethereum, and Solana since 2018: Report

The Ethereum network continues to see the largest number of monthly-active contributors at around 2,000 as of July.

Mint NFT through React frontend

I need advice on how to structure my contract. I will have 3 types of NFTs with a limited supply for each, that will be available for purchase through the website. I’m using the ERC21 contract and this is what my mint function looks like: function mint(uint256 index, address to) external whenNotPaused returns (uint256) {::Listen

I need advice on how to structure my contract. I will have 3 types of NFTs with a limited supply for each, that will be available for purchase through the website. I’m using the ERC21 contract and this is what my mint function looks like:

function mint(uint256 index, address to)         external         whenNotPaused         returns (uint256)     {         if (index == 0) {             uint256 totalMinted = _tokenIdTypeOneCounter.current();             require(                 totalMinted <= NFTTypes[index].maxSupply,                 "All NFTs are minted!"             );              _tokenIdTypeOneCounter.increment();              uint256 tokenID = _tokenIdTypeOneCounter.current();              TokenTypes[tokenID] = index;             _safeMint(to, tokenID);              return tokenID;         }          if (index == 1) {             uint256 totalMinted = _tokenIdTypeTwoCounter.current();             require(                 totalMinted <= NFTTypes[index].maxSupply,                 "All NFTs are minted!"             );              _tokenIdTypeOneCounter.increment();              uint256 tokenID = _tokenIdTypeTwoCounter.current();              TokenTypes[tokenID] = index;             _safeMint(to, tokenID);              return tokenID;         }          if (index == 2) {             uint256 totalMinted = _tokenIdTypeThreeCounter.current();             require(                 totalMinted <= NFTTypes[index].maxSupply,                 "All NFTs are minted!"             );              _tokenIdTypeOneCounter.increment();              uint256 tokenID = _tokenIdTypeThreeCounter.current();              TokenTypes[tokenID] = index;             _safeMint(to, tokenID);              return tokenID;         }          return 0;     } 

Now the question is how do I set my price for each NFT? The price would be dynamic and I will use ponder value for each NFT depending on the current price of the token on the market. I can pull the token price on the front end using the API from chainlink. Do I make the payment using the front end and then when is successful I mint the NFT or do I set the price directly in the smart contract somehow, but the issue is the price should be dynamic and pulled using API?

Contributors piling into Bitcoin, Ethereum, and Solana since 2018: Report

Shopping cart
There are no products in the cart!
Continue shopping
0