¡El código fuente de este contrato está verificado!
Metadatos del Contrato
Compilador
0.8.13+commit.abaa5c0e
Idioma
Solidity
Código Fuente del Contrato
Archivo 1 de 14: Address.sol
Código Fuente del Contrato
Archivo 2 de 14: Context.sol
Código Fuente del Contrato
Archivo 3 de 14: Counters.sol
Código Fuente del Contrato
Archivo 4 de 14: DayJobPunks.sol
// SPDX-License-Identifier: MITpragmasolidity ^0.8.9 <0.9.0;import"https://github.com/FrankNFT-labs/ERC721F/blob/v1.0.3/ERC721F.sol";
import"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.0/contracts/token/ERC721/IERC721.sol";
/**
* @title DayJob Punks contract
* @dev Extends ERC721F Non-Fungible Token Standard basic implementation.
* Optimized to no longer use ERC721Enumarable , but still provide a totalSupply() implementation.
* @author @FrankNFT.eth
*
*/contractDayJobPunksisERC721F{
uint256public tokenPrice =0.0165ether;
uint256publicconstant MAX_TOKENS =10000;
uint256public nextPunkIndexToAssign =0;
uint256public punksRemainingToAssign;
uintpublicconstant MAX_PURCHASE =26; // set 1 to high to avoid some gasuintpublicconstant MAX_RESERVE =26; // set 1 to high to avoid some gasboolpublic saleIsActive;
boolpublic freeClaimIsActive;
addressprivateconstant FRANK =0xF40Fd88ac59A206D009A07F8c09828a01e2ACC0d;
IERC721 privateconstant V1PUNKS = IERC721(0x282BDD42f4eb70e7A9D9F40c8fEA0825B7f68C5D);
eventpriceChange(address _by, uint256 price);
constructor() ERC721F("DayJobPunks", "PEA") {
setBaseTokenURI("ipfs://QmNSPEx1gqbnjJCU9NwrajwkM4AAHkd1U45kYBcVyt4KEq/");
_mint(FRANK, 0);
unchecked{
nextPunkIndexToAssign++;
punksRemainingToAssign=MAX_TOKENS-1;
}
}
/**
* Mint Tokens to a wallet.
*/functionairdrop(address to,uint numberOfTokens) publiconlyOwner{
require(nextPunkIndexToAssign + numberOfTokens <= MAX_TOKENS, "Reserve would exceed max supply of Tokens");
require(numberOfTokens < MAX_RESERVE, "Can only mint 25 tokens at a time");
for (uint i =0; i < numberOfTokens;) {
if(!_exists(nextPunkIndexToAssign)){
_safeMint(to, nextPunkIndexToAssign);
unchecked{
punksRemainingToAssign--;
}
}
unchecked{
nextPunkIndexToAssign++;
i++;
}
}
}
/**
* Mint Tokens to the owners reserve.
* Will deactivate the FREE is it was active.
*/functionreserveTokens() externalonlyOwner{
airdrop(owner(),MAX_RESERVE-1);
}
/**
* Pause sale if active, make active if paused
*/functionflipSaleState() externalonlyOwner{
saleIsActive =!saleIsActive;
if(saleIsActive){
freeClaimIsActive=false;
}
}
/**
* Pause FREE sale if active, make active if paused
*/functionflipClaimSaleState() externalonlyOwner{
freeClaimIsActive =!freeClaimIsActive;
}
/**
* Set price
*/functionsetPrice(uint256 price) externalonlyOwner{
tokenPrice = price;
emit priceChange(msg.sender, tokenPrice);
}
/**
* Mint your FREE punks here.
*/functiongetPunk(uint256 tokenId) external{
require(freeClaimIsActive,"Free claim NOT active");
require(!_exists(tokenId),"Token already minted");
require(V1PUNKS.ownerOf(tokenId)==msg.sender,"You need to own the V1");
_safeMint( msg.sender, tokenId );
unchecked{punksRemainingToAssign--;}
}
/**
* Owner claims.
*/functionownerClaim(address to, uint256 tokenId) externalonlyOwner{
require(!_exists(tokenId),"Token already minted");
require(tokenId<MAX_TOKENS,"Token nr too big");
_safeMint( to, tokenId );
unchecked{punksRemainingToAssign--;}
}
/*
* Helper method to reduce gas if a major block would get claimed.
*/functionmovePunkNextPunkIndex(uint256 tokenId) externalonlyOwner{
nextPunkIndexToAssign=tokenId;
}
/**
* Mint your tokens here.
*/functionmint(uint256 numberOfTokens) externalpayable{
require(saleIsActive,"Sale NOT active yet");
require(tokenPrice * numberOfTokens <=msg.value, "Ether value sent is not correct");
require(numberOfTokens !=0, "numberOfNfts cannot be 0");
require(numberOfTokens < MAX_PURCHASE, "Can only mint 25 tokens at a time");
require(numberOfTokens<=punksRemainingToAssign,"Purchase would exceed max supply of Tokens");
for(uint256 i; i < numberOfTokens && punksRemainingToAssign !=0;){
if(!_exists(nextPunkIndexToAssign) && nextPunkIndexToAssign < MAX_TOKENS){
_safeMint( msg.sender, nextPunkIndexToAssign );
unchecked{
punksRemainingToAssign--;
}
}elseif(totalSupply()<MAX_TOKENS && nextPunkIndexToAssign < MAX_TOKENS){
unchecked{numberOfTokens++;}
}
unchecked{
i++;
nextPunkIndexToAssign++;
}
}
}
functionexists(uint256 tokenId) externalviewreturns (bool){
return _exists(tokenId);
}
functionwithdraw() externalonlyOwner{
uint256 balance =address(this).balance;
require(balance >0, "Insufficent balance");
_withdraw(owner(), address(this).balance);
}
}