Assessment reports>Metavest>Threat Model>createTokenOptionAllocation

Function: createTokenOptionAllocation(address _grantee, uint256 _exercisePrice, address _paymentToken, uint256 _shortStopDuration, VestingAllocation.Allocation _allocation, VestingAllocation.Milestone[] _milestones)

This function is used to create a new TokenOptionAllocation contract.

Inputs

  • _grantee

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Address of the grantee.

  • _exercisePrice

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Value of exercise price.

  • _paymentToken

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Address of payment token.

  • _shortStopDuration

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Value of short stop duration.

  • _allocation

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Struct of the allocation including Allocation fields: tokenStreamTotal, vestingCliffCredit, unlockingCliffCredit, vestingRate, vestingStartTime, unlockRate, unlockStartTime, and tokenContract.

  • _milestones

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Array of Milestone. Struct of the milestone including milestoneAward, unlockOnCompletion, complete, and an array of conditionContracts addresses.

Branches and code coverage

Intended branches

  • Validate the provided parameters.

  • Create a new allocation contract through the createAndInitializeTokenOptionAllocation function.

  • Calculate the total amount of tokens to be transferred.

  • Transfer the total amount of tokens from the authority to the allocation.

  • Update the tokenOptionAllocations mapping.

Negative behavior

  • Revert if the condition check fails.

  • Revert if the total amount of tokens to be transferred is zero.

  • Revert if one of the parameters is zero address (_grantee, _paymentToken, _allocation.tokenContract).

  • Revert if the _exercisePrice is zero.

  • Revert if _allocation.vestingCliffCredit is greater than _allocation.tokenStreamTotal.

  • Revert if _allocation.unlockingCliffCredit is greater than _allocation.tokenStreamTotal.

  • Revert if the token allowance of authority is less than the total amount of tokens to be transferred.

  • Revert if the token balance of authority is less than the total amount of tokens to be transferred.

Zellic © 2024Back to top ↑