Skip to content

Instantly share code, notes, and snippets.

@shobhitic
Last active March 17, 2024 20:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shobhitic/23fe001c784208a7f9706053ab7df192 to your computer and use it in GitHub Desktop.
Save shobhitic/23fe001c784208a7f9706053ab7df192 to your computer and use it in GitHub Desktop.
Generate BaseURI and bulk upload NFTs - https://www.youtube.com/watch?v=GU2ZHXbrt90
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
import "erc721a/contracts/ERC721A.sol";
contract BASENFT is ERC721A {
constructor() ERC721A("BASE URI NFT", "BUN") {}
function mint(uint256 quantity) external payable {
// `_mint`'s second argument now takes in a `quantity`, not a `tokenId`.
_mint(msg.sender, quantity);
}
function _baseURI() override internal view virtual returns (string memory) {
return "ipfs://bafybeifgxh2lo3jpx6xg2bl3wlnifgpahcdvmktl42jz7d7m7x7y6yap3i/";
}
}
var fs = require('fs');
for (var i = 0; i < 27; i++) {
var json = {}
json.name = "Token #" + i;
json.description = "This is the description for token #" + i;
json.image = "ipfs://CHANGE TO YOUR IMAGES CID/" + i + ".png";
fs.writeFileSync('' + i, JSON.stringify(json));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment