Skip to content

A comprehensive Initial DEX Offering (IDO) platform built on Ethereum that enables projects to launch their tokens through a secure, whitelisted crowdfunding mechanism. This platform allows projects to raise ETH in exchange for their ERC-20 tokens with built-in access control, pool management, and automated token distribution.

License

Notifications You must be signed in to change notification settings

Vector-6/Automation_Swap_ETH---ERC20

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

IDO Platform - Ethereum Token Launchpad

A comprehensive Initial DEX Offering (IDO) platform built on Ethereum that enables projects to launch their tokens through a secure, whitelisted crowdfunding mechanism. This platform allows projects to raise ETH in exchange for their ERC-20 tokens with built-in access control, pool management, and automated token distribution.

๐Ÿš€ Features

Core Functionality

  • Pool Management: Create and manage fundraising pools with configurable hard caps, soft caps, and timeframes
  • Whitelist System: Secure access control ensuring only approved participants can invest
  • Token Distribution: Automated ERC-20 token distribution based on investment amounts
  • Role-Based Access: Multi-level permission system with admin and pool owner roles
  • Refund Mechanism: Secure token claiming system for participants
  • Real-time Tracking: Complete visibility into pool status, participants, and raised funds

Security Features

  • OpenZeppelin Integration: Built on battle-tested security libraries
  • Access Control: Role-based permissions with granular control
  • Pausable Contracts: Emergency stop functionality for security
  • Input Validation: Comprehensive validation for all user inputs
  • Reentrancy Protection: Secure against common attack vectors

๐Ÿ“‹ Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn
  • Git
  • Ethereum wallet (MetaMask recommended)
  • Hardhat development environment

๐Ÿ› ๏ธ Installation

  1. Clone the repository

    git clone https://github.com/your-username/Atomic-swap-eth-erc20.git
    cd Atomic-swap-eth-erc20
  2. Install dependencies

    npm install
  3. Environment Setup Create a .env file in the root directory:

    NETWORK_GATEWAY_API=your_ethereum_rpc_url
    POOL_OWNER_PRIMARY_KEY=your_private_key
    DEPLOYER_PRIMARY_KEY=your_deployer_private_key
    RAISED_WEI_RECEIVER_PRIMARY_KEY=your_receiver_private_key
    RAISED_WEI_RECEIVER_ADDRESS=your_receiver_address

๐Ÿ—๏ธ Smart Contract Architecture

Core Contracts

IDO.sol - Main Contract

The central contract managing the entire IDO process:

  • Pool creation and management
  • Role-based access control
  • Whitelist management
  • Token distribution coordination

Pool.sol - Pool Management

Handles individual fundraising pools:

  • Investment tracking
  • Participant management
  • Pool status updates
  • Fund collection

ProjectToken.sol - ERC-20 Token

Standard ERC-20 token implementation for project tokens:

  • Mintable tokens
  • Transfer functionality
  • Balance tracking

Whitelist.sol - Access Control

Manages participant whitelisting:

  • Address validation
  • Whitelist management
  • Access verification

Validations.sol - Input Validation

Utility library for input validation:

  • Address validation
  • Zero address checks

Interface Definitions

IPool.sol - Pool Interface

Defines the structure and methods for pool operations:

  • Pool models and data structures
  • Status enums
  • Method signatures

๐Ÿš€ Usage

Development

  1. Start local blockchain

    npm run node
  2. Deploy contracts locally

    npm run deployLocal
  3. Run tests

    npm test
  4. Run tests with events

    npm run testWithEvents

Deployment

  1. Deploy to testnet

    npm run deployTestNet
  2. Deploy to mainnet

    npx hardhat deploy --network mainnet

๐Ÿ“Š Pool Lifecycle

1. Pool Creation

  • Pool owner creates a new fundraising pool
  • Sets hard cap, soft cap, start/end times
  • Initial status: Upcoming

2. IDO Configuration

  • Add project token details
  • Set exchange rates and pricing
  • Configure allocation limits

3. Whitelist Management

  • Add approved participants
  • Manage access permissions

4. Fundraising Phase

  • Pool status: Ongoing
  • Whitelisted users can invest ETH
  • Real-time tracking of raised funds

5. Token Distribution

  • Pool status: Finished
  • Participants claim their tokens
  • One-time claim per participant

๐Ÿงช Testing

The project includes comprehensive test coverage:

# Run all tests
npm test

# Run tests with detailed logs
npm run testWithEvents

# Lint Solidity code
npm run solhint

# Format Solidity code
npm run prettier:solidity

Test Coverage

  • Pool creation and management
  • Whitelist functionality
  • Investment and refund processes
  • Access control validation
  • Edge cases and error handling

๐Ÿ”ง Configuration

Hardhat Configuration

The project uses Hardhat for development and deployment:

  • Solidity Version: 0.8.0
  • Optimizer: Enabled (200 runs)
  • Networks: Local, Rinkeby (commented), Mainnet ready
  • Plugins: Ethers, Waffle, Solhint, Prettier

TypeScript Support

  • Full TypeScript configuration
  • Type definitions for all dependencies
  • Compile-time error checking

๐Ÿ“ Project Structure

โ”œโ”€โ”€ contracts/           # Smart contracts
โ”‚   โ”œโ”€โ”€ IDO.sol         # Main IDO contract
โ”‚   โ”œโ”€โ”€ Pool.sol        # Pool management
โ”‚   โ”œโ”€โ”€ ProjectToken.sol # ERC-20 token
โ”‚   โ”œโ”€โ”€ Whitelist.sol   # Access control
โ”‚   โ”œโ”€โ”€ Validations.sol # Input validation
โ”‚   โ””โ”€โ”€ IPool.sol       # Pool interface
โ”œโ”€โ”€ scripts/            # Deployment scripts
โ”‚   โ””โ”€โ”€ deploy.ts       # Main deployment script
โ”œโ”€โ”€ test/              # Test files
โ”‚   โ””โ”€โ”€ ido.ts         # Comprehensive test suite
โ”œโ”€โ”€ helpers/           # Utility functions
โ”‚   โ””โ”€โ”€ bigNumber.ts   # BigNumber utilities
โ”œโ”€โ”€ hardhat.config.ts  # Hardhat configuration
โ”œโ”€โ”€ package.json       # Dependencies and scripts
โ””โ”€โ”€ tsconfig.json      # TypeScript configuration

๐Ÿ”’ Security Considerations

  • Access Control: Multi-level role-based permissions
  • Input Validation: Comprehensive validation for all inputs
  • Reentrancy Protection: Secure against reentrancy attacks
  • Integer Overflow: SafeMath operations (Solidity 0.8.0+)
  • Emergency Stops: Pausable functionality for emergencies

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

  • Follow Solidity style guide
  • Use Prettier for formatting
  • Run Solhint for linting
  • Write comprehensive tests

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Milad Mehdizade

๐Ÿ†˜ Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Contact the maintainer directly

๐Ÿ”ฎ Roadmap

  • Multi-token support
  • Advanced analytics dashboard
  • Integration with DEX aggregators
  • Mobile app support
  • Cross-chain compatibility
  • Automated KYC integration

โš ๏ธ Disclaimer: This software is provided for educational and development purposes. Always conduct thorough testing and security audits before deploying to mainnet. The authors are not responsible for any financial losses.

About

A comprehensive Initial DEX Offering (IDO) platform built on Ethereum that enables projects to launch their tokens through a secure, whitelisted crowdfunding mechanism. This platform allows projects to raise ETH in exchange for their ERC-20 tokens with built-in access control, pool management, and automated token distribution.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published