EscrowVesting
The EscrowVesting
contract manages the gradual release of funds raised from IMO sales to project teams. It implements a phase-based vesting schedule with milestone-dependent releases to ensure project accountability and protect investor interests.
Key Features
Phase-based vesting schedule (configurable, default 3 phases).
Milestone-gated fund releases.
Emergency withdrawal mechanism.
Time-locked release schedule.
Milestone checker integration.
Contract Details
Constants
Vesting Schedule
Default phases after IMO completion:
State Variables
Functions
Core Functions
release(uint256 _phaseIndex)
Purpose: Releases funds for a specific vesting phase.
Access:
MilestoneChecker
only.Requirements:
Valid phase index (0-2).
Phase has not yet been released.
Release time has been reached.
Milestone conditions have been met.
Funds are available.
Process Flow:
Validates all release conditions to be met.
Calculates the amount to be released.
Marks the phase as released.
Transfers the calculated USDT amount to the project wallet.
Events Triggered:
FundsReleased
.
Setup Functions
constructor(address _projectWallet, address _imoSaleContract, address _usdtToken)
Purpose: Initializes the vesting contract with necessary addresses.
Parameters:
_projectWallet
: The address of the project wallet._imoSaleContract
: The address of the IMO sale contract._usdtToken
: The address of the USDT token.
Validation: Ensures all addresses are non-zero.
setIMOEndTime(uint256 _endTime)
Purpose: Sets the vesting start time and initializes the vesting phases.
Access:
Owner
orIMOSale
.Phase Setup:
Events Triggered:
IMOEndTimeSet
.PhasesInitialized
.
setMilestoneChecker(address _milestoneChecker)
Purpose: Sets the address of the milestone checker contract.
Access:
Owner
only.Validation: Non-zero address.
setIMOToken(address _imoToken)
Purpose: Sets the address of the IMO token contract.
Access:
Owner
orIMOSale
.Validation:
Non-zero address.
Must be contract.
One-time setting.
Events Triggered:
IMOTokenSet
.
Fund Management
receiveUSDT(uint256 _amount)
Purpose: Receives and manages USDT funds sent to the contract by
IMOSale.sol
.Access:
IMOSale
only.Process Flow:
Transfers the specified amount of USDT from the sender.
Updates the total escrowed amount in the contract.
Events Triggered:
FundsReceived
.
emergencyWithdraw(address _recipient)
Purpose: Emergency withdrawal of funds to a specified recipient.
Access:
Owner
orIMOSale
.Requirements: The contract must have positive balance.
Security: Critical function for emergency use only.
View Functions
getReleaseableAmount(uint256 _phaseIndex)
Purpose: Calculates the amount of USDT that can be released for a specified phase.
Formula:
(totalEscrowedAmount * releasePercentage) / 100
.Returns: The amount of USDT available for release.
getPhaseInfo(uint256 _phaseIndex)
Purpose: Retrieves details of the specified phase.
Returns: Phase information (release percentage, scheduled release time, and release status).
getTotalReleasedAmount()
Purpose: Retrieves the total amount of USDT that has been released.
Returns: Total USDT amount released to date.
getRemainingEscrowBalance()
Purpose: Retrieves the remaining balance of escrowed USDT.
Returns: The amount of USDT still held in escrow.
Last updated