Assessment reports>MegaETH Predeposit>Threat Model>withdrawToken

Function: withdrawToken(address _token, uint256 amount, address to)

This function is used to withdraw ERC-20 tokens from the contract. It is only callable by the owner.

Inputs

  • _token

    • Control: Arbitrary address.

    • Constraints: None.

    • Impact: Address of the token to withdraw.

  • amount

    • Control: Arbitrary uint256.

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

    • Impact: Amount to withdraw.

  • to

    • Control: Arbitrary address.

    • Constraints: None.

    • Impact: Address to receive the funds.

Branches and code coverage

Intended branches

  • Calculate the withdrawal amount.

  • Determine the recipient address.

  • Transfer the tokens to the recipient address.

  • Emit the TokensWithdrawn event.

Negative behavior

  • Revert if the caller is not the owner.

  • Revert if the amount is zero.

Zellic © 2025Back to top ↑