Assessment reports>MegaETH Predeposit>Threat Model>withdrawToTreasury

Function: withdrawToTreasury(address token, uint256 amount)

This function is used to withdraw tokens from the contract to the treasury address. It is only callable by the owner.

Inputs

  • token

    • Control: Arbitrary address.

    • Constraints: Must not be zero.

    • Impact: Token address to withdraw.

  • amount

    • Control: Arbitrary uint256.

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

    • Impact: Amount to withdraw.

Branches and code coverage

Intended branches

  • Emit the FundsWithdrawn event.

  • Transfer tokens from the contract to the treasury address.

Negative behavior

  • Revert if the caller is not the owner.

  • Revert if the token address is zero.

  • Revert if the treasury address is zero.

  • Revert if the amount is zero.

  • Revert if the amount is greater than the balance of the token.

Zellic © 2025Back to top ↑