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
, andtokenContract
.
_milestones
Control: Arbitrary.
Constraints: None.
Impact: Array of
Milestone
. Struct of the milestone includingmilestoneAward
,unlockOnCompletion
,complete
, and an array ofconditionContracts
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 thanARRAY_LENGTH_LIMIT
(20).Revert if the
_allocation.tokenStreamTotal
+_milestoneTotal
is zero.