contract MetagochiEggMinter is Ownable{
    using SafeMath for uint256;

    modifier onlyClevel() {
        require(msg.sender == walletA || msg.sender == walletB || msg.sender == owner());
    _;
    }

    address walletA;
    address walletB;
    uint256 walletBPercentage = 10;

    IERC20 public founderToken;
    IMetaGochiEgg public founderPack;
    IMetaGochiEgg public normalPack;
    uint256 public minimumFounderAmount = 15000000000000*10**9;  // founder token has 9 decimals!!

    uint256 public mintAmountToPrice = 0.05 ether;

    constructor() {
        walletA = payable(0x352b858FFE3584238870478A53d7cd2339363A3b);
        walletB = payable(0x5FFeB4E72401143BcEC5aDC543EcC5fd388d2A88);
        founderToken = IERC20(0xC1a85Faa09c7f7247899F155439c5488B43E8429);

        founderPack = IMetaGochiEgg(0x7F1cf2796D7C33B8f5AcBB02c7FFfab51F7A3D36);
        normalPack = IMetaGochiEgg(0x90749BcAE7bDeE78fD7b8829aeAc855c32A56376);
    }

    function mint_pack(uint256 _amount) public payable {
        require(msg.value>0 && msg.value == mintAmountToPrice.mul(_amount) , "Invalid value.");
        require(_amount < 50, "Invalid value.");

        bool founder = founderToken.balanceOf(msg.sender)>=minimumFounderAmount;

        if (founder){
            // mint founder
            founderPack.mint(msg.sender, _amount);
        }else{
            // mint normal
            normalPack.mint(msg.sender, _amount);
        }
    }

    // admin and clevel functions
    function setMinimumFounderTokenAmount(uint256 _amount) public onlyOwner {
             minimumFounderAmount = _amount;
    }

    function getMinimumFounderTokenAmount() public view returns(uint256) {
             return minimumFounderAmount;
    }

    function setMintPrice(uint256 _price) public onlyOwner {
             mintAmountToPrice =_price;
    }

    function getMintPrice() public view returns (uint256) {
        return mintAmountToPrice ;
    }

    function withdraw_all() public onlyClevel {
        require (address(this).balance > 0);
        uint256 amountB = SafeMath.div(address(this).balance,100).mul(walletBPercentage);
        uint256 amountA = address(this).balance.sub(amountB);
        payable(walletA).transfer(amountA);
        payable(walletB).transfer(amountB);
    }

    function setWalletA(address _walletA) public {
        require (msg.sender == walletA, "Who are you?");
        require (_walletA != address(0x0), "Invalid wallet");
        walletA = _walletA;
    }

    function setWalletB(address _walletB) public {
        require (msg.sender == walletB, "Who are you?");
        require (_walletB != address(0x0), "Invalid wallet.");
        walletB = _walletB;
    }

    function setWalletBPercentage(uint256 _percentage) public onlyOwner{
        require (_percentage>walletBPercentage && _percentage<=100, "Invalid new slice.");
        walletBPercentage = _percentage;
    }

}
function setMinimumFounderTokenAmount(uint256 _amount) public onlyOwner {
             minimumFounderAmount = _amount;
    }
// admin and clevel functions