Vocabulary fixes

This commit is contained in:
timurgordon 2025-05-05 11:32:09 +03:00
parent a7c0772d9b
commit 2760f00a30
27 changed files with 588 additions and 329 deletions

View File

@ -65,7 +65,7 @@ impl AssetController {
// Add assets by type
let asset_types = vec![
AssetType::NFT,
AssetType::Artwork,
AssetType::Token,
AssetType::RealEstate,
AssetType::Commodity,
@ -209,7 +209,7 @@ impl AssetController {
// Add asset types for dropdown
let asset_types = vec![
("NFT", "NFT"),
("Artwork", "Artwork"),
("Token", "Token"),
("RealEstate", "Real Estate"),
("Commodity", "Commodity"),
@ -473,7 +473,7 @@ impl AssetController {
"token_price": 75.0
}),
image_url: Some("https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=600&q=80".to_string()),
external_url: Some("https://oceanviewholdings.zaz/resort".to_string()),
external_url: Some("https://oceanviewholdings.zdfz/resort".to_string()),
};
zanzibar_resort.add_blockchain_info(BlockchainInfo {
@ -486,9 +486,9 @@ impl AssetController {
timestamp: Some(now - Duration::days(120)),
});
zanzibar_resort.add_valuation(650000.0, "USD", "ZAZ Property Registry", Some("Initial tokenization valuation".to_string()));
zanzibar_resort.add_valuation(650000.0, "USD", "ZDFZ Property Registry", Some("Initial tokenization valuation".to_string()));
zanzibar_resort.add_valuation(700000.0, "USD", "International Property Appraisers", Some("Independent third-party valuation".to_string()));
zanzibar_resort.add_valuation(750000.0, "USD", "ZAZ Property Registry", Some("Updated valuation after infrastructure improvements".to_string()));
zanzibar_resort.add_valuation(750000.0, "USD", "ZDFZ Property Registry", Some("Updated valuation after infrastructure improvements".to_string()));
zanzibar_resort.add_transaction(
"Tokenization",
@ -497,7 +497,7 @@ impl AssetController {
Some(650000.0),
Some("USD".to_string()),
Some("0xabcdef123456789abcdef123456789abcdef123456789abcdef123456789abcd".to_string()),
Some("Initial property tokenization under ZAZ Property Registry".to_string()),
Some("Initial property tokenization under ZDFZ Property Registry".to_string()),
);
zanzibar_resort.add_transaction(
@ -512,14 +512,14 @@ impl AssetController {
assets.push(zanzibar_resort);
// Create ZAZ Governance Token
// Create ZDFZ Governance Token
let mut zaz_token = Asset {
id: "asset-zaz-governance".to_string(),
name: "ZAZ Governance Token".to_string(),
id: "asset-zdfz-governance".to_string(),
name: "ZDFZ Governance Token".to_string(),
description: "Official governance token of the Zanzibar Digital Freezone, used for voting on proposals and zone-wide decisions".to_string(),
asset_type: AssetType::Token,
status: AssetStatus::Active,
owner_id: "entity-zaz-foundation".to_string(),
owner_id: "entity-zdfz-foundation".to_string(),
owner_name: "Zanzibar Digital Freezone Foundation".to_string(),
created_at: now - Duration::days(365),
updated_at: now - Duration::days(2),
@ -537,7 +537,7 @@ impl AssetController {
"launch_date": (now - Duration::days(365)).to_rfc3339()
}),
image_url: Some("https://images.unsplash.com/photo-1431540015161-0bf868a2d407?q=80&w=3540&?auto=format&fit=crop&w=600&q=80".to_string()),
external_url: Some("https://governance.zaz/token".to_string()),
external_url: Some("https://governance.zdfz/token".to_string()),
};
zaz_token.add_blockchain_info(BlockchainInfo {
@ -550,9 +550,9 @@ impl AssetController {
timestamp: Some(now - Duration::days(365)),
});
zaz_token.add_valuation(300000.0, "USD", "ZAZ Token Exchange", Some("Initial valuation at launch".to_string()));
zaz_token.add_valuation(320000.0, "USD", "ZAZ Token Exchange", Some("Valuation after successful governance implementation".to_string()));
zaz_token.add_valuation(350000.0, "USD", "ZAZ Token Exchange", Some("Current market valuation".to_string()));
zaz_token.add_valuation(300000.0, "USD", "ZDFZ Token Exchange", Some("Initial valuation at launch".to_string()));
zaz_token.add_valuation(320000.0, "USD", "ZDFZ Token Exchange", Some("Valuation after successful governance implementation".to_string()));
zaz_token.add_valuation(350000.0, "USD", "ZDFZ Token Exchange", Some("Current market valuation".to_string()));
zaz_token.add_transaction(
"Distribution",
@ -602,7 +602,7 @@ impl AssetController {
"incorporation_date": (now - Duration::days(180)).to_rfc3339()
}),
image_url: Some("https://images.unsplash.com/photo-1464983953574-0892a716854b?auto=format&fit=crop&w=600&q=80".to_string()),
external_url: Some("https://spicetrade.zaz".to_string()),
external_url: Some("https://spicetrade.zdfz".to_string()),
};
spice_trade_shares.add_blockchain_info(BlockchainInfo {
@ -615,9 +615,9 @@ impl AssetController {
timestamp: Some(now - Duration::days(180)),
});
spice_trade_shares.add_valuation(150000.0, "USD", "ZAZ Business Registry", Some("Initial company valuation at incorporation".to_string()));
spice_trade_shares.add_valuation(175000.0, "USD", "ZAZ Business Registry", Some("Valuation after first export contracts".to_string()));
spice_trade_shares.add_valuation(200000.0, "USD", "ZAZ Business Registry", Some("Current valuation after expansion to European markets".to_string()));
spice_trade_shares.add_valuation(150000.0, "USD", "ZDFZ Business Registry", Some("Initial company valuation at incorporation".to_string()));
spice_trade_shares.add_valuation(175000.0, "USD", "ZDFZ Business Registry", Some("Valuation after first export contracts".to_string()));
spice_trade_shares.add_valuation(200000.0, "USD", "ZDFZ Business Registry", Some("Current valuation after expansion to European markets".to_string()));
spice_trade_shares.add_transaction(
"Share Issuance",
@ -648,8 +648,8 @@ impl AssetController {
description: "Patent for an innovative tidal energy harvesting system designed specifically for the coastal conditions of Zanzibar".to_string(),
asset_type: AssetType::IntellectualProperty,
status: AssetStatus::Active,
owner_id: "entity-zaz-energy-innovations".to_string(),
owner_name: "ZAZ Energy Innovations".to_string(),
owner_id: "entity-zdfz-energy-innovations".to_string(),
owner_name: "ZDFZ Energy Innovations".to_string(),
created_at: now - Duration::days(210),
updated_at: now - Duration::days(30),
blockchain_info: None,
@ -659,7 +659,7 @@ impl AssetController {
valuation_history: Vec::new(),
transaction_history: Vec::new(),
metadata: serde_json::json!({
"patent_number": "ZAZ-PAT-2024-0142",
"patent_number": "ZDFZ-PAT-2024-0142",
"filing_date": (now - Duration::days(210)).to_rfc3339(),
"grant_date": (now - Duration::days(120)).to_rfc3339(),
"patent_type": "Utility",
@ -667,7 +667,7 @@ impl AssetController {
"inventors": ["Dr. Amina Juma", "Eng. Ibrahim Hassan", "Dr. Sarah Mbeki"]
}),
image_url: Some("https://images.unsplash.com/photo-1708851148146-783a5b7da55d?q=80&w=3474&?auto=format&fit=crop&w=600&q=80".to_string()),
external_url: Some("https://patents.zaz/ZAZ-PAT-2024-0142".to_string()),
external_url: Some("https://patents.zdfz/ZDFZ-PAT-2024-0142".to_string()),
};
tidal_energy_patent.add_blockchain_info(BlockchainInfo {
@ -680,9 +680,9 @@ impl AssetController {
timestamp: Some(now - Duration::days(120)),
});
tidal_energy_patent.add_valuation(80000.0, "USD", "ZAZ IP Registry", Some("Initial patent valuation upon filing".to_string()));
tidal_energy_patent.add_valuation(100000.0, "USD", "ZAZ IP Registry", Some("Valuation after successful prototype testing".to_string()));
tidal_energy_patent.add_valuation(120000.0, "USD", "ZAZ IP Registry", Some("Current valuation after pilot implementation".to_string()));
tidal_energy_patent.add_valuation(80000.0, "USD", "ZDFZ IP Registry", Some("Initial patent valuation upon filing".to_string()));
tidal_energy_patent.add_valuation(100000.0, "USD", "ZDFZ IP Registry", Some("Valuation after successful prototype testing".to_string()));
tidal_energy_patent.add_valuation(120000.0, "USD", "ZDFZ IP Registry", Some("Current valuation after pilot implementation".to_string()));
tidal_energy_patent.add_transaction(
"Registration",
@ -706,15 +706,15 @@ impl AssetController {
assets.push(tidal_energy_patent);
// Create Digital Art NFT
// Create Digital Art Artwork
let mut zanzibar_heritage_nft = Asset {
id: "asset-heritage-nft".to_string(),
id: "asset-heritage-Artwork".to_string(),
name: "Zanzibar Heritage Collection #1".to_string(),
description: "Limited edition digital art NFT showcasing Zanzibar's cultural heritage, created by renowned local artist Fatma Busaidy".to_string(),
asset_type: AssetType::NFT,
description: "Limited edition digital art Artwork showcasing Zanzibar's cultural heritage, created by renowned local artist Fatma Busaidy".to_string(),
asset_type: AssetType::Artwork,
status: AssetStatus::Active,
owner_id: "entity-zaz-digital-arts".to_string(),
owner_name: "ZAZ Digital Arts Collective".to_string(),
owner_id: "entity-zdfz-digital-arts".to_string(),
owner_name: "ZDFZ Digital Arts Collective".to_string(),
created_at: now - Duration::days(90),
updated_at: now - Duration::days(10),
blockchain_info: None,
@ -729,10 +729,10 @@ impl AssetController {
"medium": "Digital Mixed Media",
"dimensions": "4000x3000 px",
"creation_date": (now - Duration::days(95)).to_rfc3339(),
"authenticity_certificate": "ZAZ-ART-CERT-2024-089"
"authenticity_certificate": "ZDFZ-ART-CERT-2024-089"
}),
image_url: Some("https://images.unsplash.com/photo-1519125323398-675f0ddb6308?auto=format&fit=crop&w=600&q=80".to_string()),
external_url: Some("https://digitalarts.zaz/collections/heritage/1".to_string()),
external_url: Some("https://digitalarts.zdfz/collections/heritage/1".to_string()),
};
zanzibar_heritage_nft.add_blockchain_info(BlockchainInfo {
@ -745,9 +745,9 @@ impl AssetController {
timestamp: Some(now - Duration::days(90)),
});
zanzibar_heritage_nft.add_valuation(5000.0, "USD", "ZAZ NFT Marketplace", Some("Initial offering price".to_string()));
zanzibar_heritage_nft.add_valuation(5500.0, "USD", "ZAZ NFT Marketplace", Some("Valuation after artist exhibition".to_string()));
zanzibar_heritage_nft.add_valuation(6000.0, "USD", "ZAZ NFT Marketplace", Some("Current market valuation".to_string()));
zanzibar_heritage_nft.add_valuation(5000.0, "USD", "ZDFZ Artwork Marketplace", Some("Initial offering price".to_string()));
zanzibar_heritage_nft.add_valuation(5500.0, "USD", "ZDFZ Artwork Marketplace", Some("Valuation after artist exhibition".to_string()));
zanzibar_heritage_nft.add_valuation(6000.0, "USD", "ZDFZ Artwork Marketplace", Some("Current market valuation".to_string()));
zanzibar_heritage_nft.add_transaction(
"Minting",
@ -756,7 +756,7 @@ impl AssetController {
Some(0.0),
Some("ETH".to_string()),
Some("0x123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234".to_string()),
Some("Initial NFT minting by artist".to_string()),
Some("Initial Artwork minting by artist".to_string()),
);
zanzibar_heritage_nft.add_transaction(
@ -766,7 +766,7 @@ impl AssetController {
Some(5000.0),
Some("USD".to_string()),
Some("0x234567890abcdef123456789abcdef123456789abcdef123456789abcdef1234".to_string()),
Some("Primary sale to ZAZ Digital Arts Collective".to_string()),
Some("Primary sale to ZDFZ Digital Arts Collective".to_string()),
);
assets.push(zanzibar_heritage_nft);

View File

@ -6,19 +6,19 @@ use serde::Deserialize;
use uuid::Uuid;
use crate::models::asset::{Asset, AssetType, AssetStatus};
use crate::models::defi::{DefiPosition, DefiPositionType, DefiPositionStatus, LendingPosition, BorrowingPosition, DEFI_DB};
use crate::models::defi::{DefiPosition, DefiPositionType, DefiPositionStatus, ProvidingPosition, ReceivingPosition, DEFI_DB};
use crate::utils::render_template;
// Form structs for DeFi operations
#[derive(Debug, Deserialize)]
pub struct LendingForm {
pub struct ProvidingForm {
pub asset_id: String,
pub amount: f64,
pub duration: i32,
}
#[derive(Debug, Deserialize)]
pub struct BorrowingForm {
pub struct ReceivingForm {
pub collateral_asset_id: String,
pub collateral_amount: f64,
pub amount: f64,
@ -53,8 +53,8 @@ pub struct CollateralForm {
pub asset_id: String,
pub amount: f64,
pub purpose: String,
pub loan_amount: Option<f64>,
pub loan_term: Option<i32>,
pub funds_amount: Option<f64>,
pub funds_term: Option<i32>,
}
pub struct DefiController;
@ -86,22 +86,22 @@ impl DefiController {
context.insert("recent_assets", &recent_assets);
// Get user's lending positions
// Get user's providing positions
let db = DEFI_DB.lock().unwrap();
let lending_positions = db.get_user_lending_positions("user123");
let lending_positions_json: Vec<serde_json::Value> = lending_positions
let providing_positions = db.get_user_providing_positions("user123");
let providing_positions_json: Vec<serde_json::Value> = providing_positions
.iter()
.map(|p| serde_json::to_value(p).unwrap())
.collect();
context.insert("lending_positions", &lending_positions_json);
context.insert("providing_positions", &providing_positions_json);
// Get user's borrowing positions
let borrowing_positions = db.get_user_borrowing_positions("user123");
let borrowing_positions_json: Vec<serde_json::Value> = borrowing_positions
// Get user's receiving positions
let receiving_positions = db.get_user_receiving_positions("user123");
let receiving_positions_json: Vec<serde_json::Value> = receiving_positions
.iter()
.map(|p| serde_json::to_value(p).unwrap())
.collect();
context.insert("borrowing_positions", &borrowing_positions_json);
context.insert("receiving_positions", &receiving_positions_json);
// Add success message if present in query params
if let Some(success) = req.query_string().strip_prefix("success=") {
@ -115,17 +115,17 @@ impl DefiController {
response
}
// Process lending request
pub async fn create_lending(_tmpl: web::Data<Tera>, form: web::Form<LendingForm>) -> Result<HttpResponse> {
println!("DEBUG: Processing lending request: {:?}", form);
// Process providing request
pub async fn create_providing(_tmpl: web::Data<Tera>, form: web::Form<ProvidingForm>) -> Result<HttpResponse> {
println!("DEBUG: Processing providing request: {:?}", form);
// Get the asset details (in a real app, this would come from a database)
// Get the asset obligationails (in a real app, this would come from a database)
let assets = Self::get_mock_assets();
let asset = assets.iter().find(|a| a.id == form.asset_id);
if let Some(asset) = asset {
// Calculate interest and return amount
let apy = match form.duration {
// Calculate profit share and return amount
let profit_share = match form.duration {
7 => 2.5,
30 => 4.2,
90 => 6.8,
@ -134,38 +134,37 @@ impl DefiController {
_ => 4.2, // Default to 30 days rate
};
let interest = form.amount * (apy / 100.0) * (form.duration as f64 / 365.0);
let return_amount = form.amount + interest;
let return_amount = form.amount + (form.amount * (profit_share / 100.0) * (form.duration as f64 / 365.0));
// Create a new lending position
let lending_position = LendingPosition {
// Create a new providing position
let providing_position = ProvidingPosition {
base: DefiPosition {
id: Uuid::new_v4().to_string(),
position_type: DefiPositionType::Lending,
position_type: DefiPositionType::Providing,
status: DefiPositionStatus::Active,
asset_id: asset.id.clone(),
asset_id: form.asset_id.clone(),
asset_name: asset.name.clone(),
asset_symbol: asset.asset_type.as_str().to_string(), // Using asset_type as symbol for now
asset_symbol: asset.asset_type.as_str().to_string(),
amount: form.amount,
value_usd: form.amount * asset.latest_valuation().map_or(0.5, |v| v.value), // Assuming 0.5 USD per token if no valuation
apy,
value_usd: form.amount * asset.current_valuation.unwrap_or(0.0),
expected_return: profit_share,
created_at: Utc::now(),
expires_at: Some(Utc::now() + Duration::days(form.duration as i64)),
user_id: "user123".to_string(), // Hardcoded user ID for now
},
duration_days: form.duration,
interest_earned: interest,
profit_share_earned: profit_share,
return_amount,
};
// Add the position to the database
{
let mut db = DEFI_DB.lock().unwrap();
db.add_lending_position(lending_position);
db.add_providing_position(providing_position);
}
// Redirect with success message
let success_message = format!("Successfully lent {} {} at {}% APY", form.amount, asset.name, apy);
let success_message = format!("Successfully provided {} {} for {} days", form.amount, asset.name, form.duration);
Ok(HttpResponse::SeeOther()
.append_header(("Location", format!("/defi?success={}", urlencoding::encode(&success_message))))
.finish())
@ -177,17 +176,17 @@ impl DefiController {
}
}
// Process borrowing request
pub async fn create_borrowing(_tmpl: web::Data<Tera>, form: web::Form<BorrowingForm>) -> Result<HttpResponse> {
println!("DEBUG: Processing borrowing request: {:?}", form);
// Process receiving request
pub async fn create_receiving(_tmpl: web::Data<Tera>, form: web::Form<ReceivingForm>) -> Result<HttpResponse> {
println!("DEBUG: Processing receiving request: {:?}", form);
// Get the asset details (in a real app, this would come from a database)
// Get the asset obligationails (in a real app, this would come from a database)
let assets = Self::get_mock_assets();
let collateral_asset = assets.iter().find(|a| a.id == form.collateral_asset_id);
if let Some(collateral_asset) = collateral_asset {
// Calculate interest rate based on duration
let interest_rate = match form.duration {
// Calculate profit share rate based on duration
let profit_share_rate = match form.duration {
7 => 3.5,
30 => 5.0,
90 => 6.5,
@ -196,26 +195,26 @@ impl DefiController {
_ => 5.0, // Default to 30 days rate
};
// Calculate interest and total to repay
let interest = form.amount * (interest_rate / 100.0) * (form.duration as f64 / 365.0);
let total_to_repay = form.amount + interest;
// Calculate profit share and total to repay
let profit_share = form.amount * (profit_share_rate / 100.0) * (form.duration as f64 / 365.0);
let total_to_repay = form.amount + profit_share;
// Calculate collateral value and ratio
let collateral_value = form.collateral_amount * collateral_asset.latest_valuation().map_or(0.5, |v| v.value);
let collateral_ratio = (collateral_value / form.amount) * 100.0;
// Create a new borrowing position
let borrowing_position = BorrowingPosition {
// Create a new receiving position
let receiving_position = ReceivingPosition {
base: DefiPosition {
id: Uuid::new_v4().to_string(),
position_type: DefiPositionType::Borrowing,
position_type: DefiPositionType::Receiving,
status: DefiPositionStatus::Active,
asset_id: "ZAZ".to_string(), // Hardcoded for now, in a real app this would be a parameter
asset_id: "ZDFZ".to_string(), // Hardcoded for now, in a real app this would be a parameter
asset_name: "Zanzibar Token".to_string(),
asset_symbol: "ZAZ".to_string(),
asset_symbol: "ZDFZ".to_string(),
amount: form.amount,
value_usd: form.amount * 0.5, // Assuming 0.5 USD per ZAZ
apy: interest_rate,
value_usd: form.amount * 0.5, // Assuming 0.5 USD per ZDFZ
expected_return: profit_share_rate,
created_at: Utc::now(),
expires_at: Some(Utc::now() + Duration::days(form.duration as i64)),
user_id: "user123".to_string(), // Hardcoded user ID for now
@ -226,8 +225,8 @@ impl DefiController {
collateral_amount: form.collateral_amount,
collateral_value_usd: collateral_value,
duration_days: form.duration,
interest_rate,
interest_owed: interest,
profit_share_rate,
profit_share_owed: profit_share,
total_to_repay,
collateral_ratio,
};
@ -235,11 +234,11 @@ impl DefiController {
// Add the position to the database
{
let mut db = DEFI_DB.lock().unwrap();
db.add_borrowing_position(borrowing_position);
db.add_receiving_position(receiving_position);
}
// Redirect with success message
let success_message = format!("Successfully borrowed {} ZAZ using {} {} as collateral",
let success_message = format!("Successfully borrowed {} ZDFZ using {} {} as collateral",
form.amount, form.collateral_amount, collateral_asset.name);
Ok(HttpResponse::SeeOther()
.append_header(("Location", format!("/defi?success={}", urlencoding::encode(&success_message))))
@ -304,7 +303,7 @@ impl DefiController {
// For now, we'll just redirect back to the DeFi dashboard with a success message
let purpose_str = match form.purpose.as_str() {
"loan" => "secure a loan",
"funds" => "secure a funds",
"synthetic" => "generate synthetic assets",
"leverage" => "leverage trading",
_ => "collateralization",
@ -324,8 +323,8 @@ impl DefiController {
// Handle Option<Number> by unwrapping with expect
stats.insert("total_value_locked".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(1250000.0).expect("Valid float")));
stats.insert("lending_volume".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(450000.0).expect("Valid float")));
stats.insert("borrowing_volume".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(320000.0).expect("Valid float")));
stats.insert("providing_volume".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(450000.0).expect("Valid float")));
stats.insert("receiving_volume".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(320000.0).expect("Valid float")));
stats.insert("liquidity_pools_count".to_string(), serde_json::Value::Number(serde_json::Number::from(12)));
stats.insert("active_stakers".to_string(), serde_json::Value::Number(serde_json::Number::from(156)));
stats.insert("total_swap_volume".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(780000.0).expect("Valid float")));

View File

@ -187,7 +187,7 @@ impl FlowController {
// Create a few mock flows
let mut flow1 = Flow {
id: "flow-1".to_string(),
name: "ZAZ Business Entity Registration".to_string(),
name: "ZDFZ Business Entity Registration".to_string(),
description: "Register a new business entity within the Zanzibar Digital Freezone legal framework".to_string(),
flow_type: FlowType::CompanyRegistration,
status: FlowStatus::InProgress,
@ -223,7 +223,7 @@ impl FlowController {
FlowStep {
id: "step-1-2".to_string(),
name: "Regulatory Review".to_string(),
description: "ZAZ Business Registry review of submitted documents and compliance with regulatory requirements".to_string(),
description: "ZDFZ Business Registry review of submitted documents and compliance with regulatory requirements".to_string(),
order: 2,
status: StepStatus::InProgress,
started_at: Some(Utc::now() - Duration::days(3)),
@ -231,7 +231,7 @@ impl FlowController {
logs: vec![
FlowLog {
id: "log-1-2-1".to_string(),
message: "Regulatory review initiated by ZAZ Business Registry".to_string(),
message: "Regulatory review initiated by ZDFZ Business Registry".to_string(),
timestamp: Utc::now() - Duration::days(3),
},
FlowLog {
@ -249,7 +249,7 @@ impl FlowController {
FlowStep {
id: "step-1-3".to_string(),
name: "Digital Identity Creation".to_string(),
description: "Creation of the entity's digital identity and blockchain credentials within the ZAZ ecosystem".to_string(),
description: "Creation of the entity's digital identity and blockchain credentials within the ZDFZ ecosystem".to_string(),
order: 3,
status: StepStatus::Pending,
started_at: None,
@ -280,7 +280,7 @@ impl FlowController {
let mut flow2 = Flow {
id: "flow-2".to_string(),
name: "Digital Asset Tokenization Approval".to_string(),
description: "Process for approving the tokenization of a real estate asset within the ZAZ regulatory framework".to_string(),
description: "Process for approving the tokenization of a real estate asset within the ZDFZ regulatory framework".to_string(),
flow_type: FlowType::AssetTokenization,
status: FlowStatus::Completed,
owner_id: "user-2".to_string(),
@ -302,7 +302,7 @@ impl FlowController {
},
FlowLog {
id: "log-2-1-2".to_string(),
message: "Independent valuation completed by ZAZ Property Registry".to_string(),
message: "Independent valuation completed by ZDFZ Property Registry".to_string(),
timestamp: Utc::now() - Duration::days(27),
},
FlowLog {
@ -315,7 +315,7 @@ impl FlowController {
FlowStep {
id: "step-2-2".to_string(),
name: "Tokenization Structure Review".to_string(),
description: "Review of the proposed token structure, distribution model, and compliance with ZAZ tokenization standards".to_string(),
description: "Review of the proposed token structure, distribution model, and compliance with ZDFZ tokenization standards".to_string(),
order: 2,
status: StepStatus::Completed,
started_at: Some(Utc::now() - Duration::days(24)),
@ -328,7 +328,7 @@ impl FlowController {
},
FlowLog {
id: "log-2-2-2".to_string(),
message: "Technical review completed by ZAZ Digital Assets Committee".to_string(),
message: "Technical review completed by ZDFZ Digital Assets Committee".to_string(),
timestamp: Utc::now() - Duration::days(22),
},
FlowLog {
@ -359,7 +359,7 @@ impl FlowController {
},
FlowLog {
id: "log-2-3-3".to_string(),
message: "Smart contracts deployed to ZAZ-approved blockchain".to_string(),
message: "Smart contracts deployed to ZDFZ-approved blockchain".to_string(),
timestamp: Utc::now() - Duration::days(15),
},
],
@ -367,7 +367,7 @@ impl FlowController {
FlowStep {
id: "step-2-4".to_string(),
name: "Final Approval and Listing".to_string(),
description: "Final regulatory approval and listing on the ZAZ Digital Asset Exchange".to_string(),
description: "Final regulatory approval and listing on the ZDFZ Digital Asset Exchange".to_string(),
order: 4,
status: StepStatus::Completed,
started_at: Some(Utc::now() - Duration::days(14)),
@ -380,12 +380,12 @@ impl FlowController {
},
FlowLog {
id: "log-2-4-2".to_string(),
message: "Regulatory approval granted by ZAZ Financial Authority".to_string(),
message: "Regulatory approval granted by ZDFZ Financial Authority".to_string(),
timestamp: Utc::now() - Duration::days(12),
},
FlowLog {
id: "log-2-4-3".to_string(),
message: "Asset tokens listed on ZAZ Digital Asset Exchange".to_string(),
message: "Asset tokens listed on ZDFZ Digital Asset Exchange".to_string(),
timestamp: Utc::now() - Duration::days(10),
},
],
@ -403,7 +403,7 @@ impl FlowController {
let mut flow3 = Flow {
id: "flow-3".to_string(),
name: "Sustainable Tourism Certification".to_string(),
description: "Application process for ZAZ Sustainable Tourism Certification for eco-tourism businesses".to_string(),
description: "Application process for ZDFZ Sustainable Tourism Certification for eco-tourism businesses".to_string(),
flow_type: FlowType::Certification,
status: FlowStatus::Stuck,
owner_id: "user-3".to_string(),
@ -474,7 +474,7 @@ impl FlowController {
FlowStep {
id: "step-3-4".to_string(),
name: "Certification Issuance".to_string(),
description: "Final review and issuance of ZAZ Sustainable Tourism Certification".to_string(),
description: "Final review and issuance of ZDFZ Sustainable Tourism Certification".to_string(),
order: 4,
status: StepStatus::Pending,
started_at: None,
@ -494,7 +494,7 @@ impl FlowController {
let mut flow4 = Flow {
id: "flow-4".to_string(),
name: "Digital Payment Provider License".to_string(),
description: "Application for a license to operate as a digital payment provider within the ZAZ financial system".to_string(),
description: "Application for a license to operate as a digital payment provider within the ZDFZ financial system".to_string(),
flow_type: FlowType::LicenseApplication,
status: FlowStatus::InProgress,
owner_id: "user-4".to_string(),
@ -529,7 +529,7 @@ impl FlowController {
FlowStep {
id: "step-4-2".to_string(),
name: "Technical Infrastructure Review".to_string(),
description: "Review of the technical infrastructure, security measures, and compliance with ZAZ financial standards".to_string(),
description: "Review of the technical infrastructure, security measures, and compliance with ZDFZ financial standards".to_string(),
order: 2,
status: StepStatus::Completed,
started_at: Some(Utc::now() - Duration::days(17)),
@ -542,7 +542,7 @@ impl FlowController {
},
FlowLog {
id: "log-4-2-2".to_string(),
message: "Security audit initiated by ZAZ Financial Technology Office".to_string(),
message: "Security audit initiated by ZDFZ Financial Technology Office".to_string(),
timestamp: Utc::now() - Duration::days(15),
},
FlowLog {

View File

@ -241,7 +241,7 @@ impl GovernanceController {
id: "prop-002".to_string(),
creator_id: 2,
creator_name: "Amina Salim".to_string(),
title: "ZAZ Sustainable Tourism Framework".to_string(),
title: "ZDFZ Sustainable Tourism Framework".to_string(),
description: "A comprehensive framework for sustainable tourism development within the Zanzibar Digital Freezone. This proposal outlines environmental standards, community benefit-sharing mechanisms, and digital infrastructure for eco-tourism businesses. It includes tokenization standards for tourism assets and a certification system for sustainable operators.".to_string(),
status: ProposalStatus::Approved,
created_at: now - Duration::days(15),
@ -265,7 +265,7 @@ impl GovernanceController {
id: "prop-004".to_string(),
creator_id: 1,
creator_name: "Ibrahim Faraji".to_string(),
title: "ZAZ Regulatory Framework for Digital Financial Services".to_string(),
title: "ZDFZ Regulatory Framework for Digital Financial Services".to_string(),
description: "Establish a comprehensive regulatory framework for digital financial services within the Zanzibar Digital Freezone. This includes licensing requirements for crypto exchanges, digital payment providers, and tokenized asset platforms operating within the zone, while ensuring compliance with international AML/KYC standards.".to_string(),
status: ProposalStatus::Rejected,
created_at: now - Duration::days(20),
@ -277,8 +277,8 @@ impl GovernanceController {
id: "prop-005".to_string(),
creator_id: 4,
creator_name: "Fatma Busaidy".to_string(),
title: "Digital Arts Incubator and NFT Marketplace".to_string(),
description: "Create a dedicated digital arts incubator and NFT marketplace to support Zanzibar's creative economy. The initiative will provide technical training, equipment, and a curated marketplace for local artists to create and sell digital art that celebrates Zanzibar's rich cultural heritage while accessing global markets.".to_string(),
title: "Digital Arts Incubator and Artwork Marketplace".to_string(),
description: "Create a dedicated digital arts incubator and Artwork marketplace to support Zanzibar's creative economy. The initiative will provide technical training, equipment, and a curated marketplace for local artists to create and sell digital art that celebrates Zanzibar's rich cultural heritage while accessing global markets.".to_string(),
status: ProposalStatus::Active,
created_at: now - Duration::days(7),
updated_at: now - Duration::days(7),
@ -301,7 +301,7 @@ impl GovernanceController {
id: "prop-007".to_string(),
creator_id: 6,
creator_name: "Saida Juma".to_string(),
title: "ZAZ Educational Technology Initiative".to_string(),
title: "ZDFZ Educational Technology Initiative".to_string(),
description: "Establish a comprehensive educational technology program within the Zanzibar Digital Freezone to develop local tech talent. This initiative includes coding academies, blockchain development courses, and digital entrepreneurship training, with a focus on preparing Zanzibar's youth for careers in the zone's growing digital economy.".to_string(),
status: ProposalStatus::Draft,
created_at: now - Duration::days(3),

View File

@ -100,7 +100,7 @@ impl MarketplaceController {
]);
context.insert("asset_types", &[
AssetType::Token.as_str(),
AssetType::NFT.as_str(),
AssetType::Artwork.as_str(),
AssetType::RealEstate.as_str(),
AssetType::IntellectualProperty.as_str(),
AssetType::Commodity.as_str(),
@ -168,7 +168,7 @@ impl MarketplaceController {
// Add current user info for bid/purchase forms
let user_id = "user-123";
let user_name = "John Doe";
let user_name = "Alice Hostly";
context.insert("user_id", &user_id);
context.insert("user_name", &user_name);
@ -237,7 +237,7 @@ impl MarketplaceController {
// Mock user data
let user_id = "user-123";
let user_name = "John Doe";
let user_name = "Alice Hostly";
// Create the listing
let _listing = Listing::new(
@ -347,7 +347,7 @@ impl MarketplaceController {
// Mock user data
let user_ids = vec!["user-123", "user-456", "user-789"];
let user_names = vec!["John Doe", "Jane Smith", "Bob Johnson"];
let user_names = vec!["Alice Hostly", "Ethan Cloudman", "Priya Servera"];
// Create some fixed price listings
for i in 0..6 {
@ -357,7 +357,7 @@ impl MarketplaceController {
let price = match asset.asset_type {
AssetType::Token => 50.0 + (i as f64 * 10.0),
AssetType::NFT => 500.0 + (i as f64 * 100.0),
AssetType::Artwork => 500.0 + (i as f64 * 100.0),
AssetType::RealEstate => 50000.0 + (i as f64 * 10000.0),
AssetType::IntellectualProperty => 2000.0 + (i as f64 * 500.0),
AssetType::Commodity => 1000.0 + (i as f64 * 200.0),
@ -398,7 +398,7 @@ impl MarketplaceController {
let starting_price = match asset.asset_type {
AssetType::Token => 40.0 + (i as f64 * 5.0),
AssetType::NFT => 400.0 + (i as f64 * 50.0),
AssetType::Artwork => 400.0 + (i as f64 * 50.0),
AssetType::RealEstate => 40000.0 + (i as f64 * 5000.0),
AssetType::IntellectualProperty => 1500.0 + (i as f64 * 300.0),
AssetType::Commodity => 800.0 + (i as f64 * 100.0),
@ -454,7 +454,7 @@ impl MarketplaceController {
let value = match asset.asset_type {
AssetType::Token => 60.0 + (i as f64 * 15.0),
AssetType::NFT => 600.0 + (i as f64 * 150.0),
AssetType::Artwork => 600.0 + (i as f64 * 150.0),
AssetType::RealEstate => 60000.0 + (i as f64 * 15000.0),
AssetType::IntellectualProperty => 2500.0 + (i as f64 * 600.0),
AssetType::Commodity => 1200.0 + (i as f64 * 300.0),
@ -491,7 +491,7 @@ impl MarketplaceController {
let price = match asset.asset_type {
AssetType::Token => 55.0 + (i as f64 * 12.0),
AssetType::NFT => 550.0 + (i as f64 * 120.0),
AssetType::Artwork => 550.0 + (i as f64 * 120.0),
AssetType::RealEstate => 55000.0 + (i as f64 * 12000.0),
AssetType::IntellectualProperty => 2200.0 + (i as f64 * 550.0),
AssetType::Commodity => 1100.0 + (i as f64 * 220.0),
@ -540,7 +540,7 @@ impl MarketplaceController {
let price = match asset.asset_type {
AssetType::Token => 45.0 + (i as f64 * 8.0),
AssetType::NFT => 450.0 + (i as f64 * 80.0),
AssetType::Artwork => 450.0 + (i as f64 * 80.0),
AssetType::RealEstate => 45000.0 + (i as f64 * 8000.0),
AssetType::IntellectualProperty => 1800.0 + (i as f64 * 400.0),
AssetType::Commodity => 900.0 + (i as f64 * 180.0),

View File

@ -5,7 +5,7 @@ use uuid::Uuid;
/// Asset types representing different categories of digital assets
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum AssetType {
NFT,
Artwork,
Token,
RealEstate,
Commodity,
@ -18,7 +18,7 @@ pub enum AssetType {
impl AssetType {
pub fn as_str(&self) -> &str {
match self {
AssetType::NFT => "NFT",
AssetType::Artwork => "Artwork",
AssetType::Token => "Token",
AssetType::RealEstate => "Real Estate",
AssetType::Commodity => "Commodity",

View File

@ -28,8 +28,8 @@ impl DefiPositionStatus {
// DeFi position type
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum DefiPositionType {
Lending,
Borrowing,
Providing,
Receiving,
Liquidity,
Staking,
Collateral,
@ -38,8 +38,8 @@ pub enum DefiPositionType {
impl DefiPositionType {
pub fn as_str(&self) -> &str {
match self {
DefiPositionType::Lending => "Lending",
DefiPositionType::Borrowing => "Borrowing",
DefiPositionType::Providing => "Providing",
DefiPositionType::Receiving => "Receiving",
DefiPositionType::Liquidity => "Liquidity",
DefiPositionType::Staking => "Staking",
DefiPositionType::Collateral => "Collateral",
@ -58,24 +58,24 @@ pub struct DefiPosition {
pub asset_symbol: String,
pub amount: f64,
pub value_usd: f64,
pub apy: f64,
pub expected_return: f64,
pub created_at: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
pub user_id: String,
}
// Lending position
// Providing position
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LendingPosition {
pub struct ProvidingPosition {
pub base: DefiPosition,
pub duration_days: i32,
pub interest_earned: f64,
pub profit_share_earned: f64,
pub return_amount: f64,
}
// Borrowing position
// Receiving position
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BorrowingPosition {
pub struct ReceivingPosition {
pub base: DefiPosition,
pub collateral_asset_id: String,
pub collateral_asset_name: String,
@ -83,61 +83,61 @@ pub struct BorrowingPosition {
pub collateral_amount: f64,
pub collateral_value_usd: f64,
pub duration_days: i32,
pub interest_rate: f64,
pub interest_owed: f64,
pub profit_share_rate: f64,
pub profit_share_owed: f64,
pub total_to_repay: f64,
pub collateral_ratio: f64,
}
// In-memory database for DeFi positions
pub struct DefiDatabase {
lending_positions: HashMap<String, LendingPosition>,
borrowing_positions: HashMap<String, BorrowingPosition>,
providing_positions: HashMap<String, ProvidingPosition>,
receiving_positions: HashMap<String, ReceivingPosition>,
}
impl DefiDatabase {
pub fn new() -> Self {
Self {
lending_positions: HashMap::new(),
borrowing_positions: HashMap::new(),
providing_positions: HashMap::new(),
receiving_positions: HashMap::new(),
}
}
// Lending operations
pub fn add_lending_position(&mut self, position: LendingPosition) {
self.lending_positions.insert(position.base.id.clone(), position);
// Providing operations
pub fn add_providing_position(&mut self, position: ProvidingPosition) {
self.providing_positions.insert(position.base.id.clone(), position);
}
pub fn get_lending_position(&self, id: &str) -> Option<&LendingPosition> {
self.lending_positions.get(id)
pub fn get_providing_position(&self, id: &str) -> Option<&ProvidingPosition> {
self.providing_positions.get(id)
}
pub fn get_all_lending_positions(&self) -> Vec<&LendingPosition> {
self.lending_positions.values().collect()
pub fn get_all_providing_positions(&self) -> Vec<&ProvidingPosition> {
self.providing_positions.values().collect()
}
pub fn get_user_lending_positions(&self, user_id: &str) -> Vec<&LendingPosition> {
self.lending_positions
pub fn get_user_providing_positions(&self, user_id: &str) -> Vec<&ProvidingPosition> {
self.providing_positions
.values()
.filter(|p| p.base.user_id == user_id)
.collect()
}
// Borrowing operations
pub fn add_borrowing_position(&mut self, position: BorrowingPosition) {
self.borrowing_positions.insert(position.base.id.clone(), position);
// Receiving operations
pub fn add_receiving_position(&mut self, position: ReceivingPosition) {
self.receiving_positions.insert(position.base.id.clone(), position);
}
pub fn get_borrowing_position(&self, id: &str) -> Option<&BorrowingPosition> {
self.borrowing_positions.get(id)
pub fn get_receiving_position(&self, id: &str) -> Option<&ReceivingPosition> {
self.receiving_positions.get(id)
}
pub fn get_all_borrowing_positions(&self) -> Vec<&BorrowingPosition> {
self.borrowing_positions.values().collect()
pub fn get_all_receiving_positions(&self) -> Vec<&ReceivingPosition> {
self.receiving_positions.values().collect()
}
pub fn get_user_borrowing_positions(&self, user_id: &str) -> Vec<&BorrowingPosition> {
self.borrowing_positions
pub fn get_user_receiving_positions(&self, user_id: &str) -> Vec<&ReceivingPosition> {
self.receiving_positions
.values()
.filter(|p| p.base.user_id == user_id)
.collect()
@ -153,40 +153,40 @@ lazy_static! {
pub fn initialize_mock_data() {
let mut db = DEFI_DB.lock().unwrap();
// Add mock lending positions
let lending_position = LendingPosition {
// Add mock providing positions
let providing_position = ProvidingPosition {
base: DefiPosition {
id: Uuid::new_v4().to_string(),
position_type: DefiPositionType::Lending,
position_type: DefiPositionType::Providing,
status: DefiPositionStatus::Active,
asset_id: "TFT".to_string(),
asset_name: "ThreeFold Token".to_string(),
asset_symbol: "TFT".to_string(),
amount: 1000.0,
value_usd: 500.0,
apy: 4.2,
expected_return: 4.2,
created_at: Utc::now(),
expires_at: Some(Utc::now() + chrono::Duration::days(30)),
user_id: "user123".to_string(),
},
duration_days: 30,
interest_earned: 3.5,
profit_share_earned: 3.5,
return_amount: 1003.5,
};
db.add_lending_position(lending_position);
db.add_providing_position(providing_position);
// Add mock borrowing positions
let borrowing_position = BorrowingPosition {
// Add mock receiving positions
let receiving_position = ReceivingPosition {
base: DefiPosition {
id: Uuid::new_v4().to_string(),
position_type: DefiPositionType::Borrowing,
position_type: DefiPositionType::Receiving,
status: DefiPositionStatus::Active,
asset_id: "ZAZ".to_string(),
asset_id: "ZDFZ".to_string(),
asset_name: "Zanzibar Token".to_string(),
asset_symbol: "ZAZ".to_string(),
asset_symbol: "ZDFZ".to_string(),
amount: 500.0,
value_usd: 250.0,
apy: 5.8,
expected_return: 5.8,
created_at: Utc::now(),
expires_at: Some(Utc::now() + chrono::Duration::days(90)),
user_id: "user123".to_string(),
@ -197,10 +197,10 @@ pub fn initialize_mock_data() {
collateral_amount: 1500.0,
collateral_value_usd: 750.0,
duration_days: 90,
interest_rate: 5.8,
interest_owed: 3.625,
profit_share_rate: 5.8,
profit_share_owed: 3.625,
total_to_repay: 503.625,
collateral_ratio: 300.0,
};
db.add_borrowing_position(borrowing_position);
db.add_receiving_position(receiving_position);
}

View File

@ -14,4 +14,4 @@ pub use user::User;
pub use ticket::{Ticket, TicketComment, TicketStatus, TicketPriority};
pub use calendar::{CalendarEvent, CalendarViewMode};
pub use marketplace::{Listing, ListingStatus, ListingType, Bid, BidStatus, MarketplaceStatistics};
pub use defi::{DefiPosition, DefiPositionType, DefiPositionStatus, LendingPosition, BorrowingPosition, DEFI_DB, initialize_mock_data};
pub use defi::{DefiPosition, DefiPositionType, DefiPositionStatus, ProvidingPosition, ReceivingPosition, DEFI_DB, initialize_mock_data};

View File

@ -126,8 +126,8 @@ pub fn configure_routes(cfg: &mut web::ServiceConfig) {
.service(
web::scope("/defi")
.route("", web::get().to(DefiController::index))
.route("/lending", web::post().to(DefiController::create_lending))
.route("/borrowing", web::post().to(DefiController::create_borrowing))
.route("/providing", web::post().to(DefiController::create_providing))
.route("/receiving", web::post().to(DefiController::create_receiving))
.route("/liquidity", web::post().to(DefiController::add_liquidity))
.route("/staking", web::post().to(DefiController::create_staking))
.route("/swap", web::post().to(DefiController::swap_tokens))

View File

@ -89,7 +89,7 @@
<div class="d-flex align-items-center">
{% if asset.asset_type == "Token" %}
<i class="bi bi-coin me-2 text-warning"></i>
{% elif asset.asset_type == "NFT" %}
{% elif asset.asset_type == "Artwork" %}
<i class="bi bi-image me-2 text-primary"></i>
{% elif asset.asset_type == "Real Estate" %}
<i class="bi bi-building me-2 text-success"></i>
@ -162,7 +162,7 @@
<div class="d-flex align-items-center">
{% if asset_type.type == "Token" %}
<i class="bi bi-coin me-2 text-warning"></i>
{% elif asset_type.type == "NFT" %}
{% elif asset_type.type == "Artwork" %}
<i class="bi bi-image me-2 text-primary"></i>
{% elif asset_type.type == "Real Estate" %}
<i class="bi bi-building me-2 text-success"></i>

View File

@ -23,7 +23,7 @@
<label for="assetTypeFilter" class="form-label">Asset Type</label>
<select class="form-select" id="assetTypeFilter">
<option value="all">All Types</option>
<option value="NFT">NFT</option>
<option value="Artwork">Artwork</option>
<option value="Token">Token</option>
<option value="RealEstate">Real Estate</option>
<option value="Commodity">Commodity</option>

View File

@ -69,7 +69,7 @@
<div class="d-none d-md-flex">
<ul class="navbar-nav flex-row">
<li class="nav-item mx-3">
<a class="nav-link text-white {% if active_page == 'about' %}active{% endif %}" target="_blank" href="https://info.ourworld.tf/zaz">
<a class="nav-link text-white {% if active_page == 'about' %}active{% endif %}" target="_blank" href="https://info.ourworld.tf/zdfz">
About
</a>
</li>
@ -194,7 +194,7 @@
<small>Convenience, Safety and Privacy</small>
</div>
<div class="col-md-4 text-center mb-2 mb-md-0">
<a class="text-white text-decoration-none mx-2" target="_blank" href="https://info.ourworld.tf/zaz">About</a>
<a class="text-white text-decoration-none mx-2" target="_blank" href="https://info.ourworld.tf/zdfz">About</a>
<span class="text-white">|</span>
<a class="text-white text-decoration-none mx-2" href="/contact">Contact</a>
</div>

View File

@ -45,7 +45,7 @@
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">Website</h5>
<p class="card-text">https://info.ourworld.tf/zaz</p>
<p class="card-text">https://info.ourworld.tf/zdfz</p>
</div>
</div>
</div>

View File

@ -53,8 +53,8 @@
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="lending-tab" data-bs-toggle="tab" data-bs-target="#lending" type="button" role="tab" aria-controls="lending" aria-selected="false">
<i class="bi bi-cash-coin me-1"></i> Lending & Borrowing
<button class="nav-link" id="providing-receiving-tab" data-bs-toggle="tab" data-bs-target="#providing-receiving" type="button" role="tab" aria-controls="providing-receiving" aria-selected="false">
<i class="bi bi-cash-coin me-1"></i> Providing & Receiving
</button>
</li>
<li class="nav-item" role="presentation">
@ -81,7 +81,7 @@
<div class="tab-content mt-3" id="defiTabsContent">
{% include "defi/tabs/overview.html" %}
{% include "defi/tabs/lending_borrowing.html" %}
{% include "defi/tabs/providing_receiving.html" %}
{% include "defi/tabs/liquidity.html" %}
{% include "defi/tabs/staking.html" %}
{% include "defi/tabs/swap.html" %}

View File

@ -27,8 +27,8 @@
<option value="TFT" data-type="token" data-value="5000" data-amount="10000" data-unit="TFT" data-img="/static/img/tokens/tft.png">
ThreeFold Token (TFT) - 10,000 TFT ($5,000)
</option>
<option value="ZAZ" data-type="token" data-value="2500" data-amount="5000" data-unit="ZAZ" data-img="/static/img/tokens/zaz.png">
Zanzibar Token (ZAZ) - 5,000 ZAZ ($2,500)
<option value="ZDFZ" data-type="token" data-value="2500" data-amount="5000" data-unit="ZDFZ" data-img="/static/img/tokens/zdfz.png">
Zanzibar Token (ZDFZ) - 5,000 ZDFZ ($2,500)
</option>
</optgroup>
<!-- Digital Assets -->
@ -207,7 +207,7 @@
<td>
<div class="d-flex align-items-center">
<i class="bi bi-image me-2 text-primary"></i>
Beach Property NFT
Beach Property Artwork
</div>
</td>
<td>$25,000</td>
@ -232,8 +232,8 @@
<tr>
<td>
<div class="d-flex align-items-center">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="20" height="20" class="rounded-circle me-1">
1,000 ZAZ
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="20" height="20" class="rounded-circle me-1">
1,000 ZDFZ
</div>
</td>
<td>$500</td>
@ -297,7 +297,7 @@
</div>
<div class="alert alert-warning mb-0">
<i class="bi bi-exclamation-triangle"></i> Your Beach Property NFT collateral is close to the liquidation threshold. Consider adding more collateral or repaying part of your synthetic assets.
<i class="bi bi-exclamation-triangle"></i> Your Beach Property Artwork collateral is close to the liquidation threshold. Consider adding more collateral or repaying part of your synthetic assets.
</div>
</div>
</div>

View File

@ -1,18 +1,18 @@
<div class="tab-pane fade" id="lending" role="tabpanel" aria-labelledby="lending-tab">
<div class="tab-pane fade" id="providing" role="tabpanel" aria-labelledby="providing-tab">
<div class="row">
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header bg-primary text-white">
<i class="bi bi-box-arrow-right me-1"></i> Lend Your Assets
<i class="bi bi-box-arrow-right me-1"></i> Provide Your Assets
</div>
<div class="card-body">
<p class="card-text">Earn interest by lending your digital assets to the ZAZ DeFi platform.</p>
<p class="card-text">Earn profit share by providing your digital assets to the ZDFZ DeFi platform.</p>
<form action="/defi/lending" method="post">
<form action="/defi/providing" method="post">
<div class="mb-3">
<label for="asset" class="form-label">Select Asset</label>
<select class="form-select" id="asset" name="asset_id" required>
<option value="" selected disabled>Choose an asset to lend</option>
<option value="" selected disabled>Choose an asset to provide</option>
{% for asset in recent_assets %}
{% if asset.status == 'Active' %}
<option value="{{ asset.id }}" data-type="{{ asset.asset_type }}" data-value="{{ asset.current_valuation }}">
@ -34,27 +34,27 @@
<div class="mb-3">
<label for="duration" class="form-label">Duration</label>
<select class="form-select" id="duration" name="duration" required>
<option value="7">7 days (2.5% APY)</option>
<option value="30" selected>30 days (4.2% APY)</option>
<option value="90">90 days (6.8% APY)</option>
<option value="180">180 days (8.5% APY)</option>
<option value="365">365 days (12.0% APY)</option>
<option value="7">7 days (2.5% Expected Return %)</option>
<option value="30" selected>30 days (4.2% Expected Return %)</option>
<option value="90">90 days (6.8% Expected Return %)</option>
<option value="180">180 days (8.5% Expected Return %)</option>
<option value="365">365 days (12.0% Expected Return %)</option>
</select>
</div>
<div class="alert alert-success">
<div class="d-flex justify-content-between">
<span>Estimated Interest:</span>
<strong id="interestEstimate">0.00 TFT</strong>
<span>Estimated Profit Share:</span>
<strong id="profitShareEstimate">0.00 TFT</strong>
</div>
<div class="d-flex justify-content-between">
<span>Return Amount:</span>
<span>Expected Return:</span>
<strong id="returnAmount">0.00 TFT</strong>
</div>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary">Lend Asset</button>
<button type="submit" class="btn btn-primary">Provide Asset</button>
</div>
</form>
</div>
@ -64,12 +64,12 @@
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header bg-success text-white">
<i class="bi bi-box-arrow-in-left me-1"></i> Borrow Against Assets
<i class="bi bi-box-arrow-in-left me-1"></i> Receive Against Assets
</div>
<div class="card-body">
<p class="card-text">Borrow digital assets using your existing assets as collateral.</p>
<p class="card-text">Receive digital assets by contributing your existing assets as security.</p>
<form action="/defi/borrowing" method="post">
<form action="/defi/receiving" method="post">
<div class="mb-3">
<label for="collateralAsset" class="form-label">Collateral Asset</label>
<select class="form-select" id="collateralAsset" name="collateral_asset_id" required>
@ -85,55 +85,55 @@
</div>
<div class="mb-3">
<label for="borrowingAsset" class="form-label">Asset to Borrow</label>
<select class="form-select" id="borrowingAsset" name="asset_id" required>
<label for="receivingAsset" class="form-label">Asset to Receive</label>
<select class="form-select" id="receivingAsset" name="asset_id" required>
<option value="TFT" selected>ThreeFold Token (TFT)</option>
<option value="BTC">Bitcoin (BTC)</option>
<option value="ETH">Ethereum (ETH)</option>
<option value="USDT">Tether (USDT)</option>
<option value="ZAZ">Zanzibar Token (ZAZ)</option>
<option value="ZDFZ">Zanzibar Token (ZDFZ)</option>
</select>
</div>
<div class="mb-3">
<label for="borrowingAmount" class="form-label">Borrow Amount</label>
<label for="receivingAmount" class="form-label">Receiving Amount</label>
<div class="input-group">
<input type="number" class="form-control" id="borrowingAmount" name="amount" min="0.01" step="0.01" required>
<span class="input-group-text" id="borrowingAssetSymbol">TFT</span>
<input type="number" class="form-control" id="receivingAmount" name="amount" min="0.01" step="0.01" required>
<span class="input-group-text" id="receivingAssetSymbol">TFT</span>
</div>
<div class="form-text">You can borrow up to 70% of your collateral value.</div>
<div class="form-text">You can receive up to 70% of your collateral value.</div>
</div>
<div class="mb-3">
<label for="borrowingTerm" class="form-label">Duration</label>
<select class="form-select" id="borrowingTerm" name="duration" required>
<option value="7">7 days (3.5% APR)</option>
<option value="30" selected>30 days (5.2% APR)</option>
<option value="90">90 days (7.8% APR)</option>
<option value="180">180 days (9.5% APR)</option>
<label for="receivingTerm" class="form-label">Duration</label>
<select class="form-select" id="receivingTerm" name="duration" required>
<option value="7">7 days (3.5% Expected Return %)</option>
<option value="30" selected>30 days (5.2% Expected Return %)</option>
<option value="90">90 days (7.8% Expected Return %)</option>
<option value="180">180 days (9.5% Expected Return %)</option>
</select>
</div>
<div class="alert alert-warning">
<div class="d-flex justify-content-between">
<span>Collateral Ratio:</span>
<strong id="borrowCollateralRatio">0%</strong>
<strong id="collateralRatio">0%</strong>
</div>
<div class="d-flex justify-content-between">
<span>Interest Due:</span>
<strong id="interestDue">0.00 TFT</strong>
<span>Obligation Due:</span>
<strong id="obligationDue">0.00 TFT</strong>
</div>
<div class="d-flex justify-content-between">
<span>Total Repayment:</span>
<strong id="borrowTotalRepayment">0.00 TFT</strong>
<strong id="totalRepayment">0.00 TFT</strong>
</div>
<div class="progress mt-2">
<div id="borrowCollateralRatioBar" class="progress-bar bg-success" role="progressbar" style="width: 0%"></div>
<div id="collateralRatioBar" class="progress-bar bg-success" role="progressbar" style="width: 0%"></div>
</div>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-success">Borrow Asset</button>
<button type="submit" class="btn btn-success">Receive Asset</button>
</div>
</form>
</div>
@ -141,23 +141,23 @@
</div>
</div>
<!-- Active Lending & Borrowing Positions -->
<!-- Active Providing & Receiving Positions -->
<div class="card mb-4">
<div class="card-header">
<i class="bi bi-list-check me-1"></i> Your Active Positions
</div>
<div class="card-body">
<ul class="nav nav-pills mb-3" id="lendingPositionsTabs" role="tablist">
<ul class="nav nav-pills mb-3" id="positionsTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="lending-positions-tab" data-bs-toggle="pill" data-bs-target="#lending-positions" type="button" role="tab" aria-controls="lending-positions" aria-selected="true">Lending</button>
<button class="nav-link active" id="providing-positions-tab" data-bs-toggle="pill" data-bs-target="#providing-positions" type="button" role="tab" aria-controls="providing-positions" aria-selected="true">Providing</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="borrowing-positions-tab" data-bs-toggle="pill" data-bs-target="#borrowing-positions" type="button" role="tab" aria-controls="borrowing-positions" aria-selected="false">Borrowing</button>
<button class="nav-link" id="receiving-positions-tab" data-bs-toggle="pill" data-bs-target="#receiving-positions" type="button" role="tab" aria-controls="receiving-positions" aria-selected="false">Receiving</button>
</li>
</ul>
<div class="tab-content" id="lendingPositionsTabsContent">
<div class="tab-pane fade show active" id="lending-positions" role="tabpanel" aria-labelledby="lending-positions-tab">
<div class="tab-content" id="positionsTabsContent">
<div class="tab-pane fade show active" id="providing-positions" role="tabpanel" aria-labelledby="providing-positions-tab">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
@ -165,17 +165,17 @@
<th>Asset</th>
<th>Amount</th>
<th>Value</th>
<th>APY</th>
<th>Expected Return %</th>
<th>Start Date</th>
<th>End Date</th>
<th>Interest Earned</th>
<th>Profit Share Earned</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% if lending_positions and lending_positions|length > 0 %}
{% for position in lending_positions %}
{% if providing_positions and providing_positions|length > 0 %}
{% for position in providing_positions %}
<tr>
<td>
<div class="d-flex align-items-center">
@ -185,10 +185,10 @@
</td>
<td>{{ position.base.amount }} {{ position.base.asset_symbol }}</td>
<td>${{ position.base.value_usd | round(precision = 2) }}</td>
<td>{{ position.base.apy }}%</td>
<td>{{ position.base.expected_return }}%</td>
<td>{{ position.base.created_at | date }}</td>
<td>{{ position.base.expires_at | date }}</td>
<td>{{ position.interest_earned | round(precision = 2) }} {{ position.base.asset_symbol }}</td>
<td>{{ position.profit_share_earned | round(precision = 2) }} {{ position.base.asset_symbol }}</td>
<td>
<span class="badge bg-{% if position.base.status == 'Active' %}success{% elif position.base.status == 'Completed' %}info{% elif position.base.status == 'Liquidated' %}danger{% else %}warning{% endif %}">
{{ position.base.status }}
@ -203,23 +203,23 @@
{% endfor %}
{% else %}
<tr>
<td colspan="9" class="text-center">No active lending positions found</td>
<td colspan="9" class="text-center">No active providing positions found</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade" id="borrowing-positions" role="tabpanel" aria-labelledby="borrowing-positions-tab">
<div class="tab-pane fade" id="receiving-positions" role="tabpanel" aria-labelledby="receiving-positions-tab">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Borrowed Asset</th>
<th>Received Asset</th>
<th>Amount</th>
<th>Collateral</th>
<th>Collateral Ratio</th>
<th>Interest Rate</th>
<th>Expected Return %</th>
<th>Start Date</th>
<th>Due Date</th>
<th>Status</th>
@ -227,8 +227,8 @@
</tr>
</thead>
<tbody>
{% if borrowing_positions and borrowing_positions|length > 0 %}
{% for position in borrowing_positions %}
{% if receiving_positions and receiving_positions|length > 0 %}
{% for position in receiving_positions %}
<tr>
<td>
<div class="d-flex align-items-center">
@ -251,7 +251,7 @@
<span>{{ position.collateral_ratio | round(precision=0) }}%</span>
</div>
</td>
<td>{{ position.base.apy }}%</td>
<td>{{ position.base.expected_return }}%</td>
<td>{{ position.base.created_at|date }}</td>
<td>{{ position.base.expires_at|date }}</td>
<td>
@ -268,7 +268,7 @@
{% endfor %}
{% else %}
<tr>
<td colspan="9" class="text-center">No active borrowing positions found</td>
<td colspan="9" class="text-center">No active receiving positions found</td>
</tr>
{% endif %}
</tbody>

View File

@ -35,9 +35,9 @@
<div class="d-flex align-items-center">
<div class="position-relative me-2">
<img src="/static/img/tokens/tft.png" alt="TFT" width="24" height="24" class="rounded-circle">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="24" height="24" class="rounded-circle position-absolute" style="left: 15px; top: 0;">
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="24" height="24" class="rounded-circle position-absolute" style="left: 15px; top: 0;">
</div>
TFT-ZAZ
TFT-ZDFZ
</div>
</td>
<td>$1,250,000</td>
@ -47,8 +47,8 @@
<td>0.2%</td>
<td>
<div class="btn-group">
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addLiquidityModal" data-pool="TFT-ZAZ">Add</button>
<button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#removeLiquidityModal" data-pool="TFT-ZAZ">Remove</button>
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addLiquidityModal" data-pool="TFT-ZDFZ">Add</button>
<button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#removeLiquidityModal" data-pool="TFT-ZDFZ">Remove</button>
</div>
</td>
</tr>
@ -78,10 +78,10 @@
<td>
<div class="d-flex align-items-center">
<div class="position-relative me-2">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="24" height="24" class="rounded-circle">
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="24" height="24" class="rounded-circle">
<img src="/static/img/tokens/usdt.png" alt="USDT" width="24" height="24" class="rounded-circle position-absolute" style="left: 15px; top: 0;">
</div>
ZAZ-USDT
ZDFZ-USDT
</div>
</td>
<td>$850,000</td>
@ -91,8 +91,8 @@
<td>0.59%</td>
<td>
<div class="btn-group">
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addLiquidityModal" data-pool="ZAZ-USDT">Add</button>
<button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#removeLiquidityModal" data-pool="ZAZ-USDT">Remove</button>
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addLiquidityModal" data-pool="ZDFZ-USDT">Add</button>
<button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#removeLiquidityModal" data-pool="ZDFZ-USDT">Remove</button>
</div>
</td>
</tr>
@ -113,16 +113,16 @@
</div>
<div class="card-body">
<div class="row">
<!-- TFT-ZAZ Position -->
<!-- TFT-ZDFZ Position -->
<div class="col-md-6 col-lg-4 mb-4">
<div class="card h-100">
<div class="card-header bg-light">
<div class="d-flex align-items-center">
<div class="position-relative me-2">
<img src="/static/img/tokens/tft.png" alt="TFT" width="24" height="24" class="rounded-circle">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="24" height="24" class="rounded-circle position-absolute" style="left: 15px; top: 0;">
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="24" height="24" class="rounded-circle position-absolute" style="left: 15px; top: 0;">
</div>
TFT-ZAZ
TFT-ZDFZ
</div>
</div>
<div class="card-body">
@ -139,8 +139,8 @@
<strong>500 TFT</strong>
</div>
<div class="d-flex justify-content-between mb-2">
<span>ZAZ:</span>
<strong>1,250 ZAZ</strong>
<span>ZDFZ:</span>
<strong>1,250 ZDFZ</strong>
</div>
<div class="d-flex justify-content-between mb-2">
<span>Earned Fees:</span>
@ -151,24 +151,24 @@
<strong class="text-success">12.5%</strong>
</div>
<div class="d-grid gap-2">
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addLiquidityModal" data-pool="TFT-ZAZ">Add Liquidity</button>
<button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#removeLiquidityModal" data-pool="TFT-ZAZ">Remove Liquidity</button>
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addLiquidityModal" data-pool="TFT-ZDFZ">Add Liquidity</button>
<button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#removeLiquidityModal" data-pool="TFT-ZDFZ">Remove Liquidity</button>
<button class="btn btn-sm btn-outline-success">Claim Rewards</button>
</div>
</div>
</div>
</div>
<!-- ZAZ-USDT Position -->
<!-- ZDFZ-USDT Position -->
<div class="col-md-6 col-lg-4 mb-4">
<div class="card h-100">
<div class="card-header bg-light">
<div class="d-flex align-items-center">
<div class="position-relative me-2">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="24" height="24" class="rounded-circle">
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="24" height="24" class="rounded-circle">
<img src="/static/img/tokens/usdt.png" alt="USDT" width="24" height="24" class="rounded-circle position-absolute" style="left: 15px; top: 0;">
</div>
ZAZ-USDT
ZDFZ-USDT
</div>
</div>
<div class="card-body">
@ -181,8 +181,8 @@
<strong>0.59%</strong>
</div>
<div class="d-flex justify-content-between mb-2">
<span>ZAZ:</span>
<strong>2,500 ZAZ</strong>
<span>ZDFZ:</span>
<strong>2,500 ZDFZ</strong>
</div>
<div class="d-flex justify-content-between mb-2">
<span>USDT:</span>
@ -197,8 +197,8 @@
<strong class="text-success">15.8%</strong>
</div>
<div class="d-grid gap-2">
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addLiquidityModal" data-pool="ZAZ-USDT">Add Liquidity</button>
<button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#removeLiquidityModal" data-pool="ZAZ-USDT">Remove Liquidity</button>
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addLiquidityModal" data-pool="ZDFZ-USDT">Add Liquidity</button>
<button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#removeLiquidityModal" data-pool="ZDFZ-USDT">Remove Liquidity</button>
<button class="btn btn-sm btn-outline-success">Claim Rewards</button>
</div>
</div>
@ -226,7 +226,7 @@
<select class="form-select" id="firstToken" name="first_token" required>
<option value="" selected disabled>Select first token</option>
<option value="TFT">ThreeFold Token (TFT)</option>
<option value="ZAZ">Zanzibar Token (ZAZ)</option>
<option value="ZDFZ">Zanzibar Token (ZDFZ)</option>
<option value="BTC">Bitcoin (BTC)</option>
<option value="ETH">Ethereum (ETH)</option>
<option value="USDT">Tether (USDT)</option>
@ -246,7 +246,7 @@
<select class="form-select" id="secondToken" name="second_token" required>
<option value="" selected disabled>Select second token</option>
<option value="TFT">ThreeFold Token (TFT)</option>
<option value="ZAZ">Zanzibar Token (ZAZ)</option>
<option value="ZDFZ">Zanzibar Token (ZDFZ)</option>
<option value="BTC">Bitcoin (BTC)</option>
<option value="ETH">Ethereum (ETH)</option>
<option value="USDT">Tether (USDT)</option>
@ -256,7 +256,7 @@
<label for="secondTokenAmount" class="form-label">Amount</label>
<div class="input-group">
<input type="number" class="form-control" id="secondTokenAmount" name="second_token_amount" min="0.000001" step="0.000001" required>
<span class="input-group-text" id="secondTokenSymbol">ZAZ</span>
<span class="input-group-text" id="secondTokenSymbol">ZDFZ</span>
</div>
</div>
</div>
@ -268,7 +268,7 @@
<span class="input-group-text" id="firstTokenSymbolRatio">TFT</span>
<span class="input-group-text">=</span>
<input type="number" class="form-control" id="initialPrice" name="initial_price" min="0.000001" step="0.000001" required>
<span class="input-group-text" id="secondTokenSymbolRatio">ZAZ</span>
<span class="input-group-text" id="secondTokenSymbolRatio">ZDFZ</span>
</div>
</div>
<div class="mb-3">

View File

@ -1,6 +1,6 @@
<div class="tab-pane fade show active" id="overview" role="tabpanel" aria-labelledby="overview-tab">
<div class="alert alert-info">
<h4 class="alert-heading"><i class="bi bi-info-circle"></i> Welcome to the ZAZ DeFi Platform!</h4>
<h4 class="alert-heading"><i class="bi bi-info-circle"></i> Welcome to the ZDFZ DeFi Platform!</h4>
<p>Our decentralized finance platform allows you to maximize the value of your digital assets through various financial services.</p>
<hr>
<p class="mb-0">Use the tabs above to explore lending, borrowing, liquidity pools, staking, swapping, and collateralization features.</p>

View File

@ -0,0 +1,260 @@
{#
This is a compliant version of the previous lending_borrowing.html tab. All terminology is updated to "Providing" and "Receiving".
#}
<div class="tab-pane fade" id="providing-receiving" role="tabpanel" aria-labelledby="providing-receiving-tab">
<div class="row">
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header bg-primary text-white">
<i class="bi bi-box-arrow-right me-1"></i> Provide Your Assets
</div>
<div class="card-body">
<p class="card-text">Earn profit share by providing your digital assets to the ZDFZ DeFi platform.</p>
<form action="/defi/providing" method="post">
<div class="mb-3">
<label for="asset" class="form-label">Select Asset</label>
<select class="form-select" id="asset" name="asset_id" required>
<option value="" selected disabled>Choose an asset to provide</option>
{% for asset in recent_assets %}
{% if asset.status == 'Active' %}
<option value="{{ asset.id }}" data-type="{{ asset.asset_type }}" data-value="{{ asset.current_valuation }}">
{{ asset.name }} ({{ asset.asset_type }}) - ${{ asset.current_valuation }}
</option>
{% endif %}
{% endfor %}
</select>
</div>
<div class="mb-3">
<label for="amount" class="form-label">Amount</label>
<div class="input-group">
<input type="number" class="form-control" id="amount" name="amount" min="0.01" step="0.01" required>
<span class="input-group-text" id="assetSymbol">TFT</span>
</div>
</div>
<div class="mb-3">
<label for="duration" class="form-label">Duration</label>
<select class="form-select" id="duration" name="duration" required>
<option value="7">7 days (2.5% Expected Return %)</option>
<option value="30" selected>30 days (4.2% Expected Return %)</option>
<option value="90">90 days (6.8% Expected Return %)</option>
<option value="180">180 days (8.5% Expected Return %)</option>
<option value="365">365 days (12.0% Expected Return %)</option>
</select>
</div>
<div class="alert alert-success">
<div class="d-flex justify-content-between">
<span>Estimated Profit Share:</span>
<strong id="profitShareEstimate">0.00 TFT</strong>
</div>
<div class="d-flex justify-content-between">
<span>Expected Return:</span>
<strong id="returnAmount">0.00 TFT</strong>
</div>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary">Provide Asset</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header bg-success text-white">
<i class="bi bi-box-arrow-in-left me-1"></i> Receive Against Assets
</div>
<div class="card-body">
<p class="card-text">Receive digital assets by contributing your existing assets as security.</p>
<form action="/defi/receiving" method="post">
<div class="mb-3">
<label for="collateralAsset" class="form-label">Collateral Asset</label>
<select class="form-select" id="collateralAsset" name="collateral_asset_id" required>
<option value="" selected disabled>Choose a collateral asset</option>
{% for asset in recent_assets %}
{% if asset.status == 'Active' %}
<option value="{{ asset.id }}" data-type="{{ asset.asset_type }}" data-value="{{ asset.current_valuation }}">
{{ asset.name }} ({{ asset.asset_type }}) - ${{ asset.current_valuation }}
</option>
{% endif %}
{% endfor %}
</select>
</div>
<div class="mb-3">
<label for="collateralAmount" class="form-label">Collateral Amount</label>
<div class="input-group">
<input type="number" class="form-control" id="collateralAmount" name="collateral_amount" min="0.01" step="0.01" required>
<span class="input-group-text" id="collateralAssetSymbol">TFT</span>
</div>
</div>
<div class="mb-3">
<label for="receivingAsset" class="form-label">Asset to Receive</label>
<select class="form-select" id="receivingAsset" name="asset_id" required>
<option value="" selected disabled>Choose an asset to receive</option>
{% for asset in recent_assets %}
{% if asset.status == 'Active' %}
<option value="{{ asset.id }}" data-type="{{ asset.asset_type }}" data-value="{{ asset.current_valuation }}">
{{ asset.name }} ({{ asset.asset_type }}) - ${{ asset.current_valuation }}
</option>
{% endif %}
{% endfor %}
</select>
<div class="form-text">You can receive up to 70% of your collateral value.</div>
</div>
<div class="mb-3">
<label for="receivingTerm" class="form-label">Duration</label>
<select class="form-select" id="receivingTerm" name="duration" required>
<option value="7">7 days (3.5% Profit Share Rate)</option>
<option value="30" selected>30 days (5.2% Profit Share Rate)</option>
<option value="90">90 days (8.1% Profit Share Rate)</option>
<option value="180">180 days (9.5% Profit Share Rate)</option>
</select>
</div>
<div class="alert alert-warning">
<div class="d-flex justify-content-between">
<span>Collateral Ratio:</span>
<strong id="collateralRatio">0.00%</strong>
</div>
<div class="d-flex justify-content-between">
<span>Profit Share Owed:</span>
<strong id="profitShareOwed">0.00 TFT</strong>
</div>
<div class="d-flex justify-content-between">
<span>Total to Repay:</span>
<strong id="totalToRepay">0.00 TFT</strong>
</div>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-success">Receive Asset</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-12">
<div class="card">
<div class="card-header bg-primary text-white">
<i class="bi bi-list-ul me-1"></i> Providing Positions
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-striped table-hover mb-0">
<thead>
<tr>
<th>Asset</th>
<th>Amount</th>
<th>Expected Return</th>
<th>Start Date</th>
<th>Due Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% if providing_positions and providing_positions|length > 0 %}
{% for position in providing_positions %}
<tr>
<td>
<div class="d-flex align-items-center">
<div class="token-icon me-2"></div>
{{ position.base.asset_name }}
</div>
</td>
<td>{{ position.base.amount }} {{ position.base.asset_symbol }}</td>
<td>{{ position.base.expected_return }}%</td>
<td>{{ position.base.created_at|date }}</td>
<td>{{ position.base.expires_at|date }}</td>
<td>
<span class="badge bg-{% if position.base.status == 'Active' %}success{% elif position.base.status == 'Completed' %}info{% elif position.base.status == 'Liquidated' %}danger{% else %}warning{% endif %}">
{{ position.base.status }}
</span>
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="6" class="text-center">No active providing positions found</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-12">
<div class="card">
<div class="card-header bg-success text-white">
<i class="bi bi-list-ul me-1"></i> Receiving Positions
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-striped table-hover mb-0">
<thead>
<tr>
<th>Asset</th>
<th>Amount</th>
<th>Collateral</th>
<th>Collateral Ratio</th>
<th>Profit Share Rate</th>
<th>Start Date</th>
<th>Due Date</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% if receiving_positions and receiving_positions|length > 0 %}
{% for position in receiving_positions %}
<tr>
<td>
<div class="d-flex align-items-center">
<div class="token-icon me-2"></div>
{{ position.base.asset_name }}
</div>
</td>
<td>{{ position.base.amount }} {{ position.base.asset_symbol }}</td>
<td>
<div class="d-flex align-items-center">
<div class="token-icon me-2"></div>
{{ position.collateral_amount }} {{ position.collateral_asset_symbol }}
</div>
</td>
<td>
<div class="d-flex align-items-center">
<div class="progress flex-grow-1 me-2" style="height: 8px;">
<div class="progress-bar {% if position.collateral_ratio >= 200 %}bg-success{% elif position.collateral_ratio >= 150 %}bg-warning{% else %}bg-danger{% endif %}" role="progressbar" style="width: {% if (position.collateral_ratio / 3) > 100 %}100{% else %}{{ position.collateral_ratio / 3 }}{% endif %}%"></div>
</div>
<span>{{ position.collateral_ratio | round(precision=0) }}%</span>
</div>
</td>
<td>{{ position.base.expected_return }}%</td>
<td>{{ position.base.created_at|date }}</td>
<td>{{ position.base.expires_at|date }}</td>
<td>
<span class="badge bg-{% if position.base.status == 'Active' %}success{% elif position.base.status == 'Completed' %}info{% elif position.base.status == 'Liquidated' %}danger{% else %}warning{% endif %}">
{{ position.base.status }}
</span>
</td>
<td>
<div class="btn-group">
<button class="btn btn-sm btn-outline-primary">Repay</button>
</div>
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="9" class="text-center">No active receiving positions found</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -75,23 +75,23 @@
</div>
</div>
<!-- ZAZ Staking -->
<!-- ZDFZ Staking -->
<div class="col-md-6 col-lg-4 mb-4">
<div class="card h-100">
<div class="card-header bg-success text-white">
<div class="d-flex align-items-center">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="24" height="24" class="rounded-circle me-2">
<h6 class="mb-0">Zanzibar Token (ZAZ)</h6>
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="24" height="24" class="rounded-circle me-2">
<h6 class="mb-0">Zanzibar Token (ZDFZ)</h6>
</div>
</div>
<div class="card-body">
<div class="d-flex justify-content-between mb-2">
<span>Total Staked:</span>
<strong>2,750,000 ZAZ</strong>
<strong>2,750,000 ZDFZ</strong>
</div>
<div class="d-flex justify-content-between mb-2">
<span>Your Stake:</span>
<strong>500 ZAZ</strong>
<strong>500 ZDFZ</strong>
</div>
<div class="d-flex justify-content-between mb-3">
<span>APY:</span>
@ -99,7 +99,7 @@
</div>
<form action="/defi/staking" method="post">
<input type="hidden" name="asset_id" value="ZAZ">
<input type="hidden" name="asset_id" value="ZDFZ">
<div class="mb-3">
<label for="zazStakingPeriod" class="form-label">Staking Period</label>
<select class="form-select" id="zazStakingPeriod" name="staking_period">
@ -113,20 +113,20 @@
<div class="mb-3">
<label for="zazStakeAmount" class="form-label">Amount to Stake</label>
<div class="input-group">
<input type="number" class="form-control" id="zazStakeAmount" name="amount" min="50" step="1" placeholder="Min 50 ZAZ">
<span class="input-group-text">ZAZ</span>
<input type="number" class="form-control" id="zazStakeAmount" name="amount" min="50" step="1" placeholder="Min 50 ZDFZ">
<span class="input-group-text">ZDFZ</span>
</div>
</div>
<div class="alert alert-success mb-3">
<div class="d-flex justify-content-between">
<span>Estimated Rewards:</span>
<strong id="zazEstimatedRewards">0 ZAZ</strong>
<strong id="zazEstimatedRewards">0 ZDFZ</strong>
</div>
</div>
<div class="d-grid gap-2">
<button class="btn btn-success" id="zazStakeButton">Stake ZAZ</button>
<button class="btn btn-success" id="zazStakeButton">Stake ZDFZ</button>
</div>
</form>
</div>
@ -177,7 +177,7 @@
</div>
<div class="d-flex justify-content-between">
<span>Reward Token:</span>
<strong>ZAZ</strong>
<strong>ZDFZ</strong>
</div>
</div>
@ -239,16 +239,16 @@
<tr>
<td>
<div class="d-flex align-items-center">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="24" height="24" class="rounded-circle me-2">
Zanzibar Token (ZAZ)
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="24" height="24" class="rounded-circle me-2">
Zanzibar Token (ZDFZ)
</div>
</td>
<td>500 ZAZ</td>
<td>500 ZDFZ</td>
<td>$250</td>
<td>2025-04-01</td>
<td>2025-05-01</td>
<td>12.0%</td>
<td>5.0 ZAZ</td>
<td>5.0 ZDFZ</td>
<td><span class="badge bg-success">Active</span></td>
<td>
<button class="btn btn-sm btn-outline-success">Claim Rewards</button>
@ -258,15 +258,15 @@
<td>
<div class="d-flex align-items-center">
<i class="bi bi-image me-2 text-primary"></i>
Beach Property NFT
Beach Property Artwork
</div>
</td>
<td>1 NFT</td>
<td>1 Artwork</td>
<td>$25,000</td>
<td>2025-02-10</td>
<td>2026-02-10</td>
<td>10.0%</td>
<td>450 ZAZ</td>
<td>450 ZDFZ</td>
<td><span class="badge bg-success">Active</span></td>
<td>
<button class="btn btn-sm btn-outline-success">Claim Rewards</button>

View File

@ -41,11 +41,11 @@
<small class="text-muted">Balance: 10,000 TFT</small>
</div>
</a></li>
<li><a class="dropdown-item d-flex align-items-center" href="#" data-token="ZAZ" data-img="/static/img/tokens/zaz.png" data-balance="5000">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="24" height="24" class="rounded-circle me-2">
<li><a class="dropdown-item d-flex align-items-center" href="#" data-token="ZDFZ" data-img="/static/img/tokens/zdfz.png" data-balance="5000">
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="24" height="24" class="rounded-circle me-2">
<div>
<div>Zanzibar Token</div>
<small class="text-muted">Balance: 5,000 ZAZ</small>
<small class="text-muted">Balance: 5,000 ZDFZ</small>
</div>
</a></li>
<li><a class="dropdown-item d-flex align-items-center" href="#" data-token="USDT" data-img="/static/img/tokens/usdt.png" data-balance="2500">
@ -82,17 +82,17 @@
<input type="number" class="form-control form-control-lg border-0" id="swapToAmount" name="to_amount" placeholder="0.0" readonly>
<div class="dropdown">
<button class="btn btn-outline-primary dropdown-toggle d-flex align-items-center" type="button" id="toTokenDropdown" data-bs-toggle="dropdown" aria-expanded="false">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="24" height="24" class="rounded-circle me-2" id="toTokenImg">
<span id="toTokenSymbol">ZAZ</span>
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="24" height="24" class="rounded-circle me-2" id="toTokenImg">
<span id="toTokenSymbol">ZDFZ</span>
</button>
<input type="hidden" name="to_token" id="toTokenInput" value="ZAZ">
<input type="hidden" name="to_token" id="toTokenInput" value="ZDFZ">
<ul class="dropdown-menu" aria-labelledby="toTokenDropdown">
<li><a class="dropdown-item d-flex align-items-center" href="#" data-token="TFT" data-img="/static/img/tokens/tft.png">
<img src="/static/img/tokens/tft.png" alt="TFT" width="24" height="24" class="rounded-circle me-2">
<div>ThreeFold Token</div>
</a></li>
<li><a class="dropdown-item d-flex align-items-center" href="#" data-token="ZAZ" data-img="/static/img/tokens/zaz.png">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="24" height="24" class="rounded-circle me-2">
<li><a class="dropdown-item d-flex align-items-center" href="#" data-token="ZDFZ" data-img="/static/img/tokens/zdfz.png">
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="24" height="24" class="rounded-circle me-2">
<div>Zanzibar Token</div>
</a></li>
<li><a class="dropdown-item d-flex align-items-center" href="#" data-token="USDT" data-img="/static/img/tokens/usdt.png">
@ -103,7 +103,7 @@
</div>
</div>
<div class="d-flex justify-content-between align-items-center text-muted small">
<span>Balance: <span id="toTokenBalance">5,000 ZAZ</span></span>
<span>Balance: <span id="toTokenBalance">5,000 ZDFZ</span></span>
<span>≈ $<span id="toTokenUsdValue">2,500.00</span></span>
</div>
</div>
@ -115,11 +115,11 @@
<div class="card-body p-3">
<div class="d-flex justify-content-between align-items-center small">
<span>Exchange Rate:</span>
<span id="exchangeRate">1 TFT = 0.5 ZAZ</span>
<span id="exchangeRate">1 TFT = 0.5 ZDFZ</span>
</div>
<div class="d-flex justify-content-between align-items-center small">
<span>Minimum Received:</span>
<span id="minimumReceived">0 ZAZ</span>
<span id="minimumReceived">0 ZDFZ</span>
</div>
<div class="d-flex justify-content-between align-items-center small">
<span>Price Impact:</span>
@ -169,8 +169,8 @@
</td>
<td>
<div class="d-flex align-items-center">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="20" height="20" class="rounded-circle me-1">
250 ZAZ
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="20" height="20" class="rounded-circle me-1">
250 ZDFZ
</div>
</td>
<td>$250.00</td>
@ -195,8 +195,8 @@
<td>2025-04-12 16:45</td>
<td>
<div class="d-flex align-items-center">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="20" height="20" class="rounded-circle me-1">
100 ZAZ
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="20" height="20" class="rounded-circle me-1">
100 ZDFZ
</div>
</td>
<td>
@ -235,9 +235,9 @@
<div class="d-flex align-items-center">
<div class="position-relative me-2">
<img src="/static/img/tokens/tft.png" alt="TFT" width="20" height="20" class="rounded-circle">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="20" height="20" class="rounded-circle position-absolute" style="left: 10px; top: 0;">
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="20" height="20" class="rounded-circle position-absolute" style="left: 10px; top: 0;">
</div>
TFT/ZAZ
TFT/ZDFZ
</div>
</td>
<td>0.5</td>
@ -262,10 +262,10 @@
<td>
<div class="d-flex align-items-center">
<div class="position-relative me-2">
<img src="/static/img/tokens/zaz.png" alt="ZAZ" width="20" height="20" class="rounded-circle">
<img src="/static/img/tokens/zdfz.png" alt="ZDFZ" width="20" height="20" class="rounded-circle">
<img src="/static/img/tokens/usdt.png" alt="USDT" width="20" height="20" class="rounded-circle position-absolute" style="left: 10px; top: 0;">
</div>
ZAZ/USDT
ZDFZ/USDT
</div>
</td>
<td>0.5</td>

View File

@ -199,7 +199,7 @@
previewContainer.innerHTML = previewHtml;
// Suggest listing type based on asset type
if (assetType === 'NFT') {
if (assetType === 'Artwork') {
listingTypeSelect.value = 'Auction';
} else if (assetType === 'Token') {
listingTypeSelect.value = 'Fixed Price';

View File

@ -180,7 +180,7 @@
<td>
{% if listing.asset_type == "Token" %}
<span class="badge bg-primary">{{ listing.asset_type }}</span>
{% elif listing.asset_type == "NFT" %}
{% elif listing.asset_type == "Artwork" %}
<span class="badge bg-info">{{ listing.asset_type }}</span>
{% elif listing.asset_type == "RealEstate" %}
<span class="badge bg-success">Real Estate</span>

View File

@ -61,7 +61,7 @@
<p><strong>Asset Type:</strong>
{% if listing.asset_type == "Token" %}
<span class="badge bg-primary">{{ listing.asset_type }}</span>
{% elif listing.asset_type == "NFT" %}
{% elif listing.asset_type == "Artwork" %}
<span class="badge bg-info">{{ listing.asset_type }}</span>
{% elif listing.asset_type == "RealEstate" %}
<span class="badge bg-success">Real Estate</span>

View File

@ -99,7 +99,7 @@
<span class="badge bg-primary">{{ listing.listing_type }}</span>
{% if listing.asset_type == "Token" %}
<span class="badge bg-primary">{{ listing.asset_type }}</span>
{% elif listing.asset_type == "NFT" %}
{% elif listing.asset_type == "Artwork" %}
<span class="badge bg-info">{{ listing.asset_type }}</span>
{% elif listing.asset_type == "RealEstate" %}
<span class="badge bg-success">Real Estate</span>
@ -175,7 +175,7 @@
<td>
{% if listing.asset_type == "Token" %}
<span class="badge bg-primary">{{ listing.asset_type }}</span>
{% elif listing.asset_type == "NFT" %}
{% elif listing.asset_type == "Artwork" %}
<span class="badge bg-info">{{ listing.asset_type }}</span>
{% elif listing.asset_type == "RealEstate" %}
<span class="badge bg-success">Real Estate</span>

View File

@ -83,7 +83,7 @@ document.addEventListener('DOMContentLoaded', function() {
// Mock prices for demonstration
const assetPrices = {
'TFT': 0.5,
'ZAZ': 0.5,
'ZDFZ': 0.5,
'USDT': 1.0
};
@ -152,11 +152,11 @@ document.addEventListener('DOMContentLoaded', function() {
const token1Label = document.getElementById('token1Label');
const token2Label = document.getElementById('token2Label');
if (selectedOption.value === 'tft-zaz') {
if (selectedOption.value === 'tft-zdfz') {
if (token1Label) token1Label.textContent = 'TFT';
if (token2Label) token2Label.textContent = 'ZAZ';
} else if (selectedOption.value === 'zaz-usdt') {
if (token1Label) token1Label.textContent = 'ZAZ';
if (token2Label) token2Label.textContent = 'ZDFZ';
} else if (selectedOption.value === 'zdfz-usdt') {
if (token1Label) token1Label.textContent = 'ZDFZ';
if (token2Label) token2Label.textContent = 'USDT';
}
@ -190,7 +190,7 @@ document.addEventListener('DOMContentLoaded', function() {
tftStakingPeriodSelect.addEventListener('change', calculateTftStakingRewards);
}
// ZAZ Staking calculations
// ZDFZ Staking calculations
const zazStakeAmountInput = document.getElementById('zazStakeAmount');
const zazStakingPeriodSelect = document.getElementById('zazStakingPeriod');
const zazEstimatedRewardsElement = document.getElementById('zazEstimatedRewards');
@ -208,7 +208,7 @@ document.addEventListener('DOMContentLoaded', function() {
// Calculate rewards (simple interest for demonstration)
const rewards = amount * apy * (termDays / 365);
zazEstimatedRewardsElement.textContent = rewards.toFixed(2) + ' ZAZ';
zazEstimatedRewardsElement.textContent = rewards.toFixed(2) + ' ZDFZ';
};
zazStakeAmountInput.addEventListener('input', calculateZazStakingRewards);
@ -264,13 +264,13 @@ document.addEventListener('DOMContentLoaded', function() {
// Mock token data
const tokenData = {
'TFT': { price: 0.5, balance: '10,000 TFT', usdValue: '5,000.00' },
'ZAZ': { price: 0.5, balance: '5,000 ZAZ', usdValue: '2,500.00' },
'ZDFZ': { price: 0.5, balance: '5,000 ZDFZ', usdValue: '2,500.00' },
'USDT': { price: 1.0, balance: '2,500 USDT', usdValue: '2,500.00' }
};
if (swapFromAmountInput && swapToAmountElement) {
let fromToken = 'TFT';
let toToken = 'ZAZ';
let toToken = 'ZDFZ';
const calculateSwap = () => {
const fromAmount = parseFloat(swapFromAmountInput.value) || 0;

View File

@ -16,7 +16,7 @@ Real World Digital Assets (RWDAs) represent digitized ownership of real-world as
- **Description**: Comprehensive description of the asset and its underlying value
- **Asset Type**: Classification (e.g., Real Estate, Business Equity (Shares), Commodity (Gold, Copper))
- **Creation Date**: When the RWDA was created/tokenized
- **Issuer**: Entity responsible for creating and managing the RWDA, needs to be linked to a Entity in ZAZ
- **Issuer**: Entity responsible for creating and managing the RWDA, needs to be linked to a Entity in ZDFZ
#### 1.2. Media and Documentation
- **Logo/Image**: Visual representation of the asset
@ -70,9 +70,9 @@ Real World Digital Assets (RWDAs) represent digitized ownership of real-world as
- **Investor Qualification**: Requirements for investors (accreditation, KYC level, etc.)
#### 3.3. Legal Framework
- **Governing Law**: Jurisdiction governing the asset (will normally be ZAZ)
- **Governing Law**: Jurisdiction governing the asset (will normally be ZDFZ)
- **Regulatory Compliance**: Applicable regulations and compliance status (there should be a default)
- **Dispute Resolution**: Process for resolving disputes (ZAZ)
- **Dispute Resolution**: Process for resolving disputes (ZDFZ)
- **Liability Limitations**: Extent of issuer and platform liability
- **Termination Conditions**: Circumstances under which the RWDA can be terminated