function endSuply() public {
    require(msg.sender == admin,"only admin can end the token sale");
    require(tokenContract.transfer(admin, tokenContract.balanceOf(address(this))),"balance not transferring");


here admin is a state variable declared as address admin;

But the error pops up and doesn't compile !

I just need to disable the contract, how can it be done ?

1 Answer 1


Elsewhere in the contract, find address admin; and declare it as address payable admin;.

Alternatively, selfdestruct(msg.sender); because require(msg.sender == admin); ensures they are the same and msg.sender should be payable.

A word of caution. selfdestruct is an inelegant way to stop a contract and could lead to non-trivial problems. Consider using Open Zeppelin Pausable.sol instead.

Hope it helps.

  • 1
    selfdestruct(msg.sender); also gives the same lint error. Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested.
    – navalsaini
    Apr 19 at 2:06
  • That's quirky. With solidity 0.8.13 that error does indeed bubble up. Wrapping in payable like selfdestruct(payable(msg.sender)); is a work-around. As an aside, have a look over here for some opinionated opinions about refraining from selfdestruct in most situations. blog.b9lab.com/selfdestruct-is-a-bug-9c312d1bb2a5 Apr 20 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.