Skip to content

Instantly share code, notes, and snippets.

@halienm
Created March 6, 2022 00:53
Show Gist options
  • Save halienm/a48fb905c807fd52e258433ec4681238 to your computer and use it in GitHub Desktop.
Save halienm/a48fb905c807fd52e258433ec4681238 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=0.8.13&optimize=true&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.2 <0.9.0;
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
contract Fund {
/// @dev Mapping of ether shares of the contract.
mapping(address => uint) shares;
/// Withdraw your share.
function withdraw() public {
(bool success,) = msg.sender.call{value: shares[msg.sender]}("");
if (success)
shares[msg.sender] = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment