feat: add platform fees for deposit networks

- TON: 0.1 USDT fee
- Polkadot: 0.1 USDT fee
- TRC20: 3 USDT fee (unchanged)
- Update fee display in Kurdish
This commit is contained in:
2026-02-08 05:58:45 +03:00
parent c45f95fa31
commit 107dbbacdf
4 changed files with 20 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "pezkuwi-telegram-miniapp",
"version": "1.0.181",
"version": "1.0.183",
"type": "module",
"description": "Pezkuwichain Telegram Mini App - Forum, Announcements, Rewards",
"author": "Pezkuwichain Team",
+3 -4
View File
@@ -40,7 +40,7 @@ const NETWORKS: NetworkInfo[] = [
description: 'Telegram Wallet',
icon: '💎',
recommended: true,
fee: 0.05,
fee: 0.1,
explorer: 'https://tonviewer.com/transaction/',
minDeposit: 10,
},
@@ -50,7 +50,7 @@ const NETWORKS: NetworkInfo[] = [
description: 'Asset Hub',
icon: '⚪',
recommended: true,
fee: 0.05,
fee: 0.1,
explorer: 'https://assethub-polkadot.subscan.io/extrinsic/',
minDeposit: 10,
},
@@ -61,8 +61,7 @@ const NETWORKS: NetworkInfo[] = [
icon: '🔴',
recommended: false,
fee: 3,
feeWarning:
'TRC20 ağ masrafı yaklaşık $3 civarındadır. 1000 USDT altındaki gönderimlerde verimli değildir. TON veya Polkadot ağını öneriyoruz.',
feeWarning: 'Mesrefa tora TRC20 bi qasî $3 ye. Em tora TON an Polkadot pêşniyar dikin.',
explorer: 'https://tronscan.org/#/transaction/',
minDeposit: 10,
},
+3 -3
View File
@@ -1,5 +1,5 @@
{
"version": "1.0.181",
"buildTime": "2026-02-08T02:31:45.624Z",
"buildNumber": 1770517905625
"version": "1.0.183",
"buildTime": "2026-02-08T02:58:45.175Z",
"buildNumber": 1770519525176
}
+13 -3
View File
@@ -15,6 +15,10 @@ import { secp256k1 } from 'https://esm.sh/@noble/curves@1.2.0/secp256k1';
const ALLOWED_ORIGIN = 'https://telegram.pezkuwichain.io';
const MIN_DEPOSIT = 10; // Minimum 10 USDT
// Platform fees per network
const TON_FEE = 0.1; // $0.1 fee for TON
const POLKADOT_FEE = 0.1; // $0.1 fee for Polkadot
const TRC20_FEE = 3; // $3 fee for TRC20
// API endpoints
@@ -135,11 +139,14 @@ async function checkTonDeposits(
continue;
}
// Create deposit record
// Calculate net amount after platform fee
const netAmount = Math.max(0, amount - TON_FEE);
// Create deposit record with net amount
const { error } = await supabase.from('tg_deposits').insert({
user_id: depositCode.user_id,
network: 'ton',
amount,
amount: netAmount,
tx_hash: txHash,
memo: comment,
status: 'confirming',
@@ -203,12 +210,15 @@ async function checkPolkadotDeposits(
result.found++;
// Calculate net amount after platform fee
const netAmount = Math.max(0, amount - POLKADOT_FEE);
// For Polkadot, memo might be in extrinsic data
// Try to find user by checking system.remark in same block
// For now, create as pending without user
const { error } = await supabase.from('tg_deposits').insert({
network: 'polkadot',
amount,
amount: netAmount,
tx_hash: txHash,
status: 'confirming',
});