IMOSale

The IMOSale.sol contract serves as the primary entry point for Initial Model Offerings (IMO), managing the fundraising process for AI model projects. It handles investment collection, investor tier management, token distribution, and coordinates with other IMO ecosystem contracts.

Key Features

  • Manages a time-limited funding period (default 14 days).

  • Handles USDT investments with tier-based access control.

  • Deploys and distributes ERC-7641 compliant IMO tokens.

  • Coordinates fund distribution between project wallet and escrow.

  • Implements emergency stop mechanism for security.

  • Supports upgradable token implementation.

Contract Details

Constants

FUNDING_PERIOD = 14 days
INITIAL_DEPOSIT_PERCENTAGE = 10 // immediate funding amount
ESCROW_PERCENTAGE = 90          // escrowed amount

Key State Variables

fundingEndTime: uint256   // Funding period end timestamp
totalFunds: uint256       // Total USDT collected
investments: mapping      // Tracks individual investments
investorTiers: mapping    // Stores investor tier levels
isFundingClosed: bool     // Funding period status
isEmergencyStopped: bool  // Emergency stop status

Functions

Core Investment Functions

invest(uint256 _amount)

  • Purpose: Enables direct USDT investment in the IMO.

  • Access: Public.

  • Usage: During the active funding period by eligible investors.

  • Input: USDT amount to invest.

  • Validation:

    • Funding period is active.

    • Emergency stop is not active.

    • Investor meets tier requirements.

    • Amount > 0.


investFor(address _investor, uint256 _amount)

  • Purpose: Enables investment through the StablecoinRouter for multiple stablecoin support.

  • Access: StablecoinRouter only.

  • Usage: Upon investing with non-USDT stablecoins.

  • Input: Investor address and USDT amount.


calculateTier(address _investor)

  • Purpose: Determines investor's tier based on their staking amount and duration. Requires Neura Staking contract for tier queries.

  • Returns: Tier level (0-3):

    • 3: Gold.

    • 2: Silver.

    • 1: Bronze.

    • 0: Not eligible.

  • Usage: Validating an investor's eligibility for participation based on their tier.


Funding Management

closeFunding()

  • Purpose: Finalizes funding period and initializes token distribution.

  • Access: Owner only.

  • Process Flow:

    1. Validates that the funding period has ended.

    2. Transfers the initial deposit to the project wallet.

    3. Moves the remaining funds to the EscrowVesting contract.

    4. Deploys IMO token.

    5. Distributes tokens to investors.

    6. Initializes related contracts.


deployIMOToken()

  • Purpose: Deploys an upgradeable ERC-7641 token contract.

  • Process Flow:

    1. Deploys the implementation contract.

    2. Sets up the proxy admin.

    3. Deploys a transparent proxy.

    4. Initializes token parameters.


distributeTokens()

  • Purpose: Mints and distributes IMO tokens to investors.

  • Process Flow: Converts USDT amounts to token amounts (18 decimals).

  • Token Distribution Ratio: 1 USDT (6 decimals) = 1 IMO Token (18 decimals).


Administrative Functions

setEmergencyStop(bool _stop)

  • Purpose: Halts all contract operations in the event of an emergency.

  • Access: Owner only.

  • Usage: When security concerns arise.


adjustFundingPeriod(uint256 _newEndTime)

  • Purpose: Modifies funding period duration.

  • Access: Owner only.

  • Restrictions: Can only be executed before the funding period closes.


updateTokenParameters(string _newName, string _newSymbol, uint256 _newClaimPoolPercentage)

  • Purpose: Updates the IMO token configuration.

  • Access: Owner only.

  • Usage: Before the funding period closes.

  • Parameters:

    • Token name.

    • Token symbol.

    • Claim pool percentage.


setEscrowVesting(address _escrowVesting)

  • Purpose: Links the EscrowVesting contract.

  • Access: Owner only.


setMilestoneChecker(address _milestoneChecker)

  • Purpose: Links MilestoneChecker contract.

  • Access: Owner only.


View Functions

getInvestorTier(address _investor)

  • Purpose: Returns investor's tier level.


getInvestedAmount(address _investor)

  • Purpose: Returns investor's total investment amount.


getInvestorsCount()

  • Purpose: Returns total number of unique investors.


getImoTokenAddress()

  • Purpose: Returns deployed IMO token address.


getUSDTBalance()

  • Purpose: Returns contract's current USDT balance.


Events

InvestmentReceived(address investor, uint256 amount, uint8 tier)
FundingClosed(uint256 totalFunds)
TokensDistributed(address investor, uint256 amount)
EmergencyStop(bool stopped)

Security Features

Access Control

  • Tiered investment system.

  • Owner-only administrative functions.

Fund Safety

  • Escrow mechanism for majority of funds.

  • Emergency stop functionality.

  • Reentrancy protection.

Investment Validation

  • Tier eligibility checks.

  • Zero amount prevention.

  • Transfer success verification.

Upgradability

  • Proxy pattern for IMO token.

  • Controlled upgrade mechanism.

Integration Points

  • Requires the initialized Neura Staking Contract for Tiers (MockStaking contract is being used currently).

  • Integrates with EscrowVesting contract.

  • Coordinates with MilestoneChecker.

  • Optional StablecoinRouter integration for supporting IMO participation with multiple whitelisted ERC-20 tokens.

Last updated