// File: StoicFrens.sol



// SPDX-License-Identifier: MIT

// This smart contract was created to accomodate Buy-One-Get-One (BOGO) airdrops
// of FRENS with GABE WEIS for Stoics Holders.

pragma solidity ^0.8.17;

import "IERC721Receiver.sol";


interface IFrensToken {
  function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;
  function setApprovalForAll(address operator, bool _approved) external;
  function totalSupply() external view returns (uint256);
  function mintSeaDrop(address minter, uint256 quantity) external;
}

contract StoicFRENSClaimBOGO {

    IFrensToken public Frens;
    address constant DEPLOYER = 0x029E4C95c75Eb16Ef63ca4aACE870D0BF444d909;
    
    /**
     * @notice Deploy the token contract with its name, symbol,
     *         administrator, and allowed SeaDrop addresses.
     */
    constructor(address frens) {
        Frens = IFrensToken(frens);
    }

    function setApproval() public {
        // Just in case, set approval for deployer wallet to transfer Frens from this contract
        Frens.setApprovalForAll(DEPLOYER, true);
    }

    function mintBogos(uint qty) public {
      if(msg.sender != DEPLOYER){
        revert NotStoicsDeployer();
      }
      Frens.mintSeaDrop(address(this), qty);
    }

    function sendBogos(address recipient, uint[] calldata tokenIds) public {
      if(msg.sender != DEPLOYER){
        revert NotStoicsDeployer();
      }
      uint numTokens = tokenIds.length;

      for (uint i = 0; i < numTokens;) {
        // mint the Frens
        Frens.transferFrom(address(this), recipient, tokenIds[i]);
        unchecked { i++; }
      }
    }

    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4) {
      return IERC721Receiver.onERC721Received.selector;
    }

    error NotStoicsDeployer();

}
// File: IERC721Receiver.sol



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}