Pre-Liquid Open Application Sale
Overview
The LegionPreLiquidOpenApplicationSale
contract executes pre-liquid sales of ERC20 tokens before the Token Generation Event (TGE). It manages the complete sale lifecycle including capital pledging, allocation processing, refunds, raised capital withdrawal, token distribution for vesting, and sale cancellation.
In this open application model, investors deposit capital amounts representing their maximum allocation commitment. Projects subsequently review applications and determine final allocations based on evaluation criteria. When accepted allocations are less than deposited amounts, investors can withdraw excess capital through Merkle proof verification.
Due to the temporal gap between capital raising and TGE, projects can withdraw raised capital before token supply, enabling early access to funds for operational requirements. Once capital is withdrawn, no modifications to sale parameters are permitted.
The pre-liquid sale operates asynchronously compared to standard sale contracts, with flexible timing based on project requirements rather than fixed periods.
Every pre-liquid open application sale consists of 6 stages, detailed below:
Pre-Liquid Open Application Sale Stages
Open Application Period: Investors submit applications by depositing maximum allocation amounts. This period continues until manually ended by Legion or project administrators.
Application Processing: Projects evaluate investor applications and determine final allocations. Legion processes these decisions and prepares allocation data structures.
Sale Conclusion: Legion or project administrators manually end the sale, triggering the refund period commencement and finalizing the application acceptance window.
Refund Period: Regulatory compliance stage where investors can request capital refunds. Duration is configured during initialization (1 hour to 2 weeks) and begins after sale conclusion.
Results Publication: Legion publishes raised capital amounts and final allocation data using Merkle trees. The ask token address is specified during this stage after TGE completion.
Token Distribution: Investors claim allocated tokens through Merkle proof verification after projects supply tokens to the contract. Vesting contracts are deployed for time-locked allocations.
Key Functions
Sale Management Functions
initialize
: Initializes the sale with configuration parameters including refund period duration, addresses, fee structures, and operational settings. No end time is set initially.end
: Manually concludes the sale and initiates the refund period. Can be executed by Legion operators or project administrators. Sets the sale end time and calculates refund period termination.publishRaisedCapital
: Publishes the total capital amount raised and accepted by the project. Restricted to Legion operators and executable after sale conclusion and refund period completion.publishSaleResults
: Publishes final allocation data including claim Merkle root, total tokens allocated, and ask token address. Restricted to Legion operators and executed after TGE when token details are finalized.
Investment Functions
invest
: Processes investor capital contributions during the open application period. Requires valid signature verification and enforces minimum investment amounts. No time restrictions apply until sale conclusion.
Capital Management Functions
withdrawRaisedCapital
: Allows project administrators to withdraw raised capital after refund period completion and capital publication. Automatically distributes fees to Legion and referrer addresses.withdrawExcessInvestedCapital
: Enables investors to reclaim excess capital not accepted in final allocations using Merkle proof verification.
Token Distribution Functions
claimTokenAllocation
: Processes investor token claims using Merkle proof verification after token supply and results publication. 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.
Administrative Functions
setAcceptedCapital
: Sets accepted capital Merkle root for excess capital withdrawal verification. Restricted to Legion operators.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.transferInvestorPositionWithAuthorization
: Allows position transfers with cryptographic authorization from Legion signers.
Technical Specifications
Configuration Parameters
Pre-Liquid Sale Configuration
hasEnded
: Boolean flag indicating sale conclusion statusrefundPeriodSeconds
: Duration of refund period after sale conclusion (1 hour to 2 weeks)
Sale Configuration
startTime
: Sale commencement timestamp (set during initialization)endTime
: Sale conclusion timestamp (set whenend()
is called)refundEndTime
: Refund period termination (calculated after sale conclusion)minimumInvestAmount
: Minimum required investment threshold
Address Configuration
bidToken
: Token accepted for investments (USDC, USDT, etc.)askToken
: Token being distributed (set during results publication after TGE)projectAdmin
: Administrative address for project operationsaddressRegistry
: Central registry for Legion infrastructure addresses
Access Control
Legion Operators
Sale conclusion and results publication
Capital amount publication and system administration
Emergency intervention and position management
Project Administrators
Sale conclusion and capital withdrawal
Sale cancellation and capital return operations
Legion or Project Administrators
Joint authority for sale conclusion operations
Shared responsibility for sale timeline management
Authorized Signers
Investment signature verification
Position transfer authorization validation
State Management
Position Tracking
Each investor position maintains:
Total invested capital amount
Refund status and settlement state
Vesting contract address assignment
Excess capital claim status
Sale Status
Global sale state includes:
Total capital invested across all participants
Total capital raised and accepted by project
Total tokens allocated for distribution
Sale conclusion and capital withdrawal status
Operational Characteristics
Asynchronous Timeline
Unlike fixed-duration sales, the pre-liquid sale operates with flexible timing:
No predetermined end time during initialization
Manual sale conclusion by authorized parties
Project-driven allocation processing timeline
TGE-dependent token distribution phase
Capital Management
Early capital withdrawal capability before token supply
Capital return requirement for post-withdrawal cancellations
Fee distribution maintains consistency with other sale types
Excess capital recovery through cryptographic verification
Allocation Processing
Open application model without predetermined limits
Project discretion in allocation determination
Merkle tree verification for excess capital claims
Post-TGE token distribution coordination
Verification Mechanisms
Signature Verification
Investment operations require valid signatures from authorized Legion signers to prevent unauthorized participation and ensure compliance with access controls.
Merkle Proof Systems
Excess capital withdrawals utilize Merkle tree verification for efficient validation of accepted allocation amounts versus invested capital.
State Validation
Sale conclusion status verification for timing-dependent operations
Capital publication status verification for withdrawal operations
Token supply status verification for distribution operations
Error Conditions
The contract implements comprehensive error handling for:
Sale conclusion status violations and timing errors
Capital publication and withdrawal sequence violations
Access control violations and unauthorized operations
State inconsistencies and duplicate operations
Token supply and distribution coordination errors
Event Emission
The contract emits detailed events for:
Investment processing with investor and position information
Sale conclusion and timeline establishment
Capital and results publication with allocation data
Administrative operations and state changes
Error conditions and system alerts
Last updated