From ca90d226d3275b31ccb16ce2b45cc94c8b868af5 Mon Sep 17 00:00:00 2001 From: Brent Fitzgerald Date: Tue, 23 Jan 2024 12:57:53 -0800 Subject: [PATCH] cleanup: private -> internal, add parens for math pemdas clarity --- README.md | 7 +++++++ src/Pizza.sol | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2a619b7..ab407bb 100644 --- a/README.md +++ b/README.md @@ -31,5 +31,12 @@ See Foundry docs for more testing options. Check out the [Makefile](./Makefile) for build/deploy targets. Example: ``` +make deploy-sepolia-dryrun make deploy-sepolia ``` + +## Private key management + +The private key is only used for deployment. + +Depending on your development needs and risk tolerance, your key can be managed any way you like. My recommended approach is to use some kind of encrypted key storage. Check out [Foundry's encrypted keystore](https://book.getfoundry.sh/reference/cast/cast-wallet-import), or use something like [1Password's `op` CLI](https://developer.1password.com/docs/cli/get-started/). diff --git a/src/Pizza.sol b/src/Pizza.sol index 7752fbd..dc1139f 100644 --- a/src/Pizza.sol +++ b/src/Pizza.sol @@ -258,7 +258,7 @@ contract Pizza is Multicall, ReentrancyGuardUpgradeable { * @param account The address of the payee to add. * @param _shares The number of shares owned by the payee. */ - function _addPayee(address account, uint256 _shares) private { + function _addPayee(address account, uint256 _shares) internal { if (account == address(0)) { revert NullPayee(account); } @@ -278,8 +278,8 @@ contract Pizza is Multicall, ReentrancyGuardUpgradeable { * @notice Releases the ETH bounty to the bounty receiver. * @param _bountyReceiver The address of the bounty receiver. */ - function _payBounty(address _bountyReceiver) private { - uint256 bountyAmount = address(this).balance * bounty / BOUNTY_PRECISION; + function _payBounty(address _bountyReceiver) internal { + uint256 bountyAmount = (bounty * address(this).balance) / BOUNTY_PRECISION; if (bountyAmount > 0) { Address.sendValue(payable(_bountyReceiver), bountyAmount); emit PayBounty(_bountyReceiver, bountyAmount); @@ -291,8 +291,8 @@ contract Pizza is Multicall, ReentrancyGuardUpgradeable { * @param _bountyToken The ERC20 tokens to be released. * @param _bountyReceiver The address of the bounty receiver. */ - function _payERC20Bounty(IERC20 _bountyToken, address _bountyReceiver) private { - uint256 bountyAmount = _bountyToken.balanceOf(address(this)) * bounty / BOUNTY_PRECISION; + function _payERC20Bounty(IERC20 _bountyToken, address _bountyReceiver) internal { + uint256 bountyAmount = (bounty * _bountyToken.balanceOf(address(this))) / BOUNTY_PRECISION; if (bountyAmount > 0) { SafeERC20.safeTransfer(_bountyToken, payable(_bountyReceiver), bountyAmount); emit PayERC20Bounty(_bountyToken, _bountyReceiver, bountyAmount);