@@ -3,19 +3,18 @@ pragma solidity 0.8.28;
33
44import "./Timestamps.sol " ;
55
6- /// A time-lock for funds
7- struct Lock {
8- /// The lock unlocks at this time
9- Timestamp expiry;
10- /// The expiry can be extended no further than this
11- Timestamp maximum;
6+ struct Fund {
7+ /// The time-lock unlocks at this time
8+ Timestamp lockExpiry;
9+ /// The lock expiry can be extended no further than this
10+ Timestamp lockMaximum;
1211 /// Indicates whether fund is frozen, and at what time
1312 Timestamp frozenAt;
14- /// The total amount of tokens locked up in the fund
13+ /// The total amount of tokens in the fund
1514 uint128 value;
1615}
1716
18- /// A lock can go through the following states:
17+ /// A fund can go through the following states:
1918///
2019/// -----------------------------------------------
2120/// | |
@@ -24,7 +23,7 @@ struct Lock {
2423/// \ /
2524/// --> Frozen --
2625///
27- enum LockStatus {
26+ enum FundStatus {
2827 /// Indicates that the fund is inactive and contains no tokens. This is the
2928 /// initial state, or the state after all tokens have been withdrawn.
3029 Inactive,
@@ -40,24 +39,24 @@ enum LockStatus {
4039 Withdrawing
4140}
4241
43- library Locks {
44- function status (Lock memory lock ) internal view returns (LockStatus ) {
45- if (Timestamps.currentTime () < lock.expiry ) {
46- if (lock .frozenAt != Timestamp.wrap (0 )) {
47- return LockStatus .Frozen;
42+ library Funds {
43+ function status (Fund memory fund ) internal view returns (FundStatus ) {
44+ if (Timestamps.currentTime () < fund.lockExpiry ) {
45+ if (fund .frozenAt != Timestamp.wrap (0 )) {
46+ return FundStatus .Frozen;
4847 }
49- return LockStatus .Locked;
48+ return FundStatus .Locked;
5049 }
51- if (lock.maximum == Timestamp.wrap (0 )) {
52- return LockStatus .Inactive;
50+ if (fund.lockMaximum == Timestamp.wrap (0 )) {
51+ return FundStatus .Inactive;
5352 }
54- return LockStatus .Withdrawing;
53+ return FundStatus .Withdrawing;
5554 }
5655
57- function flowEnd (Lock memory lock ) internal pure returns (Timestamp) {
58- if (lock .frozenAt != Timestamp.wrap (0 )) {
59- return lock .frozenAt;
56+ function flowEnd (Fund memory fund ) internal pure returns (Timestamp) {
57+ if (fund .frozenAt != Timestamp.wrap (0 )) {
58+ return fund .frozenAt;
6059 }
61- return lock.expiry ;
60+ return fund.lockExpiry ;
6261 }
6362}
0 commit comments