Assessment reports>Palmy Finance>Threat Model>createLockFor

Function: createLockFor(uint256 _value, uint256 _lockDuration, address _to)

Deposits _value tokens for _to and locks for _lockDuration.

Inputs

  • _value

    • Control: Controlled by the caller (agency).

    • Constraints: Must be greater than zero.

    • Impact: Specifies the amount of tokens to deposit and lock.

  • _lockDuration

    • Control: Controlled by the caller (agency).

    • Constraints: Must be greater than the current timestamp and less than or equal to the maximum lock duration (two years).

    • Impact: Specifies the duration for which the tokens will be locked.

  • _to

    • Control: Controlled by the caller (agency).

    • Constraints: Must be a valid address.

    • Impact: Specifies the address to deposit and lock tokens for.

Branches and code coverage (including function calls)

Intended branches

  • Successful creation of a new lock for _to with the specified _value and _lockDuration.

Negative behavior

  • Revert if the caller is not an agency.

  • Revert if _value is zero.

  • Revert if _lockDuration is not greater than the current timestamp.

  • Revert if _lockDuration exceeds the maximum lock duration (two years).

  • Revert if trying to create lock twice.

Zellic © 2025Back to top ↑