try to remove re-entrancy from withdraw function
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
3f0d1fb02e
commit
3bb6904f54
@ -20,11 +20,11 @@ contract Reserve is ERC20Permit {
|
||||
}
|
||||
|
||||
fallback() external payable {
|
||||
_innerMint(msg.sender, msg.value);
|
||||
_mint(msg.sender, msg.value);
|
||||
}
|
||||
|
||||
receive() external payable {
|
||||
_innerMint(msg.sender, msg.value);
|
||||
_mint(msg.sender, msg.value);
|
||||
}
|
||||
|
||||
function changeRate(uint256 rate) external {
|
||||
@ -39,13 +39,16 @@ contract Reserve is ERC20Permit {
|
||||
|
||||
function withdraw(address payable receiver) external {
|
||||
if (msg.sender != _owner) revert OnlyOwner();
|
||||
(bool sent,) = receiver.call{ value: accumulatedDonation }("");
|
||||
uint256 accumulatedDonationCached = accumulatedDonation;
|
||||
accumulatedDonation = 0;
|
||||
|
||||
(bool sent,) = receiver.call{ value: accumulatedDonationCached }("");
|
||||
require(sent, "Failed to send Ether");
|
||||
}
|
||||
|
||||
function superMint(address account, uint256 value) external {
|
||||
if (msg.sender != _owner) revert OnlyOwner();
|
||||
_innerMint(account, value);
|
||||
_mint(account, value);
|
||||
}
|
||||
|
||||
function mint(address account) external payable {
|
||||
|
Loading…
Reference in New Issue
Block a user