Skip to content

Commit

Permalink
cleanup: private -> internal, add parens for math pemdas clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
burnto committed Jan 23, 2024
1 parent 8664005 commit ca90d22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
10 changes: 5 additions & 5 deletions src/Pizza.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit ca90d22

Please sign in to comment.