Ceux-ci sont les NFTs les plus Justes
https://youtu.be/rygoKOO8lao
전위 드 초보자
Pour ce video tu auras besoin de Metamask ou n'importe quel wallet compatible avec l'EVM et aussi du GoerliETH que tu peux trouver gratuitement en un faucet .
르 콘트라 인텔리전트
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
contract MyWhitelistNFT is ERC721Enumerable, Ownable {
uint256 public price = 0.01 ether;
uint256 public constant MAX_SUPPLY = 10000;
string public baseTokenURI = "https://baseurl.com/";
bool public saleActive = false;
mapping (address => uint256) public whitelistReserved;
constructor () ERC721 ("My MNFT", "MNFT") {
}
// Overide functions
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
// Public functions
function mintToken(uint256 _amount) public payable {
uint256 supply = totalSupply();
require( supply + _amount <= MAX_SUPPLY, "Can't mint more than max supply" );
require( msg.value == price * _amount, "Wrong amount of ETH sent" );
if(!saleActive)
{
uint256 reservedAmt = whitelistReserved[msg.sender];
require(reservedAmt > 0 && _amount <= reservedAmt, "Sale isn't active and you are not whitelisted" );
whitelistReserved[msg.sender] = reservedAmt - _amount;
}
for(uint256 i; i < _amount; i++){
_safeMint( msg.sender, supply + i );
}
}
// Admin functions
function editWhitelistReserved(address[] memory _a, uint256[] memory _amount) public onlyOwner {
for(uint256 i; i < _a.length; i++){
whitelistReserved[_a[i]] = _amount[i];
}
}
function setSaleActive(bool val) public onlyOwner {
saleActive = val;
}
function setBaseURI(string memory baseURI) public onlyOwner {
baseTokenURI = baseURI;
}
function withdraw() public payable onlyOwner {
(bool sent, bytes memory data) = owner().call{value: address(this).balance}("");
data;
require(sent, "Failed to send Ether");
}
}
¡ Merci pour voir ce 비디오!
Suivez nous ici en dev.to et en pour ce qui a à voir avec Blockchain en Francais.
Reference
이 문제에 관하여(Ceux-ci sont les NFTs les plus Justes), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/turupawn/ceux-ci-sont-les-nfts-les-plus-justes-1lj텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)