Skip to content

Commit 8c19446

Browse files
f: revert Allocation vis changes
1 parent dae9cd9 commit 8c19446

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

packages/subgraph-service/contracts/libraries/Allocation.sol

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ library Allocation {
7676
uint256 tokens,
7777
uint256 accRewardsPerAllocatedToken,
7878
uint256 createdAtEpoch
79-
) external returns (State memory) {
79+
) internal returns (State memory) {
8080
require(!self[allocationId].exists(), AllocationAlreadyExists(allocationId));
8181

8282
State memory allocation = State({
@@ -104,54 +104,54 @@ library Allocation {
104104
* @param self The allocation list mapping
105105
* @param allocationId The allocation id
106106
*/
107-
function presentPOI(mapping(address => State) storage self, address allocationId) external {
107+
function presentPOI(mapping(address => State) storage self, address allocationId) internal {
108108
State storage allocation = _get(self, allocationId);
109109
require(allocation.isOpen(), AllocationClosed(allocationId, allocation.closedAt));
110110
allocation.lastPOIPresentedAt = block.timestamp;
111111
}
112112

113113
/**
114-
* @notice Update the accumulated rewards pending to be claimed for an allocation
114+
* @notice Update the accumulated rewards per allocated token for an allocation
115115
* @dev Requirements:
116116
* - The allocation must be open
117117
* @param self The allocation list mapping
118118
* @param allocationId The allocation id
119+
* @param accRewardsPerAllocatedToken The new accumulated rewards per allocated token
119120
*/
120-
function clearPendingRewards(mapping(address => State) storage self, address allocationId) external {
121+
function snapshotRewards(
122+
mapping(address => State) storage self,
123+
address allocationId,
124+
uint256 accRewardsPerAllocatedToken
125+
) internal {
121126
State storage allocation = _get(self, allocationId);
122127
require(allocation.isOpen(), AllocationClosed(allocationId, allocation.closedAt));
123-
allocation.accRewardsPending = 0;
128+
allocation.accRewardsPerAllocatedToken = accRewardsPerAllocatedToken;
124129
}
125130

126131
/**
127-
* @notice Close an allocation
132+
* @notice Update the accumulated rewards pending to be claimed for an allocation
128133
* @dev Requirements:
129134
* - The allocation must be open
130135
* @param self The allocation list mapping
131136
* @param allocationId The allocation id
132137
*/
133-
function close(mapping(address => State) storage self, address allocationId) external {
138+
function clearPendingRewards(mapping(address => State) storage self, address allocationId) internal {
134139
State storage allocation = _get(self, allocationId);
135140
require(allocation.isOpen(), AllocationClosed(allocationId, allocation.closedAt));
136-
allocation.closedAt = block.timestamp;
141+
allocation.accRewardsPending = 0;
137142
}
138143

139144
/**
140-
* @notice Update the accumulated rewards per allocated token for an allocation
145+
* @notice Close an allocation
141146
* @dev Requirements:
142147
* - The allocation must be open
143148
* @param self The allocation list mapping
144149
* @param allocationId The allocation id
145-
* @param accRewardsPerAllocatedToken The new accumulated rewards per allocated token
146150
*/
147-
function snapshotRewards(
148-
mapping(address => State) storage self,
149-
address allocationId,
150-
uint256 accRewardsPerAllocatedToken
151-
) internal {
151+
function close(mapping(address => State) storage self, address allocationId) internal {
152152
State storage allocation = _get(self, allocationId);
153153
require(allocation.isOpen(), AllocationClosed(allocationId, allocation.closedAt));
154-
allocation.accRewardsPerAllocatedToken = accRewardsPerAllocatedToken;
154+
allocation.closedAt = block.timestamp;
155155
}
156156

157157
/**

0 commit comments

Comments
 (0)