update deposit function
This commit is contained in:
parent
3a93a7766e
commit
f2c3898d04
@ -17,16 +17,26 @@ class StakingPool:
|
||||
|
||||
def stake(self, user: str, amount: float):
|
||||
# Calculate fee
|
||||
total_fee = amount * self.fee_rate
|
||||
|
||||
# Distribute fee
|
||||
# TODO: Handle edge case where pool has no initial users == Community funds gets the reward
|
||||
# 1. Community funds
|
||||
community_fee = total_fee * self.community_pct
|
||||
|
||||
# 2. Developer funds
|
||||
developer_fee = total_fee * self.developer_pct
|
||||
|
||||
# 3. Reward stakers
|
||||
reward_amount = total_fee - community_fee - developer_fee
|
||||
self.__distribute_reward(reward_amount)
|
||||
|
||||
# Deposit amount minus fee to contract_fund (wallet)
|
||||
# Update user_balances with deposit amount
|
||||
pass
|
||||
if user not in self.user_balances:
|
||||
self.user_balances[user] = amount - total_fee
|
||||
else:
|
||||
self.user_balances[user] += amount - total_fee
|
||||
|
||||
def unstake(self, user: str):
|
||||
# Fetch amount from user_balances
|
||||
|
Loading…
Reference in New Issue
Block a user