Skip to content

Commit

Permalink
fix: underflow in getIdleStake (TRST-L14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikol committed Dec 12, 2024
1 parent c94be63 commit 04fcd0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/horizon/contracts/staking/HorizonStakingBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ abstract contract HorizonStakingBase is
* TODO: update the calculation after the transition period.
*/
function _getIdleStake(address _serviceProvider) internal view returns (uint256) {
return
_serviceProviders[_serviceProvider].tokensStaked -
_serviceProviders[_serviceProvider].tokensProvisioned -
_serviceProviders[_serviceProvider].__DEPRECATED_tokensAllocated -
uint256 tokensUsed = _serviceProviders[_serviceProvider].tokensProvisioned +
_serviceProviders[_serviceProvider].__DEPRECATED_tokensAllocated +
_serviceProviders[_serviceProvider].__DEPRECATED_tokensLocked;
uint256 tokensStaked = _serviceProviders[_serviceProvider].tokensStaked;
return tokensStaked > tokensUsed ? tokensStaked - tokensUsed : 0;
}

/**
Expand Down

0 comments on commit 04fcd0a

Please sign in to comment.