Skip to content

Commit 8e65d22

Browse files
f: fully commit to DataServiceFeesLib
1 parent 93f7342 commit 8e65d22

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

packages/horizon/contracts/data-service/extensions/DataServiceFees.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
9595
* @param _claimId The ID of the stake claim to delete
9696
*/
9797
function _deleteStakeClaim(bytes32 _claimId) private {
98-
delete claims[_claimId];
98+
DataServiceFeesLib.deleteStakeClaim(claims, _claimId);
9999
}
100100

101101
/**
@@ -105,6 +105,6 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
105105
* @return The next stake claim ID
106106
*/
107107
function _getNextStakeClaim(bytes32 _claimId) private view returns (bytes32) {
108-
return claims[_claimId].nextClaim;
108+
return DataServiceFeesLib.getNextStakeClaim(claims, _claimId);
109109
}
110110
}

packages/horizon/contracts/data-service/libraries/DataServiceFeesLib.sol

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,33 @@ library DataServiceFeesLib {
9292
return (false, _acc);
9393
}
9494

95+
/**
96+
* @notice Deletes a stake claim.
97+
* @dev This function is used as a callback in the stake claims linked list traversal.
98+
* @param claims The mapping that stores stake claims by their ID
99+
* @param claimId The ID of the stake claim to delete
100+
*/
101+
function deleteStakeClaim(
102+
mapping(bytes32 claimId => IDataServiceFees.StakeClaim claim) storage claims,
103+
bytes32 claimId
104+
) external {
105+
delete claims[claimId];
106+
}
107+
108+
/**
109+
* @notice Gets the next stake claim in the linked list
110+
* @dev This function is used as a callback in the stake claims linked list traversal.
111+
* @param claims The mapping that stores stake claims by their ID
112+
* @param claimId The ID of the stake claim
113+
* @return The next stake claim ID
114+
*/
115+
function getNextStakeClaim(
116+
mapping(bytes32 claimId => IDataServiceFees.StakeClaim claim) storage claims,
117+
bytes32 claimId
118+
) external view returns (bytes32) {
119+
return claims[claimId].nextClaim;
120+
}
121+
95122
/**
96123
* @notice Builds a stake claim ID
97124
* @param serviceProvider The address of the service provider

0 commit comments

Comments
 (0)