Skip to content
Verified contractPartialMIT

multiMint

Address0x0000419b4b6132e05dfbd89f65b165dfd6fa126f
Balance

0 ETH

 

Transactions

435

 

Compiler

solc 0.8.12

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.12+commit.f00d7308
Language
solidity
Optimization
Yes, 10,000,000 runs
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
23,894,278
Creation transaction
0x259408da6a…7c046e0bf4

.sol

// SPDX-License-Identifier: MIT
pragma solidity =0.8.12;

/**
 * @author @ylasgamers
 * @dev This contract for tricky pass max 1 mint per wallet opensea.io with mutiple deployed contract with custom owner & can withdraw nft.
*/

interface IERC721 {
    function balanceOf(address owner) external view returns (uint256);
    function safeTransferFrom(address from, address to, uint256 tokenId) external;
    function getMintStats(address minter) external view returns (uint256 minterNumMinted, uint256 currentTotalSupply, uint256 maxSupply);
}

struct PublicDrop {
    uint80 mintPrice; // 80/256 bits
    uint48 startTime; // 128/256 bits
    uint48 endTime; // 176/256 bits
    uint16 maxTotalMintableByWallet; // 224/256 bits
    uint16 feeBps; // 240/256 bits
    bool restrictFeeRecipients; // 248/256 bits
}

interface SeaDrop {
    function mintPublic(address nftContract, address feeRecipient, address minterIfNotPayer, uint256 quantity) external payable;
    function getPublicDrop(address nftContract) external view returns (PublicDrop memory);
}

contract Mint {
    SeaDrop private immutable mintdrop = SeaDrop(0x00005EA00Ac477B1030CE78506496e8C2dE24bf5);
    IERC721 private immutable nft;
    address public immutable owner;    // original user who will receive NFT(s)

    event NFTWithdrawn(uint256 tokenId, address to);

    // constructor is payable so factory can forward ETH for mint
    constructor(address customOwner, address nftaddress) payable {
        owner = customOwner;
        nft = IERC721(nftaddress);

        // Read previous total supply for this minter (address(this))
        // prevTotal is the total supply *before* the mint we are about to do.
        (, uint256 prevTotal, ) = nft.getMintStats(address(this));

        // forward ETH sent to constructor into the SeaDrop mint call
        mintdrop.mintPublic{value: msg.value}(nftaddress, 0x0000a26b00c1F0DF003000390027140000fAa719, address(this), 1);

        // Read stats after mint
        (, uint256 currentTotalSupply, ) = nft.getMintStats(address(this));

        // Ensure supply increased (i.e. mint happened)
        require(currentTotalSupply > prevTotal, "Mint failed or supply unchanged");

        // Compute tokenId. This assumes token IDs are sequential and the newest token's id equals the new total supply.
        // If the collection uses 1-based sequential token IDs, the minted tokenId = currentTotalSupply.
        // If the collection's tokenId scheme corresponds to prevTotal+1, you can also set tokenId = prevTotal + 1.
        uint256 tokenId = currentTotalSupply;

        // Sanity: ensure this contract indeed owns at least one token
        require(nft.balanceOf(address(this)) > 0, "Contract doesn't own any NFT after mint");

        // transfer to the configured owner (the original deployer)
        nft.safeTransferFrom(address(this), owner, tokenId);
        emit NFTWithdrawn(tokenId, owner);
    }
}

contract multiMint {
    SeaDrop private immutable mintdrop = SeaDrop(0x00005EA00Ac477B1030CE78506496e8C2dE24bf5);
    // store Mint instances by deployer => nftAddress => array of Mint contracts
    mapping(address => mapping(address => Mint[])) private _deployerToNftToMints;

    event MintDeployed(address indexed deployer, address indexed nftAddress, address mintContract);

    /// @notice Deploy `total` Mint contracts that mint from `nftaddress`.
    /// @dev Splits msg.value evenly across new Mint constructors. Requires msg.value % total == 0.
	function mintMulti(uint256 total, address nftaddress) external payable {
        require(total > 0, "total mint cannot 0");

        // Read price from SeaDrop (fixed)
        PublicDrop memory publicDrop = mintdrop.getPublicDrop(nftaddress);
        uint256 price = publicDrop.mintPrice;

        uint256 requiredCost = price * total;
        require(msg.value == requiredCost, "Incorrect ETH sent");

        uint256 costPerMint = (total > 0) ? msg.value / total : 0;

        for (uint256 i = 0; i < total; i++) {
            Mint iMint = new Mint{value: costPerMint}(msg.sender, nftaddress);
            _deployerToNftToMints[msg.sender][nftaddress].push(iMint);
            emit MintDeployed(msg.sender, nftaddress, address(iMint));
        }
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 10000000,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.