@@ -97,7 +97,7 @@ library Allocation {
97
97
* @param allocationId The allocation id
98
98
*/
99
99
function presentPOI (mapping (address => State) storage self , address allocationId ) internal {
100
- State storage allocation = _get (self, allocationId);
100
+ State storage allocation = get (self, allocationId);
101
101
require (allocation.isOpen (), AllocationClosed (allocationId, allocation.closedAt));
102
102
allocation.lastPOIPresentedAt = block .timestamp ;
103
103
}
@@ -115,7 +115,7 @@ library Allocation {
115
115
address allocationId ,
116
116
uint256 accRewardsPerAllocatedToken
117
117
) internal {
118
- State storage allocation = _get (self, allocationId);
118
+ State storage allocation = get (self, allocationId);
119
119
require (allocation.isOpen (), AllocationClosed (allocationId, allocation.closedAt));
120
120
allocation.accRewardsPerAllocatedToken = accRewardsPerAllocatedToken;
121
121
}
@@ -128,7 +128,7 @@ library Allocation {
128
128
* @param allocationId The allocation id
129
129
*/
130
130
function clearPendingRewards (mapping (address => State) storage self , address allocationId ) internal {
131
- State storage allocation = _get (self, allocationId);
131
+ State storage allocation = get (self, allocationId);
132
132
require (allocation.isOpen (), AllocationClosed (allocationId, allocation.closedAt));
133
133
allocation.accRewardsPending = 0 ;
134
134
}
@@ -141,7 +141,7 @@ library Allocation {
141
141
* @param allocationId The allocation id
142
142
*/
143
143
function close (mapping (address => State) storage self , address allocationId ) internal {
144
- State storage allocation = _get (self, allocationId);
144
+ State storage allocation = get (self, allocationId);
145
145
require (allocation.isOpen (), AllocationClosed (allocationId, allocation.closedAt));
146
146
allocation.closedAt = block .timestamp ;
147
147
}
@@ -152,7 +152,9 @@ library Allocation {
152
152
* @param allocationId The allocation id
153
153
*/
154
154
function get (mapping (address => State) storage self , address allocationId ) internal view returns (State memory ) {
155
- return _get (self, allocationId);
155
+ State storage allocation = self[allocationId];
156
+ require (allocation.exists (), AllocationDoesNotExist (allocationId));
157
+ return allocation;
156
158
}
157
159
158
160
/**
@@ -189,15 +191,4 @@ library Allocation {
189
191
return self.exists () && self.tokens == 0 ;
190
192
}
191
193
192
- /**
193
- * @notice Get the allocation for an allocation id
194
- * @dev Reverts if the allocation does not exist
195
- * @param self The allocation list mapping
196
- * @param allocationId The allocation id
197
- */
198
- function _get (mapping (address => State) storage self , address allocationId ) private view returns (State storage ) {
199
- State storage allocation = self[allocationId];
200
- require (allocation.exists (), AllocationDoesNotExist (allocationId));
201
- return allocation;
202
- }
203
194
}
0 commit comments