Pre-Liquid Approved Sale
Overview
The LegionPreLiquidApprovedSale
contract executes pre-liquid sales of ERC20 tokens before the Token Generation Event (TGE). It manages the complete sale lifecycle including investment processing, refunds, raised capital withdrawal, token distribution for vesting, and sale cancellation.
The distinguishing characteristic of pre-liquid sales is commencement before token deployment (Pre-TGE). Only approved investors with signed Simple Agreement for Future Tokens (SAFT) documents can participate. Each investment requires cryptographic signature verification proving SAFT authorization and compliance with agreed allocation terms.
Due to the temporal gap between capital raising and TGE, projects can withdraw raised capital before token supply to meet operational requirements. Once capital is withdrawn, vesting term modifications are prohibited to maintain investor protection.
The pre-liquid approved sale operates asynchronously with signature-based authorization rather than fixed timing, requiring explicit approval for each transaction.
Every pre-liquid approved sale consists of 6 stages, detailed below:
Pre-Liquid Approved Sale Stages
Active Investment Period: Approved investors with signed SAFTs invest capital using cryptographic signatures. No predetermined end time; continues until manually concluded.
Sale Conclusion: Legion or project administrators manually end the sale, triggering refund period commencement and finalizing investment acceptance.
Refund Period: Individual 14-day refund windows beginning from each investor's last investment transaction, complying with MiCA regulation requirements.
TGE Details Publication: Legion publishes Token Generation Event details including ask token address, total supply, and allocated token amounts after token deployment.
Token Supply: Projects supply allocated tokens to the contract along with calculated fees for Legion and referrers after TGE completion.
Token Distribution: Investors claim allocated tokens through signature verification and vesting deployment. Claims require both allocation and vesting term authorization signatures.
Key Functions
Sale Management Functions
initialize
: Initializes the sale with configuration parameters including refund period duration, fee structures, addresses, and position management settings.end
: Manually concludes the sale and initiates refund period calculations. Can be executed by Legion operators or project administrators. Sets sale end status and timestamp.publishTgeDetails
: Publishes Token Generation Event details including ask token address, total supply, and allocated token amounts. Restricted to Legion operators after TGE completion.publishRaisedCapital
: Publishes total capital amount raised and accepted by the project. Restricted to Legion operators after sale conclusion and refund period completion.
Investment Functions
invest
: Processes investments from approved investors with SAFT authorization. Requires signature verification proving investment amount and token allocation rate compliance with signed agreements. No time restrictions apply until sale conclusion.
Capital Management Functions
withdrawRaisedCapital
: Allows project administrators to withdraw raised capital after sale conclusion and refund period completion. Automatically distributes fees to Legion and referrer addresses.withdrawExcessInvestedCapital
: Enables investors to reclaim excess capital when invested amounts exceed SAFT-approved allocation limits. Requires signature verification of reduced allocation terms.
Token Distribution Functions
claimTokenAllocation
: Processes investor token claims using dual signature verification for both allocation amounts and vesting terms. Deploys vesting contracts for time-locked tokens and transfers immediate allocations directly.releaseVestedTokens
: Triggers token release from investor vesting contracts according to predefined schedules.supplyTokens
: Allows project administrators to supply allocated tokens plus calculated fees to the contract for distribution after TGE details publication.
Administrative Functions
cancel
: Enables project administrators to cancel the sale before token supply. If capital has been withdrawn, requires project to return full amount including fees to enable investor refunds.withdrawInvestedCapitalIfCanceled
: Allows investors to reclaim invested capital from canceled sales.
Emergency Functions
emergencyWithdraw
: Enables Legion operators to withdraw specified tokens to designated addresses in emergency situations.pause
: Suspends contract operations while preserving investor fund access.unpause
: Resumes normal contract operations.syncLegionAddresses
: Updates Legion infrastructure addresses from the central registry.
Position Management Functions
transferInvestorPosition
: Enables Legion operators to transfer investor positions between addresses after sale conclusion and refund period completion.transferInvestorPositionWithAuthorization
: Allows position transfers with cryptographic authorization from Legion signers.
Technical Specifications
Configuration Parameters
Pre-Liquid Sale Configuration
refundPeriodSeconds
: Individual refund period duration per investor (up to 2 weeks)legionFeeOnCapitalRaisedBps
: Fee percentage on capital raised (basis points)legionFeeOnTokensSoldBps
: Fee percentage on tokens sold (basis points)referrerFeeOnCapitalRaisedBps
: Referrer fee on capital raised (basis points)referrerFeeOnTokensSoldBps
: Referrer fee on tokens sold (basis points)
Sale Status Tracking
hasEnded
: Sale conclusion status flagendTime
: Sale conclusion timestamprefundEndTime
: Refund period termination timestampisCanceled
: Sale cancellation status flagtokensSupplied
: Token supply completion flag
Address Configuration
bidToken
: Token accepted for investments (USDC, USDT, etc.)askToken
: Token being distributed (set during TGE details publication)projectAdmin
: Administrative address for project operationsaddressRegistry
: Central registry for Legion infrastructure addresseslegionBouncer
: Legion operator address for system administrationlegionSigner
: Authorized signature verification address
SAFT Integration
Signature-Based Authorization
All investor actions require cryptographic signatures proving:
SAFT compliance and authorization
Investment amount verification
Token allocation rate confirmation
Vesting terms agreement
Position Management
Each investor position maintains:
investedCapital
: Total capital invested by investorcachedInvestAmount
: SAFT-approved maximum investment amountcachedTokenAllocationRate
: Token allocation percentage (18 decimal precision)hasRefunded
: Refund status flaghasSettled
: Token claim completion statushasClaimedExcess
: Excess capital claim statusvestingAddress
: Deployed vesting contract address
Signature Verification Types
Investment Signatures: Authorize capital investment with SAFT compliance
Claim Signatures: Authorize token allocation claims
Vesting Signatures: Authorize vesting term deployment
Withdrawal Signatures: Authorize excess capital withdrawal
Transfer Signatures: Authorize position transfers
Access Control
Legion Operators
Sale conclusion and TGE details publication
Raised capital publication and system administration
Emergency intervention and position management
Signature verification authority
Project Administrators
Sale conclusion and capital withdrawal
Token supply operations and fee management
Sale cancellation and capital return operations
Legion or Project Administrators
Joint authority for sale conclusion operations
Shared responsibility for sale timeline management
SAFT Signers (Investors)
Must possess valid SAFT agreements
Require signature authorization for all transactions
Subject to individual refund period calculations
State Management
Signature Tracking
The contract maintains comprehensive signature usage tracking:
Per-investor signature mapping prevents replay attacks
Signature verification ensures SAFT compliance
Used signatures are permanently marked to prevent reuse
Asynchronous Operations
No predetermined sale duration during initialization
Individual refund periods per investor transaction
Manual sale conclusion by authorized parties
TGE-dependent token distribution coordination
Capital Flow Management
Early capital withdrawal capability before token supply
Capital return requirement for post-withdrawal cancellations
Fee distribution maintains consistency with other sale types
Signature-verified allocation and excess withdrawal processing
Verification Mechanisms
Multi-Signature Validation
Investment Verification: SAFT amount and allocation rate compliance
Vesting Verification: Separate signature for vesting term authorization
Excess Capital Verification: Signature proving reduced allocation terms
Position Validation: Cached amounts match signature-verified terms
SAFT Compliance Enforcement
Investment amounts must match cached SAFT limits
Token allocation rates verified against signed agreements
Excess capital withdrawal requires updated SAFT signatures
Position transfers maintain SAFT term integrity
Error Conditions
The contract implements comprehensive error handling for:
SAFT compliance violations and signature validation failures
Investment amount mismatches with cached allocation terms
Signature replay attempts and authorization failures
Sale timing violations and state inconsistencies
Token supply coordination and distribution errors
Event Emission
The contract emits detailed events for:
Investment processing with investor and SAFT compliance data
Sale conclusion and refund period initiation
TGE details and capital publication with allocation information
Token supply and distribution with vesting deployment details
Administrative operations and signature verification results
Error conditions and compliance violations
Last updated