contract PreOfm is ERC20("Pre Ocean Floor Music", "Pre$OFM"), Ownable, Pausable {

    using SafeMath for uint256;

    event MultiTransferred(uint256 recipientCount, uint256 totalAmount);
    
    constructor(uint256 supply) {
         _mint(msg.sender, supply);
    }

     /**
     * @dev Mints `amount` tokens to `to`
     *
     * See {ERC20-_mint}.
     *
     * Requirements:
     *
     * - only the owner can call this function
     */
    function mint(address to, uint256 amount) external onlyOwner {
        _mint(to, amount);
    }

     /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) external {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) external {
        require(allowance(account, _msgSender()) >= amount, "ERC20: burn amount exceeds allowance");
        _approve(account, _msgSender(), allowance(account, _msgSender()).sub(amount));
        _burn(account, amount);
    }

    /**
     * @dev Overrides and calls super {ERC20-transfer}
     *
     * See {ERC20-transfer}
     *
     * Requirements:
     *
     * - `recipient` cannot be `address(this)`
     */
    function transfer(address recipient, uint256 amount) 
        public 
        override 
        returns (bool)        
    {
        require(recipient != address(this), "PreOfm: Invalid recipient");
        return super.transfer(recipient, amount);
    }

    function multiTransfer(address[] memory recipients, uint256[] memory amount) external returns (bool) {
        require(!paused(), "ERC20Pausable: token transfer while paused");
        require(recipients.length == amount.length, "number of recipients and amounts are not equal.");
        uint256 total = 0;
        for (uint8 j=0; j<amount.length; j++) {
            total += amount[j];
        }
        require(balanceOf(msg.sender) >= total,"Insufficient Balance.");
        
        for (uint8 i=0; i < recipients.length; i++) {
            transfer(recipients[i], amount[i]);
        }
        emit MultiTransferred(recipients.length, total);
        return true;
    }

    function multiTransfer(address[] memory recipients, uint256 amount) external returns (bool) {
        require(!paused(), "ERC20Pausable: token transfer while paused");
        uint256 total = recipients.length.mul(amount);
        require(balanceOf(msg.sender) >= total, "Insufficient Balance.");
        for (uint8 i=0; i < recipients.length; i++) {
            transfer(recipients[i], amount);
        }
        emit MultiTransferred(recipients.length, total);
        return true;
    }


     function _beforeTokenTransfer(address from, address to, uint256 amount)
        internal 
        virtual 
        override 
    {
        super._beforeTokenTransfer(from, to, amount);

        require(!paused(), "ERC20Pausable: token transfer while paused");
    }

    function pause(bool shouldPause) external onlyOwner {
        if (shouldPause) {
            _pause();
        } else {
            _unpause();
        }
    }

    function destroy() external onlyOwner {
        selfdestruct(msg.sender);
    }
}
/**
 * @author Naveen Kumar (contact.naveen@vegavid.com)
 */
function transfer(address recipient, uint256 amount) 
    public 
    override 
    returns (bool)        
{
    require(recipient != address(this), "PreOfm: Invalid recipient");
    return super.transfer(recipient, amount);
}

/**
 * @dev Overrides and calls super {ERC20-transfer}
 *
 * See {ERC20-transfer}
 *
 * Requirements:
 *
 * - `recipient` cannot be `address(this)`
 */