function buyAndGiveOutCOREForToken(address _token) public {
// We check if this token is CORE token if it is we just send it out
if(_token == address(CORE)) {
// return breaks out no need to else..else..
return sendCOREToVault();
uint256 balInputToken = IERC20(_token).balanceOf(address(this));
address pairWithCORE = uniswapFactory.getPair(_token, address(CORE));
// We check if there is a pair for CORE token with that token
if(pairWithCORE != address(0) && supportedPair[pairWithCORE]){ // we check supported pair so people don't make 1 liquidity pair iwth CORE
// It mens we have a pair with CORE
// So we should just swap with it
uint256 amountOut = swapSupportingFeeOnTransfertokens(_token, pairWithCORE, balInputToken);
emit COREBought(amountOut);
return sendCOREToVault();
// This is the case we are not finding a pair with CORE so we try to find one with wETH
address pairWithWETH = uniswapFactory.getPair(_token, wETH);
if(pairWithWETH != address(0)) {
uint256 amountOut = swapSupportingFeeOnTransfertokens(_token, pairWithWETH, balInputToken);
amountOut = swapSupportingFeeOnTransfertokens(wETH, CORExWETHPair, amountOut);
emit COREBought(amountOut);
revert("FA COREBuyer : Unsupported token");