/**
/
/_______/\\\\\\\\\_        __/\\\\\\\\\\\\\\\_        __/\\\________/\\\_        __/\\\________/\\\_        __/\\\_____________        __/\\\________/\\\_        __/\\\________/\\\_                                                               
/_____/\\\////////__        _\///////\\\/////__        _\/\\\_______\/\\\_        _\/\\\_______\/\\\_        _\/\\\_____________        _\/\\\_______\/\\\_        _\/\\\_______\/\\\_                                                              
/ ___/\\\/___________        _______\/\\\_______        _\/\\\_______\/\\\_        _\/\\\_______\/\\\_        _\/\\\_____________        _\/\\\_______\/\\\_        _\/\\\_______\/\\\_                                                             
/  __/\\\_____________        _______\/\\\_______        _\/\\\\\\\\\\\\\\\_        _\/\\\_______\/\\\_        _\/\\\_____________        _\/\\\\\\\\\\\\\\\_        _\/\\\_______\/\\\_                                                            
/   _\/\\\_____________        _______\/\\\_______        _\/\\\/////////\\\_        _\/\\\_______\/\\\_        _\/\\\_____________        _\/\\\/////////\\\_        _\/\\\_______\/\\\_                                                           
/    _\//\\\____________        _______\/\\\_______        _\/\\\_______\/\\\_        _\/\\\_______\/\\\_        _\/\\\_____________        _\/\\\_______\/\\\_        _\/\\\_______\/\\\_                                                          
/     __\///\\\__________        _______\/\\\_______        _\/\\\_______\/\\\_        _\//\\\______/\\\__        _\/\\\_____________        _\/\\\_______\/\\\_        _\//\\\______/\\\__                                                         
/      ____\////\\\\\\\\\_        _______\/\\\_______        _\/\\\_______\/\\\_        __\///\\\\\\\\\/___        _\/\\\\\\\\\\\\\\\_        _\/\\\_______\/\\\_        __\///\\\\\\\\\/___                                                        
/       _______\/////////__        _______\///________        _\///________\///__        ____\/////////_____        _\///////////////__        _\///________\///__        ____\/////////_____                                                       
/___________          ___________         _____/\\\\\\\\\\\___        _______/\\\\\______        __/\\\________/\\\_        __/\\\_____________         ___________          ___________                                                            
/ ___________          ___________         ___/\\\/////////\\\_        _____/\\\///\\\____        _\/\\\_______\/\\\_        _\/\\\_____________         ___________          ___________                                                           
/  ___________          ___________         __\//\\\______\///__        ___/\\\/__\///\\\__        _\/\\\_______\/\\\_        _\/\\\_____________         ___________          ___________                                                          
/   ___________          ___________         ___\////\\\_________        __/\\\______\//\\\_        _\/\\\_______\/\\\_        _\/\\\_____________         ___________          ___________                                                         
/    ___________          ___________         ______\////\\\______        _\/\\\_______\/\\\_        _\/\\\_______\/\\\_        _\/\\\_____________         ___________          ___________                                                        
/     ___________          ___________         _________\////\\\___        _\//\\\______/\\\__        _\/\\\_______\/\\\_        _\/\\\_____________         ___________          ___________                                                       
/      ___________          ___________         __/\\\______\//\\\__        __\///\\\__/\\\____        _\//\\\______/\\\__        _\/\\\_____________         ___________          ___________                                                      
/       ___________          ___________         _\///\\\\\\\\\\\/___        ____\///\\\\\/_____        __\///\\\\\\\\\/___        _\/\\\\\\\\\\\\\\\_         ___________          ___________                                                     
/        ___________          ___________         ___\///////////_____        ______\/////_______        ____\/////////_____        _\///////////////__         ___________          ___________                                                    
/_/\\\________/\\\_        _____/\\\\\\\\\____        ____/\\\\\\\\\_____        __/\\\________/\\\_        __/\\\\\\\\\\\\\\\_        _____/\\\\\\\\\\\___        __/\\\\\\\\\\\\\\\_        __/\\\\\\\\\\\\\\\_        ____/\\\\\\\\\_____        
/_\/\\\_______\/\\\_        ___/\\\\\\\\\\\\\__        __/\\\///////\\\___        _\/\\\_______\/\\\_        _\/\\\///////////__        ___/\\\/////////\\\_        _\///////\\\/////__        _\/\\\///////////__        __/\\\///////\\\___       
/ _\/\\\_______\/\\\_        __/\\\/////////\\\_        _\/\\\_____\/\\\___        _\//\\\______/\\\__        _\/\\\_____________        __\//\\\______\///__        _______\/\\\_______        _\/\\\_____________        _\/\\\_____\/\\\___      
/  _\/\\\\\\\\\\\\\\\_        _\/\\\_______\/\\\_        _\/\\\\\\\\\\\/____        __\//\\\____/\\\___        _\/\\\\\\\\\\\_____        ___\////\\\_________        _______\/\\\_______        _\/\\\\\\\\\\\_____        _\/\\\\\\\\\\\/____     
/   _\/\\\/////////\\\_        _\/\\\\\\\\\\\\\\\_        _\/\\\//////\\\____        ___\//\\\__/\\\____        _\/\\\///////______        ______\////\\\______        _______\/\\\_______        _\/\\\///////______        _\/\\\//////\\\____    
/    _\/\\\_______\/\\\_        _\/\\\/////////\\\_        _\/\\\____\//\\\___        ____\//\\\/\\\_____        _\/\\\_____________        _________\////\\\___        _______\/\\\_______        _\/\\\_____________        _\/\\\____\//\\\___   
/     _\/\\\_______\/\\\_        _\/\\\_______\/\\\_        _\/\\\_____\//\\\__        _____\//\\\\\______        _\/\\\_____________        __/\\\______\//\\\__        _______\/\\\_______        _\/\\\_____________        _\/\\\_____\//\\\__  
/      _\/\\\_______\/\\\_        _\/\\\_______\/\\\_        _\/\\\______\//\\\_        ______\//\\\_______        _\/\\\\\\\\\\\\\\\_        _\///\\\\\\\\\\\/___        _______\/\\\_______        _\/\\\\\\\\\\\\\\\_        _\/\\\______\//\\\_ 
/       _\///________\///__        _\///________\///__        _\///________\///__        _______\///________        _\///////////////__        ___\///////////_____        _______\///________        _\///////////////__        _\///________\///__
/                                                                                                                       
///                                                                                                                       
/*                                                       *******                                                        
/*                                              ************************                                                
/*                                           ******************************                                            
/*                                         **********************************                                          
/*                                        ************************************                                         
/*                                        ************************************                                         
/*                                        ************************************                                         
/*      //////////////////////////////////************************************////////////////////////////////////    
/*      ///                               ************************************                                 ///      
/*      ///                               ************************************                                 ///      
/*      ///                              ***************************************                               ///      
/*      ///              ********       *****************************************       ********               ///      
/*      ///            ***********     *******************************************    ************             ///      
/*      ///          *******   ****  **********//////************////////***********  ****   *******           ///      
/*      ///         ******    *****  ***********************************************  *****    *****           ///      
/*      ///        ******    *****   ***********************************************   *****   ******          ///      
/*      ///     **************          *****************************************        *****************     ///      
/*      ///  ***  * *********            ***************************************             ***************   ///      
/*      ///*****     *******           *******************************************           *******     ***** ///      
/*      ///***        *****************************************************************************        *** ///      
/*      ///*             **********************************************************************              **///   
/*      ///                  **************************************************************                   *///      
/*      ///                  * *       ******************************************                              ///      
/*      ///                  *       ***********************************************                           ///      
/*      ///                  *     ******* *********************************** *******                         ///      
/*      ///                  *   *******   ***********************************   ******                        ///      
/*      ///                     *****      ***********************************      ****                       ///      
/*      ///                    *****      ************************************       ***                       ///      
/*      ///                    ****       *************************************       ***                      ///      
/*      ///                    ***        *************************************       ***                      ///      
/*      ///                    ***        *************************************       ***                      ///      
/*      ///                    ****       *************************************        **                      ///      
/*      ///                    ****       *************************************       **                       ///      
/*      ///                     ***        ******** ****************** *******        **                       ///      
/*      ///                     ***         ****** ******************  ******         **                       ///      
/*      ///                     ***          ******  ****** ********  ******          **                       ///      
/*      ///                     **           ******   *****   *****   *****            *                       ///      
/*      ///                      *            ******   ***** *****   *****                                     ///      
/*      ///                                    *****   ***** *****   ****                                      ///      
/*      ///                                     ****    *********   ****                                       ///      
/*      ///                                      *****  ********   ****                                        ///      
/*      ///                                       ***** ********   ****                                        ///      
///     ///                                        ****  *******   ***                                         ///      
///     ///                                           * ***** **     *                                         ///      
///     ///                                             **** ****    *                                         ///      
///     ///                                             ***   ***    *                                         ///      
///     ///                                             ***    ***   *                                         ///      
///     ///                                            ***      **   *                                         ///      
///     ///                                            ***     * *                                             ///      
///     ///                                              *                                                     ///      
///     ///                                              *                                                     ///      
///     ///                                              *                                                     ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     ///                                                                                                    ///      
///     //////////////////////////////////////////////////////////////////////////////////////////////////////////    
///          
///                                                                                                                    
///                                                                                                                   
/// Website: ct-hu.com 
**/


pragma solidity ^0.7.1;

// SPDX-License-Identifier: UNLICENSED

interface IERC20 {
    function totalSupply() external view returns (uint);
    function balanceOf(address who) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);
    function transfer(address to, uint value) external returns (bool);
    function approve(address spender, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
}

interface ApproveAndCallFallBack {
    function receiveApproval(address from, uint tokens, address token, bytes calldata data) external;
}

interface burn{
        function burnAmountOfTokensFromTheCallerBECAREFUL(uint256 amount) external;
}

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor ()  {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

contract SoulsHarvest is Ownable {
    IERC20 public cthu;
    IERC20 public souls;
    burn soulAddressBurn;
    address soulAddress;
constructor(address _cthu, address _souls) {
        cthu = IERC20(_cthu);
        souls = IERC20(_souls);
        soulAddressBurn = burn(_souls);
        soulAddress = _souls;
    }
    
    event Bought(address indexed buyer, uint256 amount);
    
        function withdrawERC20Tokens(address tokenAddress, uint256 amount) public onlyOwner {
        require(tokenAddress != soulAddress);
        require(tokenAddress != address(this));
        require(IERC20(tokenAddress).balanceOf(address(this)) >= amount);
        IERC20(tokenAddress).transfer(msg.sender, amount);
    }
    
    function buy(uint256 amount) external {
        require(souls.balanceOf(msg.sender) >= amount);
            uint cthuToRecieve = amount / 100;
        require(cthu.balanceOf(address(this)) >= cthuToRecieve);
        // @dev need to be approved via the UI
        souls.transferFrom(msg.sender, address(this), amount);
        soulAddressBurn.burnAmountOfTokensFromTheCallerBECAREFUL(amount);
        cthu.transfer(msg.sender, cthuToRecieve);
        emit Bought(msg.sender, amount);
    }
}