Skip to content

Commit edee270

Browse files
committed
vault: rename Lock -> Fund
1 parent 96b4fc0 commit edee270

File tree

5 files changed

+106
-109
lines changed

5 files changed

+106
-109
lines changed

contracts/Vault.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ contract Vault is VaultBase, Pausable, Ownable {
9090
return balance.designated;
9191
}
9292

93-
/// Returns the status of the lock on the fund. Most operations on the vault
94-
/// can only be done by the controller when the funds are locked. Withdrawal
95-
/// can only be done when the funds are unlocked.
96-
function getLockStatus(FundId fundId) public view returns (LockStatus) {
93+
/// Returns the status of the fund. Most operations on the vault can only be
94+
/// done by the controller when the funds are locked. Withdrawals can only be
95+
/// done in the withdrawing state.
96+
function getFundStatus(FundId fundId) public view returns (FundStatus) {
9797
Controller controller = Controller.wrap(msg.sender);
98-
return _getLockStatus(controller, fundId);
98+
return _getFundStatus(controller, fundId);
9999
}
100100

101101
/// Returns the expiry time of the lock on the fund. A locked fund unlocks

contracts/vault/Locks.sol renamed to contracts/vault/Funds.sol

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@ pragma solidity 0.8.28;
33

44
import "./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

Comments
 (0)