diff --git a/docs/dev/design/marketplace-redesign-plan.md b/docs/dev/design/marketplace-redesign-plan.md index 2cb4155..ef8d92f 100644 --- a/docs/dev/design/marketplace-redesign-plan.md +++ b/docs/dev/design/marketplace-redesign-plan.md @@ -38,14 +38,11 @@ This document outlines the comprehensive redesign of the Project Mycelium market - [ ] **Implement Mycelium Credit (MC)** - [ ] Update currency service to use MC as base - [ ] Set initial exchange rate: 1 MC = 1 USD - - [ ] Update currency conversion logic - - [ ] Update pricing calculations + - [ ] Update currency conversion logic if needed + - [ ] Update pricing calculations if needed - [ ] **Currency Display Preferences** - - [ ] Add AED to supported currencies - - [ ] Update settings page with currency selector - - [ ] Implement currency preference persistence - - [ ] Update currency display throughout UI + - [ ] Add AED to supported currencies (see /dashboard/settings Currency Preferences) ### 3. Statistics & Grid Integration - [ ] **TF Grid Statistics** diff --git a/src/services/currency.rs b/src/services/currency.rs index d5c5fae..0229ebd 100644 --- a/src/services/currency.rs +++ b/src/services/currency.rs @@ -134,6 +134,18 @@ impl CurrencyService { provider_config: None, last_updated: chrono::Utc::now(), }, + Currency { + code: "AED".to_string(), + name: "UAE Dirham".to_string(), + symbol: "د.إ".to_string(), + currency_type: crate::models::currency::CurrencyType::Fiat, + exchange_rate_to_base: dec!(3.67), + is_base_currency: false, + decimal_places: 2, + is_active: true, + provider_config: None, + last_updated: chrono::Utc::now(), + }, ] } diff --git a/src/views/dashboard/pools.html b/src/views/dashboard/pools.html index 939fd51..19e7de6 100644 --- a/src/views/dashboard/pools.html +++ b/src/views/dashboard/pools.html @@ -263,7 +263,7 @@
@@ -321,7 +321,7 @@
diff --git a/src/views/dashboard/settings.html b/src/views/dashboard/settings.html index 39d9139..cc69aab 100644 --- a/src/views/dashboard/settings.html +++ b/src/views/dashboard/settings.html @@ -418,6 +418,7 @@ + Choose your preferred currency for displaying prices in the marketplace
diff --git a/src/views/wallet/index.html b/src/views/wallet/index.html index 87ab469..1c86a19 100644 --- a/src/views/wallet/index.html +++ b/src/views/wallet/index.html @@ -74,7 +74,7 @@
diff --git a/test_aed_currency.rs b/test_aed_currency.rs new file mode 100644 index 0000000..ef8e291 --- /dev/null +++ b/test_aed_currency.rs @@ -0,0 +1,22 @@ +use rust_decimal::Decimal; +use rust_decimal_macros::dec; + +fn main() { + // Test AED currency conversion + let usd_amount = dec!(100.0); // 100 USD + let aed_rate = dec!(3.67); // 1 USD = 3.67 AED + + // Convert USD to AED + let aed_amount = usd_amount * aed_rate; + println!("100 USD = {:.2} AED", aed_amount); + + // Convert AED back to USD + let usd_converted_back = aed_amount / aed_rate; + println!("{:.2} AED = {:.2} USD", aed_amount, usd_converted_back); + + // Test formatting + println!("Formatted AED: د.إ{:.2}", aed_amount); + println!("Formatted USD: ${:.2}", usd_amount); + + println!("AED currency test completed successfully!"); +} \ No newline at end of file diff --git a/user_data/user123_at_example_com.json b/user_data/user123_at_example_com.json index 0c1be20..c26f5af 100644 --- a/user_data/user123_at_example_com.json +++ b/user_data/user123_at_example_com.json @@ -97,10 +97,94 @@ "active_product_rentals": [], "resource_provider_rental_earnings": [], "node_rentals": [], - "node_groups": [], + "node_groups": [ + { + "id": "compute", + "name": "Compute", + "description": "General compute workloads", + "node_ids": [], + "group_type": { + "Default": "compute" + }, + "updated_at": "2025-09-08T18:44:31.238377407Z", + "created_at": "2025-09-08T18:44:31.238375624Z", + "group_config": { + "group_name": "Compute Nodes", + "max_nodes": 100, + "allocation_strategy": "balanced", + "auto_scaling": true, + "preferred_slice_formats": [ + "1x1", + "2x2" + ], + "default_pricing": 50.0, + "resource_optimization": { + "cpu_optimization": 0.5, + "memory_optimization": 0.5, + "storage_optimization": 0.5, + "network_optimization": 0.5 + } + } + }, + { + "id": "storage", + "name": "Storage", + "description": "Storage and data workloads", + "node_ids": [], + "group_type": { + "Default": "storage" + }, + "updated_at": "2025-09-08T18:44:31.238384425Z", + "created_at": "2025-09-08T18:44:31.238383997Z", + "group_config": { + "group_name": "Storage Nodes", + "max_nodes": 50, + "allocation_strategy": "storage_optimized", + "auto_scaling": false, + "preferred_slice_formats": [ + "1x1" + ], + "default_pricing": 30.0, + "resource_optimization": { + "cpu_optimization": 0.3, + "memory_optimization": 0.3, + "storage_optimization": 0.8, + "network_optimization": 0.6 + } + } + }, + { + "id": "ai-gpu", + "name": "AI/GPU", + "description": "AI and GPU-intensive workloads", + "node_ids": [], + "group_type": { + "Default": "ai-gpu" + }, + "updated_at": "2025-09-08T18:44:31.238388576Z", + "created_at": "2025-09-08T18:44:31.238388156Z", + "group_config": { + "group_name": "AI/GPU Nodes", + "max_nodes": 20, + "allocation_strategy": "gpu_optimized", + "auto_scaling": true, + "preferred_slice_formats": [ + "4x4", + "8x8" + ], + "default_pricing": 200.0, + "resource_optimization": { + "cpu_optimization": 0.8, + "memory_optimization": 0.7, + "storage_optimization": 0.4, + "network_optimization": 0.5 + } + } + } + ], "slice_rentals": [], "slice_assignments": [], - "display_currency": "USD", + "display_currency": "AED", "quick_topup_amounts": [ 10.0, 25.0,