Assessment reports>STFX>Threat Models>claim

Function: claim(bytes32 _salt)

Transfers the deposit to the investor depending on the investor's weightage to the totalRaised by the STF. Will revert if the investor did not invest in the STF during the fundraisingPeriod.

Inputs

  • _salt

    • Control: User has full control of input parameter.

    • Constraints: The _stf corresponding to the salt must not be in a NOT_OPENED state.

    • Impact: Claims can only be made to STFs that are in an OPENED or DISTRIBUTED state.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

  • claim -> getStfInfo(_salt)

    • What is controllable? _salt.

    • If return value controllable, how is it used and how can it go wrong? Return value is used to get the corresponding STF info. It could go wrong if a user is able to claim for an STF that they have not invested in.

    • What happens if it reverts, reenters, or does other unusual control flow? User can reenter if ERC777 tokens are used; the protocol should do their due diligence to ensure that vetted tokens are used.

  • claim -> claimableAmount(_salt, msg.sender)

    • What is controllable? _salt.

    • If return value controllable, how is it used and how can it go wrong? Return value is used to get the amount that can be claimed by the user. It could go wrong if a user is able to claim for an STF that they have not invested in or the calculation is wrong.

    • What happens if it reverts, reenters, or does other unusual control flow? Function can only revert if totalRaised is equal to zero because there would be a division by zero error. The control flow for determining how much a user should get paid out is complex, should be reviewed carefully, and ideally should be simplified.

Zellic © 2024Back to top ↑