Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AMM Plus Strategy - Yield Optimizer with Arbitrage Detection

📋 Overview

This repository contains an automated market maker (AMM) strategy that implements a yield optimizer with arbitrage detection for the NEAR blockchain ecosystem. The strategy focuses on selling CRANS tokens to obtain other tokens (primarily NEAR/stNEAR) while detecting and exploiting arbitrage opportunities across different liquidity pool routes.

🎯 Strategy Description

Core Concept

  • Direction: Sells CRANS tokens to acquire NEAR/stNEAR
  • Method: Multi-path arbitrage detection across various LP pairs
  • Optimization: Yield maximization through route comparison and selection

Key Components

1. Supervisor (yieldOptimizer.tsx)

The main yield optimization engine that:

  • Manages the complete trading cycle
  • Handles CRANS token sales across multiple routes
  • Coordinates with Ref Finance DEX
  • Implements safety mechanisms and cooldown periods
  • Tracks and reports profit/loss

2. Arbitrage (arbitrageDetector.tsx)

The arbitrage detection system that:

  • Simulates multiple trading routes in real-time
  • Compares expected returns across different LP paths
  • Identifies the most profitable route
  • Validates arbitrage opportunities before execution

🛠 Technical Architecture

Trading Routes

The system evaluates multiple routes for CRANS token sales:

Primary Routes:
- CRANS → NEAR → stNEAR
- CRANS → SHITZU → NEAR → stNEAR
- CRANS → BD → NEAR → stNEAR
- CRANS → SIN → NEAR → stNEAR
- CRANS → PUMP → NEAR → stNEAR

Complex Multi-hop Routes:
- CRANS → SHITZU → BD → NEAR → stNEAR
- CRANS → BD → SHITZU → NEAR → stNEAR

Configuration

  • Base Amount: 500 CRANS per trade
  • Cooldown: 1-3 minutes between cycles
  • Safety Margin: 99.9% slippage protection
  • Gas Limit: 300 TGas

🔧 Dependencies

  • React: Frontend framework
  • NEAR: Priv Keys interaction
  • Rhea Finance SDK: DEX integration
  • Big.js: Precision arithmetic
  • TypeScript: Type safety

🚀 Usage

Prerequisites

  • NEAR wallet with CRANS tokens
  • Rhea Finance deposit to DEX contract
  • Private key configuration

Integration

import { ArbitrageSupervisor } from './yieldOptimizer';
import { CransArbitrage } from './arbitrageDetector';

// Initialize yield optimizer
<ArbitrageSupervisor 
  isEnabled={true}
  onProfit={(profit) => console.log('Profit:', profit)}
  onRouteFound={(route) => console.log('Best route:', route)}
/>

📊 Performance Metrics

The system provides real-time monitoring of:

  • Trade execution success rate
  • Profit/loss tracking
  • Route performance comparison
  • Gas usage optimization
  • Market conditions analysis

📈 Strategy Logic

  1. Balance Check: Verify CRANS token availability
  2. Route Simulation: Test all possible trading paths
  3. Arbitrage Detection: Identify most profitable route
  4. Execution: Execute trades with safety margins
  5. Profit Calculation: Track and report returns
  6. Cooldown: Wait before next cycle

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages