Commit Graph

12 Commits

Author SHA1 Message Date
Ricardo Guilherme Schmidt
04f9c446ee refactor(StakeManager, StakeVault): decouple StakeManager <-> StakeVault (#240)
- BREAKING CHANGE: Updated stake and lock functions in StakeManager to accept an additional parameter for current lock until timestamp.
- BREAKING CHANGE: Modified StakeVault to handle the new locking mechanism and removed the old updateLockUntil function.
- Adjusted related tests to reflect changes in function signatures and expected behaviors.
- Ensured that funds locked checks are properly referenced in tests and contracts.
2025-08-18 08:57:28 -03:00
r4bbit
695a208804 !refactor: rename getStakedBalance() -> stakedBalanceOf()
This is to align with all the other `mp*Of` and `mp*OfAccount`
functions as discussed in #188

BREAKING CHANGE:

`getStakedBalance(address)` is now `stakedBalanceOf(address)`

Closes #188
2025-03-25 20:25:46 +01:00
r4bbit
2e01e0d03b refactor(RewardsStreamerMP): merge compound() with _updateVault()
This commit merges `compound()` into `_updateVault()` as there's no
reason not to update vault without compounding it.

This was discussed in #187.

BREAKING CHANGE: A couple of APIs have been removed or replaced.

-> inline _compound into _updateVault()
-> remove compond() in favor of updateVaultMP()
-> rename updateVaultMP() to updateVault()
-> rename compoundAccount() to updateAccount()

Closes #187
2025-03-25 16:09:04 +01:00
r4bbit
aa1addbfcd chore: downgrade to paris
We put `cancun` as evm version into the foundry toml by mistake and
ended up building on top of it with certain assumptions.

Turns out that the network we're deploying to does not support that
version so we have to compile with `paris`.

This however, also requires a downgrade of the open zeppelin libraries,
which in turn requires changes in our code base. Primarily related to
initialization of `OwnableUpgradeable` and upgrades via UUPSUpgradeable.

This commit makes all the necessary changes.
2025-03-05 11:47:30 +01:00
Andrea Franz
58f43d07ce feature(RewardsStreamerMP): add compound function and track rewards accrued by each vault 2025-02-20 17:15:17 +01:00
r4bbit
6f199313ec feat(RewardsStreamerMP): allow vaults to migrate to other vaults
This commit introduces a function `migrateToVault(address)` that allows
`StakeVault`s to migrate to other `StakeVault` instances.

The idea is that, when an upgrade was done on the stake manager, it
might introduces functions that can't be accessed through the stake
vaults that are out there.

Users will have to create new stake vault instances that provide the
necessary functionality.

`migrateToVault()` allows them to do so.

Closes #127
2025-02-19 17:58:15 +01:00
r4bbit
aa67f1f628 chore: make linter happy 2025-02-06 13:21:01 +01:00
Ricardo Guilherme Schmidt
a22da253c3 refactor(RewardStreamerMP): extract MP and Stake mathematical formulas to abstract contracts 2025-01-30 17:06:16 +01:00
Andrea Franz
f601050dbe refactor(RewardsStreamerMP): rename functions to be appropriate 2024-12-20 07:40:55 +01:00
r4bbit
9374025924 feat(StakeManager): add capabilities to register vaults
This commit introduces changes related to vault registrations in the
stake manager.

The stake manager needs to keep track of the vaults a users creates so
it can aggregate accumulated MP across vaults for any given user.

The `StakeVault` now comes with a `register()` function which needs to
be called to register itself with the stake manager. `StakeManager` has
a new `onlyRegisteredVault` modifier that ensures only registered vaults
can actually `stake` and `unstake`.

Closes #70
2024-12-03 16:55:34 +01:00
Andrea Franz
dffaea2a73 feat(RewardsStreamerMP): stream rewards for a period without checking a real reward token balance 2024-12-03 13:50:52 +01:00
r4bbit
4968ad4ea6 test(RewardsStreamerMP): add test to ensure funds are saffe when stack overflow
If there's a malicious upgrade which causes a stack overflow error when
`leave()` is called, the user of the vault should still be able to get
their funds out.

This commit adds a test that proofs this is happening.
2024-12-01 08:25:36 +01:00