Spaces:
Running
Running
File size: 4,537 Bytes
4709c28 d25c33d 06bdf4b 4709c28 06bdf4b 4709c28 06bdf4b d25c33d 06bdf4b 4709c28 d25c33d 06bdf4b d25c33d 4709c28 06bdf4b 4709c28 d25c33d 06bdf4b d25c33d 06bdf4b d25c33d 06bdf4b d25c33d 06bdf4b d25c33d 06bdf4b 4709c28 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
document.addEventListener('DOMContentLoaded', function() {
// Get DOM elements
const depositAmount = document.getElementById('depositAmount');
const walletAddress = document.getElementById('walletAddress');
const kycStatus = document.getElementById('kycStatus');
const depositTier = document.getElementById('depositTier');
const referralCode = document.getElementById('referralCode');
const depositBtn = document.getElementById('depositBtn');
const depositSummary = document.getElementById('depositSummary');
// Update summary when inputs change
[depositAmount, depositTier].forEach(element => {
element.addEventListener('input', updateSummary);
});
// Submit deposit button event
depositBtn.addEventListener('click', function() {
if (!validateForm()) return;
const amount = parseFloat(depositAmount.value);
// Show success message
alert(`Pre-deposit of ${amount.toLocaleString()} USDC submitted successfully!\nWallet: ${walletAddress.value.substring(0, 6)}...${walletAddress.value.substring(walletAddress.value.length - 4)}`);
// Reset form
depositAmount.value = '';
walletAddress.value = '';
kycStatus.value = '';
depositTier.value = 'standard';
referralCode.value = '';
updateSummary();
});
// Validate form
function validateForm() {
if (!depositAmount.value || parseFloat(depositAmount.value) < 1000) {
alert('Please enter a valid deposit amount (minimum $1,000)');
return false;
}
if (!walletAddress.value || walletAddress.value.length < 10) {
alert('Please enter a valid wallet address');
return false;
}
if (!kycStatus.value) {
alert('Please select your KYC status');
return false;
}
return true;
}
// Update deposit summary
function updateSummary() {
const amount = parseFloat(depositAmount.value) || 0;
const tier = depositTier.value || 'standard';
// Calculate allocation status based on amount
let allocationStatus = "Pending";
if (amount >= 500000) {
allocationStatus = "Guaranteed";
} else if (amount >= 50000) {
allocationStatus = "High Priority";
} else if (amount >= 1000) {
allocationStatus = "Processing";
}
// Estimate yield (mock calculation)
let estimatedYield = "TBD";
if (amount > 0) {
const baseRate = 0.12; // 12% base APY
const multipliers = {
'standard': 1,
'preferred': 1.2,
'institutional': 1.5
};
const finalRate = baseRate * multipliers[tier];
estimatedYield = `${(finalRate * 100).toFixed(1)}% APY`;
}
// Update summary display
depositSummary.innerHTML = `
<h3 class="text-2xl font-bold mb-4">Your Deposit Information</h3>
<div class="space-y-3">
<div class="flex justify-between">
<span>Deposit Amount:</span>
<span class="font-bold">${amount.toLocaleString()} USDC</span>
</div>
<div class="flex justify-between">
<span>Allocation Status:</span>
<span class="font-bold">${allocationStatus}</span>
</div>
<div class="flex justify-between">
<span>Estimated Yield:</span>
<span class="font-bold">${estimatedYield}</span>
</div>
<div class="flex justify-between">
<span>Total Cap:</span>
<span class="font-bold">$250M</span>
</div>
<div class="pt-4">
<div class="w-full bg-gray-700 rounded-full h-2.5">
<div class="bg-gradient-to-r from-purple-500 to-pink-500 h-2.5 rounded-full" style="width: ${(amount / 250000000) * 100}%"></div>
</div>
<div class="flex justify-between text-sm mt-2">
<span>${amount.toLocaleString()}</span>
<span>$250M</span>
</div>
</div>
</div>
`;
}
// Initialize summary
updateSummary();
});
|