Commit Graph

169 Commits

Author SHA1 Message Date
r4bbit cf7a8b6574
chore(ci): add certora CI integration (#40) 2023-12-11 15:10:41 +01:00
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 70c74e2c2c
refactor(StakeVault): use custom error over error strings (#35) 2023-11-07 09:38:00 +01:00
r4bbit 6f591dd674
refactor(StakeManager): use custom errors everywhere (#30) 2023-10-10 15:49:34 +02:00
r4bbit 85b5163418
docs: fix codecov badge
Due to a missing space, this was not rendering correctly
2023-10-10 15:46:29 +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 abe11d6806
fix(remappings): add trailing slash to OZ remapping (#26)
Even though import lookup during compilation works fine without it, language servers get
confused and expect the trailing slash.
2023-10-10 13:52:10 +02:00
r4bbit 1626e62fa5
docs: add codecov badge to readme (#25) 2023-10-10 13:51:50 +02:00
r4bbit b9782cfdf5
chore: remove unused legacy snt deploy script (#19)
This was kept around as I wasn't sure if this was still needed but now
that we've removed the legacy folder and are aiming for adding SNT as a
vendor dependency it's most likely no longer needed.

If we still need something like that, we'd implement it as foundry
script.
2023-09-18 09:03:54 +02:00
Ricardo Guilherme Schmidt 8e16f5b315
Merge pull request #7 from logos-co/fix/gha-badge
fix: make gha-badge point at the right repository
2023-09-13 18:59:57 -03:00
Ricardo Guilherme Schmidt 4af5c5f02c
Merge pull request #8 from logos-co/docs/pnpm-yarn
docs: fix PR template to mention `pnpm` not `yarn`
2023-09-13 18:59:35 -03:00
r4bbit a20d272e67
docs: fix PR template to mention `pnpm` not `yarn`
This has been fixed in the original foundry template as well but wasn't
yet in the changes done to this repository.
2023-09-13 10:13:38 +02:00
r4bbit 60d007591f
fix: make gha-badge point at the right repository
This was a left over from migrating to the foundry template.
2023-09-13 10:11:48 +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 39071e49fe
Merge pull request #4 from logos-co/fix-vault-constructor
Vault's contract
2023-08-24 12:08:51 -03:00
Frederico Teixeira 0e95ca428f Vault's contract gets ERC20 and Manager
as arguments
2023-08-21 08:21:59 +02:00
Ricardo Guilherme Schmidt 05969c2b48
Merge pull request #3 from logos-co/fix-compiler-version
Fix compiler version
2023-07-25 10:09:59 -03:00
Ricardo Guilherme Schmidt a84a7978a4
add env example, fix hardhat conf 2023-07-25 01:49:59 -03:00
Frederico Teixeira d9d6a6e633 function signature changed from "pure" to "view",
as it access block.timestap.
2023-07-24 17:16:44 +02:00
Frederico Teixeira 9d0bb25715 introduced a ^ in the solidity compiler version 2023-07-24 17:16:03 +02:00
Ricardo Guilherme Schmidt 79006d72ea
Merge pull request #2 from logos-co/martin_dev
Initial MP mint repaired
2023-07-16 22:56:51 -03:00
Martin Strobl 56f007e3b7 added MP boost limit check
- limit checked when locking incl. the increased limit due to bonus
- limit checked when processing only for accounts that are not locked
2023-07-11 15:47:55 +02:00
Martin Strobl a731962d32 Repair minting MPs with lock
- The "free MPs" in the amount of 100% of stake that are minted on deposit are now not minted anymore duplicitely in the lock function
2023-07-11 12:08:30 +02:00
Martin Strobl fe5cd4b517 Initial MP mint repaired
- Now, MPs are minted on the newly staked amount only (previously was entire stake).
- The bonus MPs are calculated correctly such that there is a 1x bonus per year of lock.
- Still TBD: MPs are not minted  for existing stake if current lock extended (or newly introduced), there is no check for max boost MP ceiling
2023-07-11 11:56:34 +02:00
Ricardo Guilherme Schmidt 24e59ff4a8
Merge pull request #1 from logos-co/research
Merge research into develop
2023-07-10 09:16:56 -03:00
Ricardo Guilherme Schmidt fcb8dca9a6
mintInitialMultiplier dt+1 2023-07-09 16:00:49 -03:00
Ricardo Guilherme Schmidt c1570fa471
add optimism minime 2023-07-08 17:10:37 -03:00
Ricardo Guilherme Schmidt 17d1816570
fixes: initial multiplier mint, leave, unstake 2023-07-06 09:12:01 -03:00
Ricardo Guilherme Schmidt c487f24371
add keys to config file 2023-06-28 21:54:05 -03:00
Ricardo Guilherme Schmidt 50241a1494
fix deploy script 2023-06-28 21:10:52 -03:00
Ricardo Guilherme Schmidt cbeb1afdd8
add script to deploy SNT/STT 2023-06-28 20:03:00 -03:00
Ricardo Guilherme Schmidt 9ba151266d
use solidity 0.8.18 for hardhat compatibility 2023-06-28 17:51:53 -03:00
Ricardo Guilherme Schmidt 7af15318a1
update hardhat 2023-06-28 17:49:33 -03:00
Ricardo Guilherme Schmidt c350bbd3ce
add legacy contracts 2023-06-28 14:29:01 -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
Ricardo Guilherme Schmidt ff4bdf65f3
fix typo 2023-06-26 12:30:48 -03:00
Ricardo Guilherme Schmidt 6bf8d66221
force users to migrate or leave 2023-06-26 12:26:02 -03:00
Ricardo Guilherme Schmidt da5ea645b0
fix account rewarding 2023-06-26 11:52:51 -03:00
Ricardo Guilherme Schmidt 6a05b57f40
fix import 2023-06-26 11:51:42 -03:00
Ricardo Guilherme Schmidt 57bc268288
rename functions 2023-06-25 11:44:32 -03:00
Ricardo Guilherme Schmidt ef9cf77c3a
fix constructor 2023-06-25 11:44:12 -03:00
Ricardo Guilherme Schmidt 2f6fe21682
small fix 2023-06-23 20:03:03 -03:00
Ricardo Guilherme Schmidt fc74878977
fix compilation errors 2023-06-23 20:01:59 -03:00
Ricardo Guilherme Schmidt 98ea9aee4f
update solc 2023-06-23 19:26:07 -03:00
Ricardo Guilherme Schmidt 1417e1721a
update solc 2023-06-23 19:24:59 -03:00