hashlips / example_nft_minter Goto Github PK
View Code? Open in Web Editor NEWUse this repo to see how to create a Dapp that can mint NFTs.
License: MIT License
Use this repo to see how to create a Dapp that can mint NFTs.
License: MIT License
Hey, i want to mint 10.000 NFTs in at once, but if i mint more than 169 NFTs, remix ethereum say me when i mint more than 169 in the function after the deploy of the contract :
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error. { "code": -32000, "message": "execution reverted" }
And when i want to deploy my contract with more than 169 NFTs with 800000000 gas limit the error code is :
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error. { "code": -32000, "message": "gas required exceeds allowance (20019530)" }
I am on the Matic test network (Mumbai) and my smart contract is :
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
`// SPDX-License-Identifier: GPL-3.0
// Created by HashLips
// The Nerdy Coder Clones
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract NerdyCoderClones is ERC721Enumerable, Ownable {
using Strings for uint256;
string public baseURI;
string public baseExtension = ".json";
uint256 public cost = 0.01 ether;
uint256 public maxSupply = 10000;
uint256 public maxMintAmount = 10000;
bool public paused = false;
mapping(address => bool) public whitelisted;
constructor(
string memory _name,
string memory _symbol,
string memory _initBaseURI
) ERC721(_name, _symbol) {
setBaseURI(_initBaseURI);
mint(msg.sender, 500);
}
// internal
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
// public
function mint(address _to, uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
if (msg.sender != owner()) {
if(whitelisted[msg.sender] != true) {
require(msg.value >= cost * _mintAmount);
}
}
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(_to, supply + i);
}
}
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256;
for (uint256 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIds;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension))
: "";
}
//only owner
function setCost(uint256 _newCost) public onlyOwner {
cost = _newCost;
}
function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner {
maxMintAmount = _newmaxMintAmount;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function setBaseExtension(string memory _newBaseExtension) public onlyOwner {
baseExtension = _newBaseExtension;
}
function pause(bool _state) public onlyOwner {
paused = _state;
}
function whitelistUser(address _user) public onlyOwner {
whitelisted[_user] = true;
}
function removeWhitelistUser(address _user) public onlyOwner {
whitelisted[_user] = false;
}
function withdraw() public payable onlyOwner {
require(payable(msg.sender).send(address(this).balance));
}
`}``
Hello. I Hope this message finds you well. I am struggling to replace the main image with another one of my own, can someone explain to me how is it done? Thank you so much in advance!
Can you do a same solidity Remix for Polygon blockchain or a read me file to transfer it to that network
2 days ago I could take the this smart contract and deploy it on Remix and was able to mint from both the owners address and other wallets. Last night I started to get an error that would not let any wallets, other then the owners, use the mint function. It seems that everything fails unless line 46 (in SmartContract.sol) is disabled. Anyone else having this issue? It seems like msg.value is passing as empty (or 0), therefor the transaction fails on line 46.
I was able to deploy the contract to Rinkeby then verify the contract on etherscan and use the mint function that because Payable the payableAmount field and if filled out correctly the mint from the non-owner wallet works.
New to Solidity so a bit stuck, any thoughts ?
what is the send wallet here for the eth network?
.send({
gasLimit: "285000",
to: "0x827acb09a2dc20e39c9aad7f7190d9bc53534192",
from: blockchain.account,
I replaced your settings to make it work for me but im getting an error and it keeps sending to my buying wallet which is not in this app.js file.
0xf66f2872c726a8198d6a2a7d07acba0215571c2284f8b0a7cb45e1ca0b935b88
its suppose to send to another wallet not same wallet buying.
is there more info on custom setup for your great site?
I have my test site live here to see - www.jonlittlenfts.com
My metamask is connected with Matic Mainnet (also I tried on Testnet), but its giving message "Change Network to Polygon"
Screenshot - https://prnt.sc/1stu8co
After compiling NFT_TOKEN.sol i got the above error.
Errors:
Source "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol" not found: File import callback not supported
Source "@openzeppelin/contracts/access/Ownable.sol" not found: File import callback not supported
Expected identifier, got 'LParen'
Hi guys,
Does anyone know what changes are required to change the buy button section to allow the user to buy more than one nft at a time? The current set-up only allows 1 nft to be purchased per transaction
Thanks in advance
We'll I definitely screwed up somewhere.... After I created the contract and the first 20 nfts were minted they were in my opensea account. However, no pictures came through and the left side nft data wasn't there.
Before I started down this road I did create a collection on Opensea with the same name of my collection I just minted. Opensea however created a new collection with "v2" after my name with my freshly minted nfts. Could this be my problem?
Just launched my dapp, it allows to connect and functions perfectly until you go to buy an NFT. Once you initiate a purchase it says it is minting your NFT but the button just stays Busy. I used pinata to host the nfts, could that be the issue? If so should I switch them to my website server?
Thank you for any help, it is greatly appreciated!
I changed the networkId to 1 for ethereum main met instead of polygon but it gives me an error after connecting to metamask. Any ideas?
when I use yarn start I get this error:
warning package.json: No license field error Command "start" not found.
Hello,
is there a way to set the cost to be in polygon wrapped ethereum instead of matic?
thank you
Is there a way to make the metamask connection be active on refresh? Every time, the user needs to press the connect button, even if the website is not closed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.