0

my withdraw function asks for payable amount in Etherscan before invoking it, not sure what's the reason?

function withdraw() public payable onlyOwner {
    (bool os, ) = payable(owner()).call{value: address(this).balance}("");
    require(os);

}

enter image description here

  • 2
    The function is marked as payable and etherscan is asking how much ether you want to send. If you don't want to send anything enter 0 (zero). – Ismael Feb 17 '22 at 05:49

1 Answers1

0

If you want to send ether (or bnb) to an address, the address must be of type address payable. That is why you are casting owner() as payable. What is payable is not the amount, but the address.

You can find more info here -> What's the difference between 'address' and 'address payable'?