@@ -97,7 +97,7 @@ library Allocation {
9797 * @param allocationId The allocation id
9898 */
9999 function presentPOI (mapping (address => State) storage self , address allocationId ) internal {
100- State storage allocation = _get (self, allocationId);
100+ State storage allocation = get (self, allocationId);
101101 require (allocation.isOpen (), AllocationClosed (allocationId, allocation.closedAt));
102102 allocation.lastPOIPresentedAt = block .timestamp ;
103103 }
@@ -115,7 +115,7 @@ library Allocation {
115115 address allocationId ,
116116 uint256 accRewardsPerAllocatedToken
117117 ) internal {
118- State storage allocation = _get (self, allocationId);
118+ State storage allocation = get (self, allocationId);
119119 require (allocation.isOpen (), AllocationClosed (allocationId, allocation.closedAt));
120120 allocation.accRewardsPerAllocatedToken = accRewardsPerAllocatedToken;
121121 }
@@ -128,7 +128,7 @@ library Allocation {
128128 * @param allocationId The allocation id
129129 */
130130 function clearPendingRewards (mapping (address => State) storage self , address allocationId ) internal {
131- State storage allocation = _get (self, allocationId);
131+ State storage allocation = get (self, allocationId);
132132 require (allocation.isOpen (), AllocationClosed (allocationId, allocation.closedAt));
133133 allocation.accRewardsPending = 0 ;
134134 }
@@ -141,7 +141,7 @@ library Allocation {
141141 * @param allocationId The allocation id
142142 */
143143 function close (mapping (address => State) storage self , address allocationId ) internal {
144- State storage allocation = _get (self, allocationId);
144+ State storage allocation = get (self, allocationId);
145145 require (allocation.isOpen (), AllocationClosed (allocationId, allocation.closedAt));
146146 allocation.closedAt = block .timestamp ;
147147 }
@@ -152,7 +152,9 @@ library Allocation {
152152 * @param allocationId The allocation id
153153 */
154154 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;
156158 }
157159
158160 /**
@@ -189,15 +191,4 @@ library Allocation {
189191 return self.exists () && self.tokens == 0 ;
190192 }
191193
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- }
203194}
0 commit comments