Assessment reports>MegaETH Predeposit>Threat Model>withdrawETH

Function: withdrawETH(uint256 amount, address to)

This function is used to withdraw ETH from the contract. It is only callable by the owner.

Inputs

  • amount

    • Control: Arbitrary uint256.

    • Constraints: Must be less than or equal to the balance of the contract.

    • Impact: Amount to withdraw.

  • to

    • Control: Arbitrary address.

    • Constraints: Must not be zero.

    • Impact: Address to receive the funds.

Branches and code coverage

Intended branches

  • Calculate the withdrawal amount.

  • Determine the recipient address.

  • Revert if the withdrawal amount is zero.

  • Transfer the ETH to the recipient address.

  • Emit the ETHWithdrawn event.

Negative behavior

  • Revert if the caller is not the owner.

  • Revert if the amount is zero.

Zellic © 2025Back to top ↑