Skip to content
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

Require can be changed to custom revert #9883

Open
allwin199 opened this issue Jul 21, 2023 · 4 comments
Open

Require can be changed to custom revert #9883

allwin199 opened this issue Jul 21, 2023 · 4 comments

Comments

@allwin199
Copy link

Description

require can be refactored to customRevert

function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
// Check that the request exists. If not, revert.
RequestRecord memory record = s_requests[requestId];
require(record.requestId == requestId, "request ID not found in map");
// Update the randomness in the record, and increment the response counter.
s_requests[requestId].randomness = randomWords[0];
s_vrfResponseCounter++;
}

In the below code, custom revert is used.

function forward(address target, bytes calldata handler) external {
if (s_forwardPermissionList[msg.sender] != target) {
revert PermissionNotSet();
}

@allwin199
Copy link
Author

I can work on this if has to be changed.

@rgottleber
Copy link

Hey @worksofallwin if you want to open a PR for this issue that would be awesome

Please check out the contributing guidelines

@allwin199
Copy link
Author

Sure!

@allwin199
Copy link
Author

@rgottleber I have opened a PR for this, let me know if anything has to be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants