Assessment reports>Metavest>Threat Model>createVestingAllocation

Function: createVestingAllocation(address _grantee, VestingAllocation.Allocation _allocation, VestingAllocation.Milestone[] _milestones)

This function is used to create a new VestingAllocation contract.

Inputs

  • _grantee

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Address of the grantee.

  • _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

  • Calculate the total amount of tokens to be vested.

  • Create a new vesting allocation contract through vestingFactory.

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

  • Update the vestingAllocations array.

Negative behavior

  • Revert if the grantee is the zero address.

  • Revert if _allocation.tokenContract is the zero address.

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

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

  • Revert if the length of _milestones is greater than ARRAY_LENGTH_LIMIT (20).

  • Revert if the _allocation.tokenStreamTotal + _milestoneTotal is zero.

Zellic © 2024Back to top ↑