update docs

This commit is contained in:
Andrea Franz
2024-09-10 10:19:52 +02:00
parent 1c1764ec7a
commit 8d320560da

View File

@@ -36,23 +36,23 @@ User-specific calculations are done only when a user interacts with the contract
![z-Screenshot](https://github.com/user-attachments/assets/1c40a991-6096-46f2-9c28-0f95c9233374)
Initial setup:
**Initial setup:**
* rewardIndex: 0
* accountedRewards: 0
* Rewards in contract: 0
T1: Alice stakes 10 tokens
**T1: Alice stakes 10 tokens**
* Alice's userRewardIndex: 0
* totalStaked: 10 tokens
T2: Bob stakes 30 tokens
**T2: Bob stakes 30 tokens**
* Bob's userRewardIndex: 0
* totalStaked: 40 tokens
T3: 1000 Rewards arrive
**T3: 1000 Rewards arrive**
New rewardIndex calculation:
@@ -74,7 +74,7 @@ For Bob:
* Staked amount: 30 tokens
* Potential Rewards: 30 * (25 - 0) = 750
T4: Alice withdraws her stake and Rewards
**T4: Alice withdraws her stake and Rewards**
Alice's withdrawal:
@@ -86,12 +86,12 @@ Update state:
* totalStaked = 40 - 10 = 30 tokens
* Rewards in contract = 1000 - 250 = 750
T5: Charlie stakes 30 tokens
**T5: Charlie stakes 30 tokens**
* Charlie's userRewardIndex: 25
* totalStaked = 30 + 30 = 60 tokens
T6: Another 1000 Rewards arrive
**T6: Another 1000 Rewards arrive**
New rewardIndex calculation:
@@ -127,7 +127,7 @@ Charlie's withdrawal:
* Rewards: 499.9
* Rewards in contract after Charlie's withdrawal: 499.9 - 499.9 = 0
Final state:
**T7: Final state:**
* Alice received: 10 tokens and 250 Rewards
* Bob received: 30 tokens and 1250.1 Rewards