mirror of
https://github.com/vacp2p/staking-reward-streamer.git
synced 2026-01-09 21:18:01 -05:00
update docs
This commit is contained in:
16
README.md
16
README.md
@@ -36,23 +36,23 @@ User-specific calculations are done only when a user interacts with the contract
|
||||
|
||||

|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user