model spec
This commit is contained in:
		
							
								
								
									
										16
									
								
								specs/models/finance/account.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								specs/models/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/finance/asset.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								specs/models/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{}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user