feat: add HEZ/DOT pool support and fix user-facing token names

- Add HEZ/DOT pool to PoolDashboard
- Display DOT, ETH, BTC instead of wDOT, wETH, wBTC to users
- Update priceOracle with correct symbol mappings
- Fix lint errors in check_all_pools.mjs
- Extract MINTABLE_ASSETS to separate file for fast refresh
This commit is contained in:
2026-02-06 11:06:28 +03:00
parent 884d68714b
commit 842dc9d8c2
7 changed files with 159 additions and 61 deletions
+3 -4
View File
@@ -7,10 +7,9 @@ const COINGECKO_API = 'https://api.coingecko.com/api/v3';
// CoinGecko ID mappings
export const COINGECKO_IDS: Record<string, string> = {
'wDOT': 'polkadot',
'wETH': 'ethereum',
'wBTC': 'bitcoin',
'wUSDT': 'tether',
'DOT': 'polkadot',
'ETH': 'ethereum',
'BTC': 'bitcoin',
'USDT': 'tether',
};
+91
View File
@@ -0,0 +1,91 @@
import { ApiPromise, WsProvider } from '@pezkuwi/api';
async function checkAllPools() {
const provider = new WsProvider('wss://asset-hub-rpc.pezkuwichain.io');
const api = await ApiPromise.create({ provider });
console.log('Connected to Asset Hub\n');
const userAddress = '5CyuFfbF95rzBxru7c9yEsX4XmQXUxpLUcbj9RLg9K1cGiiF';
// Get all pools
const poolKeys = await api.query.assetConversion.pools.keys();
console.log('=== ALL POOLS ===');
console.log('Total pools found:', poolKeys.length, '\n');
for (const key of poolKeys) {
const poolPair = key.args[0];
console.log('Pool key:', JSON.stringify(poolPair.toHuman()));
const poolInfo = await api.query.assetConversion.pools(poolPair);
if (!poolInfo.isEmpty) {
const poolData = poolInfo.unwrap().toJSON();
console.log('LP Token ID:', poolData.lpToken);
// Get LP supply
const lpAsset = await api.query.poolAssets.asset(poolData.lpToken);
if (lpAsset.isSome) {
const supply = lpAsset.unwrap().toJSON().supply;
console.log('Total LP Supply:', Number(BigInt(supply)) / 1e12);
}
// Get user's LP balance
const userLp = await api.query.poolAssets.account(poolData.lpToken, userAddress);
if (userLp.isSome) {
const balance = userLp.unwrap().toJSON().balance;
console.log('User LP Balance:', Number(BigInt(balance)) / 1e12);
} else {
console.log('User LP Balance: 0');
}
// Try to get price
try {
const asset1 = poolPair[0];
const asset2 = poolPair[1];
const oneUnit = BigInt(1e12);
const quote = await api.call.assetConversionApi.quotePriceExactTokensForTokens(
asset1,
asset2,
oneUnit.toString(),
true
);
if (quote && !quote.isNone) {
console.log('Price (1 asset1 -> asset2):', Number(BigInt(quote.unwrap().toString())) / 1e12);
}
} catch {
// Try with 6 decimals for USDT
try {
const asset1 = poolPair[0];
const asset2 = poolPair[1];
const oneUnit = BigInt(1e12);
const quote = await api.call.assetConversionApi.quotePriceExactTokensForTokens(
asset1,
asset2,
oneUnit.toString(),
true
);
if (quote && !quote.isNone) {
console.log('Price (1 asset1 -> asset2):', Number(BigInt(quote.unwrap().toString())) / 1e6, 'USDT');
}
} catch {
console.log('Could not get price');
}
}
}
console.log('---');
}
// Check all LP token balances for user
console.log('\n=== USER LP TOKEN BALANCES ===');
for (let lpId = 0; lpId < 5; lpId++) {
const userLp = await api.query.poolAssets.account(lpId, userAddress);
if (userLp.isSome) {
const balance = userLp.unwrap().toJSON().balance;
console.log(`LP Token ${lpId}: ${Number(BigInt(balance)) / 1e12}`);
}
}
await api.disconnect();
}
checkAllPools().catch(console.error);
+7
View File
@@ -19,6 +19,9 @@ const getDisplayTokenName = (assetId: number): string => {
if (assetId === ASSET_IDS.WHEZ || assetId === 2) return 'wHEZ';
if (assetId === ASSET_IDS.PEZ || assetId === 1) return 'PEZ';
if (assetId === ASSET_IDS.WUSDT || assetId === 1000) return 'USDT';
if (assetId === 1001) return 'DOT';
if (assetId === 1002) return 'ETH';
if (assetId === 1003) return 'BTC';
return getAssetSymbol(assetId); // Fallback for other assets
};
@@ -75,6 +78,7 @@ const PoolDashboard = () => {
[NATIVE_TOKEN_ID, ASSET_IDS.PEZ], // Native HEZ / PEZ
[NATIVE_TOKEN_ID, ASSET_IDS.WUSDT], // Native HEZ / wUSDT
[NATIVE_TOKEN_ID, ASSET_IDS.WHEZ], // Native HEZ / wHEZ
[NATIVE_TOKEN_ID, 1001], // Native HEZ / wDOT
// wHEZ pools
[ASSET_IDS.WHEZ, ASSET_IDS.PEZ], // wHEZ / PEZ
[ASSET_IDS.WHEZ, ASSET_IDS.WUSDT], // wHEZ / wUSDT
@@ -155,6 +159,9 @@ const PoolDashboard = () => {
// Get decimals for each asset
const getAssetDecimals = (assetId: number): number => {
if (assetId === ASSET_IDS.WUSDT || assetId === 1000) return 6; // wUSDT has 6 decimals
if (assetId === 1001) return 10; // wDOT has 10 decimals
if (assetId === 1002) return 18; // wETH has 18 decimals
if (assetId === 1003) return 8; // wBTC has 8 decimals
return 12; // Native, wHEZ, PEZ have 12 decimals
};
+2 -1
View File
@@ -8,7 +8,8 @@ import PoolDashboard from '@/components/PoolDashboard';
import { CreatePoolModal } from './CreatePoolModal';
import { InitializeHezPoolModal } from './InitializeHezPoolModal';
import { InitializeUsdtModal } from './InitializeUsdtModal';
import { MintAssetModal, MINTABLE_ASSETS, type AssetConfig } from './MintAssetModal';
import { MintAssetModal } from './MintAssetModal';
import { MINTABLE_ASSETS, type AssetConfig } from './mintableAssets';
import { XCMConfigurationWizard } from '@/components/admin/XCMConfigurationWizard';
import { ArrowRightLeft, Droplet, Settings } from 'lucide-react';
import { isFounderWallet } from '@pezkuwi/utils/auth';
+1 -50
View File
@@ -8,16 +8,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Alert, AlertDescription } from '@/components/ui/alert';
import { useToast } from '@/hooks/use-toast';
export interface AssetConfig {
id: number;
symbol: string;
name: string;
decimals: number;
logo?: string;
defaultAmount?: string;
color?: string; // For theming (green, blue, orange, etc.)
}
import type { AssetConfig } from './mintableAssets';
interface MintAssetModalProps {
isOpen: boolean;
@@ -327,43 +318,3 @@ export const MintAssetModal: React.FC<MintAssetModalProps> = ({
</div>
);
};
// Pre-configured assets for easy use
export const MINTABLE_ASSETS: Record<string, AssetConfig> = {
wUSDT: {
id: 1000,
symbol: 'wUSDT',
name: 'Wrapped USDT',
decimals: 6,
logo: '/shared/images/USDT(hez)logo.png',
defaultAmount: '10000',
color: 'green',
},
wDOT: {
id: 1001,
symbol: 'wDOT',
name: 'Wrapped DOT',
decimals: 10,
logo: '/shared/images/dot.png',
defaultAmount: '100',
color: 'pink',
},
wETH: {
id: 1002,
symbol: 'wETH',
name: 'Wrapped ETH',
decimals: 18,
logo: '/shared/images/etherium.png',
defaultAmount: '10',
color: 'purple',
},
wBTC: {
id: 1003,
symbol: 'wBTC',
name: 'Wrapped BTC',
decimals: 8,
logo: '/shared/images/bitcoin.png',
defaultAmount: '1',
color: 'orange',
},
};
+6 -6
View File
@@ -28,9 +28,9 @@ type TransactionStatus = 'idle' | 'signing' | 'submitting' | 'success' | 'error'
const USER_TOKENS = [
{ symbol: 'HEZ', emoji: '🟡', assetId: -1, name: 'HEZ', decimals: 12, displaySymbol: 'HEZ', logo: '/shared/images/hez_token_512.png' },
{ symbol: 'USDT', emoji: '💵', assetId: 1000, name: 'USDT', decimals: 6, displaySymbol: 'USDT', logo: '/shared/images/USDT(hez)logo.png' },
{ symbol: 'wDOT', emoji: '🔴', assetId: 1001, name: 'Wrapped DOT', decimals: 10, displaySymbol: 'wDOT', logo: '/shared/images/dot.png' },
{ symbol: 'wETH', emoji: '💎', assetId: 1002, name: 'Wrapped ETH', decimals: 18, displaySymbol: 'wETH', logo: '/shared/images/etherium.png' },
{ symbol: 'wBTC', emoji: '🟠', assetId: 1003, name: 'Wrapped BTC', decimals: 8, displaySymbol: 'wBTC', logo: '/shared/images/bitcoin.png' },
{ symbol: 'DOT', emoji: '🔴', assetId: 1001, name: 'DOT', decimals: 10, displaySymbol: 'DOT', logo: '/shared/images/dot.png' },
{ symbol: 'ETH', emoji: '💎', assetId: 1002, name: 'ETH', decimals: 18, displaySymbol: 'ETH', logo: '/shared/images/etherium.png' },
{ symbol: 'BTC', emoji: '🟠', assetId: 1003, name: 'BTC', decimals: 8, displaySymbol: 'BTC', logo: '/shared/images/bitcoin.png' },
] as const;
export const SwapInterface: React.FC<SwapInterfaceProps> = ({ pools }) => {
@@ -266,9 +266,9 @@ export const SwapInterface: React.FC<SwapInterfaceProps> = ({ pools }) => {
switch (symbol) {
case 'HEZ': return nativeLocation;
case 'USDT': return usdtLocation;
case 'wDOT': return wdotLocation;
case 'wETH': return wethLocation;
case 'wBTC': return wbtcLocation;
case 'DOT': return wdotLocation;
case 'ETH': return wethLocation;
case 'BTC': return wbtcLocation;
default: return formatAssetLocation(fromAssetId!);
}
};
+49
View File
@@ -0,0 +1,49 @@
export interface AssetConfig {
id: number;
symbol: string;
name: string;
decimals: number;
logo?: string;
defaultAmount?: string;
color?: string; // For theming (green, blue, orange, etc.)
}
// Pre-configured assets for easy use
export const MINTABLE_ASSETS: Record<string, AssetConfig> = {
wUSDT: {
id: 1000,
symbol: 'wUSDT',
name: 'Wrapped USDT',
decimals: 6,
logo: '/shared/images/USDT(hez)logo.png',
defaultAmount: '10000',
color: 'green',
},
wDOT: {
id: 1001,
symbol: 'wDOT',
name: 'Wrapped DOT',
decimals: 10,
logo: '/shared/images/dot.png',
defaultAmount: '100',
color: 'pink',
},
wETH: {
id: 1002,
symbol: 'wETH',
name: 'Wrapped ETH',
decimals: 18,
logo: '/shared/images/etherium.png',
defaultAmount: '10',
color: 'purple',
},
wBTC: {
id: 1003,
symbol: 'wBTC',
name: 'Wrapped BTC',
decimals: 8,
logo: '/shared/images/bitcoin.png',
defaultAmount: '1',
color: 'orange',
},
};