CryptoFly.us | CRYPTOCURRENCY BITCOIN SHIRTS CLOTHING APPAREL HATS

CRYPTO NEWS

How blockchain technology can pave the way to a new future, explained

Mass adoption of privacy-preserving computation might become a significant improvement for blockchain.

in case we will mint all NFTs, did we still need add set price and withdrew function in solidity contract

greeting the next code is solidity contract code. it continue three functions. 1- one, take svg image and encode it to base64 to produce ‘image uri’. 2- second one, take the ‘image uri’ and add to it some string then encode the result to base64 for second time. 3- third and last one, call two::Listen

greeting

the next code is solidity contract code. it continue three functions.

1- one, take svg image and encode it to base64 to produce ‘image uri’.

2- second one, take the ‘image uri’ and add to it some string then encode the result to base64 for second time.

3- third and last one, call two last function then mint the NFTs.

Q1- so if am the only one who will use this contract to mint new NFTs, did i need to set set price and withdrew function?

Q2- also is there’s some security problem or any other functions that i should add them?

Q3- just in case. most of time hear about using random numbers in create NFTs as another layer of security (of course plus create random NFTs). this code can do what required from any need to use random numbers, is it secure?

thanks in advance

// SPDX-License-Identifier: MIT pragma solidity 0.8.0;  import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "base64-sol/base64.sol";  contract SVGNFT is ERC721URIStorage, Ownable {     uint256 public tokenCounter;     event CreatedSVGNFT(uint256 indexed tokenId, string tokenURI);      constructor() ERC721("SVG NFT", "svgNFT")     {         tokenCounter = 0;     }      function create(string memory svg) public {         _safeMint(msg.sender, tokenCounter);         string memory imageURI = svgToImageURI(svg);         _setTokenURI(tokenCounter, formatTokenURI(imageURI));         tokenCounter = tokenCounter + 1;         emit CreatedSVGNFT(tokenCounter, svg);     }      function svgToImageURI(string memory svg) private pure returns (string memory) {         string memory baseURL = "data:image/svg+xml;base64,";         string memory svgBase64Encoded = Base64.encode(bytes(string(abi.encodePacked(svg))));         return string(abi.encodePacked(baseURL,svgBase64Encoded));     }      function formatTokenURI(string memory imageURI) private pure returns (string memory) {         return string(                 abi.encodePacked(                     "data:application/json;base64,",                     Base64.encode(                         bytes(                             abi.encodePacked(                                 '{"name":"',                                 "SVG NFT",                                 '", "description":"An NFT based on SVG!", "attributes":"", "image":"',imageURI,'"}'                             )                         )                     )                 )             );     } } 

How blockchain technology can pave the way to a new future, explained

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