From 8e05274a527959964c9544db728c50cde717a443 Mon Sep 17 00:00:00 2001 From: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:18:51 -0600 Subject: [PATCH] reformat CoinToss.sol --- solidity/src/CoinToss.sol | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/solidity/src/CoinToss.sol b/solidity/src/CoinToss.sol index 8f46184..37a5e09 100644 --- a/solidity/src/CoinToss.sol +++ b/solidity/src/CoinToss.sol @@ -26,19 +26,12 @@ contract CoinToss is CadenceRandomConsumer { return coinTosses[user] != 0; } - /** - * @dev Checks if a value is non-zero. - */ - function isNonZero(uint256 value) public pure returns (bool) { - return value > 0; - } - /** * @dev Allows a user to flip a coin by sending FLOW to the contract. This is the commit step in the commit-reveal scheme. */ function flipCoin() public payable { - require(isNonZero(msg.value), "Must send FLOW to place flip a coin"); - require(!isNonZero(coinTosses[msg.sender]), "Must close previous coin flip before placing a new one"); + require(_isNonZero(msg.value), "Must send FLOW to place flip a coin"); + require(!_isNonZero(coinTosses[msg.sender]), "Must close previous coin flip before placing a new one"); // request randomness uint256 requestId = _requestRandomness(); @@ -80,4 +73,11 @@ contract CoinToss is CadenceRandomConsumer { emit CoinRevealed(msg.sender, requestId, coinFace, prize); } + + /** + * @dev Checks if a value is non-zero. + */ + function _isNonZero(uint256 value) internal pure returns (bool) { + return value > 0; + } }