'Having this problem in solidity can someone help me

Invalid type for argument in function call. Invalid implicit conversion from contract AstTokenSale to address requested.

I have this error and do not know how to fix it can someone help me

here is the code

        require(tokenContract.transfer(admin, tokenContract.balanceOf(this)));


Solution 1:[1]

The error stating that Invalid implicit conversion from contract AstTokenSale to address requested meaning that you have to cast to address explicitly.

Try this require(tokenContract.transfer(admin, tokenContract.balanceOf(address(this))));

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1