Function: claim(address user, uint256 tokenAmount, byte[32][] merkleProof)

This function is used to claim tokens and ETH for a user. It is only callable by the user themselves if selfClaim is true; otherwise, it is only callable by the owner.

Inputs

  • user

    • Control: Arbitrary address.

    • Constraints: Must be msg.sender if selfClaim is true and must be in the Merkle tree.

    • Impact: Address of the user to claim for.

  • tokenAmount

    • Control: Arbitrary uint256.

    • Constraints: Must be in the Merkle tree.

    • Impact: Amount of tokens to claim.

  • merkleProof

    • Control: Arbitrary bytes32[].

    • Constraints: Must be a valid Merkle proof for the user and token amount.

    • Impact: Merkle proof for verification.

Branches and code coverage

Intended branches

  • Invoke MerkleProof.verify to verify the Merkle proof.

  • Update the claim record.

  • Transfer ERC-20 tokens.

  • Transfer ETH.

  • Emit the Claimed event.

Negative behavior

  • Revert if claiming is paused.

  • Revert if the caller is not the user themselves, when selfClaim is true.

  • Revert if the user has already claimed.

  • Revert if the Merkle proof is invalid.

  • Revert if the token amount is zero and the ETH amount per user is zero.

  • Revert if the token balance is insufficient.

  • Revert if the ETH balance is insufficient.

Zellic © 2025Back to top ↑