// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;






// 
// ██████╗ ██╗      █████╗  ██████╗██╗  ██╗███╗   ███╗ ██████╗ ███╗   ██╗███████╗████████╗███████╗██████╗     ██████╗  █████╗ ██████╗ ██╗███████╗███████╗
// ██╔══██╗██║     ██╔══██╗██╔════╝██║ ██╔╝████╗ ████║██╔═══██╗████╗  ██║██╔════╝╚══██╔══╝██╔════╝██╔══██╗    ██╔══██╗██╔══██╗██╔══██╗██║██╔════╝██╔════╝
// ██████╔╝██║     ███████║██║     █████╔╝ ██╔████╔██║██║   ██║██╔██╗ ██║███████╗   ██║   █████╗  ██████╔╝    ██████╔╝███████║██████╔╝██║█████╗  ███████╗
// ██╔══██╗██║     ██╔══██║██║     ██╔═██╗ ██║╚██╔╝██║██║   ██║██║╚██╗██║╚════██║   ██║   ██╔══╝  ██╔══██╗    ██╔══██╗██╔══██║██╔══██╗██║██╔══╝  ╚════██║
// ██████╔╝███████╗██║  ██║╚██████╗██║  ██╗██║ ╚═╝ ██║╚██████╔╝██║ ╚████║███████║   ██║   ███████╗██║  ██║    ██████╔╝██║  ██║██████╔╝██║███████╗███████║
// ╚═════╝ ╚══════╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝╚═╝     ╚═╝ ╚═════╝ ╚═╝  ╚═══╝╚══════╝   ╚═╝   ╚══════╝╚═╝  ╚═╝    ╚═════╝ ╚═╝  ╚═╝╚═════╝ ╚═╝╚══════╝╚══════╝
//                                                                                                                                                       
// Blackmonster Babies - generated with HeyMint.xyz Launchpad - https://nft-launchpad.heymint.xyz
// 








import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol";
import {IAddressRelay} from "./interfaces/IAddressRelay.sol";
import {BaseConfig} from "./libraries/HeyMintStorage.sol";

contract BlackmonsterBabies {
    bytes32 internal constant _IMPLEMENTATION_SLOT =
        0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
    bytes32 internal constant _ADDRESS_RELAY_SLOT =
        keccak256("heymint.launchpad.addressRelay");

    /**
     * @notice Initializes the child contract with the base implementation address and the configuration settings
     * @param _name The name of the NFT
     * @param _symbol The symbol of the NFT
     * @param _baseConfig Base configuration settings
     */
    constructor(
        string memory _name,
        string memory _symbol,
        address _addressRelay,
        address _implementation,
        BaseConfig memory _baseConfig
    ) {
        StorageSlot
            .getAddressSlot(_IMPLEMENTATION_SLOT)
            .value = _implementation;
        StorageSlot.getAddressSlot(_ADDRESS_RELAY_SLOT).value = _addressRelay;
        IAddressRelay addressRelay = IAddressRelay(
            StorageSlot.getAddressSlot(_ADDRESS_RELAY_SLOT).value
        );
        address implContract = addressRelay.fallbackImplAddress();
        (bool success, ) = implContract.delegatecall(
            abi.encodeWithSelector(0x35a825b0, _name, _symbol, _baseConfig)
        );
        require(success);
    }

    /**
     * @dev Delegates the current call to nftImplementation
     *
     * This function does not return to its internal call site - it will return directly to the external caller.
     */
    fallback() external payable {
        IAddressRelay addressRelay = IAddressRelay(
            StorageSlot.getAddressSlot(_ADDRESS_RELAY_SLOT).value
        );
        address implContract = addressRelay.getImplAddress(msg.sig);

        assembly {
            calldatacopy(0, 0, calldatasize())
            let result := delegatecall(
                gas(),
                implContract,
                0,
                calldatasize(),
                0,
                0
            )
            returndatacopy(0, 0, returndatasize())
            switch result
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    receive() external payable {}
}
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_addressRelay","type":"address"},{"internalType":"address","name":"_implementation","type":"address"},{"components":[{"internalType":"bool","name":"publicSaleActive","type":"bool"},{"internalType":"bool","name":"usePublicSaleTimes","type":"bool"},{"internalType":"bool","name":"presaleActive","type":"bool"},{"internalType":"bool","name":"usePresaleTimes","type":"bool"},{"internalType":"bool","name":"soulbindingActive","type":"bool"},{"internalType":"bool","name":"randomHashActive","type":"bool"},{"internalType":"bool","name":"enforceRoyalties","type":"bool"},{"internalType":"bool","name":"heyMintFeeActive","type":"bool"},{"internalType":"uint8","name":"publicMintsAllowedPerAddress","type":"uint8"},{"internalType":"uint8","name":"presaleMintsAllowedPerAddress","type":"uint8"},{"internalType":"uint8","name":"publicMintsAllowedPerTransaction","type":"uint8"},{"internalType":"uint8","name":"presaleMintsAllowedPerTransaction","type":"uint8"},{"internalType":"uint16","name":"maxSupply","type":"uint16"},{"internalType":"uint16","name":"presaleMaxSupply","type":"uint16"},{"internalType":"uint16","name":"royaltyBps","type":"uint16"},{"internalType":"uint32","name":"publicPrice","type":"uint32"},{"internalType":"uint32","name":"presalePrice","type":"uint32"},{"internalType":"uint24","name":"projectId","type":"uint24"},{"internalType":"string","name":"uriBase","type":"string"},{"internalType":"address","name":"presaleSignerAddress","type":"address"},{"internalType":"uint32","name":"publicSaleStartTime","type":"uint32"},{"internalType":"uint32","name":"publicSaleEndTime","type":"uint32"},{"internalType":"uint32","name":"presaleStartTime","type":"uint32"},{"internalType":"uint32","name":"presaleEndTime","type":"uint32"},{"internalType":"uint32","name":"fundingEndsAt","type":"uint32"},{"internalType":"uint32","name":"fundingTarget","type":"uint32"}],"internalType":"struct BaseConfig","name":"_baseConfig","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}]