📜  whithdraw from contract insolidity - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:11.432000             🧑  作者: Mango

代码示例1
/**
     * @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);
    }