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 feesdefaultGasFee_
: Default gas fee amount (in wei) for deployments without custom feesdefaultTokenFee_
: 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 managedfundingType
: Funding model (ITypes.FundingType.Full
orITypes.FundingType.Partial
)
Returns: Address of the newly deployed VestedMilestoneManager
Process:
- Fee determination - Checks for custom fees for
msg.sender
, otherwise uses defaults - Manager deployment - Creates new
VestedMilestoneManager
with determined parameters - Admin transfer - Sets deployer as admin and removes factory admin privileges
- 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 contracttoken
: ERC20 token address being managedfeeType
: Fee structure type (Gas
orDistributionToken
)fee
: Fee amount (wei for gas fees, basis points for token fees)feeCollector
: Address that will collect feescreator
: Address that deployed the managerfundingType
: 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
- Clear milestone definitions - Use descriptive external references
- Reasonable allocations - Distribute tokens appropriately across milestones
- Approval criteria - Establish clear criteria for milestone approval
- Documentation - Maintain records of milestone achievements
- Dispute resolution - Plan for milestone disputes and resolution processes
Comparison with Time-Based Factories
Feature | VestedMilestoneManagerFactory | TokenVestingManagerFactory |
---|---|---|
Release Trigger | Admin approval | Time passage |
Milestone Support | Yes (multi-step) | No |
Performance Tracking | Yes (external refs) | No |
Approval Workflow | Required | Not applicable |
Use Case | Achievement-based | Time-based |
Complexity | Higher (approval logic) | Lower |
The VestedMilestoneManagerFactory
provides specialized deployment for milestone-based token vesting with approval workflows, enabling performance-based compensation and project deliverable tracking.