main #13
@@ -7,12 +7,16 @@ pub mut:
 | 
				
			|||||||
	id                u32
 | 
						id                u32
 | 
				
			||||||
	customer_id       u32 // links back to customer for this capacity (user on ledger)
 | 
						customer_id       u32 // links back to customer for this capacity (user on ledger)
 | 
				
			||||||
	compute_slices_nr int // nr of slices I need in 1 machine
 | 
						compute_slices_nr int // nr of slices I need in 1 machine
 | 
				
			||||||
	compute_slice     f64 // price per 1 GB slice I want to accept
 | 
						compute_slice_price     f64 // price per 1 GB slice I want to accept
 | 
				
			||||||
	storage_slices    []u32
 | 
						storage_slices_nr int
 | 
				
			||||||
 | 
						storage_slice_price     f64 // price per 1 GB storage slice I want to accept
 | 
				
			||||||
 | 
						storage_slices_nr int
 | 
				
			||||||
	status            BidStatus
 | 
						status            BidStatus
 | 
				
			||||||
	obligation        bool // if obligation then will be charged and money needs to be in escrow, otherwise its an intent
 | 
						obligation        bool // if obligation then will be charged and money needs to be in escrow, otherwise its an intent
 | 
				
			||||||
	start_date        u32  // epoch
 | 
						start_date        u32  // epoch
 | 
				
			||||||
	end_date          u32
 | 
						end_date          u32
 | 
				
			||||||
 | 
						signature_user    string // signature as done by a user/consumer to validate their identity and intent
 | 
				
			||||||
 | 
						billing_period    BillingPeriod
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub enum BidStatus {
 | 
					pub enum BidStatus {
 | 
				
			||||||
@@ -22,3 +26,12 @@ pub enum BidStatus {
 | 
				
			|||||||
	cancelled
 | 
						cancelled
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub enum BillingPeriod {
 | 
				
			||||||
 | 
						hourly
 | 
				
			||||||
 | 
						monthly
 | 
				
			||||||
 | 
						yearly
 | 
				
			||||||
 | 
						biannually
 | 
				
			||||||
 | 
						triannually 
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										52
									
								
								heromodels/src/models/grid4/specs/model_contract.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								heromodels/src/models/grid4/specs/model_contract.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
				
			|||||||
 | 
					module datamodel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// I can bid for infra, and optionally get accepted
 | 
				
			||||||
 | 
					@[heap]
 | 
				
			||||||
 | 
					pub struct Contract {
 | 
				
			||||||
 | 
					pub mut:
 | 
				
			||||||
 | 
						id                u32
 | 
				
			||||||
 | 
						customer_id       u32 // links back to customer for this capacity (user on ledger)
 | 
				
			||||||
 | 
						compute_slices     []ComputeSliceProvisioned
 | 
				
			||||||
 | 
						storage_slices     []StorageSliceProvisioned
 | 
				
			||||||
 | 
						compute_slice_price     f64 // price per 1 GB agreed upon
 | 
				
			||||||
 | 
						storage_slice_price     f64 // price per 1 GB agreed upon
 | 
				
			||||||
 | 
						network_slice_price     f64 // price per 1 GB agreed upon (transfer)
 | 
				
			||||||
 | 
						status            ContractStatus
 | 
				
			||||||
 | 
						start_date        u32  // epoch
 | 
				
			||||||
 | 
						end_date          u32
 | 
				
			||||||
 | 
						signature_user    string // signature as done by a user/consumer to validate their identity and intent
 | 
				
			||||||
 | 
						signature_hoster  string // signature as done by the hoster
 | 
				
			||||||
 | 
						billing_period    BillingPeriod
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub enum ConctractStatus {
 | 
				
			||||||
 | 
						active
 | 
				
			||||||
 | 
						cancelled
 | 
				
			||||||
 | 
						error
 | 
				
			||||||
 | 
						paused
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// typically 1GB of memory, but can be adjusted based based on size of machine
 | 
				
			||||||
 | 
					pub struct ComputeSliceProvisioned {
 | 
				
			||||||
 | 
					pub mut:
 | 
				
			||||||
 | 
						node_id					 u32
 | 
				
			||||||
 | 
						id                       u16 // the id of the slice in the node
 | 
				
			||||||
 | 
						mem_gb                   f64
 | 
				
			||||||
 | 
						storage_gb               f64
 | 
				
			||||||
 | 
						passmark                 int
 | 
				
			||||||
 | 
						vcores                   int
 | 
				
			||||||
 | 
						cpu_oversubscription     int
 | 
				
			||||||
 | 
						tags string
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 1GB of storage
 | 
				
			||||||
 | 
					pub struct StorageSliceProvisioned {
 | 
				
			||||||
 | 
					pub mut:
 | 
				
			||||||
 | 
						node_id		   u32
 | 
				
			||||||
 | 
						id             u16 // the id of the slice in the node, are tracked in the node itself
 | 
				
			||||||
 | 
						storage_size_gb int
 | 
				
			||||||
 | 
						tags string
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
module datamodel
 | 
					module datamodel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//ACCESS ONLY TF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@[heap]
 | 
					@[heap]
 | 
				
			||||||
pub struct Node {
 | 
					pub struct Node {
 | 
				
			||||||
pub mut:
 | 
					pub mut:
 | 
				
			||||||
@@ -11,7 +13,7 @@ pub mut:
 | 
				
			|||||||
	devices          DeviceInfo
 | 
						devices          DeviceInfo
 | 
				
			||||||
	country          string       // 2 letter code as specified in lib/data/countries/data/countryInfo.txt, use that library for validation
 | 
						country          string       // 2 letter code as specified in lib/data/countries/data/countryInfo.txt, use that library for validation
 | 
				
			||||||
	capacity         NodeCapacity // Hardware capacity details
 | 
						capacity         NodeCapacity // Hardware capacity details
 | 
				
			||||||
	provisiontime    u32          // lets keep it simple and compatible
 | 
						birthtime    	 u32          // first time node was active
 | 
				
			||||||
	pubkey           string
 | 
						pubkey           string
 | 
				
			||||||
	signature_node   string // signature done on node to validate pubkey with privkey
 | 
						signature_node   string // signature done on node to validate pubkey with privkey
 | 
				
			||||||
	signature_farmer string // signature as done by farmers to validate their identity
 | 
						signature_farmer string // signature as done by farmers to validate their identity
 | 
				
			||||||
@@ -81,29 +83,20 @@ pub mut:
 | 
				
			|||||||
// typically 1GB of memory, but can be adjusted based based on size of machine
 | 
					// typically 1GB of memory, but can be adjusted based based on size of machine
 | 
				
			||||||
pub struct ComputeSlice {
 | 
					pub struct ComputeSlice {
 | 
				
			||||||
pub mut:
 | 
					pub mut:
 | 
				
			||||||
	nodeid                   u32 // the node in the grid, there is an object describing the node
 | 
						u16                       int // the id of the slice in the node
 | 
				
			||||||
	id                       int // the id of the slice in the node
 | 
					 | 
				
			||||||
	mem_gb                   f64
 | 
						mem_gb                   f64
 | 
				
			||||||
	storage_gb               f64
 | 
						storage_gb               f64
 | 
				
			||||||
	passmark                 int
 | 
						passmark                 int
 | 
				
			||||||
	vcores                   int
 | 
						vcores                   int
 | 
				
			||||||
	cpu_oversubscription     int
 | 
						cpu_oversubscription     int
 | 
				
			||||||
	storage_oversubscription int
 | 
						storage_oversubscription int
 | 
				
			||||||
	price_range              []f64 = [0.0, 0.0]
 | 
					 | 
				
			||||||
	gpus                     u8  // nr of GPU's see node to know what GPU's are
 | 
						gpus                     u8  // nr of GPU's see node to know what GPU's are
 | 
				
			||||||
	price_cc                 f64 // price per slice (even if the grouped one)
 | 
					 | 
				
			||||||
	pricing_policy           PricingPolicy
 | 
					 | 
				
			||||||
	sla_policy               SLAPolicy
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 1GB of storage
 | 
					// 1GB of storage
 | 
				
			||||||
pub struct StorageSlice {
 | 
					pub struct StorageSlice {
 | 
				
			||||||
pub mut:
 | 
					pub mut:
 | 
				
			||||||
	nodeid         u32 // the node in the grid
 | 
						u16             int // the id of the slice in the node, are tracked in the node itself
 | 
				
			||||||
	id             int // the id of the slice in the node, are tracked in the node itself
 | 
					 | 
				
			||||||
	price_cc       f64 // price per slice (even if the grouped one)
 | 
					 | 
				
			||||||
	pricing_policy PricingPolicy
 | 
					 | 
				
			||||||
	sla_policy     SLAPolicy
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn (mut n Node) check() ! {
 | 
					fn (mut n Node) check() ! {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,8 +12,7 @@ pub mut:
 | 
				
			|||||||
	pricingpolicy                       PricingPolicy
 | 
						pricingpolicy                       PricingPolicy
 | 
				
			||||||
	compute_slice_normalized_pricing_cc f64 // pricing in CC - cloud credit, per 2GB node slice
 | 
						compute_slice_normalized_pricing_cc f64 // pricing in CC - cloud credit, per 2GB node slice
 | 
				
			||||||
	storage_slice_normalized_pricing_cc f64 // pricing in CC - cloud credit, per 1GB storage slice
 | 
						storage_slice_normalized_pricing_cc f64 // pricing in CC - cloud credit, per 1GB storage slice
 | 
				
			||||||
	reputation                          int = 50 // between 0 and 100, earned over time
 | 
						signature_farmer string // signature as done by farmers to validate that they created this group
 | 
				
			||||||
	uptime                              int // between 0 and 100, set by system, farmer has no ability to set this
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub struct SLAPolicy {
 | 
					pub struct SLAPolicy {
 | 
				
			||||||
@@ -26,5 +25,9 @@ pub mut:
 | 
				
			|||||||
pub struct PricingPolicy {
 | 
					pub struct PricingPolicy {
 | 
				
			||||||
pub mut:
 | 
					pub mut:
 | 
				
			||||||
	marketplace_year_discounts []int = [30, 40, 50] // e.g. 30,40,50 means if user has more CC in wallet than 1 year utilization on all his purchaes then this provider gives 30%, 2Y 40%, ...
 | 
						marketplace_year_discounts []int = [30, 40, 50] // e.g. 30,40,50 means if user has more CC in wallet than 1 year utilization on all his purchaes then this provider gives 30%, 2Y 40%, ...
 | 
				
			||||||
	volume_discounts           []int = [10, 20, 30] // e.g. 10,20,30
 | 
						// volume_discounts           []int = [10, 20, 30] // e.g. 10,20,30
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								heromodels/src/models/grid4/specs/model_reputation.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								heromodels/src/models/grid4/specs/model_reputation.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					@[heap]
 | 
				
			||||||
 | 
					pub struct NodeGroupReputation {
 | 
				
			||||||
 | 
					pub mut:
 | 
				
			||||||
 | 
						nodegroup_id 	u32
 | 
				
			||||||
 | 
						reputation                          int = 50 // between 0 and 100, earned over time
 | 
				
			||||||
 | 
						uptime                              int // between 0 and 100, set by system, farmer has no ability to set this
 | 
				
			||||||
 | 
						nodes                               []NodeReputation
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub struct NodeReputation {
 | 
				
			||||||
 | 
					pub mut:
 | 
				
			||||||
 | 
						node_id 							u32
 | 
				
			||||||
 | 
						reputation                          int = 50 // between 0 and 100, earned over time
 | 
				
			||||||
 | 
						uptime                              int // between 0 and 100, set by system, farmer has no ability to set this
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,21 +0,0 @@
 | 
				
			|||||||
module datamodel
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@[heap]
 | 
					 | 
				
			||||||
pub struct Reservation {
 | 
					 | 
				
			||||||
pub mut:
 | 
					 | 
				
			||||||
	id             u32
 | 
					 | 
				
			||||||
	customer_id    u32 // links back to customer for this capacity
 | 
					 | 
				
			||||||
	compute_slices []u32
 | 
					 | 
				
			||||||
	storage_slices []u32
 | 
					 | 
				
			||||||
	status         ReservationStatus
 | 
					 | 
				
			||||||
	start_date     u32 // epoch
 | 
					 | 
				
			||||||
	end_date       u32
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
pub enum ReservationStatus {
 | 
					 | 
				
			||||||
	pending
 | 
					 | 
				
			||||||
	confirmed
 | 
					 | 
				
			||||||
	assigned
 | 
					 | 
				
			||||||
	cancelled
 | 
					 | 
				
			||||||
	done
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user