init: 初始化 AssetX 项目仓库
包含 webapp(Next.js 用户端)、webapp-back(Go 后端)、 antdesign(管理后台)、landingpage(营销落地页)、 数据库 SQL 和配置文件。
This commit is contained in:
16
webapp/lib/api/contracts.ts
Normal file
16
webapp/lib/api/contracts.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface ContractConfig {
|
||||
name: string
|
||||
chain_id: number
|
||||
address: string
|
||||
}
|
||||
|
||||
export async function fetchContracts(): Promise<ContractConfig[]> {
|
||||
try {
|
||||
const res = await fetch('/api/contracts')
|
||||
if (!res.ok) return []
|
||||
const data = await res.json()
|
||||
return data.contracts ?? []
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
243
webapp/lib/api/fundmarket.ts
Normal file
243
webapp/lib/api/fundmarket.ts
Normal file
@@ -0,0 +1,243 @@
|
||||
// Fund Market API Client
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080/api';
|
||||
|
||||
export interface StatsData {
|
||||
label: string;
|
||||
value: string;
|
||||
change: string;
|
||||
isPositive: boolean;
|
||||
}
|
||||
|
||||
export interface Product {
|
||||
id: number;
|
||||
name: string;
|
||||
tokenSymbol: string;
|
||||
decimals: number;
|
||||
contractAddress: string;
|
||||
chainId: number;
|
||||
token_role: string;
|
||||
category: string;
|
||||
categoryColor: "blue" | "green" | "orange" | "purple" | "red";
|
||||
iconUrl: string;
|
||||
yieldAPY: string;
|
||||
poolCap: string;
|
||||
risk: string;
|
||||
riskLevel: 1 | 2 | 3;
|
||||
circulatingSupply: string;
|
||||
poolCapacityPercent: number;
|
||||
}
|
||||
|
||||
// Fetch all products
|
||||
// tokenList=true: include stablecoins (for token dropdowns)
|
||||
// tokenList=false (default): exclude stablecoins (Fund Market page)
|
||||
export async function fetchProducts(tokenList: boolean = false): Promise<Product[]> {
|
||||
try {
|
||||
const url = tokenList === true
|
||||
? `${API_BASE_URL}/fundmarket/products?token_list=1`
|
||||
: `${API_BASE_URL}/fundmarket/products`;
|
||||
const response = await fetch(url, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch products');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || 'Failed to fetch products');
|
||||
}
|
||||
|
||||
return data.data ?? [];
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching products:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch market stats
|
||||
export async function fetchStats(): Promise<StatsData[]> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/fundmarket/stats`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch stats');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || 'Failed to fetch stats');
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching stats:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// Product Detail Interfaces
|
||||
export interface ProductDetail {
|
||||
// Basic Info
|
||||
id: number;
|
||||
assetCode: string;
|
||||
name: string;
|
||||
subtitle: string;
|
||||
description: string;
|
||||
tokenSymbol: string;
|
||||
decimals: number;
|
||||
|
||||
// Investment Parameters
|
||||
underlyingAssets: string;
|
||||
poolCapUsd: number;
|
||||
riskLevel: number;
|
||||
riskLabel: string;
|
||||
targetApy: number;
|
||||
|
||||
// Contract Info
|
||||
contractAddress: string;
|
||||
chainId: number;
|
||||
|
||||
// Display Info
|
||||
category: string;
|
||||
categoryColor: string;
|
||||
iconUrl: string;
|
||||
|
||||
// Performance Data
|
||||
currentApy: number;
|
||||
tvlUsd: number;
|
||||
volume24hUsd: number;
|
||||
volumeChangeVsAvg: number;
|
||||
circulatingSupply: number;
|
||||
poolCapacityPercent: number;
|
||||
currentPrice: number;
|
||||
|
||||
// Custody Info
|
||||
custody?: {
|
||||
custodianName: string;
|
||||
custodyType: string;
|
||||
custodyLocation: string;
|
||||
auditorName: string;
|
||||
lastAuditDate: string;
|
||||
auditReportUrl?: string;
|
||||
additionalInfo?: any;
|
||||
};
|
||||
|
||||
// Audit Reports
|
||||
auditReports: Array<{
|
||||
reportType: string;
|
||||
reportTitle: string;
|
||||
reportDate: string;
|
||||
auditorName: string;
|
||||
summary: string;
|
||||
reportUrl: string;
|
||||
}>;
|
||||
|
||||
// Product Links
|
||||
productLinks: Array<{
|
||||
linkText: string;
|
||||
linkUrl: string;
|
||||
description: string;
|
||||
displayArea: string; // 'protocol' | 'verification' | 'both'
|
||||
displayOrder: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
// Fetch single product by ID (simple format)
|
||||
export async function fetchProductById(id: number): Promise<Product | null> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/fundmarket/products/${id}`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch product');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || 'Failed to fetch product');
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching product:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Daily return point
|
||||
export interface DailyReturnPoint {
|
||||
date: string; // "YYYY-MM-DD"
|
||||
ytPrice: number;
|
||||
dailyReturn: number; // %
|
||||
hasData: boolean;
|
||||
}
|
||||
|
||||
export async function fetchDailyReturns(id: number, year: number, month: number): Promise<DailyReturnPoint[]> {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE_URL}/fundmarket/products/${id}/daily-returns?year=${year}&month=${month}`,
|
||||
{ cache: 'no-store' }
|
||||
);
|
||||
if (!response.ok) throw new Error('Failed to fetch daily returns');
|
||||
const data = await response.json();
|
||||
if (!data.success) throw new Error(data.error || 'Failed to fetch daily returns');
|
||||
return data.data ?? [];
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching daily returns:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// History point for APY/Price chart
|
||||
export interface HistoryPoint {
|
||||
time: string; // "MM/DD HH:mm"
|
||||
apy: number; // APY %
|
||||
price: number; // YT token price in USDC
|
||||
}
|
||||
|
||||
// Fetch hourly APY/price history for chart
|
||||
export async function fetchProductHistory(id: number): Promise<HistoryPoint[]> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/fundmarket/products/${id}/history`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
if (!response.ok) throw new Error('Failed to fetch history');
|
||||
const data = await response.json();
|
||||
if (!data.success) throw new Error(data.error || 'Failed to fetch history');
|
||||
return data.data ?? [];
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching product history:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch product detail by ID (detailed format)
|
||||
export async function fetchProductDetail(id: number): Promise<ProductDetail | null> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/fundmarket/products/${id}`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch product detail');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || 'Failed to fetch product detail');
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching product detail:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
201
webapp/lib/api/lending.ts
Normal file
201
webapp/lib/api/lending.ts
Normal file
@@ -0,0 +1,201 @@
|
||||
// Lending API Client
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080/api';
|
||||
|
||||
export interface CollateralInfo {
|
||||
tokenSymbol: string;
|
||||
balance: string;
|
||||
balanceUsd: number;
|
||||
collateralValue: number;
|
||||
}
|
||||
|
||||
export interface LendingPosition {
|
||||
userAddress: string;
|
||||
walletAddress: string;
|
||||
suppliedBalance: string;
|
||||
suppliedBalanceUsd: number;
|
||||
borrowedBalance: string;
|
||||
borrowedBalanceUsd: number;
|
||||
collateralBalances: Record<string, CollateralInfo>;
|
||||
healthFactor: number;
|
||||
ltv: number;
|
||||
supplyAPY: number;
|
||||
borrowAPY: number;
|
||||
}
|
||||
|
||||
export interface LendingStats {
|
||||
totalSuppliedUsd: number;
|
||||
totalBorrowedUsd: number;
|
||||
totalCollateralUsd: number;
|
||||
utilizationRate: number;
|
||||
avgSupplyAPY: number;
|
||||
avgBorrowAPY: number;
|
||||
totalUsers: number;
|
||||
activeBorrowers: number;
|
||||
totalTVL: number;
|
||||
}
|
||||
|
||||
export interface LendingMarket {
|
||||
id: number;
|
||||
market_name: string;
|
||||
contract_address: string;
|
||||
chain_id: number;
|
||||
collateral_asset: string;
|
||||
borrow_collateral_factor: number;
|
||||
liquidate_collateral_factor: number;
|
||||
liquidation_penalty: number;
|
||||
supply_cap: number;
|
||||
base_supply_apy: number;
|
||||
base_borrow_apy: number;
|
||||
is_active: boolean;
|
||||
}
|
||||
|
||||
export interface LendingAPYPoint {
|
||||
time: string;
|
||||
supply_apy: number;
|
||||
borrow_apy: number;
|
||||
}
|
||||
|
||||
export interface LendingAPYHistory {
|
||||
history: LendingAPYPoint[];
|
||||
current_supply_apy: number;
|
||||
current_borrow_apy: number;
|
||||
apy_change: number;
|
||||
period: string;
|
||||
}
|
||||
|
||||
export async function fetchLendingAPYHistory(
|
||||
period: '1W' | '1M' | '1Y' = '1W',
|
||||
chainId?: number
|
||||
): Promise<LendingAPYHistory | null> {
|
||||
try {
|
||||
const params = new URLSearchParams({ period });
|
||||
if (chainId) params.append('chain_id', chainId.toString());
|
||||
const response = await fetch(`${API_BASE_URL}/lending/apy-history?${params}`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
if (!response.ok) return null;
|
||||
const data = await response.json();
|
||||
if (!data.success) return null;
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching lending APY history:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchLendingPosition(address: string): Promise<LendingPosition | null> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/lending/position/${address}`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
if (!response.ok) return null;
|
||||
const data = await response.json();
|
||||
if (!data.success) return null;
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching lending position:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchLendingStats(): Promise<LendingStats | null> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/lending/stats`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
if (!response.ok) return null;
|
||||
const data = await response.json();
|
||||
if (!data.success) return null;
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching lending stats:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchLendingMarkets(): Promise<LendingMarket[]> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/lending/markets`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
if (!response.ok) return [];
|
||||
const data = await response.json();
|
||||
if (!data.success) return [];
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching lending markets:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function notifySupplyCollateral(asset: string, amount: string, txHash?: string): Promise<void> {
|
||||
try {
|
||||
await fetch(`${API_BASE_URL}/lending/supply-collateral`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ asset, amount, tx_hash: txHash }),
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
console.error('Error notifying supply collateral:', error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function notifyWithdrawCollateral(asset: string, amount: string, txHash?: string): Promise<void> {
|
||||
try {
|
||||
await fetch(`${API_BASE_URL}/lending/withdraw-collateral`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ asset, amount, tx_hash: txHash }),
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
console.error('Error notifying withdraw collateral:', error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function notifyLendingBorrow(amount: string, txHash?: string): Promise<void> {
|
||||
try {
|
||||
await fetch(`${API_BASE_URL}/lending/borrow`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ amount, tx_hash: txHash }),
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
console.error('Error notifying lending borrow:', error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function notifyLendingRepay(amount: string, txHash?: string): Promise<void> {
|
||||
try {
|
||||
await fetch(`${API_BASE_URL}/lending/repay`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ amount, tx_hash: txHash }),
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
console.error('Error notifying lending repay:', error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function notifyLendingSupply(amount: string, txHash?: string): Promise<void> {
|
||||
try {
|
||||
await fetch(`${API_BASE_URL}/lending/supply`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ amount, tx_hash: txHash }),
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
console.error('Error notifying lending supply:', error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function notifyLendingWithdraw(amount: string, txHash?: string): Promise<void> {
|
||||
try {
|
||||
await fetch(`${API_BASE_URL}/lending/withdraw`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ amount, tx_hash: txHash }),
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
console.error('Error notifying lending withdraw:', error);
|
||||
}
|
||||
}
|
||||
360
webapp/lib/api/points.ts
Normal file
360
webapp/lib/api/points.ts
Normal file
@@ -0,0 +1,360 @@
|
||||
// Points API Client
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080/api';
|
||||
|
||||
// =====================
|
||||
// Type Definitions
|
||||
// =====================
|
||||
|
||||
export interface WalletRegisterData {
|
||||
walletAddress: string;
|
||||
inviteCode: string;
|
||||
usedCount: number;
|
||||
memberTier: string;
|
||||
vipLevel: number;
|
||||
totalPoints: number;
|
||||
globalRank: number;
|
||||
}
|
||||
|
||||
export interface DashboardData {
|
||||
totalPoints: number;
|
||||
globalRank: number;
|
||||
topPercentage: string;
|
||||
memberTier: string;
|
||||
vipLevel: number;
|
||||
pointsToNextTier: number;
|
||||
nextTier: string;
|
||||
season: {
|
||||
seasonNumber: number;
|
||||
seasonName: string;
|
||||
isLive: boolean;
|
||||
endTime: string;
|
||||
daysRemaining: number;
|
||||
hoursRemaining: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface LeaderboardUser {
|
||||
rank: number;
|
||||
address: string;
|
||||
points: number;
|
||||
}
|
||||
|
||||
export interface LeaderboardData {
|
||||
topUsers: LeaderboardUser[];
|
||||
myRank: number;
|
||||
myPoints: number;
|
||||
}
|
||||
|
||||
export interface InviteCodeData {
|
||||
code: string;
|
||||
usedCount: number;
|
||||
maxUses: number;
|
||||
}
|
||||
|
||||
export interface RoleCount {
|
||||
icon: string;
|
||||
label: string;
|
||||
current: number;
|
||||
target: number;
|
||||
}
|
||||
|
||||
export interface TeamTVLData {
|
||||
currentTVL: string;
|
||||
targetTVL: string;
|
||||
progressPercent: number;
|
||||
totalMembers: number;
|
||||
roles: RoleCount[];
|
||||
}
|
||||
|
||||
export interface ActivityRecord {
|
||||
type: string;
|
||||
userAddress: string;
|
||||
friendAddress?: string;
|
||||
inviteCode?: string;
|
||||
points: number;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface ActivitiesData {
|
||||
activities: ActivityRecord[];
|
||||
pagination: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
total: number;
|
||||
totalPage: number;
|
||||
};
|
||||
}
|
||||
|
||||
// =====================
|
||||
// API Functions
|
||||
// =====================
|
||||
|
||||
/**
|
||||
* Register or retrieve a user by wallet address
|
||||
* @param walletAddress - The connected wallet address
|
||||
*/
|
||||
export async function registerWallet(walletAddress: string): Promise<WalletRegisterData | null> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/points/wallet-register`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ wallet_address: walletAddress }),
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error('Wallet register API error:', response.status);
|
||||
return null;
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
if (!data.success) {
|
||||
console.error('Wallet register error:', data.error);
|
||||
return null;
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error registering wallet:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch user points dashboard
|
||||
*/
|
||||
export async function fetchDashboard(walletAddress?: string): Promise<DashboardData | null> {
|
||||
try {
|
||||
const params = walletAddress ? `?wallet_address=${encodeURIComponent(walletAddress)}` : '';
|
||||
const response = await fetch(`${API_BASE_URL}/points/dashboard${params}`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error('Dashboard API error:', response.status);
|
||||
return null;
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
console.error('Dashboard API error:', data.error);
|
||||
return null;
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching dashboard:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch leaderboard
|
||||
* @param limit - Number of top users to fetch (default: 5)
|
||||
* @param walletAddress - Optional wallet address to identify current user's rank
|
||||
*/
|
||||
export async function fetchLeaderboard(limit: number = 5, walletAddress?: string): Promise<LeaderboardData | null> {
|
||||
try {
|
||||
const params = new URLSearchParams({ limit: limit.toString() });
|
||||
if (walletAddress) params.set('wallet_address', walletAddress);
|
||||
const response = await fetch(`${API_BASE_URL}/points/leaderboard?${params}`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error('Leaderboard API error:', response.status);
|
||||
return null;
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
console.error('Leaderboard API error:', data.error);
|
||||
return null;
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching leaderboard:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch user's invite code information
|
||||
*/
|
||||
export async function fetchInviteCode(): Promise<InviteCodeData | null> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/points/invite-code`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch invite code');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || 'Failed to fetch invite code');
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching invite code:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind an invite code
|
||||
* @param code - Invite code to bind
|
||||
* @param signature - User signature for verification
|
||||
* @param walletAddress - Optional wallet address of the current user
|
||||
*/
|
||||
export async function bindInviteCode(code: string, signature: string, walletAddress?: string): Promise<{ success: boolean; message?: string; error?: string }> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/points/bind-invite`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ code, signature, wallet_address: walletAddress }),
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok || !data.success) {
|
||||
return {
|
||||
success: false,
|
||||
error: data.error || 'Failed to bind invite code',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: data.message,
|
||||
};
|
||||
} catch (error: unknown) {
|
||||
console.error('Error binding invite code:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Unknown error',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch team TVL statistics
|
||||
* @param walletAddress - Optional wallet address to identify current user's team
|
||||
*/
|
||||
export async function fetchTeamTVL(walletAddress?: string): Promise<TeamTVLData | null> {
|
||||
try {
|
||||
const params = walletAddress ? `?wallet_address=${encodeURIComponent(walletAddress)}` : '';
|
||||
const response = await fetch(`${API_BASE_URL}/points/team${params}`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error('Team TVL API error:', response.status, response.statusText);
|
||||
|
||||
// 返回默认值而不是 null
|
||||
return {
|
||||
currentTVL: "$0",
|
||||
targetTVL: "$10M",
|
||||
progressPercent: 0,
|
||||
totalMembers: 0,
|
||||
roles: []
|
||||
};
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
console.error('Team TVL API error:', data.error);
|
||||
// 返回默认值
|
||||
return {
|
||||
currentTVL: "$0",
|
||||
targetTVL: "$10M",
|
||||
progressPercent: 0,
|
||||
totalMembers: 0,
|
||||
roles: []
|
||||
};
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching team TVL:', error);
|
||||
// 返回默认值而不是 null
|
||||
return {
|
||||
currentTVL: "$0",
|
||||
targetTVL: "$10M",
|
||||
progressPercent: 0,
|
||||
totalMembers: 0,
|
||||
roles: []
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch user activities
|
||||
* @param type - Activity type: 'all', 'referrals', 'deposits'
|
||||
* @param page - Page number (default: 1)
|
||||
* @param pageSize - Items per page (default: 10)
|
||||
* @param walletAddress - Optional wallet address
|
||||
*/
|
||||
export async function fetchActivities(
|
||||
type: 'all' | 'referrals' | 'deposits' = 'all',
|
||||
page: number = 1,
|
||||
pageSize: number = 10,
|
||||
walletAddress?: string
|
||||
): Promise<ActivitiesData | null> {
|
||||
try {
|
||||
const params = new URLSearchParams({
|
||||
type,
|
||||
page: page.toString(),
|
||||
pageSize: pageSize.toString(),
|
||||
});
|
||||
if (walletAddress) params.set('wallet_address', walletAddress);
|
||||
|
||||
const response = await fetch(`${API_BASE_URL}/points/activities?${params}`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch activities');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || 'Failed to fetch activities');
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching activities:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format points to display format (e.g., 52000 -> "52k")
|
||||
*/
|
||||
export function formatPoints(points: number): string {
|
||||
if (points >= 1000000) {
|
||||
return `${(points / 1000000).toFixed(1)}M`;
|
||||
} else if (points >= 1000) {
|
||||
return `${(points / 1000).toFixed(0)}k`;
|
||||
}
|
||||
return points.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate progress percentage
|
||||
*/
|
||||
export function calculateProgress(current: number, target: number): number {
|
||||
if (target === 0) return 0;
|
||||
return Math.round((current / target) * 100 * 100) / 100;
|
||||
}
|
||||
12
webapp/lib/api/tokens.ts
Normal file
12
webapp/lib/api/tokens.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// Token interface for swap
|
||||
export interface Token {
|
||||
symbol: string;
|
||||
name: string;
|
||||
decimals: number; // 配置值(兜底)
|
||||
onChainDecimals?: number; // 链上实际读取值,优先使用
|
||||
iconUrl: string;
|
||||
contractAddress: string;
|
||||
chainId: number;
|
||||
tokenType: 'stablecoin' | 'yield-token';
|
||||
}
|
||||
|
||||
33
webapp/lib/buttonStyles.ts
Normal file
33
webapp/lib/buttonStyles.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Centralized button style configurations using tailwind-variants
|
||||
* Maintains consistent button styling across the app with automatic class merging
|
||||
*/
|
||||
|
||||
import { tv, type VariantProps } from "tailwind-variants";
|
||||
|
||||
export const buttonStyles = tv({
|
||||
base: "group transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",
|
||||
variants: {
|
||||
intent: {
|
||||
// Theme button - 页面主题色按钮 (bg-foreground text-background)
|
||||
theme: "rounded-xl h-11 w-full px-6 text-body-small font-bold bg-foreground text-background",
|
||||
// Max button - 绿色 Max 按钮
|
||||
max: "rounded-full px-3 h-[24px] min-w-0 text-[12px] font-bold !bg-[#a7f3d0] !text-[#065f46] dark:!bg-green-900/30 dark:!text-green-300",
|
||||
},
|
||||
fullWidth: {
|
||||
true: "w-full",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
intent: "theme",
|
||||
},
|
||||
});
|
||||
|
||||
// Type export for use in components
|
||||
export type ButtonIntent = VariantProps<typeof buttonStyles>["intent"];
|
||||
|
||||
/**
|
||||
* Disabled button state classes
|
||||
* Apply these when button is disabled
|
||||
*/
|
||||
export const disabledButtonClasses = "cursor-not-allowed opacity-50";
|
||||
23
webapp/lib/constants.ts
Normal file
23
webapp/lib/constants.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 全局常量 — 汇率、费率、gas limit 等
|
||||
* 组件中禁止直接写魔法数字,必须引用此文件
|
||||
*/
|
||||
|
||||
// ---- 汇率 ----
|
||||
/** USDC → GYUS 兑换比例 */
|
||||
export const USDC_TO_GYUS_RATE = 0.9852
|
||||
/** USDC → USD 估值系数 */
|
||||
export const USDC_USD_RATE = 1.00045
|
||||
/** USDC → ALP 兑换比例 */
|
||||
export const USDC_TO_ALP_RATE = 0.098
|
||||
|
||||
// ---- 费率 ----
|
||||
/** 提现手续费比例 (0.5%) */
|
||||
export const WITHDRAW_FEE_RATE = 0.005
|
||||
/** 滑点保护系数 (1 - maxSlippage) */
|
||||
export const SLIPPAGE_PROTECTION = 0.995
|
||||
|
||||
// ---- Gas Limit ----
|
||||
export const DEFAULT_GAS_LIMIT = 5_000_000n
|
||||
export const SWAP_GAS_LIMIT = 30_000_000n
|
||||
export const WITHDRAW_GAS_LIMIT = 1_000_000n
|
||||
641
webapp/lib/contracts/abis/USDY.json
Normal file
641
webapp/lib/contracts/abis/USDY.json
Normal file
@@ -0,0 +1,641 @@
|
||||
[
|
||||
{
|
||||
"inputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AddressEmptyCode",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC1967InvalidImplementation",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ERC1967NonPayable",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "allowance",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "needed",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InsufficientAllowance",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "needed",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InsufficientBalance",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "approver",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InvalidApprover",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "receiver",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InvalidReceiver",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InvalidSender",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InvalidSpender",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "FailedCall",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "Forbidden",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidInitialization",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidVault",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NotInitializing",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnableInvalidOwner",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnableUnauthorizedAccount",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UUPSUnauthorizedCallContext",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "slot",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "UUPSUnsupportedProxiableUUID",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint64",
|
||||
"name": "version",
|
||||
"type": "uint64"
|
||||
}
|
||||
],
|
||||
"name": "Initialized",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "previousOwner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnershipTransferred",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Upgraded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "VaultAdded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "VaultRemoved",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UPGRADE_INTERFACE_VERSION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addVault",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_amount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "burn",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_amount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "mint",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "proxiableUUID",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeVault",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "renounceOwnership",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "newImplementation",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "upgradeToAndCall",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "vaults",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
1552
webapp/lib/contracts/abis/YT-Token.json
Normal file
1552
webapp/lib/contracts/abis/YT-Token.json
Normal file
File diff suppressed because it is too large
Load Diff
907
webapp/lib/contracts/abis/YTAssetFactory.json
Normal file
907
webapp/lib/contracts/abis/YTAssetFactory.json
Normal file
@@ -0,0 +1,907 @@
|
||||
[
|
||||
{
|
||||
"inputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AddressEmptyCode",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC1967InvalidImplementation",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ERC1967NonPayable",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "FailedCall",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidAddress",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidHardCap",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidInitialization",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NotInitializing",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnableInvalidOwner",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnableUnauthorizedAccount",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UUPSUnauthorizedCallContext",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "slot",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "UUPSUnsupportedProxiableUUID",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "VaultNotExists",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "newDefaultHardCap",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "DefaultHardCapSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "newHardCap",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "HardCapSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint64",
|
||||
"name": "version",
|
||||
"type": "uint64"
|
||||
}
|
||||
],
|
||||
"name": "Initialized",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "redemptionTime",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "NextRedemptionTimeSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "previousOwner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnershipTransferred",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "ytPrice",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "PricesUpdated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Upgraded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "manager",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "hardCap",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "index",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "VaultCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "newImplementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "VaultImplementationUpdated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UPGRADE_INTERFACE_VERSION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "allVaults",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "_name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "_symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_manager",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_hardCap",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdc",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_redemptionTime",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_initialYtPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdcPriceFeed",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "createVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string[]",
|
||||
"name": "_names",
|
||||
"type": "string[]"
|
||||
},
|
||||
{
|
||||
"internalType": "string[]",
|
||||
"name": "_symbols",
|
||||
"type": "string[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_managers",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "_hardCaps",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdc",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "_redemptionTimes",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "_initialYtPrices",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdcPriceFeed",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "createVaultBatch",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "vaults",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "defaultHardCap",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAllVaults",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVaultCount",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getVaultInfo",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "exists",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "totalAssets",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "idleAssets",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "managedAssets",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "totalSupply",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "hardCap",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "usdcPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "ytPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "nextRedemptionTime",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_start",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_end",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getVaults",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "vaults",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vaultImplementation",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_defaultHardCap",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "pauseVault",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_vaults",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "pauseVaultBatch",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "proxiableUUID",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "renounceOwnership",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_defaultHardCap",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setDefaultHardCap",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_hardCap",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setHardCap",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_vaults",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "_hardCaps",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"name": "setHardCapBatch",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_threshold",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setPriceStalenessThreshold",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_newImplementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setVaultImplementation",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_manager",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setVaultManager",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_nextRedemptionTime",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setVaultNextRedemptionTime",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_vaults",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_nextRedemptionTime",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setVaultNextRedemptionTimeBatch",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "unpauseVault",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_vaults",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "unpauseVaultBatch",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_ytPrice",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "updateVaultPrices",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_vaults",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "_ytPrices",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"name": "updateVaultPricesBatch",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "newImplementation",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "upgradeToAndCall",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_newImplementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "upgradeVault",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_vaults",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_newImplementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "upgradeVaultBatch",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "vaultImplementation",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
657
webapp/lib/contracts/abis/YTLPToken.json
Normal file
657
webapp/lib/contracts/abis/YTLPToken.json
Normal file
@@ -0,0 +1,657 @@
|
||||
[
|
||||
{
|
||||
"inputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AddressEmptyCode",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC1967InvalidImplementation",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ERC1967NonPayable",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "allowance",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "needed",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InsufficientAllowance",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "needed",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InsufficientBalance",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "approver",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InvalidApprover",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "receiver",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InvalidReceiver",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InvalidSender",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC20InvalidSpender",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "FailedCall",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidInitialization",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidMinter",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidPoolManager",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NotInitializing",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NotMinter",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnableInvalidOwner",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnableUnauthorizedAccount",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UUPSUnauthorizedCallContext",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "slot",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "UUPSUnsupportedProxiableUUID",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint64",
|
||||
"name": "version",
|
||||
"type": "uint64"
|
||||
}
|
||||
],
|
||||
"name": "Initialized",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "minter",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "bool",
|
||||
"name": "isActive",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "MinterSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "previousOwner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnershipTransferred",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Upgraded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UPGRADE_INTERFACE_VERSION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_amount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "burn",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isMinter",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_amount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "mint",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "poolManager",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "proxiableUUID",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "renounceOwnership",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_minter",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "_isActive",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "setMinter",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_poolManager",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setPoolManager",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "newImplementation",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "upgradeToAndCall",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
847
webapp/lib/contracts/abis/YTPoolManager.json
Normal file
847
webapp/lib/contracts/abis/YTPoolManager.json
Normal file
@@ -0,0 +1,847 @@
|
||||
[
|
||||
{
|
||||
"inputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AddressEmptyCode",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "CooldownNotPassed",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC1967InvalidImplementation",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ERC1967NonPayable",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "FailedCall",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "Forbidden",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InsufficientOutput",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidAddress",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidAmount",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidDuration",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidInitialization",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NotInitializing",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "PrivateMode",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ReentrancyGuardReentrantCall",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "SafeERC20FailedOperation",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UUPSUnauthorizedCallContext",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "slot",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "UUPSUnsupportedProxiableUUID",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "aumInUsdy",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "ytLPSupply",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "usdyAmount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "mintAmount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "AddLiquidity",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "addition",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "deduction",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "AumAdjustmentChanged",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "duration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "CooldownDurationSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "cooldownTime",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "CooldownInherited",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "oldGov",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "newGov",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "GovChanged",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "handler",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "bool",
|
||||
"name": "isActive",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "HandlerSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint64",
|
||||
"name": "version",
|
||||
"type": "uint64"
|
||||
}
|
||||
],
|
||||
"name": "Initialized",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "ytLPAmount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "aumInUsdy",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "ytLPSupply",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "usdyAmount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "RemoveLiquidity",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Upgraded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "BASIS_POINTS_DIVISOR",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "MAX_COOLDOWN_DURATION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "PRICE_PRECISION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UPGRADE_INTERFACE_VERSION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "YTLP_PRECISION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_fundingAccount",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_amount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_minUsdy",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_minYtLP",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "addLiquidityForAccount",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "aumAddition",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "aumDeduction",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "cooldownDuration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_amount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getAddLiquidityOutput",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "usdyAmount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "ytLPMintAmount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "_maximise",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "getAumInUsdy",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "_maximise",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "getPrice",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_tokenOut",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_ytLPAmount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getRemoveLiquidityOutput",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "usdyAmount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "gov",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_ytVault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdy",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_ytLP",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_cooldownDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isHandler",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "lastAddedAt",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "onLPTransfer",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "proxiableUUID",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_tokenOut",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_ytLPAmount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_minOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_receiver",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidityForAccount",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_addition",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_deduction",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setAumAdjustment",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_duration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setCooldownDuration",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_gov",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setGov",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_handler",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "_isActive",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "setHandler",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "newImplementation",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "upgradeToAndCall",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "usdy",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ytLP",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ytVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
649
webapp/lib/contracts/abis/YTPriceFeed.json
Normal file
649
webapp/lib/contracts/abis/YTPriceFeed.json
Normal file
@@ -0,0 +1,649 @@
|
||||
[
|
||||
{
|
||||
"inputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AddressEmptyCode",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC1967InvalidImplementation",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ERC1967NonPayable",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "FailedCall",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "Forbidden",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidAddress",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidChainlinkPrice",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidInitialization",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "MaxChangeTooHigh",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NotInitializing",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "PriceChangeTooLarge",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "SpreadTooHigh",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "StalePrice",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UUPSUnauthorizedCallContext",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "slot",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "UUPSUnsupportedProxiableUUID",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint64",
|
||||
"name": "version",
|
||||
"type": "uint64"
|
||||
}
|
||||
],
|
||||
"name": "Initialized",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "keeper",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "bool",
|
||||
"name": "isActive",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "KeeperSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "oldPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "newPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "PriceUpdate",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "spreadBps",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "SpreadUpdate",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Upgraded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "BASIS_POINTS_DIVISOR",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "MAX_SPREAD_BASIS_POINTS",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "PRICE_PRECISION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UPGRADE_INTERFACE_VERSION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_price",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "forceUpdatePrice",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getMaxPrice",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getMinPrice",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "_maximise",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "getPrice",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getPriceInfo",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "currentPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "cachedPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "maxPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "minPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "spread",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "gov",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdcAddress",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdcPriceFeed",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isKeeper",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "lastPrice",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "maxPriceChangeBps",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "priceStalenesThreshold",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "proxiableUUID",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_keeper",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "_isActive",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "setKeeper",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_maxPriceChangeBps",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setMaxPriceChangeBps",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_threshold",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setPriceStalenessThreshold",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_spreadBasisPoints",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setSpreadBasisPoints",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_tokens",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "_spreadBasisPoints",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"name": "setSpreadBasisPointsForMultiple",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdcAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setUSDCAddress",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdcPriceFeed",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setUSDCPriceFeed",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "spreadBasisPoints",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "updatePrice",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "newImplementation",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "upgradeToAndCall",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "usdcAddress",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
497
webapp/lib/contracts/abis/YTRewardRouter.json
Normal file
497
webapp/lib/contracts/abis/YTRewardRouter.json
Normal file
@@ -0,0 +1,497 @@
|
||||
[
|
||||
{
|
||||
"inputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AddressEmptyCode",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "AlreadyInitialized",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC1967InvalidImplementation",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ERC1967NonPayable",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "EnforcedPause",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ExpectedPause",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "FailedCall",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "Forbidden",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InsufficientOutput",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidAddress",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidAmount",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidInitialization",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NotInitializing",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ReentrancyGuardReentrantCall",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UUPSUnauthorizedCallContext",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "slot",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "UUPSUnsupportedProxiableUUID",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint64",
|
||||
"name": "version",
|
||||
"type": "uint64"
|
||||
}
|
||||
],
|
||||
"name": "Initialized",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Paused",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "tokenIn",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "tokenOut",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Swap",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Unpaused",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Upgraded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UPGRADE_INTERFACE_VERSION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_amount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_minUsdy",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_minYtLP",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "addLiquidity",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getAccountValue",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getYtLPPrice",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "gov",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdy",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_ytLP",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_ytPoolManager",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_ytVault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "pause",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "paused",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "proxiableUUID",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_tokenOut",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_ytLPAmount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_minOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_receiver",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidity",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_tokenIn",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_tokenOut",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_minOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_receiver",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "swapYT",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "unpause",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "newImplementation",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "upgradeToAndCall",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "usdy",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ytLP",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ytPoolManager",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ytVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
581
webapp/lib/contracts/abis/YTVault.json
Normal file
581
webapp/lib/contracts/abis/YTVault.json
Normal file
@@ -0,0 +1,581 @@
|
||||
[
|
||||
{
|
||||
"inputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "target", "type": "address" }],
|
||||
"name": "AddressEmptyCode",
|
||||
"type": "error"
|
||||
},
|
||||
{ "inputs": [], "name": "AmountExceedsLimit", "type": "error" },
|
||||
{ "inputs": [], "name": "DailyLimitExceeded", "type": "error" },
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }],
|
||||
"name": "ERC1967InvalidImplementation",
|
||||
"type": "error"
|
||||
},
|
||||
{ "inputs": [], "name": "ERC1967NonPayable", "type": "error" },
|
||||
{ "inputs": [], "name": "EmergencyMode", "type": "error" },
|
||||
{ "inputs": [], "name": "FailedCall", "type": "error" },
|
||||
{ "inputs": [], "name": "Forbidden", "type": "error" },
|
||||
{ "inputs": [], "name": "InsufficientPool", "type": "error" },
|
||||
{ "inputs": [], "name": "InsufficientUSDYAmount", "type": "error" },
|
||||
{ "inputs": [], "name": "InvalidAddress", "type": "error" },
|
||||
{ "inputs": [], "name": "InvalidAmount", "type": "error" },
|
||||
{ "inputs": [], "name": "InvalidFee", "type": "error" },
|
||||
{ "inputs": [], "name": "InvalidInitialization", "type": "error" },
|
||||
{ "inputs": [], "name": "InvalidPoolAmount", "type": "error" },
|
||||
{ "inputs": [], "name": "MaxUSDYExceeded", "type": "error" },
|
||||
{ "inputs": [], "name": "NotInEmergency", "type": "error" },
|
||||
{ "inputs": [], "name": "NotInitializing", "type": "error" },
|
||||
{ "inputs": [], "name": "NotSwapper", "type": "error" },
|
||||
{ "inputs": [], "name": "OnlyPoolManager", "type": "error" },
|
||||
{ "inputs": [], "name": "ReentrancyGuardReentrantCall", "type": "error" },
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "token", "type": "address" }],
|
||||
"name": "SafeERC20FailedOperation",
|
||||
"type": "error"
|
||||
},
|
||||
{ "inputs": [], "name": "SameToken", "type": "error" },
|
||||
{ "inputs": [], "name": "SlippageTooHigh", "type": "error" },
|
||||
{ "inputs": [], "name": "SwapDisabled", "type": "error" },
|
||||
{ "inputs": [], "name": "TokenNotWhitelisted", "type": "error" },
|
||||
{ "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" },
|
||||
{
|
||||
"inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }],
|
||||
"name": "UUPSUnsupportedProxiableUUID",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{ "indexed": true, "internalType": "address", "name": "account", "type": "address" },
|
||||
{ "indexed": true, "internalType": "address", "name": "token", "type": "address" },
|
||||
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" },
|
||||
{ "indexed": false, "internalType": "uint256", "name": "usdyAmount", "type": "uint256" }
|
||||
],
|
||||
"name": "AddLiquidity",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [{ "indexed": false, "internalType": "bool", "name": "enabled", "type": "bool" }],
|
||||
"name": "EmergencyModeSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{ "indexed": true, "internalType": "address", "name": "oldGov", "type": "address" },
|
||||
{ "indexed": true, "internalType": "address", "name": "newGov", "type": "address" }
|
||||
],
|
||||
"name": "GovChanged",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }],
|
||||
"name": "Initialized",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{ "indexed": true, "internalType": "address", "name": "oldManager", "type": "address" },
|
||||
{ "indexed": true, "internalType": "address", "name": "newManager", "type": "address" }
|
||||
],
|
||||
"name": "PoolManagerChanged",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{ "indexed": true, "internalType": "address", "name": "account", "type": "address" },
|
||||
{ "indexed": true, "internalType": "address", "name": "token", "type": "address" },
|
||||
{ "indexed": false, "internalType": "uint256", "name": "usdyAmount", "type": "uint256" },
|
||||
{ "indexed": false, "internalType": "uint256", "name": "amountOut", "type": "uint256" }
|
||||
],
|
||||
"name": "RemoveLiquidity",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{ "indexed": true, "internalType": "address", "name": "account", "type": "address" },
|
||||
{ "indexed": true, "internalType": "address", "name": "tokenIn", "type": "address" },
|
||||
{ "indexed": true, "internalType": "address", "name": "tokenOut", "type": "address" },
|
||||
{ "indexed": false, "internalType": "uint256", "name": "amountIn", "type": "uint256" },
|
||||
{ "indexed": false, "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
||||
{ "indexed": false, "internalType": "uint256", "name": "feeBasisPoints", "type": "uint256" }
|
||||
],
|
||||
"name": "Swap",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [{ "indexed": false, "internalType": "bool", "name": "enabled", "type": "bool" }],
|
||||
"name": "SwapEnabledSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }],
|
||||
"name": "Upgraded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "BASIS_POINTS_DIVISOR",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "PRICE_PRECISION",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UPGRADE_INTERFACE_VERSION",
|
||||
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "USDY_DECIMALS",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"name": "allWhitelistedTokens",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_token", "type": "address" },
|
||||
{ "internalType": "address", "name": "_receiver", "type": "address" }
|
||||
],
|
||||
"name": "buyUSDY",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "_token", "type": "address" }],
|
||||
"name": "clearWhitelistedToken",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "emergencyMode",
|
||||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAllPoolTokens",
|
||||
"outputs": [{ "internalType": "address[]", "name": "", "type": "address[]" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "_usdyDelta", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_feeBasisPoints", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_taxBasisPoints", "type": "uint256" },
|
||||
{ "internalType": "bool", "name": "_increment", "type": "bool" }
|
||||
],
|
||||
"name": "getFeeBasisPoints",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "_token", "type": "address" }],
|
||||
"name": "getMaxPrice",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "_token", "type": "address" }],
|
||||
"name": "getMinPrice",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "bool", "name": "_maximise", "type": "bool" }],
|
||||
"name": "getPoolValue",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_token", "type": "address" },
|
||||
{ "internalType": "bool", "name": "_maximise", "type": "bool" }
|
||||
],
|
||||
"name": "getPrice",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "_usdyAmount", "type": "uint256" }
|
||||
],
|
||||
"name": "getRedemptionFeeBasisPoints",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_tokenIn", "type": "address" },
|
||||
{ "internalType": "address", "name": "_tokenOut", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "_amountIn", "type": "uint256" }
|
||||
],
|
||||
"name": "getSwapAmountOut",
|
||||
"outputs": [
|
||||
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "amountOutAfterFees", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "feeBasisPoints", "type": "uint256" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_tokenIn", "type": "address" },
|
||||
{ "internalType": "address", "name": "_tokenOut", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "_usdyAmount", "type": "uint256" }
|
||||
],
|
||||
"name": "getSwapFeeBasisPoints",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "_token", "type": "address" }],
|
||||
"name": "getTargetUsdyAmount",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "gov",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "hasDynamicFees",
|
||||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_usdy", "type": "address" },
|
||||
{ "internalType": "address", "name": "_priceFeed", "type": "address" }
|
||||
],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isSwapEnabled",
|
||||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "isSwapper",
|
||||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "maxSwapAmount",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "maxSwapSlippageBps",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "maxUsdyAmounts",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "poolAmounts",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "priceFeed",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "proxiableUUID",
|
||||
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_token", "type": "address" },
|
||||
{ "internalType": "address", "name": "_receiver", "type": "address" }
|
||||
],
|
||||
"name": "sellUSDY",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "bool", "name": "_hasDynamicFees", "type": "bool" }],
|
||||
"name": "setDynamicFees",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "bool", "name": "_emergencyMode", "type": "bool" }],
|
||||
"name": "setEmergencyMode",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "_gov", "type": "address" }],
|
||||
"name": "setGov",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "_amount", "type": "uint256" }
|
||||
],
|
||||
"name": "setMaxSwapAmount",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "uint256", "name": "_slippageBps", "type": "uint256" }],
|
||||
"name": "setMaxSwapSlippageBps",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "_manager", "type": "address" }],
|
||||
"name": "setPoolManager",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "bool", "name": "_isSwapEnabled", "type": "bool" }],
|
||||
"name": "setSwapEnabled",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "_swapFee", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_stableSwapFee", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_taxBasisPoints", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_stableTaxBasisPoints", "type": "uint256" }
|
||||
],
|
||||
"name": "setSwapFees",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_swapper", "type": "address" },
|
||||
{ "internalType": "bool", "name": "_isActive", "type": "bool" }
|
||||
],
|
||||
"name": "setSwapper",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "_decimals", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_weight", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_maxUsdyAmount", "type": "uint256" },
|
||||
{ "internalType": "bool", "name": "_isStable", "type": "bool" }
|
||||
],
|
||||
"name": "setWhitelistedToken",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "stableSwapFeeBasisPoints",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "stableTaxBasisPoints",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "stableTokens",
|
||||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_tokenIn", "type": "address" },
|
||||
{ "internalType": "address", "name": "_tokenOut", "type": "address" },
|
||||
{ "internalType": "address", "name": "_receiver", "type": "address" }
|
||||
],
|
||||
"name": "swap",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "swapFeeBasisPoints",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "taxBasisPoints",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "tokenBalances",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "tokenDecimals",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "tokenWeights",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "totalTokenWeights",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "newImplementation", "type": "address" },
|
||||
{ "internalType": "bytes", "name": "data", "type": "bytes" }
|
||||
],
|
||||
"name": "upgradeToAndCall",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "usdy",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "usdyAmounts",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "whitelistedTokens",
|
||||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_token", "type": "address" },
|
||||
{ "internalType": "address", "name": "_receiver", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "_amount", "type": "uint256" }
|
||||
],
|
||||
"name": "withdrawToken",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ytPoolManager",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
1468
webapp/lib/contracts/abis/lendingProxy.json
Normal file
1468
webapp/lib/contracts/abis/lendingProxy.json
Normal file
File diff suppressed because it is too large
Load Diff
126
webapp/lib/contracts/index.ts
Normal file
126
webapp/lib/contracts/index.ts
Normal file
@@ -0,0 +1,126 @@
|
||||
import { arbitrumSepolia, bscTestnet } from 'wagmi/chains'
|
||||
import { getDynamicOverride } from './registry'
|
||||
|
||||
// 导入所有 ABI
|
||||
import YTAssetFactory_ABI from './abis/YTAssetFactory.json'
|
||||
import YTToken_ABI from './abis/YT-Token.json'
|
||||
import USDY_ABI from './abis/USDY.json'
|
||||
import YTLPToken_ABI from './abis/YTLPToken.json'
|
||||
import YTPriceFeed_ABI from './abis/YTPriceFeed.json'
|
||||
import YTVault_ABI from './abis/YTVault.json'
|
||||
import YTPoolManager_ABI from './abis/YTPoolManager.json'
|
||||
import YTRewardRouter_ABI from './abis/YTRewardRouter.json'
|
||||
import lendingProxy_ABI from './abis/lendingProxy.json'
|
||||
|
||||
/**
|
||||
* 合约名称枚举(用于类型安全)
|
||||
* 地址全部从数据库动态加载,通过 /api/contracts 接口获取。
|
||||
*/
|
||||
export type ContractName =
|
||||
| 'USDC'
|
||||
| 'USDY'
|
||||
| 'YT-A'
|
||||
| 'YT-B'
|
||||
| 'YT-C'
|
||||
| 'YTLPToken'
|
||||
| 'YTAssetFactory'
|
||||
| 'YTVault'
|
||||
| 'YTPriceFeed'
|
||||
| 'YTPoolManager'
|
||||
| 'YTRewardRouter'
|
||||
| 'lendingProxy'
|
||||
|
||||
/**
|
||||
* ABI 配置
|
||||
*/
|
||||
export const abis = {
|
||||
// 代币
|
||||
YTToken: YTToken_ABI,
|
||||
USDY: USDY_ABI,
|
||||
YTLPToken: YTLPToken_ABI,
|
||||
|
||||
// 核心合约
|
||||
YTAssetFactory: YTAssetFactory_ABI,
|
||||
YTVault: YTVault_ABI,
|
||||
YTPriceFeed: YTPriceFeed_ABI,
|
||||
YTPoolManager: YTPoolManager_ABI,
|
||||
YTRewardRouter: YTRewardRouter_ABI,
|
||||
|
||||
// 借贷
|
||||
lendingProxy: lendingProxy_ABI,
|
||||
} as const
|
||||
|
||||
/**
|
||||
* 获取合约地址(完全从动态注册表读取)
|
||||
* 地址由后端 /api/contracts 接口提供(来源:system_contracts + assets 表)。
|
||||
* 启动时由 useContractRegistry() 写入注册表。
|
||||
* 未加载完成前返回 undefined,各 hook 通过 enabled: !!address 优雅处理。
|
||||
*/
|
||||
export function getContractAddress(
|
||||
contractName: string,
|
||||
chainId: number
|
||||
): `0x${string}` | undefined {
|
||||
return getDynamicOverride(contractName, chainId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取合约 ABI
|
||||
*/
|
||||
export function getContractABI(contractName: keyof typeof abis) {
|
||||
return abis[contractName]
|
||||
}
|
||||
|
||||
/** 支持的网络 */
|
||||
export const SUPPORTED_CHAINS = {
|
||||
ARBITRUM_SEPOLIA: {
|
||||
id: arbitrumSepolia.id,
|
||||
name: 'Arbitrum Sepolia',
|
||||
explorer: 'https://sepolia.arbiscan.io',
|
||||
rpcUrl: 'https://sepolia-rollup.arbitrum.io/rpc',
|
||||
},
|
||||
BSC_TESTNET: {
|
||||
id: bscTestnet.id,
|
||||
name: 'BSC Testnet',
|
||||
explorer: 'https://testnet.bscscan.com',
|
||||
rpcUrl: 'https://bsc-testnet-rpc.publicnode.com',
|
||||
},
|
||||
} as const
|
||||
|
||||
/**
|
||||
* 获取区块浏览器 URL
|
||||
*/
|
||||
export function getBlockExplorerUrl(chainId: number): string {
|
||||
if (chainId === bscTestnet.id) {
|
||||
return SUPPORTED_CHAINS.BSC_TESTNET.explorer
|
||||
}
|
||||
return SUPPORTED_CHAINS.ARBITRUM_SEPOLIA.explorer
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取交易 URL
|
||||
*/
|
||||
export function getTxUrl(txHash: string, chainId?: number): string {
|
||||
const explorer = chainId ? getBlockExplorerUrl(chainId) : SUPPORTED_CHAINS.BSC_TESTNET.explorer
|
||||
return `${explorer}/tx/${txHash}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地址 URL
|
||||
*/
|
||||
export function getAddressUrl(address: string, chainId?: number): string {
|
||||
const explorer = chainId ? getBlockExplorerUrl(chainId) : SUPPORTED_CHAINS.BSC_TESTNET.explorer
|
||||
return `${explorer}/address/${address}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网络名称
|
||||
*/
|
||||
export function getNetworkName(chainId: number): string {
|
||||
if (chainId === bscTestnet.id) {
|
||||
return SUPPORTED_CHAINS.BSC_TESTNET.name
|
||||
}
|
||||
if (chainId === arbitrumSepolia.id) {
|
||||
return SUPPORTED_CHAINS.ARBITRUM_SEPOLIA.name
|
||||
}
|
||||
return `Unknown Network (${chainId})`
|
||||
}
|
||||
30
webapp/lib/contracts/registry.ts
Normal file
30
webapp/lib/contracts/registry.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Dynamic contract address registry.
|
||||
* Populated from /api/contracts at runtime; falls back to static config.
|
||||
* Module-level store — safe because addresses are the same across all renders.
|
||||
*/
|
||||
const dynamicRegistry = new Map<string, `0x${string}`>()
|
||||
|
||||
export function setContractAddressDynamic(name: string, chainId: number, address: string) {
|
||||
if (address && address.startsWith('0x')) {
|
||||
dynamicRegistry.set(`${name}:${chainId}`, address as `0x${string}`)
|
||||
}
|
||||
}
|
||||
|
||||
export function getDynamicOverride(name: string, chainId: number): `0x${string}` | undefined {
|
||||
return dynamicRegistry.get(`${name}:${chainId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 按名称搜索,忽略 chainId(当 token 的 chainId=0 即 DB 未配置时使用)
|
||||
* 返回第一个匹配的 { address, chainId }
|
||||
*/
|
||||
export function getDynamicOverrideByName(name: string): { address: `0x${string}`; chainId: number } | undefined {
|
||||
for (const [key, value] of dynamicRegistry) {
|
||||
if (key.startsWith(`${name}:`)) {
|
||||
const chainId = parseInt(key.split(':')[1], 10)
|
||||
return { address: value, chainId }
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
77
webapp/lib/errors.ts
Normal file
77
webapp/lib/errors.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* 合约错误处理工具
|
||||
*/
|
||||
|
||||
const USER_REJECTION_PATTERNS = [
|
||||
'User rejected',
|
||||
'User denied',
|
||||
'user rejected',
|
||||
'rejected the request',
|
||||
]
|
||||
|
||||
/** 判断是否为用户拒绝交易 */
|
||||
export function isUserRejection(err: unknown): boolean {
|
||||
const msg = getErrorMessage(err)
|
||||
return USER_REJECTION_PATTERNS.some(pattern => msg.includes(pattern))
|
||||
}
|
||||
|
||||
/** 解析合约 revert 原因 */
|
||||
export function parseContractError(err: unknown, fallback = 'Transaction failed'): string {
|
||||
if (!err) return fallback
|
||||
const msg = getErrorMessage(err)
|
||||
const match =
|
||||
msg.match(/reverted with reason string '(.+?)'/) ||
|
||||
msg.match(/execution reverted: (.+?)(?:\n|$)/) ||
|
||||
msg.match(/reverted: (.+?)(?:\n|$)/)
|
||||
if (match) return match[1]
|
||||
const short = getShortMessage(err)
|
||||
if (short) return short
|
||||
return fallback
|
||||
}
|
||||
|
||||
/** 统一 catch 块处理 */
|
||||
export function handleContractCatchError(
|
||||
err: unknown,
|
||||
fallback: string,
|
||||
setError: (msg: string) => void,
|
||||
setStatus: (status: string) => void,
|
||||
): void {
|
||||
if (isUserRejection(err)) {
|
||||
setError('Transaction cancelled')
|
||||
setStatus('idle')
|
||||
} else {
|
||||
setError(parseContractError(err, fallback))
|
||||
setStatus('error')
|
||||
}
|
||||
}
|
||||
|
||||
/** 校验金额是否为合法正数 */
|
||||
export function isValidAmount(amount: string): boolean {
|
||||
const n = Number(amount)
|
||||
return !isNaN(n) && isFinite(n) && n > 0
|
||||
}
|
||||
|
||||
/** 安全解析浮点数,NaN/Infinity → 0 */
|
||||
export function safeParseFloat(value: string | number): number {
|
||||
const n = typeof value === 'string' ? parseFloat(value) : value
|
||||
if (isNaN(n) || !isFinite(n)) return 0
|
||||
return n
|
||||
}
|
||||
|
||||
function getErrorMessage(err: unknown): string {
|
||||
if (err instanceof Error) return err.message
|
||||
if (typeof err === 'object' && err !== null) {
|
||||
const e = err as Record<string, unknown>
|
||||
if (typeof e.message === 'string') return e.message
|
||||
if (typeof e.shortMessage === 'string') return e.shortMessage
|
||||
}
|
||||
return String(err)
|
||||
}
|
||||
|
||||
function getShortMessage(err: unknown): string | undefined {
|
||||
if (typeof err === 'object' && err !== null) {
|
||||
const e = err as Record<string, unknown>
|
||||
if (typeof e.shortMessage === 'string') return e.shortMessage
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
63
webapp/lib/wagmi.ts
Normal file
63
webapp/lib/wagmi.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { http, fallback } from 'wagmi'
|
||||
import { mainnet, sepolia, arbitrum, base, arbitrumSepolia, bscTestnet, bsc } from 'wagmi/chains'
|
||||
import { injected } from 'wagmi/connectors'
|
||||
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi'
|
||||
import { createAppKit } from '@reown/appkit/react'
|
||||
|
||||
// WalletConnect Project ID
|
||||
const projectId = process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID || ''
|
||||
|
||||
const networks = [mainnet, sepolia, arbitrum, base, bsc, arbitrumSepolia, bscTestnet] as const
|
||||
|
||||
// Mutable copy for AppKit which requires non-readonly tuple
|
||||
const mutableNetworks = [...networks] as unknown as [import('@reown/appkit/networks').AppKitNetwork, ...import('@reown/appkit/networks').AppKitNetwork[]]
|
||||
|
||||
const transports = {
|
||||
[mainnet.id]: http(),
|
||||
[sepolia.id]: http(),
|
||||
[arbitrum.id]: http(),
|
||||
[base.id]: http(),
|
||||
[bsc.id]: http(),
|
||||
[arbitrumSepolia.id]: http(),
|
||||
[bscTestnet.id]: fallback([
|
||||
http('https://bsc-testnet-rpc.publicnode.com'),
|
||||
http('https://bsc-testnet.blockpi.network/v1/rpc/public'),
|
||||
http('https://endpoints.omniatech.io/v1/bsc/testnet/public'),
|
||||
http('https://data-seed-prebsc-1-s1.binance.org:8545'),
|
||||
]),
|
||||
}
|
||||
|
||||
// Wagmi Adapter for AppKit — WalletConnect Core is initialized here only once
|
||||
export const wagmiAdapter = new WagmiAdapter({
|
||||
networks: mutableNetworks,
|
||||
projectId,
|
||||
connectors: [injected({ shimDisconnect: true })],
|
||||
transports,
|
||||
})
|
||||
|
||||
// Create AppKit modal
|
||||
createAppKit({
|
||||
adapters: [wagmiAdapter],
|
||||
networks: mutableNetworks,
|
||||
projectId,
|
||||
metadata: {
|
||||
name: 'AssetX',
|
||||
description: 'DeFi Asset Management Platform',
|
||||
url: typeof window !== 'undefined' ? window.location.origin : 'https://assetx.io',
|
||||
icons: ['/logo.svg'],
|
||||
},
|
||||
features: {
|
||||
analytics: true,
|
||||
email: false,
|
||||
socials: [],
|
||||
onramp: false,
|
||||
swaps: false,
|
||||
},
|
||||
themeMode: 'light',
|
||||
themeVariables: {
|
||||
'--w3m-z-index': 9999,
|
||||
},
|
||||
})
|
||||
|
||||
// Use wagmiAdapter.wagmiConfig as the single source of truth
|
||||
export const config = wagmiAdapter.wagmiConfig
|
||||
Reference in New Issue
Block a user