11 Commits

Author SHA1 Message Date
r4bbit
d9a64559a2
fix(StakeManager): add checks for whether lockup period is in range (#39)
This commit introduces `MIN_LOCKUP_PERIOD` and `MAX_LOCKUP_PERIOD` and
makes use of them within `StakeManager.stake()` and
`StakeManager.lock()` accordingly.

When users deposit tokens into their vault via `stake()`, they can
provide an optional lockup time. If the value is `0` it implies users do
not want to lock their stake.

If the value is `> 0` it has to be within the range of
`MIN_LOCKUP_PERIOD` and `MAX_LOCKUP_PERIOD`.

Properly addresses #15
2023-12-06 12:10:07 +01:00
r4bbit
f259286e98
feat: introduce VaultFactory (#38)
This commit introduces a first version of a `VaultFactory` that later
will be extended to be capable of instantiating reward vaults and
possible keep track of vault instances per owner.

As a first step, this implementation comes with a `createVault()`
function which takes care of creating vaults.

Because `VaultFactory` also knows about `StakeManager` it can derive the
manager's address and stake token from it when creating vaults, allowing
the API to be without arguments.

Partially addresses #37
2023-11-07 09:49:22 +01:00
r4bbit
b5e513ce49
refactor(StakeVault): introduce stakedToken() API (#36)
Because the `stakedToken` property is `immutable`, solhint recommends to
make it in all caps. This commit changes the property to adhere to that
rule and also makes the property private.

To access the `stakedToken` there's now a `stakedToken()` function on
the contract.
2023-11-07 09:40:38 +01:00
r4bbit
6f591dd674
refactor(StakeManager): use custom errors everywhere (#30) 2023-10-10 15:49:34 +02:00
r4bbit
03d2dcf3e8
refactor(StakeManager): add custom StakeManager__FundsLocked error (#29) 2023-10-10 15:44:16 +02:00
r4bbit
eeffcfe7d7
refactor(StakeManager): use custom error in onlyVault modifier (#28)
Also introduce tests that ensure the error is actually emitted.
2023-10-10 15:32:46 +02:00
r4bbit
725d380547
test(StakeManager): expand on deployment test (#27)
Added some additional assertions related to access control and exposed
properties.
2023-10-10 13:53:03 +02:00
r4bbit
2e7c5148b4
refactor: migrate repository to foundry-template (#6)
This commit migrates the repo to our foundry template, which ensures we
have consistent tooling across smart contract repositories that are
maintained by Vac.

This removes all hardhat related files and workflows and replaces them
with more perfomant foundry workflows.

It also sets up tests, CI and linting.
2023-09-12 18:37:30 +02:00
Ricardo Guilherme Schmidt
7af15318a1
update hardhat 2023-06-28 17:49:33 -03:00
Ricardo Guilherme Schmidt
a53cbb07ac
fix test timeout 2023-06-26 23:11:48 -03:00
Ricardo Guilherme Schmidt
82ebd1301e
create test script 2023-06-26 17:27:19 -03:00