Update git remote URL from git.threefold.info to git.ourworld.tf
This commit is contained in:
@@ -1,16 +1,27 @@
|
||||
module finance
|
||||
|
||||
import base
|
||||
import freeflowuniverse.herolib.hero.models.core
|
||||
|
||||
// Account represents a financial account for tracking balances and transactions
|
||||
// Supports multiple account types (checking, savings, investment, etc.)
|
||||
pub struct Account {
|
||||
base.Base
|
||||
core.Base
|
||||
pub mut:
|
||||
name string // internal name of the account for the user
|
||||
user_id u32 // user id of the owner of the account
|
||||
description string // optional description of the account
|
||||
ledger string // describes the ledger/blockchain where the account is located e.g. "ethereum", "bitcoin" or other institutions
|
||||
address string // address of the account on the blockchain
|
||||
pubkey string
|
||||
assets []Asset
|
||||
name string // User-friendly account name
|
||||
account_type AccountType
|
||||
balance f64 // Current balance in the account's currency
|
||||
currency string // Currency code (USD, EUR, etc.)
|
||||
description string // Optional description of the account
|
||||
is_active bool // Whether the account is currently active
|
||||
}
|
||||
|
||||
// AccountType defines the different types of financial accounts
|
||||
pub enum AccountType {
|
||||
checking
|
||||
savings
|
||||
investment
|
||||
credit
|
||||
loan
|
||||
crypto
|
||||
other
|
||||
}
|
||||
|
@@ -1,31 +1,34 @@
|
||||
module finance
|
||||
|
||||
import base
|
||||
|
||||
pub enum AssetType {
|
||||
erc20
|
||||
erc721
|
||||
erc1155
|
||||
native
|
||||
}
|
||||
import freeflowuniverse.herolib.hero.models.core
|
||||
|
||||
// Asset represents any valuable resource owned by an entity
|
||||
// Can be financial (stocks, bonds) or physical (real estate, commodities)
|
||||
pub struct Asset {
|
||||
base.Base
|
||||
core.Base
|
||||
pub mut:
|
||||
name string
|
||||
description string
|
||||
amount f64
|
||||
address string // address of the asset on the blockchain or bank
|
||||
asset_type AssetType // type of the asset
|
||||
decimals u8 // number of decimals of the asset
|
||||
name string // Asset name or identifier
|
||||
symbol string // Trading symbol or identifier @[index]
|
||||
asset_type AssetType
|
||||
quantity f64 // Amount of the asset held
|
||||
unit_price f64 // Price per unit in the asset's currency
|
||||
total_value f64 // total_value = quantity * unit_price
|
||||
currency string // Currency for pricing (USD, EUR, etc.)
|
||||
category string // Asset category (stocks, bonds, crypto, etc.)
|
||||
exchange string // Exchange where asset is traded
|
||||
description string // Detailed description of the asset
|
||||
is_active bool // Whether the asset is currently tracked
|
||||
purchase_date u64 // Unix timestamp of purchase/acquisition
|
||||
}
|
||||
|
||||
pub fn (self Asset) index_keys() map[string]string {
|
||||
return {
|
||||
'name': self.name
|
||||
}
|
||||
}
|
||||
|
||||
pub fn (self Asset) ftindex_keys() map[string]string {
|
||||
return map[string]string{}
|
||||
// AssetType defines the classification of assets
|
||||
pub enum AssetType {
|
||||
stock
|
||||
bond
|
||||
crypto
|
||||
commodity
|
||||
real_estate
|
||||
currency
|
||||
nft
|
||||
other
|
||||
}
|
||||
|
@@ -1,61 +1,29 @@
|
||||
module marketplace
|
||||
module finance
|
||||
|
||||
import base
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
import asset // For AssetType
|
||||
// ListingStatus, ListingType enums and Bid struct are used from the same module
|
||||
import freeflowuniverse.herolib.hero.models.core
|
||||
|
||||
// Listing represents a marketplace listing for an asset
|
||||
pub struct Listing {
|
||||
base.Base // Provides id, created_at, updated_at
|
||||
// Marketplace represents a platform for buying and selling goods/services
|
||||
// Can be internal or external marketplace configurations
|
||||
pub struct Marketplace {
|
||||
core.Base
|
||||
pub mut:
|
||||
title string
|
||||
description string
|
||||
asset_id string
|
||||
asset_type asset.AssetType // Enum from the asset model
|
||||
seller_id string
|
||||
price f64 // Initial price for fixed price, or starting price for auction
|
||||
currency string
|
||||
listing_type ListingType
|
||||
status ListingStatus
|
||||
expires_at ourtime.OurTime // Optional
|
||||
sold_at ourtime.OurTime // Optional
|
||||
buyer_id string // Optional
|
||||
sale_price f64 // Optional
|
||||
bids []Bid // List of bids for auction type listings
|
||||
tags []string
|
||||
image_url string // Optional
|
||||
name string // Marketplace name (e.g., "Amazon", "eBay") @[index]
|
||||
marketplace_type MarketplaceType
|
||||
api_endpoint string // API endpoint for marketplace integration
|
||||
api_key string // Authentication key for API access
|
||||
currency string // Default currency for transactions
|
||||
fee_percentage f64 // Marketplace fee as percentage (0.0-100.0)
|
||||
is_active bool // Whether marketplace is currently enabled
|
||||
description string // Detailed marketplace description
|
||||
support_email string // Contact email for support issues
|
||||
}
|
||||
|
||||
// ListingStatus defines the status of a marketplace listing
|
||||
pub enum ListingStatus {
|
||||
active
|
||||
sold
|
||||
cancelled
|
||||
expired
|
||||
}
|
||||
|
||||
// ListingType defines the type of marketplace listing
|
||||
pub enum ListingType {
|
||||
fixed_price
|
||||
// MarketplaceType defines the type of marketplace platform
|
||||
pub enum MarketplaceType {
|
||||
centralized
|
||||
decentralized
|
||||
peer_to_peer
|
||||
auction
|
||||
exchange
|
||||
classified
|
||||
other
|
||||
}
|
||||
|
||||
// Bid represents a bid on an auction listing
|
||||
pub struct Bid {
|
||||
pub mut:
|
||||
listing_id string // ID of the listing this bid belongs to
|
||||
bidder_id u32
|
||||
amount f64
|
||||
currency string
|
||||
status BidStatus
|
||||
}
|
||||
|
||||
// BidStatus defines the status of a bid on an auction listing
|
||||
pub enum BidStatus {
|
||||
active
|
||||
accepted
|
||||
rejected
|
||||
cancelled
|
||||
}
|
Reference in New Issue
Block a user