Skip to main content

VestedMilestoneManagerFactory

Factory for deploying milestone-based vesting managers with admin approval workflows and step-by-step token release mechanisms.

Contract Information

File Location: contracts/factories/VestedMilestoneManagerFactory.sol

Inheritance:

contract VestedMilestoneManagerFactory is IVestedMilestoneManagerFactory, FactoryFeeManager

Overview

The VestedMilestoneManagerFactory deploys VestedMilestoneManager instances designed for milestone-based token vesting. Unlike traditional time-based vesting, these managers require explicit admin approval for each milestone step before tokens can be claimed, making them ideal for performance-based compensation and project deliverables.

Key Features

  • Milestone-based vesting - Tokens released only upon admin approval of specific steps
  • Immediate or veted distribution - Tokens can be released immediately or after a vesting period
  • Flexible step structure - Each milestone can have multiple approval steps
  • Performance tracking - External reference strings for milestone identification
  • Admin approval workflow - Explicit approval required for each step
  • Flexible funding models - Support for both full upfront and partial funding

Key Differences from Other Factories

  • Approval-based releases - Tokens vest only upon admin approval, not time passage
  • Multi-step milestones - Each milestone can contain multiple sequential steps
  • External references - Support for human-readable milestone descriptions
  • Performance focus - Designed for achievement-based compensation

Constructor

constructor(
address feeCollector_,
uint256 defaultGasFee_,
uint256 defaultTokenFee_
) FactoryFeeManager(feeCollector_, defaultGasFee_, defaultTokenFee_)

Parameters:

  • feeCollector_: Address that will receive deployment and usage fees
  • defaultGasFee_: Default gas fee amount (in wei) for deployments without custom fees
  • defaultTokenFee_: Default token fee percentage (in basis points) for deployments without custom fees

Example:

// Deploy factory for milestone-based vesting
VestedMilestoneManagerFactory factory = new VestedMilestoneManagerFactory(
0x123...789, // Fee collector address
0.001 ether, // 0.001 ETH gas fee
200 // 2% token fee (200 basis points)
);

Core Functions

newVestedMilestoneManager

function newVestedMilestoneManager(
address tokenAddress,
ITypes.FundingType fundingType
) external returns (VestedMilestoneManager)

Deploys a new VestedMilestoneManager instance with caller-specific fee configuration.

Parameters:

  • tokenAddress: ERC20 token contract address to be managed
  • fundingType: Funding model (ITypes.FundingType.Full or ITypes.FundingType.Partial)

Returns: Address of the newly deployed VestedMilestoneManager

Process:

  1. Fee determination - Checks for custom fees for msg.sender, otherwise uses defaults
  2. Manager deployment - Creates new VestedMilestoneManager with determined parameters
  3. Admin transfer - Sets deployer as admin and removes factory admin privileges
  4. Event emission - Emits VestedMilestoneManagerCreated event

Example:

// Deploy manager for project token with milestone-based vesting
VestedMilestoneManager manager = factory.newVestedMilestoneManager(
0x6B...E2, // ERC20 token
ITypes.FundingType.Partial // Fund as milestones are achieved
);

// Manager is deployed with:
// - Token: ERC20
// - Fee type: Determined by deployer's custom config or factory default
// - Fee amount: Determined by deployer's custom config or factory default
// - Fee collector: Factory's fee collector
// - Funding type: Partial (for milestone-based funding)
// - Admin: msg.sender (deployer)

Events

VestedMilestoneManagerCreated

event VestedMilestoneManagerCreated(
VestedMilestoneManager indexed vestedMilestoneManager,
address indexed token,
ITypes.FeeType feeType,
uint256 fee,
address indexed feeCollector,
address creator,
ITypes.FundingType fundingType
)

Emitted when a new VestedMilestoneManager is deployed.

Parameters:

  • vestedMilestoneManager: Address of the deployed manager contract
  • token: ERC20 token address being managed
  • feeType: Fee structure type (Gas or DistributionToken)
  • fee: Fee amount (wei for gas fees, basis points for token fees)
  • feeCollector: Address that will collect fees
  • creator: Address that deployed the manager
  • fundingType: Funding model used

Security Considerations

Approval Workflow Security

  • Admin approval required - Tokens only vest upon explicit admin approval
  • Step validation - Ensure milestones are properly structured before approval
  • Funding verification - Verify adequate funding before milestone approval

Access Control

  • Factory admin controls - Only factory admin can set custom fees
  • Manager admin transfer - Deployer becomes manager admin immediately
  • Milestone recipient control - Only recipients can claim approved milestones

Milestone Security

  • External reference validation - Ensure milestone descriptions are clear and verifiable
  • Allocation verification - Verify milestone allocations match intended distributions
  • Revocation capabilities - Consider revocability for performance-based compensation

Common Use Cases

1. Software Development Projects

// Deploy manager for development milestones
VestedMilestoneManager devManager = factory.newVestedMilestoneManager(
projectToken,
ITypes.FundingType.Partial
);

// Create milestones: "MVP", "Beta", "Production"

2. Research Grants

// Deploy manager for research funding
VestedMilestoneManager researchManager = factory.newVestedMilestoneManager(
grantToken,
ITypes.FundingType.Partial
);

// Create milestones: "Proposal", "Research", "Publication"

3. Marketing Campaigns

// Deploy manager for campaign payments
VestedMilestoneManager campaignManager = factory.newVestedMilestoneManager(
campaignToken,
ITypes.FundingType.Full
);

// Create milestones: "Setup", "Launch", "Results"

Best Practices

  1. Clear milestone definitions - Use descriptive external references
  2. Reasonable allocations - Distribute tokens appropriately across milestones
  3. Approval criteria - Establish clear criteria for milestone approval
  4. Documentation - Maintain records of milestone achievements
  5. Dispute resolution - Plan for milestone disputes and resolution processes

Comparison with Time-Based Factories

FeatureVestedMilestoneManagerFactoryTokenVestingManagerFactory
Release TriggerAdmin approvalTime passage
Milestone SupportYes (multi-step)No
Performance TrackingYes (external refs)No
Approval WorkflowRequiredNot applicable
Use CaseAchievement-basedTime-based
ComplexityHigher (approval logic)Lower

The VestedMilestoneManagerFactory provides specialized deployment for milestone-based token vesting with approval workflows, enabling performance-based compensation and project deliverable tracking.