25 Commits

Author SHA1 Message Date
Mark Spanbroek
8b2d726a2f 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-02-06 16:33:03 +01:00
Mark Spanbroek
3064b1468c vault: reduce size of timestamp further 2025-02-06 16:33:03 +01:00
Mark Spanbroek
0237b640e7 vault: rename error 2025-02-06 16:33:03 +01:00
Mark Spanbroek
a2af8c0512 vault: remove _getAccount()
- no longer calculate flow updates when not needed
- use account.update(timestamp) where needed
- use _getBalance() to view current balance
2025-02-06 16:33:03 +01:00
Mark Spanbroek
f6fb441dec vault: fix transfer to self 2025-02-06 16:33:03 +01:00
Mark Spanbroek
523544a4e8 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-02-06 16:33:03 +01:00
Mark Spanbroek
8f5e0f14f8 vault: combine Account and Flow structs 2025-02-06 16:33:03 +01:00
Mark Spanbroek
25d9c15ca7 vault: do not delete lock when burning 2025-02-06 16:33:03 +01:00
Mark Spanbroek
b09f742944 vault: formatting 2025-02-06 16:33:03 +01:00
Mark Spanbroek
95b9ca6fc6 vault: reordering 2025-02-06 16:33:03 +01:00
Mark Spanbroek
8f6190b371 vault: simplify _getAccount() 2025-02-06 16:33:03 +01:00
Mark Spanbroek
374bced5f5 vault: _getAccount updates to the latest timestamp 2025-02-06 16:33:03 +01:00
Mark Spanbroek
c8704cc3af vault: combine account and flow mappings 2025-02-06 16:33:03 +01:00
Mark Spanbroek
56cd4bcfc5 vault: rename balance -> account 2025-02-06 16:33:03 +01:00
Mark Spanbroek
707ec5f55c vault: rename context -> fund 2025-02-06 16:33:03 +01:00
Mark Spanbroek
10839ce532 vault: reorder functions
in roughly chronological order
2025-02-06 16:33:03 +01:00
Mark Spanbroek
2fecf2e741 vault: only allow deposit, transfer, etc when locked 2025-02-06 16:33:03 +01:00
Mark Spanbroek
de3a847d7b vault: delete lock all tokens are withdrawn or burned 2025-02-06 16:33:03 +01:00
Mark Spanbroek
9aecbd54d9 vault: disallow designating of flowing tokens 2025-02-06 16:33:03 +01:00
Mark Spanbroek
63109b813b vault: delete flow when burning or withdrawing 2025-02-06 16:33:03 +01:00
Mark Spanbroek
85537cdb49 vault: cannot burn flowing tokens 2025-02-06 16:33:03 +01:00
Mark Spanbroek
a120cdf2ab vault: disallow transfer of flowing tokens 2025-02-06 16:33:03 +01:00
Mark Spanbroek
d35cc00841 vault: check Lock invariant before writing 2025-02-06 16:33:03 +01:00
Mark Spanbroek
421a1eb5ba vault: change flows over time 2025-02-06 16:33:03 +01:00
Mark Spanbroek
8ee4512080 vault: flow to multiple recipients
- changes balance from uint256 -> uint128
  so that entire Balance can be read or written
  with a single operation
- moves Lock to library
- simplifies lock checks
2025-02-06 16:33:03 +01:00