An automated task that monitors Sushi.com for new token listings and automatically executes purchases when new tokens are detected.
- Token Detection: Monitors Sushi.com for newly listed tokens (simulated for demo)
- Duplicate Prevention: Tracks already processed tokens to avoid duplicate purchases
- Automatic Execution: Creates purchase intents when new tokens are found
- Configurable Parameters: Allows you to set purchase amount, slippage, and recipient
- Mimic Protocol CLI installed
- Node.js and yarn
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 tokensmaxFee: Maximum execution fee for MimicslippageBps: Slippage tolerance in basis points (e.g., 300 = 3%)
-
Compile the task:
mimic compile
-
Deploy to Mimic Registry:
mimic deploy
-
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
In a production version, the getNewTokenFromSushi() function would:
- Web Scraping: Make HTTP requests to Sushi.com
- HTML Parsing: Extract token addresses from the page content
- Address Validation: Verify addresses are valid ERC20 tokens
- 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
}When a new token is detected:
- Intent Creation: Creates a Mimic intent for the purchase
- Slippage Protection: Applies configured slippage tolerance
- Fee Management: Uses specified maximum fee
- Logging: Records transaction details
- Uses Mimic's storage system to track processed tokens
- Prevents duplicate purchases of the same token
- Maintains state across executions
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
}Add criteria for token selection:
- Minimum liquidity requirements
- Trading volume thresholds
- Token age restrictions
- Whitelist/blacklist functionality
Extend to monitor multiple exchanges:
- SushiSwap
- Uniswap
- PancakeSwap
- Others
This current implementation is a demonstration that:
- Uses hardcoded token addresses for testing
- Simulates token detection logic
- Creates transfer intents instead of actual swaps
For live trading:
- Implement real web scraping of Sushi.com
- Add proper swap logic using DEX routers
- Include risk management (position limits, stop losses)
- Add monitoring and alerts
- Test thoroughly on testnet first
- Never share private keys
- Use small test amounts initially
- Monitor all transactions
- Set reasonable slippage limits
- Implement emergency stop mechanisms
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.
- 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
To extend this automation:
- Fork the repository
- Implement additional features
- Test thoroughly
- Submit pull request
For issues with: