> For the complete documentation index, see [llms.txt](https://surgeai.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://surgeai.gitbook.io/docs/technical/core-contract.md).

# Core-Contract

## Surge Smart Contract

### 📋 Contract Function Overview

#### 1. AI Token Issuance

* Create dedicated tokens for AI projects
* Support token minting, transfer, and burning
* 6 decimal precision for accurate calculations

#### 2. Project Crowdfunding

* Project owners can initiate crowdfunding campaigns
* Investors can participate with SUI tokens
* Support for target amount setting and time control
* Automatic handling of successful or failed crowdfunding

#### 3. Milestone Unlocking

* Tokens are not released all at once
* Gradual unlocking based on project progress
* Unlock a certain percentage upon reaching each milestone
* Prevents concentrated token dumping

#### 4. Liquidity Management

* Automatically create liquidity pools on Cetus protocol
* Support token swapping and price discovery
* Ensure sufficient token liquidity

### 🏗️ Contract Architecture

```
User Interface (Frontend)
    ↓
Smart Contract Layer
├── AI Token Contract (ai.move)
├── Project Management Contract (project_manager.move)
├── Milestone Contract (milestone.move)
├── Launchpad Contract (launchpad_manager.move)
└── Cetus Integration Contract (cetus.move)
    ↓
Sui Blockchain
```

### 💰 Token Economic Model

#### Token Distribution

* **Total Supply**: 1 billion AI tokens
* **Initial Release**: 100 million (10%) - Available at project launch
* **Vested Tokens**: 900 million (90%) - Gradually unlocked

#### Unlocking Mechanism

1. **Milestone Unlocking**: Unlock a certain percentage upon reaching each milestone

### 🚀 Understand our Contract

#### For Project Owners

**1. Create AI Token**

```move
// Initialize your AI token
ai::init(AI {}, ctx);
```

**2. Launch Crowdfunding Project**

```move
// Set crowdfunding parameters
project_manager::initialize_project_manager<USDA, AI>(
    target_funds,    // Target amount
    clock,           // Time control
    owner,           // Project owner
    count,           // Project number
    launch_admin,    // Admin permissions
    ctx
);
```

**3. Manage Project Progress**

* Set milestone goals
* Update project status
* Handle crowdfunding results

#### For Investors

**1. Participate in Crowdfunding**

```move
// Participate in crowdfunding with USDA tokens
project_manager::fund_project<USDA>(
    project_manager,  // Project address
    payment,         // Your investment amount
    ctx
);
```

**2. Claim Tokens**

```move
// Claim tokens after successful crowdfunding
project_manager::claim_tokens<AI>(
    project_manager,
    ctx
);
```

**3. Request Refund**

```move
// Request refund if crowdfunding fails
project_manager::claim_refund<USDA>(
    project_manager,
    ctx
);
```

#### For Liquidity Providers

**1. Add Liquidity**

```move
// Add liquidity to Cetus pool
cetus::add_liquidity(
    pool,
    coin_a,
    coin_b,
    ctx
);
```

**2. Remove Liquidity**

```move
// Remove liquidity from pool
cetus::remove_liquidity(
    pool,
    liquidity,
    ctx
);
```

### 🔧 Technical Parameters

#### Network Configuration

* **Mainnet**: `https://fullnode.mainnet.sui.io`
* **Testnet**: `https://fullnode.testnet.sui.io`
* **Devnet**: `https://fullnode.devnet.sui.io`

#### Contract Addresses

* **AI Token**: `0x0` (Update after deployment)
* **Cetus Protocol**: `0xb2a1d27337788bda89d350703b8326952413bd94b35b9b573ac8401b9803d018`

#### Key Constants

* **Maximum Supply**: 1,000,000,000 AI tokens
* **Initial Release**: 100,000,000 (10%)
* **Token Precision**: 6 decimals

### 📊 Status Descriptions

#### Milestone Status

* **In Progress**: Working towards milestone
* **Completed**: Milestone achieved, tokens can be unlocked
* **Expired**: Milestone timeout, needs to be reset

### 🔗 Related Links

* [Sui Official Documentation](https://docs.sui.io/)
* [Move Language Documentation](https://move-language.github.io/move/)
* [Cetus Protocol](https://cetus.zone/)

### 🔒 Security

* This is a closed-source project in this stage
* Contract code is not publicly available but audit
* For security inquiries, please contact the development team
* Regular security audits are conducted internally

**Disclaimer**: This contract is for educational and research purposes only. Investment involves risks, please make decisions carefully.
