A decentralized automated trading protocol built on Uniswap v4 that enables limit orders and dollar-cost averaging (DCA) orders through Reactive Network technology. This project eliminates the need for manual intervention in trading strategies by leveraging reactive smart contracts that execute orders automatically based on price conditions or time intervals.
Our current DEX trading requires constant monitoring and manual execution. This project addresses:
- Automated Limit Orders: Execute trades when price targets are reached
- Dollar Cost Averaging: Spread purchases over time to reduce volatility impact
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Reactive β β Cross-Chain β β Destination β
β Network ββββββ Bridge ββββββ Chain β
β (Cron Events) β β β β (Ethereum) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Cron Contract β β Callback β β Hook Contract β
β (Triggers) ββββββ Contract ββββββ (Execution) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β Uniswap v4 β
β Pool Manager β
βββββββββββββββββββ
Cron.sol: Reactive smart contract on Reactive Network that monitors time-based eventsCallback.sol: Receives cross-chain triggers and initiates order executionHook.sol: Uniswap v4 hook implementing limit orders and DCA functionalityPriceOracle.sol: Provides price feeds for order condition validation
This project is submitted for the Reactive Network Grant Program. See GRANT_APPLICATION.md for complete grant application details including:
- Comprehensive problem statement and solution architecture
- 2-milestone development roadmap
- Technical specifications and workflow documentation
- Grant payment structure and deliverables
- RSC Development & Testnet Integration
- Mainnet Deployment & Production Integration
# Clone the repository
git clone https://github.com/your-username/newera-finance-react-network.git
cd newera-finance-react-network
# Install dependencies
forge install
# Build contracts
forge build# Start local test environment
anvil
# Run tests
forge test
# Run specific test file
forge test --match-path test/New.t.sol -v- Grant Application - Complete grant proposal and technical specifications
- Workflow Documentation - Detailed execution flows and examples
- API Reference - Contract interfaces and function documentation
forge test# Test limit order functionality
forge test --match-test test_limitOrderExecution -v
# Test DCA functionality
forge test --match-test test_dcaOrderExecution -vforge coverage# Set environment variables
export PRIVATE_KEY=your_private_key
export REACTIVE_RPC_URL=https://reactive.network/rpc
# Deploy reactive contract
forge script script/DeployReactive.s.sol --rpc-url $REACTIVE_RPC_URL --broadcast --verify# Set environment variables
export PRIVATE_KEY=your_private_key
export ETH_RPC_URL=https://mainnet.infura.io/v3/YOUR_PROJECT_ID
# Deploy callback contract
forge script script/DeployCallback.s.sol --rpc-url $ETH_RPC_URL --broadcast --verifyThe hook contract is deployed through the Uniswap v4 deployment process with specific permissions for automated trading.
# Private key for deployment
PRIVATE_KEY=your_private_key_here
# RPC URLs
REACTIVE_RPC_URL=https://reactive.network/rpc
ETH_RPC_URL=https://mainnet.infura.io/v3/YOUR_PROJECT_ID
ARBITRUM_RPC_URL=https://arb1.arbitrum.io/rpc
# Contract addresses (after deployment)
REACTIVE_CONTRACT_ADDRESS=0x...
CALLBACK_CONTRACT_ADDRESS=0x...
HOOK_CONTRACT_ADDRESS=0xAd33Fff75D8B3C75EdD6D63e9D537400784e2000The system supports multiple chains:
- Reactive Network: Origin chain for cron triggers
- Ethereum Mainnet: Primary destination chain
- Arbitrum One: Secondary destination chain for lower fees
- Polygon: Additional destination chain support
- Execution Success Rate: >99% across all order types
- Average Gas Cost: 145,000 gas per execution
- Cross-Chain Latency: <5 seconds
- Order Completion Rate: 99.9% for DCA orders
- Cron Contract:
0xc3452836732be1cd06269205251fbe1917f42767 - System Contract:
0xc9f36411C9897e7F959D99ffca2a0Ba7ee0D7bDA
- Callback Contract:
0xE5449F5f2DBC9e596aA37E4DA0e75F5360bDc636 - Hook Contract:
0x9a57784250f0de5b20ba70cb56535a280a93e000
- Comprehensive test suite with 99%+ coverage
- Formal verification planned for production deployment
- Multi-sig controls for critical functions
- Admin pause functionality for all automated executions
- User-level order cancellation at any time
- Circuit breakers for anomalous market conditions
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Write tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the GPL-2.0-or-later License - see the LICENSE file for details.
- Reactive Network for providing the reactive smart contract infrastructure
- Uniswap v4 for the advanced automated market maker technology
- Foundry for the excellent development tooling
Disclaimer: This software is for educational and research purposes. Users should understand the risks involved in automated trading and DeFi protocols. Always test thoroughly on testnets before mainnet deployment.