ldhldh commited on
Commit
ca87255
โ€ข
1 Parent(s): 8ad6bff

Update Blockchain.py

Browse files
Files changed (1) hide show
  1. Blockchain.py +9 -1
Blockchain.py CHANGED
@@ -53,6 +53,7 @@ class Blockchain:
53
  if id not in self.user_wallets:
54
  # ์ƒˆ๋กœ์šด ์œ ์ €์ธ ๊ฒฝ์šฐ ์ดˆ๊ธฐ ํ–‰๋™๋ ฅ ์„ค์ •
55
  self.user_wallets[id] = 10 # ์ดˆ๊ธฐ ํ–‰๋™๋ ฅ์„ 10์œผ๋กœ ์„ค์ •
 
56
  else:
57
  # inference ์š”์ฒญ ์‹œ ์ฐจ๊ฐ
58
  self.user_wallets[id] -= 1
@@ -69,7 +70,7 @@ class Blockchain:
69
 
70
  def get_user_balance(self, id):
71
  # ํŠน์ • ์œ ์ €์˜ ํ–‰๋™๋ ฅ์„ ์กฐํšŒ
72
- return self.user_wallets.get(id, 0)
73
 
74
  def get_user_gpu_mem(self, id):
75
  # ํŠน์ • ์œ ์ €์˜ ๊ธฐ์—ฌ gpu๋ฅผ ์กฐํšŒ
@@ -81,6 +82,13 @@ class Blockchain:
81
  for mem in self.user_gpus.values():
82
  result += int(mem)
83
  return result
 
 
 
 
 
 
 
84
  @property
85
  def last_block(self):
86
  """
 
53
  if id not in self.user_wallets:
54
  # ์ƒˆ๋กœ์šด ์œ ์ €์ธ ๊ฒฝ์šฐ ์ดˆ๊ธฐ ํ–‰๋™๋ ฅ ์„ค์ •
55
  self.user_wallets[id] = 10 # ์ดˆ๊ธฐ ํ–‰๋™๋ ฅ์„ 10์œผ๋กœ ์„ค์ •
56
+ self.user_wallets[id] -= 1
57
  else:
58
  # inference ์š”์ฒญ ์‹œ ์ฐจ๊ฐ
59
  self.user_wallets[id] -= 1
 
70
 
71
  def get_user_balance(self, id):
72
  # ํŠน์ • ์œ ์ €์˜ ํ–‰๋™๋ ฅ์„ ์กฐํšŒ
73
+ return self.user_wallets.get(id, 10)
74
 
75
  def get_user_gpu_mem(self, id):
76
  # ํŠน์ • ์œ ์ €์˜ ๊ธฐ์—ฌ gpu๋ฅผ ์กฐํšŒ
 
82
  for mem in self.user_gpus.values():
83
  result += int(mem)
84
  return result
85
+
86
+ def get_total_coin(self):
87
+ # ์ „์ฒด ์ฝ”์ธ(ํ–‰๋™๋ ฅ) ์ˆ˜ ๋ฐ˜ํ™˜
88
+ result = 0
89
+ for coin in self.user_wallets.values():
90
+ result += int(coin)
91
+ return result
92
  @property
93
  def last_block(self):
94
  """