-
Notifications
You must be signed in to change notification settings - Fork 135
4.1.0 #1247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
4.1.0 #1247
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b3d69f6
implement global lock
julianmrodri e033781
add docs
julianmrodri fefda24
implement global lock in functions
julianmrodri c49347e
fix lint
julianmrodri 2805843
fix docs
julianmrodri 95306c0
fix lint
julianmrodri 311e0c1
update version
julianmrodri 3b33b68
disabled 4.0 explicit test
julianmrodri 235bc5c
tests and nit
julianmrodri c24cd4e
additional tests
julianmrodri c58fa2a
additional tests
julianmrodri 00b25bb
claim rewards test
julianmrodri bba71b1
fix order
julianmrodri e190f23
fix style
julianmrodri a1aba68
remove comments
julianmrodri 5ee0c8d
upg tests
julianmrodri 24eaf0a
fix docs
julianmrodri ad45a90
add isComponent check
julianmrodri eaf7bae
fix lint
julianmrodri 40e1269
implement as modifier
julianmrodri 6393f71
Merge pull request #1255 from reserve-protocol/component-check
julianmrodri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| // SPDX-License-Identifier: BlueOak-1.0.0 | ||
| pragma solidity 0.8.19; | ||
|
|
||
| // solhint-disable-next-line max-line-length | ||
| // Based on OpenZeppelin Upgradeable Contracts (last updated v5.1.0) (utils/ReentrancyGuardUpgradeable.sol) | ||
|
|
||
| import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; | ||
|
|
||
| /** | ||
| * @dev Contract module that helps prevent global reentrant calls. | ||
| * | ||
| * Inheriting from `GlobalReentrancyGuard` will allow to implement a global lock | ||
| * and allow other contracts to define the {globalNonReentrant} modifier, | ||
| * which can be applied to functions to make sure there are no nested (reentrant) | ||
| * calls among them. | ||
| * | ||
| */ | ||
| abstract contract GlobalReentrancyGuard is Initializable { | ||
| // Booleans are more expensive than uint256 or any type that takes up a full | ||
| // word because each write operation emits an extra SLOAD to first read the | ||
| // slot's contents, replace the bits taken up by the boolean, and then write | ||
| // back. This is the compiler's defense against contract upgrades and | ||
| // pointer aliasing, and it cannot be disabled. | ||
|
|
||
| // The values being non-zero value makes deployment a bit more expensive, | ||
| // but in exchange the refund on every call to nonReentrant will be lower in | ||
| // amount. Since refunds are capped to a percentage of the total | ||
| // transaction's gas, it is best to keep them low in cases like this one, to | ||
| // increase the likelihood of the full refund coming into effect. | ||
| uint256 private constant NOT_ENTERED = 1; | ||
| uint256 private constant ENTERED = 2; | ||
|
|
||
| /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard | ||
| struct ReentrancyGuardStorage { | ||
| uint256 _status; | ||
| } | ||
|
|
||
| // solhint-disable-next-line max-line-length | ||
| // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) | ||
| bytes32 private constant ReentrancyGuardStorageLocation = | ||
| 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; | ||
|
|
||
| function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { | ||
| assembly { | ||
| $.slot := ReentrancyGuardStorageLocation | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @dev Unauthorized reentrant call. | ||
| */ | ||
| error ReentrancyGuardReentrantCall(); | ||
|
|
||
| function __ReentrancyGuard_init() internal onlyInitializing { | ||
| __ReentrancyGuard_init_unchained(); | ||
| } | ||
|
|
||
| function __ReentrancyGuard_init_unchained() internal onlyInitializing { | ||
| ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); | ||
| $._status = NOT_ENTERED; | ||
| } | ||
|
|
||
| function _nonReentrantBefore() internal { | ||
| ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); | ||
| // On the first call to nonReentrant, _status will be NOT_ENTERED | ||
| if ($._status == ENTERED) { | ||
| revert ReentrancyGuardReentrantCall(); | ||
| } | ||
|
|
||
| // Any calls to nonReentrant after this point will fail | ||
| $._status = ENTERED; | ||
| } | ||
|
|
||
| function _nonReentrantAfter() internal { | ||
| ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); | ||
| // By storing the original value once again, a refund is triggered (see | ||
| // https://eips.ethereum.org/EIPS/eip-2200) | ||
| $._status = NOT_ENTERED; | ||
| } | ||
|
|
||
| /** | ||
| * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates | ||
| * there is a `nonReentrant` function in the call stack. | ||
| */ | ||
| function _reentrancyGuardEntered() internal view returns (bool) { | ||
| ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); | ||
| return $._status == ENTERED; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.