Assessment reports>Bera Contracts>Threat Model>Function: claim(bytes32[] calldata _proof, bytes calldata _signature, uint256 _amount, address _onBehalfOf)

Function: claim(bytes32[] calldata _proof, bytes calldata _signature, uint256 _amount, address _onBehalfOf)

The claim function is used to claim airdrops. The function receives and verifies a signature and a proof of inclusion of the claim.

Inputs

  • _proof

    • Validation: Check that the amount and the account were previously included in the airdrop.

    • Impact: Prevents nonincluded airdrop being claimed.

  • _signature

    • Validation: The address that signed the contract address — the amount and the account of the claim should match the signer address.

    • Impact: Prevents unauthorized claims.

  • _amount

    • Validation: The amount has to be smaller than the contract balance.

    • Impact: The airdrop amount to transfer.

  • _onBehalfOf

    • Validation: Check if the claim was already done.

    • Impact: Prevents a claim being executed twice.

Branches and code coverage (including function calls)

Intended branches

  • A claim properly signed and included in the root of the Merkle tree is successfully distributed.

Negative behavior

  • A claim already distributed is rejected.

  • A claim with an invalid signature is rejected.

  • A claim with an invalid inclusion proof is rejected.

  • A transfer failure during a claim properly reverts.

Function call analysis

  • claim -> _rootCheck(_proof, _amount, _onBehalfOf)

    • External/Internal? Internal.

    • Argument control? All arguments.

    • Impact: Checks the proof of inclusion of the amount and the account.

  • _signatureCheck(_amount, _signature, _onBehalfOf);

    • External/Internal? Internal.

    • Argument control? All arguments.

    • Impact: Checks the signature of the amount and the account.

  • transfer(_onBehalfOf, amount)

    • External/Internal? Internal.

    • Argument control? All arguments.

    • Impact: Transfers the airdrop to the account.

Zellic © 2025Back to top ↑