r4bbit
5bc7ebf963
feat(RewardsStreamerMP): add lock(uint256) function
...
This adds a `lock()` function to the staking contract, allowing vaults
to lock their funds after they have staked in the past.
Closes #40
2024-11-01 14:32:02 +01:00
r4bbit
91cd844dd6
chore(certora): formally verify StakeVault account balance vs ERC20
...
balance
Closes #29
2024-10-30 12:52:21 +01:00
r4bbit
6fea58b334
feat: add TrustedCodehashAccess contract and interface
...
This enables whitelisting in the staking manager contract using the
`TrustedCodehashAccess` interface.
These changes were largely taken from #39 with few changes:
- Due to different OZ versions, `Ownable()` constructor needs to be
called with owner
Closes #15
2024-10-22 12:03:09 +02:00
r4bbit
18a8465d58
chore: introduce IStakeManager interface
...
This introduces a first version of `IStakeManager`, highly inspired by
the changes done in
https://github.com/vacp2p/staking-reward-streamer/pull/39 .
However, in this commit, it only adds the methods that are currently
supported by both, `StakeManager` and `RewardStreamerMP`.
Future commits will add APIs for locking and leaving.
2024-10-22 11:05:45 +02:00
r4bbit
0e14b7b3a6
feat: introduce StakeVault
...
This ports the `StakeVault` contract over to this repository
and exposes functions to interface with the reward streamer contract
to address issue #14 .
Closes #14
2024-10-22 11:05:45 +02:00
r4bbit
ba26e7cc79
refactor(RewardStreamerMP): rename user vars to account
...
Closes #59
2024-10-21 13:49:29 +02:00
Andrea Franz
753c62db3a
chore: update gas report
2024-10-18 15:25:54 +02:00
Andrea Franz
c54ad8f361
feat(XPToken): introduce mintAllowance. cannot mint if totalSupply is >= external supply * 3
2024-10-18 15:25:54 +02:00
Andrea Franz
c6623c3d34
feat(XPToken): external supply and balances are 1:1 to providers numbers
2024-10-18 15:25:54 +02:00
Andrea Franz
7e7c51302c
feat(XPToken): XPToken extends ERC20 and use its balanceOf/totalSupply adding external supply/balances
2024-10-18 15:25:54 +02:00
r4bbit
044301869a
chore(certora): dont wait for results
2024-10-18 14:51:36 +02:00
r4bbit
ad2d11d138
chore(certora): add rule that greater lockup means greater MPs
...
Closes #28
2024-10-18 14:25:14 +02:00
r4bbit
77d77b8017
chore(certora): add rule that MPs are minted at 1-to-1 ratio
...
Closes #27
2024-10-18 13:56:15 +02:00
Andrea Franz
7799fde5b2
feature(XPToken): upgrade to Ownable2Step
2024-10-18 13:55:46 +02:00
Ricardo Guilherme Schmidt
2ee6eb8065
test(RewardsStreamerMP): ensure bonusMP and maxMP are decreased
2024-10-16 14:55:59 +02:00
r4bbit
8de2f2ae0b
test(RewardsStreamerMP): ensure bonusMP and maxMP are decreased
...
correctly at unstake
This commit adds some tests to check that, if a user (partically)
unstakes their funds, their initial and bonus MP get decreased
proportionally, as well as their max mp.
Closes #46
2024-10-16 14:55:59 +02:00
r4bbit
b79deb70f5
chore(certora): add accountMPGreaterEqualsAccountBalance invariant
...
Closes #26
2024-10-16 14:01:51 +02:00
r4bbit
59f2566c78
refactor(RewardStreamerMP): keep track of maxMP instead of
...
`potentialMP`
This commit changes the mechanics to ensure there are no more MP
generated that what's allowed as per max limiting.
Previously we've kept track of `potentialMP` which would decrease as
more MP are generated.
This made verifying certain rules on certora hard and/or impossible.
So we decided to track `maxMP` instead, which only decreases when users
unstake.
This commit also introduces a rule that ensures any accounts MP never
exceed their max mp.
Closes #44
2024-10-16 12:44:47 +02:00
r4bbit
3eb4aa830e
chore(certora): add sumOfBalancesIsTotalStaked invariant
...
Closes #24
2024-10-14 12:04:52 +02:00
Andrea Franz
0b3768d259
chore: remove linter warning and errors
2024-10-14 11:58:28 +02:00
Andrea Franz
43536a4dca
feat(XPNFTToken): add NFTMetadataGeneratorURL
2024-10-14 11:58:28 +02:00
Andrea Franz
9253b0bd55
test(XPNFTToken): add tests to NFTMetadataGeneratorSVG
2024-10-14 11:58:28 +02:00
Andrea Franz
b5517a2828
test(XPNFTToken): add tests
2024-10-14 11:58:28 +02:00
Andrea Franz
e4e8c7c505
chore(XPNFTToken): add INFTMetadataGenerator with Base and SVG generator
2024-10-14 11:58:28 +02:00
Andrea Franz
7352f8837a
feat(XPNFTToken): add XPNFTMetadataGenerator
2024-10-14 11:58:28 +02:00
Andrea Franz
7ed87fada9
feat(XPNFTToken): add base XPNFTToken
2024-10-14 11:58:28 +02:00
Andrea Franz
74522424e6
chore: update gas reports
2024-10-11 16:56:03 +02:00
Andrea Franz
966093e575
chore(XPToken): rename local variables to use the suffix share instead of contribution
2024-10-11 16:56:03 +02:00
Andrea Franz
b9c34ec48e
chore(XPToken): use share instead of contribution in IXPProvider function names
2024-10-11 16:56:03 +02:00
Andrea Franz
478174a356
chore(XPToken): add certora base config
2024-10-11 16:56:03 +02:00
Andrea Franz
117fc2300e
test(XPToken): add tests
2024-10-11 16:56:03 +02:00
Andrea Franz
0a5563e387
chore(XPToken): use XP Contribution for providers functions
2024-10-11 16:56:03 +02:00
Andrea Franz
4b787d478f
chore: update libs
2024-10-11 16:56:03 +02:00
Andrea Franz
f816755340
feat(XPToken): add base XPToken with IXPProvider interface
2024-10-11 16:56:03 +02:00
r4bbit
286bfd2ff4
test: add tests for reaching MP limit
...
Closes #4
2024-10-09 11:45:33 +02:00
r4bbit
0af58f90fb
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-10-09 11:41:48 +02:00
r4bbit
a48a050bd8
test: add lockup tests
...
Closes #3
2024-10-09 11:41:48 +02:00
r4bbit
47440677a8
test: add dedicated tests for smaller scenarios
2024-10-09 11:36:05 +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