Function: createRestrictedTokenAward(address _grantee, uint256 _repurchasePrice, address _paymentToken, uint256 _shortStopDuration, VestingAllocation.Allocation _allocation, VestingAllocation.Milestone[] _milestones)
This function is used to create a new RestrictedTokenAllocation contract.
Inputs
_grantee
Control: Arbitrary.
Constraints: None.
Impact: Address of the grantee.
_repurchasePrice
Control: Arbitrary.
Constraints: None.
Impact: Value of repurchase 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
, 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
Validate the provided parameters.
Create a new allocation contract through the
createAndInitializeRestrictedTokenAward
function.Calculate the total amount of tokens to be transferred.
Transfer the total amount of tokens from the authority to the allocation.
Update the
restrictedTokenAllocations
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
_reputationPrice
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.