Skip to content

kevan1/mimic-hackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sushi Token Auto-Buyer

An automated task that monitors Sushi.com for new token listings and automatically executes purchases when new tokens are detected.

🎯 What it does

  1. Token Detection: Monitors Sushi.com for newly listed tokens (simulated for demo)
  2. Duplicate Prevention: Tracks already processed tokens to avoid duplicate purchases
  3. Automatic Execution: Creates purchase intents when new tokens are found
  4. Configurable Parameters: Allows you to set purchase amount, slippage, and recipient

🛠 Setup

Prerequisites

  • Mimic Protocol CLI installed
  • Node.js and yarn

Configuration Parameters

When deploying, you'll configure these inputs:

  • chainId: Target blockchain (1 for Ethereum mainnet)
  • baseToken: Token to spend (e.g., USDC address: 0xA0b86a33E6411a3330E1b5e1eB8aaD0aF4bc8b6d)
  • swapAmount: Amount to spend per new token (in wei)
  • recipient: Where to send purchased tokens
  • maxFee: Maximum execution fee for Mimic
  • slippageBps: Slippage tolerance in basis points (e.g., 300 = 3%)

🚀 Deployment

  1. Compile the task:

    mimic compile
  2. Deploy to Mimic Registry:

    mimic deploy
  3. Schedule in UI:

    • Go to Mimic Protocol UI
    • Import your deployed task
    • Set scheduling (recommended: every 5-10 minutes)
    • Configure input parameters
    • Start the automation

💡 How it works

Token Detection (Production Implementation)

In a production version, the getNewTokenFromSushi() function would:

  1. Web Scraping: Make HTTP requests to Sushi.com
  2. HTML Parsing: Extract token addresses from the page content
  3. Address Validation: Verify addresses are valid ERC20 tokens
  4. Duplicate Checking: Compare against stored list of processed tokens
// Production example:
function getNewTokenFromSushi(): string | null {
  const response = Http.get('https://www.sushi.com/api/tokens')
  const tokensData = JSON.parse(response.body)
  
  const processedTokens = getProcessedTokens()
  
  for (const token of tokensData.tokens) {
    if (!processedTokens.includes(token.address)) {
      storeToken(token.address)
      return token.address
    }
  }
  
  return null
}

Purchase Execution

When a new token is detected:

  1. Intent Creation: Creates a Mimic intent for the purchase
  2. Slippage Protection: Applies configured slippage tolerance
  3. Fee Management: Uses specified maximum fee
  4. Logging: Records transaction details

Storage & State

  • Uses Mimic's storage system to track processed tokens
  • Prevents duplicate purchases of the same token
  • Maintains state across executions

🔧 Customization

Adding Real Web Scraping

Replace the demo token detection with actual Sushi.com scraping:

function scrapeSushiWebsite(): string | null {
  const response = Http.get('https://www.sushi.com/')
  const html = response.body
  
  // Parse HTML for new token announcements
  const addressPattern = /0x[a-fA-F0-9]{40}/g
  const addresses = html.match(addressPattern)
  
  // Filter and validate addresses
  // Return first new token found
}

Enhanced Filtering

Add criteria for token selection:

  • Minimum liquidity requirements
  • Trading volume thresholds
  • Token age restrictions
  • Whitelist/blacklist functionality

Multi-DEX Support

Extend to monitor multiple exchanges:

  • SushiSwap
  • Uniswap
  • PancakeSwap
  • Others

⚠️ Important Notes

Demo vs Production

This current implementation is a demonstration that:

  • Uses hardcoded token addresses for testing
  • Simulates token detection logic
  • Creates transfer intents instead of actual swaps

Production Considerations

For live trading:

  1. Implement real web scraping of Sushi.com
  2. Add proper swap logic using DEX routers
  3. Include risk management (position limits, stop losses)
  4. Add monitoring and alerts
  5. Test thoroughly on testnet first

Security

  • Never share private keys
  • Use small test amounts initially
  • Monitor all transactions
  • Set reasonable slippage limits
  • Implement emergency stop mechanisms

📊 Monitoring

The automation logs key events:

  • Token detection attempts
  • New token discoveries
  • Purchase executions
  • Error conditions

Monitor these logs in the Mimic UI to track performance.

🛡 Risk Management

  • Position Limits: Set maximum spend per token
  • Slippage Protection: Configure acceptable slippage
  • Fee Limits: Set maximum gas/execution fees
  • Token Validation: Verify tokens before purchase
  • Emergency Stops: Ability to pause automation

🤝 Contributing

To extend this automation:

  1. Fork the repository
  2. Implement additional features
  3. Test thoroughly
  4. Submit pull request

📞 Support

For issues with:

  • Mimic Protocol: Discord | Docs
  • This Automation: Create an issue in this repository

⚠️ DISCLAIMER: This is experimental software for educational purposes. Use at your own risk. Always test with small amounts first.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors