Answers for "whithdraw from contract in solidity"

0

whithdraw from contract in solidity

/**
     * @dev withdraw contract balance to a wallet
     * @dev won't execute if it isn't the owner who is executing the command
     * @dev using openzeppelins OnlyOwner.sol class
     * @param _address the address to withdraw to
     */
    function withdraw(address payable _address) public onlyOwner {
        uint contractBal = address(this).balance;
        _address.transfer(contractBal);
        emit withdrawn(_address, contractBal);
    }
Posted by: Guest on September-03-2021

Browse Popular Code Answers by Language