Skip to content

Commit

Permalink
fix: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaShWoof committed Jun 7, 2024
1 parent 9c8de85 commit cf4ccb5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contracts/Comet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,20 @@ contract Comet is CometMainInterface {
(asset11_a, asset11_b) = getPackedAssetInternal(config.assetConfigs, 11);
}

/**
* @dev Prevents marked functions from being reentered
* Note: this restrict contracts from calling comet functions in their hooks.
* Doing so will cause the transaction to revert.
*/
modifier nonReentrant() {
nonReentrantBefore();
_;
nonReentrantAfter();
}

/**
* @dev Checks that the reentrancy flag is not set and then sets the flag
*/
function nonReentrantBefore() internal {
bytes32 slot = REENTRANCY_GUARD_FLAG_SLOT;
uint256 status;
Expand All @@ -211,6 +219,9 @@ contract Comet is CometMainInterface {
}
}

/**
* @dev Unsets the reentrancy flag
*/
function nonReentrantAfter() internal {
bytes32 slot = REENTRANCY_GUARD_FLAG_SLOT;
uint256 status;

Check warning on line 227 in contracts/Comet.sol

View workflow job for this annotation

GitHub Actions / Contract linter

Variable "status" is unused
Expand Down

0 comments on commit cf4ccb5

Please sign in to comment.