Skip to content

Forgeforward-Labs/contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sominia Smart Contracts

This directory contains the smart contracts for the Forgeforward protocol, a comprehensive platform that provides token creation, locking, and airdrop distribution services.

πŸ—οΈ Project Structure

smart-contracts/
β”œβ”€β”€ contracts/                    # Solidity smart contracts
β”‚   β”œβ”€β”€ Airdrop/                 # Airdrop distribution contracts
β”‚   β”‚   └── Distributor.sol      # Main airdrop distributor contract
β”‚   β”œβ”€β”€ lockFactory/             # Token locking system
β”‚   β”‚   β”œβ”€β”€ Factory.sol          # Factory for creating token locks
β”‚   β”‚   └── TokenLock.sol        # Individual token lock contract
β”‚   └── tokenFactory/            # Token creation system
β”‚       β”œβ”€β”€ Factory.sol          # Factory for creating tokens
β”‚       └── tokens/              # Token implementations
β”‚           β”œβ”€β”€ FeeToken.sol     # Token with transfer fees
β”‚           └── Standard.sol     # Standard ERC20 token
β”œβ”€β”€ ignition/                    # Hardhat Ignition deployment modules
β”‚   └── modules/                 # Deployment scripts
β”‚       β”œβ”€β”€ AirdropDistributor.ts
β”‚       β”œβ”€β”€ LockFactory.ts
β”‚       β”œβ”€β”€ TokenFactory.ts
β”‚       └── Counter.ts
β”œβ”€β”€ scripts/                     # Utility scripts
β”œβ”€β”€ test/                        # Test files
└── hardhat.config.ts           # Hardhat configuration

πŸš€ Features

Token Factory

  • Standard Tokens: Create basic ERC20 tokens with customizable parameters
  • Fee Tokens: Create tokens with configurable transfer fees
  • Factory Pattern: Efficient deployment of multiple token instances

Lock Factory

  • Token Locking: Lock tokens for specified time periods
  • Project Integration: Associate locks with project metadata and images
  • Flexible Locking: Support for various lock durations and amounts

Airdrop System

  • Batch Distribution: Efficiently distribute tokens to multiple recipients
  • Gas Optimization: Optimized for large-scale airdrop operations

πŸ› οΈ Technology Stack

  • Solidity: ^0.8.28
  • Hardhat: ^3.0.4 - Development framework
  • OpenZeppelin: ^5.4.0 - Security-focused contract library
  • Viem: ^2.37.3 - TypeScript interface for Ethereum
  • Hardhat Ignition: ^3.0.2 - Deployment management

πŸ“‹ Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn package manager
  • Git

πŸš€ Getting Started

Installation

# Install dependencies
npm install

# Or using yarn
yarn install

Environment Setup

Create a .env file in the root directory with the following variables:

# Sepolia Testnet
SEPOLIA_RPC_URL=your_sepolia_rpc_url
SEPOLIA_PRIVATE_KEY=your_private_key

# Somnia Testnet
SOMNIA_TESTNET_RPC_URL=your_somnia_testnet_rpc_url
SOMNIA_TESTNET_PRIVATE_KEY=your_private_key

Compilation

# Compile contracts
npx hardhat compile

Testing

# Run all tests
npx hardhat test

# Run Solidity tests only
npx hardhat test solidity

# Run TypeScript tests only
npx hardhat test nodejs

πŸš€ Deployment

Local Development

# Deploy to local Hardhat network
npx hardhat ignition deploy ignition/modules/TokenFactory.ts
npx hardhat ignition deploy ignition/modules/LockFactory.ts
npx hardhat ignition deploy ignition/modules/AirdropDistributor.ts

Testnet Deployment

Sepolia Testnet

# Set up private key (first time only)
npx hardhat keystore set SEPOLIA_PRIVATE_KEY

# Deploy to Sepolia
npx hardhat ignition deploy --network sepolia ignition/modules/TokenFactory.ts
npx hardhat ignition deploy --network sepolia ignition/modules/LockFactory.ts
npx hardhat ignition deploy --network sepolia ignition/modules/AirdropDistributor.ts

Somnia Testnet

# Deploy to Somnia Testnet
npx hardhat ignition deploy --network somniaTestnet ignition/modules/TokenFactory.ts
npx hardhat ignition deploy --network somniaTestnet ignition/modules/LockFactory.ts
npx hardhat ignition deploy --network somniaTestnet ignition/modules/AirdropDistributor.ts

πŸ”§ Configuration

The project supports multiple networks:

  • hardhatMainnet: Local simulation of L1 mainnet
  • hardhatOp: Local simulation of Optimism
  • sepolia: Sepolia testnet
  • somniaTestnet: Somnia testnet

πŸ“ Contract Details

TokenFactory

  • Address: Deployed via Ignition modules
  • Events:
    • FeeTokenCreated: Emitted when a fee token is created
    • StandardTokenCreated: Emitted when a standard token is created

LockFactory

  • Address: Deployed via Ignition modules
  • Events:
    • LockCreated: Emitted when a token lock is created

AirdropDistributor

  • Address: Deployed via Ignition modules
  • Features: Batch token distribution with gas optimization

πŸ§ͺ Testing

The project includes comprehensive tests covering:

  • Contract deployment and initialization
  • Token creation (both standard and fee tokens)
  • Token locking functionality
  • Airdrop distribution
  • Access control and permissions
  • Edge cases and error handling

πŸ”’ Security

  • Uses OpenZeppelin's audited contracts
  • Implements proper access controls
  • Follows Solidity best practices
  • Comprehensive test coverage

πŸ“š Documentation

For detailed contract documentation, refer to:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors