From c16d8468589f68622275021c1c2f441d6908882f Mon Sep 17 00:00:00 2001 From: Sofio Date: Tue, 16 Dec 2025 07:30:53 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20LP=20=E6=B5=81?= =?UTF-8?q?=E5=8A=A8=E6=80=A7=E6=B1=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增功能: - 添加 LPPanel 组件,支持流动性池操作 - 添加流动性 (addLiquidity): 存入 YT 代币或 WUSD 获得 ytLP - 移除流动性 (removeLiquidity): 销毁 ytLP 获取代币 - 代币互换 (swapYT): 在池内交换 YT 代币 合约集成: - YTRewardRouter: 0x51eEF57eC57c867AC23945f0ce21aA5A9a2C246c - YTLPToken: 0x1b96F219E8aeE557DD8bD905a6c72cc64eA5BD7B - YTPoolManager: 0x14246886a1E1202cb6b5a2db793eF3359d536302 - YTVault: 0x19982e5145ca5401A1084c0BF916c0E0bB343Af9 - USDY: 0x631Bd6834C50f6d2B07035c9253b4a19132E888c UI功能: - 显示池子 AUM、ytLP 价格、总供应量 - 显示用户 ytLP 余额和冷却时间 - Tab 切换: 添加流动性/移除流动性/代币互换 - 代币授权检查和一键授权 - 滑点容忍度设置 - 中英文翻译支持 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- frontend/src/App.css | 63 +++ frontend/src/App.tsx | 10 +- frontend/src/components/LPPanel.tsx | 622 ++++++++++++++++++++++++++++ frontend/src/config/contracts.ts | 259 +++++++++++- frontend/src/i18n/locales/en.json | 34 +- frontend/src/i18n/locales/zh.json | 34 +- 6 files changed, 1018 insertions(+), 4 deletions(-) create mode 100644 frontend/src/components/LPPanel.tsx diff --git a/frontend/src/App.css b/frontend/src/App.css index 83b068d..436bf7f 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -824,3 +824,66 @@ body { margin-top: 4px; word-break: break-all; } + +/* LP Panel Styles */ +.pool-info { + background: #f0f7ff; + padding: 16px; + border-radius: 8px; + margin-bottom: 20px; + border: 1px solid #bbdefb; +} + +.lp-tabs { + display: flex; + gap: 8px; + margin-bottom: 20px; + border-bottom: 2px solid #e0e0e0; + padding-bottom: 0; +} + +.tab-btn { + padding: 10px 20px; + background: none; + border: none; + color: #666; + font-size: 14px; + font-weight: 500; + cursor: pointer; + border-bottom: 2px solid transparent; + margin-bottom: -2px; + transition: all 0.2s; +} + +.tab-btn:hover { + color: #1976d2; +} + +.tab-btn.active { + color: #1976d2; + border-bottom-color: #1976d2; +} + +.warning-box { + background: #fff3e0; + color: #e65100; + padding: 12px 16px; + border-radius: 6px; + margin-bottom: 16px; + border-left: 4px solid #ff9800; + font-size: 14px; +} + +.btn-link { + background: none; + border: none; + color: #1976d2; + padding: 4px 8px; + font-size: 12px; + cursor: pointer; + text-decoration: underline; +} + +.btn-link:hover { + color: #1565c0; +} diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index b82e571..d6e4f54 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -8,11 +8,12 @@ import { LanguageSwitch } from './components/LanguageSwitch' import { WUSDPanel } from './components/WUSDPanel' import { VaultPanel } from './components/VaultPanel' import { FactoryPanel } from './components/FactoryPanel' +import { LPPanel } from './components/LPPanel' import { ToastProvider } from './components/Toast' import { TransactionProvider } from './context/TransactionContext' import './App.css' -type Tab = 'wusd' | 'vault' | 'factory' +type Tab = 'wusd' | 'vault' | 'factory' | 'lp' function AppContent() { const { t } = useTranslation() @@ -48,12 +49,19 @@ function AppContent() { > {t('nav.factory')} +
{activeTab === 'wusd' && } {activeTab === 'vault' && } {activeTab === 'factory' && } + {activeTab === 'lp' && }