// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "contracts/SimpleGraveStone.sol";
import "contracts/GraveStoneAbstract.sol";

contract Airdrop is Ownable {
    function excuteGraveStoneLock(address contractAddress, address[] memory tos, uint256 expTime)public onlyOwner returns (bool){
        require(tos.length > 0);
        GraveStoneAbstract graveStoneAbstract = GraveStoneAbstract(contractAddress);
        
        for (uint i = 0; i < tos.length; i++) {
            graveStoneAbstract.safeMintWithLock(tos[i], expTime);
        }
        return true;
    }

    function excuteGraveStone(address contractAddress, address[] memory tos)public onlyOwner returns (bool){
        require(tos.length > 0);
        GraveStoneAbstract graveStoneAbstract = GraveStoneAbstract(contractAddress);
        
        for (uint i = 0; i < tos.length; i++) {
            graveStoneAbstract.safeMint(tos[i]);
        }
        return true;
    }

    function excuteToken(address from, address contractAddress, address[] memory tos, uint256 amount) public returns (bool) {
        require(tos.length > 0);
        ERC20 erc20 = ERC20(contractAddress);
        for (uint i = 0; i < tos.length; i++) {
            erc20.transferFrom(from,tos[i],amount);
        }
        return true;
    }
}
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"address[]","name":"tos","type":"address[]"}],"name":"excuteGraveStone","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"address[]","name":"tos","type":"address[]"},{"internalType":"uint256","name":"expTime","type":"uint256"}],"name":"excuteGraveStoneLock","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"address[]","name":"tos","type":"address[]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"excuteToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]