Mark Spanbroek
bddbd02f02
marketplace: burn tokens in vault when slashing
...
- move all collateral calculatons to separate library
2025-03-04 09:36:10 +01:00
Mark Spanbroek
639466662d
marketplace: simplify withdrawing by client
...
- removes RequestCancelled event, which was not great anyway
because it is not emitted at the moment that the request is
cancelled
2025-03-04 09:36:10 +01:00
Mark Spanbroek
1e74be6243
marketplace: remove accounting that is now done by vault
2025-03-04 09:36:10 +01:00
Mark Spanbroek
d95863bce8
marketplace: remove fuzzing
...
replaced by formal verification with certora
2025-03-04 09:36:10 +01:00
Mark Spanbroek
13b4038d35
marketplace: collateral is uint128
...
Vault stores balances as uint128
2025-03-04 09:36:10 +01:00
Mark Spanbroek
83a59d8227
marketplace: use Timestamp, Duration and TokensPerSecond types
2025-03-04 09:36:10 +01:00
Mark Spanbroek
284b54e575
vault: move Timestamp and TokensPerSecond libraries one level up
2025-03-04 09:36:10 +01:00
Mark Spanbroek
8df557801c
marketplace: use vault in marketplace
2025-03-04 09:36:10 +01:00
Mark Spanbroek
8b40f63693
marketplace: remove support for changing payout addresses
2025-03-04 09:36:10 +01:00
Mark Spanbroek
d5ab2ecf8d
marketplace: deploy vault and set it in the marketplace
2025-03-04 09:36:10 +01:00
Mark Spanbroek
994e328b05
marketplace: use SafeERC20 for transfers
2025-03-04 09:36:10 +01:00
Mark Spanbroek
9b42a4627f
vault: clarification
...
Co-Authored-by: Adam Uhlíř <adam@uhlir.dev>
2025-03-04 09:36:00 +01:00
Mark Spanbroek
edee270eca
vault: rename Lock -> Fund
2025-03-04 09:36:00 +01:00
Mark Spanbroek
96b4fc0eff
vault: rename lock states
...
- NoLock -> Inactive
- Unlocked -> Withdrawing
2025-03-04 09:36:00 +01:00
Mark Spanbroek
2900bed8fd
vault: rename Fund -> FundId
2025-03-04 09:36:00 +01:00
Mark Spanbroek
62aea75295
vault: freezeFund() instead of burnFund()
2025-03-04 09:36:00 +01:00
Mark Spanbroek
6db1a5fb3a
vault: only allow account holder to withdraw for itself
2025-03-04 09:36:00 +01:00
Mark Spanbroek
95a698c574
vault: allow for multiple accounts for one account holder
2025-03-04 09:36:00 +01:00
Mark Spanbroek
b64c64aff8
vault: rename account->holder in tests
2025-03-04 09:36:00 +01:00
Mark Spanbroek
4c46f2d1a0
vault: pausing and unpausing
2025-03-04 09:36:00 +01:00
Mark Spanbroek
15e7ae855d
vault: cleanup tests
2025-03-04 09:36:00 +01:00
Mark Spanbroek
7de8b8ccb6
vault: format all solidity files
2025-03-04 09:36:00 +01:00
Mark Spanbroek
79c127b80e
update openzeppelin contracts to 5.2.0
2025-03-04 09:36:00 +01:00
Mark Spanbroek
81032965f4
vault: update documentation
2025-03-04 09:36:00 +01:00
Mark Spanbroek
473a5fec19
vault: fix accounting of locked value when burning designated tokens
2025-03-04 09:36:00 +01:00
Mark Spanbroek
43cd44330b
vault: add documentation
2025-03-04 09:36:00 +01:00
Mark Spanbroek
439d3772db
vault: remove dead code
2025-03-04 09:36:00 +01:00
Mark Spanbroek
b7b1e8c25b
vault: cleanup
2025-03-04 09:36:00 +01:00
Mark Spanbroek
dc3084836f
vault: prefix errors with 'Vault'
2025-03-04 09:36:00 +01:00
Mark Spanbroek
0a539fb017
vault: burn designated/fund allowed when flowing
2025-03-04 09:36:00 +01:00
Mark Spanbroek
ad6df66768
vault: burn part of designated tokens
2025-03-04 09:36:00 +01:00
Mark Spanbroek
3ff331b883
vault: rename burn -> burnAccount, burnAll -> burnFund
2025-03-04 09:36:00 +01:00
Mark Spanbroek
62eb07e640
vault: clean up errors
2025-03-04 09:36:00 +01:00
Mark Spanbroek
1259c2fe71
vault: test lock state transitions
2025-03-04 09:36:00 +01:00
Mark Spanbroek
e3291ed82e
vault: formatting
2025-03-04 09:36:00 +01:00
Mark Spanbroek
13d590d67b
vault: do not expose Lock internals on public api
2025-03-04 09:36:00 +01:00
Mark Spanbroek
6877078f4c
vault: transfer tokens to 0xdead when fund is burned
2025-03-04 09:36:00 +01:00
Mark Spanbroek
bbdd614579
vault: burn entire fund
2025-03-04 09:36:00 +01:00
Mark Spanbroek
682b65b24a
vault: extract common tests for unlocked funds
2025-03-04 09:36:00 +01:00
Mark Spanbroek
4533c82011
vault: prevent approval hijacking
...
- transfer ERC20 funds into the vault from the
controller, not from the user
- prevents an attacker from hijacking a user's
ERC20 approval to move tokens into a part of
the vault that is controlled by the attacker
2025-03-04 09:36:00 +01:00
Mark Spanbroek
b076528e1a
vault: reduce size of timestamp further
2025-03-04 09:36:00 +01:00
Mark Spanbroek
6980acd59b
vault: rename error
2025-03-04 09:36:00 +01:00
Mark Spanbroek
026609e3c7
vault: remove _getAccount()
...
- no longer calculate flow updates when not needed
- use account.update(timestamp) where needed
- use _getBalance() to view current balance
2025-03-04 09:36:00 +01:00
Mark Spanbroek
a83a6f4cad
vault: fix transfer to self
2025-03-04 09:36:00 +01:00
Mark Spanbroek
450e5308d9
vault: split flow into incoming and outgoing
...
- no need to deal with signed integers anymore
- allows flow to self to designate tokens over time
2025-03-04 09:36:00 +01:00
Mark Spanbroek
297ec7f6b3
vault: cleanup
2025-03-04 09:36:00 +01:00
Mark Spanbroek
f9464f9118
vault: combine Account and Flow structs
2025-03-04 09:36:00 +01:00
Mark Spanbroek
5d3683383d
vault: do not delete lock when burning
2025-03-04 09:36:00 +01:00
Mark Spanbroek
2600578b48
vault: formatting
2025-03-04 09:36:00 +01:00
Mark Spanbroek
ee6d56a54b
vault: reordering
2025-03-04 09:36:00 +01:00