@@ -21,24 +21,6 @@ library ProvisionTracker {
21
21
*/
22
22
error ProvisionTrackerInsufficientTokens (uint256 tokensAvailable , uint256 tokensRequired );
23
23
24
- /**
25
- * @notice Checks if a service provider has enough tokens available to lock
26
- * @param self The provision tracker mapping
27
- * @param graphStaking The HorizonStaking contract
28
- * @param serviceProvider The service provider address
29
- * @param delegationRatio A delegation ratio to limit the amount of delegation that's usable
30
- * @return true if the service provider has enough tokens available to lock, false otherwise
31
- */
32
- function check (
33
- mapping (address => uint256 ) storage self ,
34
- IHorizonStaking graphStaking ,
35
- address serviceProvider ,
36
- uint32 delegationRatio
37
- ) external view returns (bool ) {
38
- uint256 tokensAvailable = graphStaking.getTokensAvailable (serviceProvider, address (this ), delegationRatio);
39
- return self[serviceProvider] <= tokensAvailable;
40
- }
41
-
42
24
/**
43
25
* @notice Locks tokens for a service provider
44
26
* @dev Requirements:
@@ -55,7 +37,7 @@ library ProvisionTracker {
55
37
address serviceProvider ,
56
38
uint256 tokens ,
57
39
uint32 delegationRatio
58
- ) internal {
40
+ ) external {
59
41
if (tokens == 0 ) return ;
60
42
61
43
uint256 tokensRequired = self[serviceProvider] + tokens;
@@ -72,9 +54,27 @@ library ProvisionTracker {
72
54
* @param serviceProvider The service provider address
73
55
* @param tokens The amount of tokens to release
74
56
*/
75
- function release (mapping (address => uint256 ) storage self , address serviceProvider , uint256 tokens ) internal {
57
+ function release (mapping (address => uint256 ) storage self , address serviceProvider , uint256 tokens ) external {
76
58
if (tokens == 0 ) return ;
77
59
require (self[serviceProvider] >= tokens, ProvisionTrackerInsufficientTokens (self[serviceProvider], tokens));
78
60
self[serviceProvider] -= tokens;
79
61
}
62
+
63
+ /**
64
+ * @notice Checks if a service provider has enough tokens available to lock
65
+ * @param self The provision tracker mapping
66
+ * @param graphStaking The HorizonStaking contract
67
+ * @param serviceProvider The service provider address
68
+ * @param delegationRatio A delegation ratio to limit the amount of delegation that's usable
69
+ * @return true if the service provider has enough tokens available to lock, false otherwise
70
+ */
71
+ function check (
72
+ mapping (address => uint256 ) storage self ,
73
+ IHorizonStaking graphStaking ,
74
+ address serviceProvider ,
75
+ uint32 delegationRatio
76
+ ) external view returns (bool ) {
77
+ uint256 tokensAvailable = graphStaking.getTokensAvailable (serviceProvider, address (this ), delegationRatio);
78
+ return self[serviceProvider] <= tokensAvailable;
79
+ }
80
80
}
0 commit comments