Spaces:
Sleeping
Sleeping
Update Blockchain.py
Browse files- 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,
|
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 |
"""
|