94 lines
2.1 KiB
V
94 lines
2.1 KiB
V
module main
|
|
|
|
import freeflowuniverse.herolib.hero.models.marketplace.core
|
|
|
|
pub struct LiquidityPool {
|
|
core.Base
|
|
pub mut:
|
|
id string
|
|
name string
|
|
token_a string
|
|
token_b string
|
|
reserve_a f64 // Using f64 for Decimal
|
|
reserve_b f64 // Using f64 for Decimal
|
|
exchange_rate f64 // Using f64 for Decimal
|
|
liquidity f64 // Using f64 for Decimal
|
|
volume_24h f64 // Using f64 for Decimal
|
|
fee_percentage f64 // Using f64 for Decimal
|
|
status PoolStatus
|
|
}
|
|
|
|
pub enum PoolStatus {
|
|
active
|
|
paused
|
|
maintenance
|
|
}
|
|
|
|
pub struct ExchangeRequest {
|
|
pub mut:
|
|
pool_id string
|
|
from_token string
|
|
to_token string
|
|
amount f64 // Using f64 for Decimal
|
|
min_receive f64 // Using f64 for Decimal
|
|
slippage_tolerance f64 // Using f64 for Decimal
|
|
}
|
|
|
|
pub struct ExchangeResponse {
|
|
pub mut:
|
|
success bool
|
|
message string
|
|
transaction_id string
|
|
from_amount f64 // Using f64 for Decimal
|
|
to_amount f64 // Using f64 for Decimal
|
|
exchange_rate f64 // Using f64 for Decimal
|
|
fee f64 // Using f64 for Decimal
|
|
}
|
|
|
|
pub struct StakeRequest {
|
|
pub mut:
|
|
amount f64 // Using f64 for Decimal
|
|
duration_months u32
|
|
}
|
|
|
|
pub struct StakePosition {
|
|
core.Base
|
|
pub mut:
|
|
id string
|
|
user_id string
|
|
amount f64 // Using f64 for Decimal
|
|
start_date u64 // Unix timestamp
|
|
end_date u64 // Unix timestamp
|
|
discount_percentage f64 // Using f64 for Decimal
|
|
reputation_bonus int
|
|
status StakeStatus
|
|
}
|
|
|
|
pub enum StakeStatus {
|
|
active
|
|
completed
|
|
withdrawn
|
|
}
|
|
|
|
// Pool analytics data
|
|
pub struct PoolAnalytics {
|
|
pub mut:
|
|
price_history []PricePoint
|
|
volume_history []VolumePoint
|
|
liquidity_distribution map[string]f64 // Using f64 for Decimal
|
|
staking_distribution map[string]int
|
|
}
|
|
|
|
pub struct PricePoint {
|
|
pub mut:
|
|
timestamp u64 // Unix timestamp
|
|
price f64 // Using f64 for Decimal
|
|
volume f64 // Using f64 for Decimal
|
|
}
|
|
|
|
pub struct VolumePoint {
|
|
pub mut:
|
|
date string
|
|
volume f64 // Using f64 for Decimal
|
|
}
|