Skip to content

Commit

Permalink
transer eth function added
Browse files Browse the repository at this point in the history
  • Loading branch information
StarKeyJON authored Mar 31, 2022
1 parent 8c3eaef commit 4cafbb9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions MarketTrades.sol
Original file line number Diff line number Diff line change
Expand Up @@ -773,11 +773,21 @@ contract MarketTrades is ReentrancyGuard {
}
}

/// @notice
/*~~~>
Internal function for sending ether
<~~~*/
/// @return Bool
function sendEther(address recipient, uint ethvalue) internal nonReentrant returns (bool){
(bool success, bytes memory data) = address(recipient).call{value: ethvalue}("");
return(success);
}

///@notice
/*~~~> External ETH transfer forwarded to role provider contract <~~~*/
event FundsForwarded(uint value, address from, address to);
receive() external payable {
payable(roleAdd).transfer(msg.value);
require(sendEther(roleAdd, msg.value));
emit FundsForwarded(msg.value, msg.sender, roleAdd);
}

Expand All @@ -793,4 +803,4 @@ contract MarketTrades is ReentrancyGuard {
)external pure returns(bytes4) {
return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
}
}
}

0 comments on commit 4cafbb9

Please sign in to comment.