Skip to content

Commit 0c0d090

Browse files
committed
fix: lint errors
1 parent 504fff1 commit 0c0d090

File tree

4 files changed

+38
-38
lines changed

4 files changed

+38
-38
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ library ProvisionTracker {
4242
self[serviceProvider] += tokens;
4343
}
4444

45+
/**
46+
* @notice Releases tokens for a service provider
47+
* @dev Requirements:
48+
* - `tokens` must be less than or equal to the amount of tokens locked for the service provider
49+
* @param self The provision tracker mapping
50+
* @param serviceProvider The service provider address
51+
* @param tokens The amount of tokens to release
52+
*/
53+
function release(mapping(address => uint256) storage self, address serviceProvider, uint256 tokens) internal {
54+
if (tokens == 0) return;
55+
require(self[serviceProvider] >= tokens, ProvisionTrackerInsufficientTokens(self[serviceProvider], tokens));
56+
self[serviceProvider] -= tokens;
57+
}
58+
4559
/**
4660
* @notice Checks if a service provider has enough tokens available to lock
4761
* @param self The provision tracker mapping
@@ -58,18 +72,4 @@ library ProvisionTracker {
5872
uint256 tokensAvailable = graphStaking.getTokensAvailable(serviceProvider, address(this), delegationRatio);
5973
return self[serviceProvider] <= tokensAvailable;
6074
}
61-
62-
/**
63-
* @notice Releases tokens for a service provider
64-
* @dev Requirements:
65-
* - `tokens` must be less than or equal to the amount of tokens locked for the service provider
66-
* @param self The provision tracker mapping
67-
* @param serviceProvider The service provider address
68-
* @param tokens The amount of tokens to release
69-
*/
70-
function release(mapping(address => uint256) storage self, address serviceProvider, uint256 tokens) internal {
71-
if (tokens == 0) return;
72-
require(self[serviceProvider] >= tokens, ProvisionTrackerInsufficientTokens(self[serviceProvider], tokens));
73-
self[serviceProvider] -= tokens;
74-
}
7575
}

packages/horizon/contracts/staking/HorizonStaking.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
836836
address _serviceProvider,
837837
address _verifier,
838838
uint256 _shares,
839-
address beneficiary
839+
address _beneficiary
840840
) private returns (bytes32) {
841841
require(_shares > 0, HorizonStakingInvalidZeroShares());
842842
DelegationPoolInternal storage pool = _getDelegationPool(_serviceProvider, _verifier);
@@ -862,7 +862,7 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
862862
bytes32 thawRequestId = _createThawRequest(
863863
_serviceProvider,
864864
_verifier,
865-
beneficiary,
865+
_beneficiary,
866866
thawingShares,
867867
thawingUntil,
868868
pool.thawingNonce

packages/horizon/contracts/staking/HorizonStakingBase.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,19 +288,19 @@ abstract contract HorizonStakingBase is
288288
return _provisions[_serviceProvider][_verifier].tokens - _provisions[_serviceProvider][_verifier].tokensThawing;
289289
}
290290

291-
/**
292-
* @notice See {IHorizonStakingBase-getDelegatedTokensAvailable}.
293-
*/
294-
function _getDelegatedTokensAvailable(address _serviceProvider, address _verifier) private view returns (uint256) {
295-
DelegationPoolInternal storage poolInternal = _getDelegationPool(_serviceProvider, _verifier);
296-
return poolInternal.tokens - poolInternal.tokensThawing;
297-
}
298-
299291
/**
300292
* @notice Gets the next thaw request after `_thawRequestId`.
301293
* @dev This function is used as a callback in the thaw requests linked list traversal.
302294
*/
303295
function _getNextThawRequest(bytes32 _thawRequestId) internal view returns (bytes32) {
304296
return _thawRequests[_thawRequestId].next;
305297
}
298+
299+
/**
300+
* @notice See {IHorizonStakingBase-getDelegatedTokensAvailable}.
301+
*/
302+
function _getDelegatedTokensAvailable(address _serviceProvider, address _verifier) private view returns (uint256) {
303+
DelegationPoolInternal storage poolInternal = _getDelegationPool(_serviceProvider, _verifier);
304+
return poolInternal.tokens - poolInternal.tokensThawing;
305+
}
306306
}

packages/subgraph-service/contracts/utilities/AllocationManager.sol

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -457,20 +457,6 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
457457
return legacyAllocations.get(_allocationId);
458458
}
459459

460-
/**
461-
* @notice Verifies ownership of an allocation id by verifying an EIP712 allocation proof
462-
* @dev Requirements:
463-
* - Signer must be the allocation id address
464-
* @param _indexer The address of the indexer
465-
* @param _allocationId The id of the allocation
466-
* @param _proof The EIP712 proof, an EIP712 signed message of (indexer,allocationId)
467-
*/
468-
function _verifyAllocationProof(address _indexer, address _allocationId, bytes memory _proof) private view {
469-
bytes32 digest = _encodeAllocationProof(_indexer, _allocationId);
470-
address signer = ECDSA.recover(digest, _proof);
471-
require(signer == _allocationId, AllocationManagerInvalidAllocationProof(signer, _allocationId));
472-
}
473-
474460
/**
475461
* @notice Encodes the allocation proof for EIP712 signing
476462
* @param _indexer The address of the indexer
@@ -489,4 +475,18 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
489475
function _isOverAllocated(address _indexer, uint32 _delegationRatio) internal view returns (bool) {
490476
return !allocationProvisionTracker.check(_graphStaking(), _indexer, _delegationRatio);
491477
}
478+
479+
/**
480+
* @notice Verifies ownership of an allocation id by verifying an EIP712 allocation proof
481+
* @dev Requirements:
482+
* - Signer must be the allocation id address
483+
* @param _indexer The address of the indexer
484+
* @param _allocationId The id of the allocation
485+
* @param _proof The EIP712 proof, an EIP712 signed message of (indexer,allocationId)
486+
*/
487+
function _verifyAllocationProof(address _indexer, address _allocationId, bytes memory _proof) private view {
488+
bytes32 digest = _encodeAllocationProof(_indexer, _allocationId);
489+
address signer = ECDSA.recover(digest, _proof);
490+
require(signer == _allocationId, AllocationManagerInvalidAllocationProof(signer, _allocationId));
491+
}
492492
}

0 commit comments

Comments
 (0)