Skip to content

Commit

Permalink
fixing shrelock issue #108 sherlock-audit/2024-05-sophon-judging#108 (#6
Browse files Browse the repository at this point in the history
)
  • Loading branch information
RomanHiden authored Jun 3, 2024
1 parent 73adb67 commit 1f8d4e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contracts/farm/SophonFarming.sol
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,15 @@ contract SophonFarming is Upgradeable2Step, SophonFarmingState {
* @param _startBlock the start block
*/
function setStartBlock(uint256 _startBlock) external onlyOwner {
if (_startBlock == 0 || (endBlock != 0 && _startBlock >= endBlock)) {
uint256 blockNumber = getBlockNumber();
if (_startBlock == 0 || blockNumber > _startBlock || (endBlock != 0 && _startBlock >= endBlock)) {
revert InvalidStartBlock();
}
if (getBlockNumber() > startBlock) {
if (blockNumber > startBlock) {
revert FarmingIsStarted();
}

massUpdatePools();
startBlock = _startBlock;
}

Expand Down

0 comments on commit 1f8d4e5

Please sign in to comment.