Commit 50db0484 authored by m4rio.eth's avatar m4rio.eth

Replaced transfer with call for sending ETH so it can support also non-EOA

parent a22c36eb
...@@ -49,8 +49,9 @@ contract Challenge { ...@@ -49,8 +49,9 @@ contract Challenge {
fallback() external payable {} fallback() external payable {}
receive() external payable {} receive() external payable {}
function withdraw() external { function withdraw() external {
require(msg.sender == owner); require(msg.sender == owner, "not owner");
owner.transfer(address(this).balance); (bool sent, ) = owner.call{value: address(this).balance}("");
require(sent, "Failed to send Ether");
} }
// create challenge // create challenge
...@@ -214,7 +215,8 @@ contract Challenge { ...@@ -214,7 +215,8 @@ contract Challenge {
require(stepState == c.assertedState[c.R], "wrong asserted state for challenger"); require(stepState == c.assertedState[c.R], "wrong asserted state for challenger");
// pay out bounty!! // pay out bounty!!
c.challenger.transfer(address(this).balance); (bool sent, ) = c.challenger.call{value: address(this).balance}("");
require(sent, "Failed to send Ether");
emit ChallengerWins(challengeId); emit ChallengerWins(challengeId);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment