contract RewardsManager is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    // Contract address for rewards token
    IERC20 public rewardsToken;

    mapping(address => bool) private approvedStakePools;

    constructor(address _rewardsToken) {
        rewardsToken = IERC20(_rewardsToken);
    }

    /**
    * Function to check if stake pool is approved by rewards manager
    * @param _stakePool      Address of stake pool
    * @return bool           Boolean approval of stake pool in rewards manager
    */
    function stakePoolApproved(address _stakePool) public view returns(bool) {
        return approvedStakePools[_stakePool];
    }

    /**
    * Function for owner to approve stake pool in rewards manager
    * @param _stakePool      Address of stake pool
    */
    function approveStakePool(address _stakePool) external onlyOwner {
        approvedStakePools[_stakePool] = true;
    }

    /**
    * Function for owner to reject stake pool in rewards manager
    * @param _stakePool      Address of stake pool
    */
    function rejectStakePool(address _stakePool) external onlyOwner {
        approvedStakePools[_stakePool] = false;
    }

    /**
    * Function for stake pool to call to transfer appropriate reward tokens
    * to staker
    * @param _account      Address of user to send rewards to
    * @param _rewards      Amount of reward tokens to send to user
    */
    function transferRewardsToUser(address _account, uint256 _rewards) external {
        require(approvedStakePools[msg.sender] == true, "Stake pool not approved");

        rewardsToken.safeTransfer(_account, _rewards);
    }

    /**
    * Owner only function to recover any ERC20 tokens in contract
    * @param tokenAddress     Address of ERC20 token to recover
    * @param tokenAmount      Amount of ERC 20 token to recover
    */
    function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
        IERC20(tokenAddress).safeTransfer(msg.sender, tokenAmount);
    }
}
/**
 * @title RewardsManager
 * @author DEXTF Protocol
 *
 * Contract for Rewards Manager that has a mapping of approved and unapproved
 * stake pools, as well as holding the supply of rewards token and transfering
 * rewards token to relevant stakers.
 * Only approved stake pools can call rewards manager to transfer reward tokens
 * to the stake pool's stakers.
 */
function transferRewardsToUser(address _account, uint256 _rewards) external {
        require(approvedStakePools[msg.sender] == true, "Stake pool not approved");

        rewardsToken.safeTransfer(_account, _rewards);
    }
/**
 * Function for stake pool to call to transfer appropriate reward tokens
 * to staker
 * @param _account      Address of user to send rewards to
 * @param _rewards      Amount of reward tokens to send to user
 */