r4bbit
7d268543c8
fix: improve precision loss when unstaking and add testso
...
This commit changes the calculation for when MPs are reduced globally
and for the user that is unstaking.
Instead of getting an `amountRatio` first and using that the
multiplication, we're now applying the `SCALE_FACTOR` to both, the
numerator and denominator to maintain the ratio while increasing
precision.
2024-09-25 11:54:47 +02:00
r4bbit
d54b1ab941
test: add lockup tests
...
Closes #3
2024-09-25 10:40:48 +02:00
r4bbit
826f7077d4
test: add dedicated tests for smaller scenarios
2024-09-25 10:24:40 +02:00
r4bbit
24c3469cd1
chore: make linter and formatter happy
2024-09-25 10:23:46 +02:00
Andrea Franz
532c90f1c2
chore: fix repo name in package.json ( #6 )
2024-09-25 10:15:39 +02:00
Andrea Franz
4ef75621a3
import foundry template ( #1 )
2024-09-25 09:39:14 +02:00
Andrea Franz
197262ba79
re-enable and fix all tests on user attributes
2024-09-18 12:36:58 +02:00
Andrea Franz
36ef21361c
fix tests
2024-09-18 12:26:48 +02:00
Andrea Franz
a19b122d4f
fix rewards calculation with MPs
2024-09-18 11:41:17 +02:00
Andrea Franz
9f8a808e07
add test file for RewardsStreamerMP
2024-09-16 13:43:39 +02:00
Andrea Franz
d9ddfddaab
reorder function and introduce updateGlobalState that updates both reward index and global MP
2024-09-16 13:38:37 +02:00
Andrea Franz
2aab9a8b8b
remove calculation of totalMP and userMP in the user calculations. They are already updated in updateGlobalMP.
2024-09-16 13:00:55 +02:00
Andrea Franz
c74a2e936c
set user.lockUntil to 0 if there's no locking period (in case there was before)
2024-09-16 13:00:28 +02:00
Andrea Franz
f543722bdf
set lastMPUpdatedTime in the constructor to the current block's timestamp
2024-09-16 12:59:58 +02:00
Andrea Franz
d021a617e2
fix updateUserMP
2024-09-16 12:42:24 +02:00
Andrea Franz
6bebb16c6f
improve updateGlobalMP
2024-09-16 12:41:52 +02:00
Andrea Franz
4a4549dec9
change updateUserRewards to use staked tokens and MPs with the same weight
2024-09-16 12:40:41 +02:00
Andrea Franz
4eeec95c9f
move getter functions
2024-09-16 12:40:04 +02:00
Andrea Franz
54ddaa71f2
change updateRewardIndex to count staked tokens and MP with the same weight
2024-09-16 12:38:38 +02:00
Andrea Franz
90250c9ebc
fix unstake function
2024-09-16 12:38:05 +02:00
Andrea Franz
e9ea8102e1
fix calculation in stake function
2024-09-16 12:37:30 +02:00
Andrea Franz
912d0bd100
add tests on reward index after staking and unstaking
2024-09-13 16:36:23 +02:00
Andrea Franz
99776251c9
update accountedRewards when rewards are distributed
2024-09-13 16:36:05 +02:00
Andrea Franz
be5cdb42b6
add Rewards Streamer with Multiplier Points
2024-09-11 15:56:32 +02:00
Andrea Franz
43088c4551
update README
2024-09-11 15:55:20 +02:00
Andrea Franz
6ee5259fb5
update names to use RewardsStreamer
2024-09-11 15:52:59 +02:00
Andrea Franz
d146e822c2
remove MP from main contract
2024-09-11 15:41:52 +02:00
Andrea Franz
f239fa48a3
add multiplier points
2024-09-11 13:24:01 +02:00
Andrea Franz
51cafba5d6
update README
2024-09-11 13:23:16 +02:00
Andrea Franz
7e685a1daf
more docs
2024-09-10 13:05:17 +02:00
Andrea Franz
927d822dbe
Update README.md
2024-09-10 12:58:36 +02:00
Andrea Franz
f7228c28bd
Update README.md
2024-09-10 10:22:15 +02:00
Andrea Franz
8d320560da
update docs
2024-09-10 10:19:52 +02:00
Andrea Franz
1c1764ec7a
Update README.md
2024-09-10 09:52:12 +02:00
Andrea Franz
7114388ae2
update docs
2024-09-10 09:50:52 +02:00
Andrea Franz
bc58f131ae
update readme
2024-09-10 02:21:16 +02:00
Andrea Franz
e25743e2a4
update README
2024-09-10 02:08:47 +02:00
Andrea Franz
5f7df8ca01
add example in README
2024-09-10 02:07:40 +02:00
Andrea Franz
415c697604
move docs to README
2024-09-10 01:47:59 +02:00
Andrea Franz
ae5e7e258a
add docs to StakingManager
2024-09-10 01:37:48 +02:00
Andrea Franz
ae9a0231ee
add remappings
2024-09-10 01:37:37 +02:00
Andrea Franz
7e15f37eba
implement base indexes logic
2024-09-10 01:08:53 +02:00
Andrea Franz
6b86d96142
update license and solc version
2024-09-10 00:05:27 +02:00
Andrea Franz
96bf45b9c9
forge install: openzeppelin-contracts
...
v5.0.2
2024-09-10 00:03:33 +02:00
Andrea Franz
da3a05badf
add StakeManager contract
2024-09-10 00:02:52 +02:00
Andrea Franz
ec99480f48
forge install: forge-std
...
v1.9.2
2024-09-09 22:23:02 +02:00
Andrea Franz
9999866d0c
chore: forge init
2024-09-09 22:23:01 +02:00