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

error in solidity code #14528

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

YakshitAgarwal
Copy link
Contributor

Original solidity code:

pragma solidity ^0.7.0;

contract MutexPattern {
bool locked = false;
mapping(address => uint256) public balances;

modifier noReentrancy() {
    require(!locked, "Blocked from reentrancy.");
    locked = true;
    _;
    locked = false;
}
// This function is protected by a mutex, so reentrant calls from within `msg.sender.call` cannot call `withdraw` again.
//  The `return` statement evaluates to `true` but still evaluates the `locked = false` statement in the modifier
function withdraw(uint _amount) public payable noReentrancy returns(bool) {
    require(balances[msg.sender] >= _amount, "No balance to withdraw.");

    balances[msg.sender] -= _amount;
    bool (success, ) = msg.sender.call{value: _amount}("");
    require(success);

    return true;
}

}

Error in the above code:
bool (success, ) = msg.sender.call{value: _amount}("");

Changed to:
(bool success, ) = msg.sender.call{value: _amount}("");

@github-actions github-actions bot added the content 🖋️ This involves copy additions or edits label Dec 18, 2024
Copy link

netlify bot commented Dec 18, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 8041c3b
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/67631e3af65d5d000869e4b0
😎 Deploy Preview https://deploy-preview-14528--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 45 (🔴 down 11 from production)
Accessibility: 92 (no change from production)
Best Practices: 89 (🔴 down 9 from production)
SEO: 98 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@konopkja
Copy link
Contributor

this PR is related to #14527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content 🖋️ This involves copy additions or edits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants