Unruggable Meme Framework

repository·main·Indexed 41 days ago

https://github.com/keep-starknet-strange/unruggable.meme

A security-focused framework for launching and verifying memecoins on Starknet. It provides tools to prevent rugpulls through contract-level safeguards, including a Factory for ERC20 deployment, a Locker manager for token locks, and automated launch integrations for Ekubo and Jediswap.

Tokens
24.9K
Snippets
94
Records
117
Agent score
51%

What's inside Unruggable Meme

  1. Overview of Unruggable Memecoin contracts

    main

    The Unruggable framework consists of several core contracts:

    • Factory (contracts/src/factory/factory.cairo): The primary entrypoint. Responsible for creating and launching Memecoins.
    • Memecoin (contracts/src/token/memecoin.cairo): The ERC20 token contract containing framework-specific properties.
    • Locker manager (contracts/src/locker/locker_manager.cairo): Manages token locks. It abstracts accountability by deploying specific contracts to hold tokens for a set period.
    • EkuboLauncher (contracts/exchanges/ekubo/launcher.cairo): Automates the Ekubo launch process, manages liquidity positions, and allows owners to withdraw earned fees.
  2. Overview of Unruggable Meme

    main

    Unruggable Meme is a framework designed for building safer memecoins on Starknet. It provides innovative contracts and safeguards to prevent rugpulls, ensuring security and transparency for both creators launching tokens and traders verifying token safety.

    Key Use Cases:

    • Token Launchers: Use the framework to launch memecoins with built-in safeguards like locked Liquidity Pool (LP) tokens and controlled token supply allocation.
    • Traders: Use the platform to check if a memecoin is 'safu' (safe) before investing.

    ⚠️ Security Warning: The Unruggable Memecoin contracts have not yet undergone security audits. While they offer more security than standard tokens (via LP locking and supply safeguards), they may still contain undiscovered vulnerabilities. Use at your own risk and perform due diligence.

  3. Create and launch an Unruggable Memecoin

    main

    The Unruggable framework follows a two-step process to create a memecoin:

    1. Deploy the Memecoin

    Use the Factory contract to deploy a new Memecoin contract. You must specify:

    • The owner of the memecoin
    • Name
    • Symbol
    • Total supply

    The resulting Memecoin is ERC20 compliant and includes framework-specific functions like is_launched, get_team_allocation, and liquidity_type.

    2. Launch on an Exchange

    Once deployed, you must launch the token on an exchange. You need to provide:

    • The address of the memecoin
    • Duration of transfer restrictions
    • Maximum percentage of total supply allowed in a single transaction (while restrictions are active)
    • Address of the quote token (e.g., ETH or STRK)

    Launching on Jediswap

    Requires providing an amount of liquidity in quote tokens and an unlock time for the LP tokens. The liquidity position is transferred to a locker for a configurable duration (minimum 6 months).

    Launching on Ekubo (Capital Efficient)

    Ekubo launching allows for liquidity within fixed bounds, meaning you don't need a large amount of quote tokens. The process is automated via the EkuboLauncher:

    1. The team sends quote token liquidity (covering their team allocation at the starting price) to the Factory.
    2. The Factory creates liquidity positions in two steps, concentrating the team's allocation in the first tick.
    3. The Factory uses the provided quote tokens to buy back the team's tokens from the pool and transfers them to specified initial holders.
    4. The principal liquidity position is held by the EkuboLauncher contract and is locked forever. Owners can withdraw earned fees via this contract.
  4. Test the Unruggable contracts

    main

    Testing is performed using Starknet Foundry (snforge).

    Unit Tests

    Run tests locally in isolation. No RPC provider is required.

    snforge test unit_tests

    Fork Tests

    Run tests on a fork of Starknet mainnet (required for testing Ekubo interactions).

    Setup Requirements:

    1. Obtain an API key from an RPC provider (Nethermind or BlastAPI recommended for v6.0 support).
    2. Update the [[tool.snforge.fork]] section in Scarb.toml with your RPC URL.
    3. Run the tests:
    snforge test
  5. Understand Memecoin liquidity types

    main

    Liquidity for launched memecoins is categorized into two main types via the LaunchedLiquidity union:

    1. JediswapLiquidity: Uses LiquidityType.JEDISWAP_ERC20 or LiquidityType.STARKDEFI_ERC20. It requires a lockPosition (string) and quoteAmount (string).
    2. EkuboLiquidity: Uses LiquidityType.EKUBO_NFT. It requires an ekuboId (string), startingTick (number), poolKey (an EkuboPoolKey object), and bounds (an EkuboBounds object).

    Both types inherit BaseLiquidity properties: lockManager, unlockTime, owner, and quoteToken.

    export type JediswapLiquidity = {
      type: LiquidityType.JEDISWAP_ERC20 | LiquidityType.STARKDEFI_ERC20
      lockPosition: string
      quoteAmount: string
    } & Omit<BaseLiquidity, 'type'>
    
    export type EkuboLiquidity = {
      type: LiquidityType.EKUBO_NFT
      ekuboId: string
      startingTick: number
      poolKey: EkuboPoolKey
      bounds: EkuboBounds
    } & Omit<BaseLiquidity, 'type'>
  6. Understand the StoreState composition

    main

    The global StoreState is a union type of the following slices. When building custom hooks or components that interact with the store, you can rely on the properties defined in these interfaces:

    • ApplicationSlice: Application-level configuration and status.
    • ContractsSlice: Data related to deployed Starknet contracts.
    • LaunchSlice: State related to the launch sequence/mechanics.
    • TransactionSlice: State tracking pending, successful, or failed transactions.
  7. Create a multi-step form for the Telegram bot

    main

    Use createForm to define a sequence of interactive steps (fields) for a user in a specific chat. A form can contain text fields (for free-form user input with optional Zod validation) or choice fields (for inline keyboard buttons).

    To use a form, you must:

    1. Define the fields using defineField to ensure type safety.
    2. Initialize the form with createForm(chatId, fields).
    3. Register the form in the global Forms registry using Forms.setForm(chatId, form).
    4. Use form.setActiveField(fieldName) to prompt the user for the next piece of data.

    The bot automatically handles incoming message events for text fields and callback_query events for choice fields, triggering the respective handler functions defined in your fields.

    import { createForm, defineField, Forms } from './utils/form';
    import { z } from 'zod';
    
    const chatId = 12345;
    
    const form = createForm(chatId, {
      userName: defineField({
        type: 'text',
        validation: z.string().min(3),
        message: 'Please enter your username:',
        handler: ({ value, msg }) => {
          console.log(`User entered: ${value}`);
          // Move to next field
          form.setActiveField('age');
        }
      }),
      age: defineField({
        type: 'choice',
        choices: [
          { key: 'young', title: 'Young' },
          { key: 'old', title: 'Old' }
        ],
        message: 'Select your age group:',
        handler: ({ value, query }) => {
          console.log(`User chose: ${value}`);
          Forms.resetForm(chatId);
        }
      })
    });
    
    // Register the form so the bot listeners can find it
    Forms.setForm(chatId, form);
    
    // Start the first step
    form.setActiveField('userName');
  8. Initialize the Factory with configuration

    main

    To interact with the memecoin ecosystem (deploying, launching, or querying memecoins), instantiate the Factory class by providing a FactoryConfig object. The configuration requires a provider and a chainId to correctly resolve contract addresses and interact with the Starknet network.

    import { Factory } from './factory/default';
    
    const factory = new Factory({
      provider: myStarknetProvider,
      chainId: 1,
    });
  9. Launch a memecoin via Telegram Bot

    main

    The Telegram bot provides a multi-step interactive form to launch an unruggable memecoin. The process involves specifying the token address, selecting an AMM, configuring team allocations, setting anti-bot parameters, and defining liquidity lock terms.

    Key Launch Parameters:

    • Token Address: Must be a valid, unlaunched unruggable memecoin address.
    • AMM Selection: Choose between available AMMs (e.g., EKUBO or standard AMMs).
    • Team Allocations: Up to 10 addresses can be assigned tokens. The total allocation cannot exceed 10% of the total supply.
    • Hold Limit: A percentage (recommended 1%) that limits how much a single holder can own.
    • Anti-bot Period: A time (hh:mm format) after which anti-bot features are disabled.
    • Starting Market Cap: The initial USD market cap (recommended $10.00).
    • Liquidity Lock: For standard AMMs, you can specify a duration in months (6-24) or type forever for a permanent lock.