Built with ❄️ by the YETI team for EthGlobal Unite DeFi Hackathon 2025
YETI is a DeFi trading app that bridges TradingView alerts to automated on-chain limit orders using the 1inch Limit Order Protocol. Essentially, it lets you use any TradingView indicators or custom Pine Script strategies to trigger on-chain trades automatically. YETI transforms your existing TradingView strategies into secure, non-custodial, automated trading systems.
YETI consists of six interconnected components that work together to provide a complete TradingView-to-DeFi trading solution:
TradingView Alert → Webhook Server → Smart Contracts → Order Execution
↓ ↓
Frontend UI ← → Orderbook Server ← → Order Watcher
- Webhook Server (Python/FastAPI) - Receives and validates TradingView webhooks; Running in a TEE
- Smart Contracts (Solidity) - On-chain oracle and predicate validation
- Frontend Application (Next.js/React) - User interface for order management
- Yeti SDK (TypeScript) - Core library for order creation and management
- Orderbook Server (Node.js/Express) - Order storage and discovery service
- Order Watcher (Node.js) - Automated order execution service
- Non-Custodial Security: Funds never leave your wallet
- TradingView Integration: Use your existing strategies and indicators
- Automated Execution: Orders execute automatically when alerts trigger
- Open & Verifiable: All trades recorded on-chain with full transparency
- TEE Security: Trusted Execution Environment for webhook authentication and oracle
- Smart Contracts: Solidity, Foundry, 1inch Limit Order Protocol, Solady
- Backend: Python (FastAPI), Node.js (Express), TypeScript
- Frontend: Next.js, React, TailwindCSS, Framer Motion
- Database: SQLite with better-sqlite3
- Blockchain: Base for now but EVM compatible
- Security: Chainlink oracles, HMAC webhook validation, TEE integration
- Connect your wallet
- Select trading pair and amounts
- Sign the order (no funds transferred)
- Copy the generated webhook URL and secret
- Create a new alert in TradingView
- Set the webhook URL from step 1
- Set the message to:
buy_[secret]orsell_[secret] - Configure your trading conditions
- Save the alert
When your TradingView alert triggers:
- Webhook server receives and validates the alert
- Alert data is stored on-chain via WebhookOracle
- Order watcher detects the alert
- Takers can execute the 1inch limit order
- Order status updates in the orderbook
You can check pending and filled ordered in the Dashboard.
- Node.js 18+ and npm/yarn
- Python 3.9+ and uv
- Git
- A Web3 wallet (MetaMask recommended)
- TradingView Pro account (for webhook alerts)
git clone https://github.com/0xAkuti/yeti.git
cd yeticd contracts
forge install
forge build
forge test
# Deploy to local network (anvil)
anvil &
forge script script/SetupAnvilEnvironment.s.sol --broadcast --rpc-url http://localhost:8545cd webhook-server
cp .env.example .env
# Edit .env with your configuration
uv sync
uv run main.pycd orderbook-server
npm install
cp .env.example .env
# Edit .env with contract addresses
npm run db:setup
npm run devcd yeti-order-manager
npm install
cp .env.sample .env
# Edit .env with your private key and contract addresses
npm run watch-orderscd yeti-frontend2
npm install
cp .env.example .env.local
# Edit .env.local with your configuration
npm run devCONTRACT_ADDRESS=0x... # WebhookOracle contract address
RPC_URL=http://localhost:8545 # Blockchain RPC endpoint
DSTACK_SIMULATOR_ENDPOINT=... # TEE endpoint
TEE_SECRET=123 # TEE secret key
NGROK_AUTHTOKEN=... # Ngrok auth token for public webhooksRPC_URL=http://localhost:8545 # Blockchain RPC
PRIVATE_KEY=0x... # Trading wallet private key
ORDERBOOK_URL=http://localhost:3002 # Orderbook server URL
WEBHOOK_SERVER_URL=http://localhost:3001 # Webhook server URL
LIMIT_ORDER_PROTOCOL_ADDRESS=0x111111125421cA6dc452d289... # 1inch contract
WEBHOOK_ORACLE_ADDRESS=0x... # Oracle contract
WEBHOOK_PREDICATE_ADDRESS=0x... # Predicate contractPORT=3002 # Server port
RPC_URL=http://localhost:8545 # Blockchain RPC
WEBHOOK_ORACLE_ADDRESS=0x... # Oracle contract
WEBHOOK_PREDICATE_ADDRESS=0x... # Predicate contract
ALERT_MONITOR_ENABLED=true # Enable blockchain monitoringDeploy contracts using the provided Foundry scripts or use existing deployments:
- Ethereum Mainnet: See 1inch documentation
- Base: Custom deployment required
- Local Development: Use
SetupAnvilEnvironment.s.solscript
POST /create-webhook # Create new webhook
POST /webhook/{id} # Receive TradingView alert
GET /alert/{id} # Get alert status
GET /health # Health check
GET /status # Server statusGET /api/orders # List orders
POST /api/orders # Create order
GET /api/orders/{id} # Get order details
PATCH /api/orders/{id} # Update order
DELETE /api/orders/{id} # Cancel order
GET /api/stats # Order statisticsimport { YetiSDK } from 'yeti-order-manager';
import { JsonRpcProvider, Wallet } from 'ethers';
// Initialize SDK
const provider = new JsonRpcProvider('http://localhost:8545');
const signer = new Wallet('0x...', provider);
const sdk = new YetiSDK({
provider,
signer,
webhookServerUrl: 'http://localhost:3001',
orderbookServerUrl: 'http://localhost:3002',
contracts: {
limitOrderProtocol: '0x...',
webhookOracle: '0x...',
webhookPredicate: '0x...',
chainlinkCalculator: '0x...'
}
});
// Create conditional order
const { webhook, orderData, tradingViewSetup } = await sdk.createConditionalOrder({
makerAsset: '0x...', // USDC
takerAsset: '0x...', // WETH
makingAmount: '1000000000', // 1000 USDC
takingAmount: '300000000000000000', // 0.3 WETH
action: 'LONG'
}, '0x...'); // maker address
console.log('TradingView Setup:', tradingViewSetup);
// Sign and submit order
const orderForSigning = sdk.getOrderForSigning(orderData, 1); // chainId
const signature = await signer.signTypedData(
orderForSigning.domain,
orderForSigning.types,
orderForSigning.values
);
// Store in orderbook
await sdk.orderbook.createOrder({
...orderData,
signature
});
// Watch and auto-fill (for backend services)
await sdk.watchAndFillOrder(orderData, signature);- HMAC-based webhook authentication using TEE-derived secrets
- IP address validation for TradingView webhooks
- Nonce-based replay attack prevention
- Constant-time comparison for timing attack prevention
- Only the webhook server running in TEE is authorized to submit to oracle
- Role-based access control for oracle submissions
- Time-based alert validation (configurable max age) and oralce staleness
- Immutable predicate validation logic
- Integration with audited 1inch protocol
- Orders signed client-side, funds never transferred to contracts
- Private keys remain in user control
- On-chain execution through established 1inch infrastructure
- Full transaction transparency and auditability
# Smart contracts
cd contracts && forge test
# Order manager
cd yeti-order-manager && npm test
# Orderbook server
cd orderbook-server && npm test- Start local blockchain:
anvil - Deploy contracts:
forge script script/SetupAnvilEnvironment.s.sol --broadcast - Start all services in separate terminals:
cd webhook-server && uv run main.pycd orderbook-server && npm run devcd yeti-order-manager && npm run watch-orderscd yeti-frontend2 && npm run dev
# Webhook server
cd webhook-server
docker build -t yeti-webhook-server .
docker run -p 3001:3001 --env-file .env yeti-webhook-server
# Or use docker-compose
docker-compose up- Webhook Server: Python 3.9+, 1GB RAM, public endpoint
- Orderbook Server: Node.js 18+, 2GB RAM, SQLite storage
- Order Watcher: Node.js 18+, 1GB RAM, private key access
- Frontend: Static hosting (Vercel, Netlify)
- Use environment-specific private keys
- Enable HTTPS for all endpoints
- Configure proper CORS policies
- Monitor webhook endpoints for abuse
- Implement rate limiting and DDoS protection
- Use hardware wallets for high-value operations
- Health endpoints for all services
- Blockchain connection monitoring
- Order execution tracking
- Alert delivery verification
- Gas price optimization
This project was built for the EthGlobal Unite DeFi Hackathon. Contributions are welcome:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details.
- 1inch: For the robust Limit Order Protocol
- EthGlobal: For hosting the Unite DeFi Hackathon
- TradingView: For powerful charting and alert capabilities
- Chainlink: For reliable price oracle infrastructure