FairLaunch.sol

Quick Links

VIEW CONTRACT ON GITHUB

The FairLaunch.sol contract managed the protocol's genesis event: a 48-hour public sale designed to be completely fair and transparent. It allowed anyone to contribute USDC and receive a proportional share of the 62,222,222 AEC allocation (7% of total supply). All proceeds were sent to the LiquidityDeployer to form the protocol's initial POL.

Inherits from: ReentrancyGuard


Key State Variables

Variable
Type
Description

usdc

IERC20

The immutable address of the USDC token used for contributions.

aec

IERC20

The immutable address of the AEC token being distributed.

liquidityDeployer

address

The immutable address of the LiquidityDeployer contract that receives all USDC raised.

launchStartTime

uint256

The timestamp when the 48-hour contribution window begins.

launchEndTime

uint256

The timestamp when the 48-hour contribution window ends.

isFinalized

bool

A flag that becomes true after the launch ends and finalizeLaunch() is called.

totalRaised

uint256

The total amount of USDC contributed by all participants.

contributions

mapping(address => uint256)

A mapping from a user's address to their total USDC contribution.

hasClaimed

mapping(address => bool)

A mapping that returns true if a user has already claimed their AEC tokens.

Write Functions

User-Facing Functions

  • contribute(uint256 amount): Allows a user to contribute amount of USDC to the launch. Can only be called during the 48-hour contribution window.

  • emergencyWithdraw(): A safety function that allows a user to withdraw their contributed USDC. This is only available for the first 24 hours of the launch window.

  • claim(): After the launch is finalized, contributors can call this function to receive their proportional share of AEC tokens.

  • batchClaim(address[] calldata users): A gas-saving function that allows anyone to trigger the claim process for multiple users at once.

  • refund(): If the launch ends without meeting the $10,000 USDC minimum raise, this function becomes available for all contributors to safely reclaim 100% of their USDC.

Public Functions

  • finalizeLaunch(): A permissionless function that can be called by anyone after the launchEndTime has passed. It finalizes the sale, calculates the price, and transfers all collected USDC to the liquidityDeployer.


View Functions

  • getLaunchStatus(): Returns a summary of the launch's current state, including whether it is active, ended, or finalized, the time remaining, total USDC raised, and the number of contributors.

  • getClaimableAmount(address user): Returns the exact amount of AEC a specific user is eligible to claim after the launch is finalized.

  • getUserInfo(address user): Returns a user's contribution details, including their contributed amount, their claimable AEC, whether they have claimed, and their percentage share of the total raise.

  • previewClaim(address user): A function to preview a user's potential AEC allocation based on the current state of the launch before it is finalized.


Events

  • LaunchStarted(uint256 startTime, uint256 endTime): Emitted at contract deployment, logging the start and end times of the contribution window.

  • Contributed(address indexed user, uint256 amount, uint256 totalRaised): Emitted each time a user successfully contributes USDC.

  • LaunchFinalized(uint256 totalRaised, uint256 totalAEC): Emitted when finalizeLaunch() is successfully called, locking in the final results of the sale.

  • Claimed(address indexed user, uint256 aecAmount, uint256 refund): Emitted when a user successfully claims their AEC tokens.

  • EmergencyWithdrawn(address indexed user, uint256 amount): Emitted when a user uses the emergencyWithdraw or refund function.

Last updated