feat: 添加 YT Asset 合约测试前端
- React + TypeScript + Vite 项目结构 - WalletConnect 钱包连接功能 - WUSD 铸造页面(含边界测试) - Vault 交易页面(买入/卖出 YT,含边界测试) - Factory 管理页面(创建 Vault、更新价格,含权限测试) - 中英文国际化支持 - 显示 Owner/Manager 角色信息 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
29
frontend/src/i18n/index.ts
Normal file
29
frontend/src/i18n/index.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import i18n from 'i18next'
|
||||
import { initReactI18next } from 'react-i18next'
|
||||
import LanguageDetector from 'i18next-browser-languagedetector'
|
||||
|
||||
import en from './locales/en.json'
|
||||
import zh from './locales/zh.json'
|
||||
|
||||
const resources = {
|
||||
en: { translation: en },
|
||||
zh: { translation: zh }
|
||||
}
|
||||
|
||||
i18n
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
resources,
|
||||
fallbackLng: 'en',
|
||||
debug: false,
|
||||
interpolation: {
|
||||
escapeValue: false
|
||||
},
|
||||
detection: {
|
||||
order: ['localStorage', 'navigator'],
|
||||
caches: ['localStorage']
|
||||
}
|
||||
})
|
||||
|
||||
export default i18n
|
||||
135
frontend/src/i18n/locales/en.json
Normal file
135
frontend/src/i18n/locales/en.json
Normal file
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"common": {
|
||||
"connectWallet": "Connect Wallet",
|
||||
"disconnect": "Disconnect",
|
||||
"processing": "Processing...",
|
||||
"confirm": "Confirm",
|
||||
"cancel": "Cancel",
|
||||
"loading": "Loading...",
|
||||
"success": "Success!",
|
||||
"error": "Error",
|
||||
"balance": "Balance",
|
||||
"amount": "Amount",
|
||||
"contract": "Contract",
|
||||
"address": "Address",
|
||||
"network": "Arbitrum Sepolia",
|
||||
"connectFirst": "Please connect wallet first"
|
||||
},
|
||||
"nav": {
|
||||
"wusd": "WUSD",
|
||||
"vaultTrading": "Vault Trading",
|
||||
"factory": "Factory"
|
||||
},
|
||||
"header": {
|
||||
"title": "YT Asset Test"
|
||||
},
|
||||
"footer": {
|
||||
"description": "YT Asset Contract Testing Interface"
|
||||
},
|
||||
"wusd": {
|
||||
"title": "WUSD Token",
|
||||
"mintAmount": "Mint Amount",
|
||||
"enterAmount": "Enter amount to mint",
|
||||
"mint": "Mint WUSD",
|
||||
"minting": "Minting...",
|
||||
"confirming": "Confirming...",
|
||||
"mintSuccess": "Mint successful!"
|
||||
},
|
||||
"vault": {
|
||||
"title": "Vault Trading",
|
||||
"selectVault": "Select Vault",
|
||||
"vaultInfo": "Vault Info",
|
||||
"totalAssets": "Total Assets",
|
||||
"idleAssets": "Idle Assets",
|
||||
"totalSupply": "Total Supply",
|
||||
"hardCap": "Hard Cap",
|
||||
"wusdPrice": "WUSD Price",
|
||||
"ytPrice": "YT Price",
|
||||
"yourWusdBalance": "Your WUSD Balance",
|
||||
"yourYtBalance": "Your YT Balance",
|
||||
"buyYt": "Buy YT",
|
||||
"sellYt": "Sell YT",
|
||||
"wusdAmount": "WUSD Amount",
|
||||
"ytAmount": "YT Amount",
|
||||
"enterWusdAmount": "Enter WUSD amount",
|
||||
"enterYtAmount": "Enter YT amount",
|
||||
"youWillReceive": "You will receive",
|
||||
"approveWusd": "Approve WUSD",
|
||||
"buy": "Buy YT",
|
||||
"sell": "Sell YT"
|
||||
},
|
||||
"factory": {
|
||||
"title": "Factory Management",
|
||||
"factoryContract": "Factory Contract",
|
||||
"owner": "Owner",
|
||||
"defaultHardCap": "Default Hard Cap",
|
||||
"totalVaults": "Total Vaults",
|
||||
"yourRole": "Your Role",
|
||||
"roleOwner": "Owner",
|
||||
"roleUser": "User",
|
||||
"allVaults": "All Vaults",
|
||||
"noVaults": "No vaults created yet",
|
||||
"createVault": "Create New Vault",
|
||||
"name": "Name",
|
||||
"symbol": "Symbol",
|
||||
"managerAddress": "Manager Address",
|
||||
"redemptionTime": "Redemption Time",
|
||||
"initialWusdPrice": "Initial WUSD Price",
|
||||
"initialYtPrice": "Initial YT Price",
|
||||
"create": "Create Vault",
|
||||
"updatePrices": "Update Vault Prices",
|
||||
"vaultAddress": "Vault Address",
|
||||
"selectVault": "Select Vault",
|
||||
"newWusdPrice": "New WUSD Price",
|
||||
"newYtPrice": "New YT Price",
|
||||
"update": "Update Prices"
|
||||
},
|
||||
"language": {
|
||||
"en": "English",
|
||||
"zh": "Chinese"
|
||||
},
|
||||
"test": {
|
||||
"title": "Boundary Test",
|
||||
"currentStatus": "Current Status",
|
||||
"canRedeem": "Can Redeem",
|
||||
"timeToRedeem": "Time to Redeem",
|
||||
"hardCap": "Hard Cap",
|
||||
"role": "Your Role",
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
"customAmount": "Custom Amount",
|
||||
"transferAddress": "Transfer Address",
|
||||
"boundaryTests": "Boundary Tests",
|
||||
"boundaryHint": "These tests are designed to trigger contract errors. Expected errors are shown for each test.",
|
||||
"permissionTests": "Permission Tests",
|
||||
"permissionHint": "Test permission restrictions. Should fail if you're not Owner/Manager.",
|
||||
"managerTests": "Manager Functions",
|
||||
"managerHint": "Manager-only functions. Current Manager: ",
|
||||
"normalTests": "Normal Functions",
|
||||
"quickActions": "Quick Actions",
|
||||
"run": "Run",
|
||||
"running": "Running...",
|
||||
"mint10000": "Mint 10000 WUSD",
|
||||
"maxApprove": "Max Approve WUSD",
|
||||
"buyZero": "Buy Amount 0",
|
||||
"buyZeroDesc": "Test depositYT(0)",
|
||||
"sellZero": "Sell Amount 0",
|
||||
"sellZeroDesc": "Test withdrawYT(0)",
|
||||
"buyExceedBalance": "Buy Exceed Balance",
|
||||
"buyExceedBalanceDesc": "Buy more than WUSD balance",
|
||||
"sellExceedBalance": "Sell Exceed Balance",
|
||||
"sellExceedBalanceDesc": "Sell more than YT balance",
|
||||
"buyExceedHardcap": "Buy Exceed Hardcap",
|
||||
"buyExceedHardcapDesc": "Buy amount exceeds vault hardcap",
|
||||
"sellInLock": "Sell In Lock Period",
|
||||
"sellInLockDesc": "Try to sell during lock period",
|
||||
"mintZero": "Mint Amount 0",
|
||||
"mintZeroDesc": "Test mint(0)",
|
||||
"burnExceed": "Burn Exceed Balance",
|
||||
"burnExceedDesc": "Burn more than balance",
|
||||
"updatePriceNotOwner": "Update Price (Not Owner)",
|
||||
"updatePriceNotOwnerDesc": "Non-owner calls updateVaultPrices",
|
||||
"setManagerNotOwner": "Set Manager (Not Owner)",
|
||||
"setManagerNotOwnerDesc": "Non-owner calls setVaultManager"
|
||||
}
|
||||
}
|
||||
135
frontend/src/i18n/locales/zh.json
Normal file
135
frontend/src/i18n/locales/zh.json
Normal file
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"common": {
|
||||
"connectWallet": "连接钱包",
|
||||
"disconnect": "断开连接",
|
||||
"processing": "处理中...",
|
||||
"confirm": "确认",
|
||||
"cancel": "取消",
|
||||
"loading": "加载中...",
|
||||
"success": "成功!",
|
||||
"error": "错误",
|
||||
"balance": "余额",
|
||||
"amount": "数量",
|
||||
"contract": "合约",
|
||||
"address": "地址",
|
||||
"network": "Arbitrum Sepolia",
|
||||
"connectFirst": "请先连接钱包"
|
||||
},
|
||||
"nav": {
|
||||
"wusd": "WUSD",
|
||||
"vaultTrading": "金库交易",
|
||||
"factory": "工厂管理"
|
||||
},
|
||||
"header": {
|
||||
"title": "YT 资产测试"
|
||||
},
|
||||
"footer": {
|
||||
"description": "YT 资产合约测试界面"
|
||||
},
|
||||
"wusd": {
|
||||
"title": "WUSD 代币",
|
||||
"mintAmount": "铸造数量",
|
||||
"enterAmount": "输入铸造数量",
|
||||
"mint": "铸造 WUSD",
|
||||
"minting": "铸造中...",
|
||||
"confirming": "确认中...",
|
||||
"mintSuccess": "铸造成功!"
|
||||
},
|
||||
"vault": {
|
||||
"title": "金库交易",
|
||||
"selectVault": "选择金库",
|
||||
"vaultInfo": "金库信息",
|
||||
"totalAssets": "总资产",
|
||||
"idleAssets": "闲置资产",
|
||||
"totalSupply": "总供应量",
|
||||
"hardCap": "硬顶",
|
||||
"wusdPrice": "WUSD 价格",
|
||||
"ytPrice": "YT 价格",
|
||||
"yourWusdBalance": "你的 WUSD 余额",
|
||||
"yourYtBalance": "你的 YT 余额",
|
||||
"buyYt": "买入 YT",
|
||||
"sellYt": "卖出 YT",
|
||||
"wusdAmount": "WUSD 数量",
|
||||
"ytAmount": "YT 数量",
|
||||
"enterWusdAmount": "输入 WUSD 数量",
|
||||
"enterYtAmount": "输入 YT 数量",
|
||||
"youWillReceive": "你将收到",
|
||||
"approveWusd": "授权 WUSD",
|
||||
"buy": "买入 YT",
|
||||
"sell": "卖出 YT"
|
||||
},
|
||||
"factory": {
|
||||
"title": "工厂管理",
|
||||
"factoryContract": "工厂合约",
|
||||
"owner": "所有者",
|
||||
"defaultHardCap": "默认硬顶",
|
||||
"totalVaults": "金库总数",
|
||||
"yourRole": "你的角色",
|
||||
"roleOwner": "所有者",
|
||||
"roleUser": "用户",
|
||||
"allVaults": "所有金库",
|
||||
"noVaults": "暂无金库",
|
||||
"createVault": "创建新金库",
|
||||
"name": "名称",
|
||||
"symbol": "符号",
|
||||
"managerAddress": "管理员地址",
|
||||
"redemptionTime": "赎回时间",
|
||||
"initialWusdPrice": "初始 WUSD 价格",
|
||||
"initialYtPrice": "初始 YT 价格",
|
||||
"create": "创建金库",
|
||||
"updatePrices": "更新金库价格",
|
||||
"vaultAddress": "金库地址",
|
||||
"selectVault": "选择金库",
|
||||
"newWusdPrice": "新 WUSD 价格",
|
||||
"newYtPrice": "新 YT 价格",
|
||||
"update": "更新价格"
|
||||
},
|
||||
"language": {
|
||||
"en": "英文",
|
||||
"zh": "中文"
|
||||
},
|
||||
"test": {
|
||||
"title": "边界测试",
|
||||
"currentStatus": "当前状态",
|
||||
"canRedeem": "可赎回",
|
||||
"timeToRedeem": "赎回倒计时",
|
||||
"hardCap": "硬顶",
|
||||
"role": "你的角色",
|
||||
"yes": "是",
|
||||
"no": "否",
|
||||
"customAmount": "自定义金额",
|
||||
"transferAddress": "转账地址",
|
||||
"boundaryTests": "边界测试",
|
||||
"boundaryHint": "这些测试旨在触发合约错误。每个测试都显示了预期的错误。",
|
||||
"permissionTests": "权限测试",
|
||||
"permissionHint": "测试权限限制。如果你不是 Owner/Manager 应该会失败。",
|
||||
"managerTests": "Manager 功能",
|
||||
"managerHint": "仅限 Manager 的功能。当前 Manager: ",
|
||||
"normalTests": "正常功能",
|
||||
"quickActions": "快速操作",
|
||||
"run": "执行",
|
||||
"running": "执行中...",
|
||||
"mint10000": "铸造 10000 WUSD",
|
||||
"maxApprove": "最大授权 WUSD",
|
||||
"buyZero": "买入金额为0",
|
||||
"buyZeroDesc": "测试 depositYT(0)",
|
||||
"sellZero": "卖出金额为0",
|
||||
"sellZeroDesc": "测试 withdrawYT(0)",
|
||||
"buyExceedBalance": "买入超过余额",
|
||||
"buyExceedBalanceDesc": "买入金额超过 WUSD 余额",
|
||||
"sellExceedBalance": "卖出超过余额",
|
||||
"sellExceedBalanceDesc": "卖出金额超过 YT 余额",
|
||||
"buyExceedHardcap": "买入超过硬顶",
|
||||
"buyExceedHardcapDesc": "买入金额超过 Vault 硬顶",
|
||||
"sellInLock": "锁定期卖出",
|
||||
"sellInLockDesc": "在锁定期内尝试卖出",
|
||||
"mintZero": "铸造金额为0",
|
||||
"mintZeroDesc": "测试 mint(0)",
|
||||
"burnExceed": "销毁超过余额",
|
||||
"burnExceedDesc": "销毁金额超过余额",
|
||||
"updatePriceNotOwner": "更新价格(非Owner)",
|
||||
"updatePriceNotOwnerDesc": "非 Owner 调用 updateVaultPrices",
|
||||
"setManagerNotOwner": "设置Manager(非Owner)",
|
||||
"setManagerNotOwnerDesc": "非 Owner 调用 setVaultManager"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user