...
This commit is contained in:
16
specs/models_older/finance/account.v
Normal file
16
specs/models_older/finance/account.v
Normal file
@@ -0,0 +1,16 @@
|
||||
module finance
|
||||
|
||||
import base
|
||||
|
||||
pub struct Account {
|
||||
base.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
|
||||
}
|
||||
|
31
specs/models_older/finance/asset.v
Normal file
31
specs/models_older/finance/asset.v
Normal file
@@ -0,0 +1,31 @@
|
||||
module finance
|
||||
|
||||
import base
|
||||
|
||||
pub enum AssetType {
|
||||
erc20
|
||||
erc721
|
||||
erc1155
|
||||
native
|
||||
}
|
||||
|
||||
pub struct Asset {
|
||||
base.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
|
||||
}
|
||||
|
||||
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{}
|
||||
}
|
61
specs/models_older/finance/marketplace.v
Normal file
61
specs/models_older/finance/marketplace.v
Normal file
@@ -0,0 +1,61 @@
|
||||
module marketplace
|
||||
|
||||
import base
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
import asset // For AssetType
|
||||
// ListingStatus, ListingType enums and Bid struct are used from the same module
|
||||
|
||||
// Listing represents a marketplace listing for an asset
|
||||
pub struct Listing {
|
||||
base.Base // Provides id, created_at, updated_at
|
||||
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
|
||||
}
|
||||
|
||||
// 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
|
||||
auction
|
||||
exchange
|
||||
}
|
||||
|
||||
// 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